LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

binary switch dont work outside a loop

I have positioned a binary switch outside a loop. But if the loop is running the switch dont work. I have create a simple diagram to illustrate it. I think its possible to reach the same result on another way. But why dont it works so?

Thanks
0 Kudos
Message 1 of 7
(3,121 Views)
The button works the same...
But LabView only checks it when the vi starts. If you
want to check it multiple times, then you have to
program it that way - put the button inside the loop!

Best regards
Gerd
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 7
(3,121 Views)
Hi there,
If you use the "Highlight Execution" and look at your block diagram when you run your VI you will see how the data flows. Data from your switch is sent once and since there is no loop around the switch the switch will send the data only once. If you put the switch and the LED inside the loop structure it will send the data for evry iteration of the loop.

Hope this clear things out
Robert S
Application Engineer at National Instruments

This is the function of the "Dataflow"-execution wich controls the behavior of a VI
0 Kudos
Message 3 of 7
(3,121 Views)
Hello,

thanks for your answer. But I placed the button outside the loop so that it don´t work every iteration.
I want to open a com port, start a microwave generator with it or something else - once only or alternativly in very different time intervals - user controlled.

Or for example storing data on disk. And not only at the starting of the VI.
On the other side I need to control the temperature, the power and so on every second oder millisecond.

Thanks
0 Kudos
Message 4 of 7
(3,121 Views)
If you want to do that, then you have to program it...
Make a case statement and let the user select when
to save data to a file. Or make some logic and start
your microwave generator only at certain conditions...
All the same programming: make a case statement of it,
like in every other language.

Best regards,
Gerd
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 7
(3,121 Views)
I don´t understand this.
A case statement inside the while loop will be repeated every time with the time condition of these certain loop, outside the loop it works only one time at the start of the VI.
0 Kudos
Message 6 of 7
(3,121 Views)
You can use different loops with different timings.
One loop with a fixed timing for device controlling,
other loop for user interface (using "Wait for front
panel activity").
Or the mentioned case statement: use a loop with a
small timing value (10 to 50ms) and check for a
condition to start your device. Only when the condition
is set the case statement is executed.

Best regards,
Gerd
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 7
(3,121 Views)