LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2 parallel whiles and delay

Hi I'm learning about the use of parallel whiles for my program. Just can someone explain me why in the attached example, the delayed leds do not behave as they should. For example, if LED 1 has 500ms delay and LED 2 1000ms delay, LED 2 turns off first. But if LED 1 delay is higher than LED 2 delay, it works properly.

If I use single stepping it works properly.

 

 

0 Kudos
Message 1 of 3
(559 Views)

You have a race condition, because the upper loop will run a second time most of the time (after turning off the LED for a nanosecond) because the lower loop takes twice as long before resetting the switch. If you increase the upper delay to e.g. 600ms, your VI will work more reliably.

 

What is the purpose of the outer while loop?


LabVIEW Champion. It all comes together in GCentral GCentral
0 Kudos
Message 2 of 3
(549 Views)

I probably would use event structures for this, see attached simple example (LV 2010).

 


LabVIEW Champion. It all comes together in GCentral GCentral
0 Kudos
Message 3 of 3
(547 Views)