LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SWITCH INPUT OUTPUT

HELLO,

Is there a violation done when a switch on the front panel is used as an indicator and a control?
The reason for this question is that I am using discrete i/o card to read and create logic and I am using the a light switch as both an input and a control and i am getting problems...


Thanks
0 Kudos
Message 1 of 6
(4,130 Views)
Describe your problem and/or post your vi. You can have a control also be an indicator by writing to a local variable of the control in your block diagram, or writing to it's value property node. Normally it does not cause problems. But as with all local variables, you can introduce problems with improper programming.
- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 6
(4,125 Views)
A switch can either be an indicator (data sink) or a control (data source), but not both.

Of course you can use local variables to read from an indicator or write to a control programmatically. Is that what you are doing? There is always room for conflict and you should be careful when doing this, e.g. what should happen if the program writes one value and the operator writes a different value at the same time?

The statement "...getting problems" is too generic to make any suggestions. Do you have a broken run arrow? Do you get problems during running (unexpected results, unpredictable behavior, crash...)?

A code sample would make it much easier for us! 🙂
Message 3 of 6
(4,123 Views)
My first question to info-LabVIEW was about how to use 2 controls for period and frequency of a sinewave and have the other update if you change either. The answer was to keep track of state in your loop; to figure out the one that changed. Then you invert that (1/period=frequency) and use a local variable to write the answer to the other control.

Give us a bit more information and we'll get yours answered as well.

Bob
0 Kudos
Message 4 of 6
(4,105 Views)
Thanks Altenbach,

What you described is pretty much what I am doing, I am indeed using local variables and there are conflicts rising due to both input and outputs being written to.

Thanks!
0 Kudos
Message 5 of 6
(4,097 Views)
As everyone has pointed out, incorrect use of local variables can result in a race condition. You really need to provide more details. The best way to provide the details is to post your code with an explanation of what you're trying to do.
0 Kudos
Message 6 of 6
(4,090 Views)