LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to stop sub vi while loop

hi,

      i have three while loop.

        1)main vi out side of event structure with timeout

        2)second while 1sec time delay

        3).sub vi 3sec delay

all while stop one globle bool controll button.

 

when i will stop this main vi it will take some time to stop.bcaz delay in while how sop immediate.pls tell me any other methode.

     

Download All
0 Kudos
Message 1 of 6
(3,095 Views)

Use a state machine. Have the state machine keep running with a small execution timing (e.g. 10ms) and keep checking if the 3s has elapsed (to do your process) or if it's time to exit.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 6
(3,058 Views)

Hi Gokul,

 

try using Queues.

 

Attached a sample ,on how Queues used to stops parrallel loops.

 

In ur case u can pass the Q refnum to sub Vi and stop all the loops.Dont forgot to close refum after while loop.

 

Refer http://digital.ni.com/public.nsf/allkb/267704CDE91156D186256F6D00711AAE

0 Kudos
Message 3 of 6
(3,038 Views)

HI,

        I want blink two LED.

        

        1).while two LED 1sec

         2).sub vi while LED 3sec

 

if i will use state machine  both led blink 4sec.

0 Kudos
Message 4 of 6
(3,035 Views)

hi,

         led mean two boolean indicator blink...for difference while loop and difference time delay.if i will use state machine totall delay is added.so pls tell me to stop without delay while loop.

0 Kudos
Message 5 of 6
(2,944 Views)

Show your latest attempt with using the state machine.

 

It sounds like you are wiring things up to work in series rather than parallel.

0 Kudos
Message 6 of 6
(2,922 Views)