Touch Panel Buttons
ericthompson
Posts: 28
I hope this isn't too basic of a question, but I haven't been able to attend programming I yet, and I was wondering about a couple simple things.
First, how do you make a button do two things? E.g. Mute. Let's take a Pioneer Elite receiver I am working on. It has a mute on and mute off through RS-232. I can also query what the status is. Where or how do you store that return value/query? I was thinking that I could take that info and put it in an if/else loop. Would that be the easiest/most efficient?
Second, I decided to play with the aluminum smoke panel. For the DSS, it can bring up a keypad to type in a channel. How do you a) limit input to only 3 digits; b)extract those 1-3 digits in order to pulse the satellite receiver to change to the appropriate channel?
I guess the bottom line is that I have figured out how to send information to equipment based on button pushes, but I don't know how to ask the panel for anything more than a PUSH,HOLD, or RELEASE.
Thanks,
Eric
First, how do you make a button do two things? E.g. Mute. Let's take a Pioneer Elite receiver I am working on. It has a mute on and mute off through RS-232. I can also query what the status is. Where or how do you store that return value/query? I was thinking that I could take that info and put it in an if/else loop. Would that be the easiest/most efficient?
Second, I decided to play with the aluminum smoke panel. For the DSS, it can bring up a keypad to type in a channel. How do you a) limit input to only 3 digits; b)extract those 1-3 digits in order to pulse the satellite receiver to change to the appropriate channel?
I guess the bottom line is that I have figured out how to send information to equipment based on button pushes, but I don't know how to ask the panel for anything more than a PUSH,HOLD, or RELEASE.
Thanks,
Eric
0
Comments
In G4 panel design, you can limit the length of text (or digits) within the keyborad's / keypad/s design:
1) open the keypad (it's a popup I think)
2) mark the text field where later the text/digits are shown
3) in the button properties, in GENERAL tab, you can set the MAX TEXT LENGTH. If it's 0 (zero) it's not limited, in your case set this value to 3.[/QUOTE]
The integer definition exists in order to give the button two states, but in the IF..ELSE statement it says IF(nReceiverMute), which I have seen written in other code I was looking at. If the IF(condition) is how it is written, how is IF(nReceiverMute) a condition since nReceiverMute is not a BOOLEAN expression.
Why isn't it IF(nReceiverMute=1), for example? Is it because in DEFINE_PROGRAM you assign [dvPanel,1]=nReceiverMute=1. If you never assign dvReceiverMute to equal 1, how does it get that value? Is it passing the channel code of 1 from th tp?
If it is passing the value, does this answer the b) part of my second question which is how do you pass information from the panel to Netlinx...i.e. a text entry field where you would enter a 3-digit channel for example?
The Integer definition means nReceiverMute can hold any value from 0 to 65535. It just so happens it is only assigned the values of 0 or 1 in this snippet.
The condition IF(nReceiverMute) evaluates to true if nReceiverMute has a value other than 0. It would evaluate to false only is nReceiverMute had a value of 0.
It could be, but since the variable is used to track a binary value it wasn't necessary to explicitely test the value. If you were tracking more than two values in a variable, then IF(nReceiverMute=1) would test to see if value==1 was the current value.
nReceiverMute was set to 1 in the ELSE clause.
The contents of the text-entry field would be returned as a string from the panel. See the panel docs for the exact syntax to parse as it differs between G3 and G4 panels (G4 panels allows you to set the string prefix). You would parse the string and convert the ASCII data representing the 3 digit channel number.
Thanks!