LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Do "Stop.vi" command only once in while loop

Dear all,

 

As you can see from the pic. , I need to put  "stop.vi" in a while loop but i dont want the motor to stop every iteration of the loop(i want it to stop only once) Is there any option in a while loop  that do "stop.vi" only once and go on? 

 

Thank you,

Kind regards,

0 Kudos
Message 1 of 14
(4,646 Views)

Something like this.

 

Example_VI_BD.png

=====================
LabVIEW 2012


Message 2 of 14
(4,639 Views)

Thanks for your precious reply Steve Chandler, i will try it on weekend. I will post my feedback then.

 

Kind Regards.

0 Kudos
Message 3 of 14
(4,611 Views)

Dear Steve Chandler,

 

As you see from my attachment , in the program condition; "stop.vi" is already in a false case structure. According to your reply, should i put the "stop.vi" in true case structure which will be inserted in the false case structure too ?? 

 

Best regards.

0 Kudos
Message 4 of 14
(4,602 Views)
Basically replace your stop vi with the entire code that I posted. Replsce the dialog in that with your stop vi. I cannot provide a link because I am posting from my phone but search for Action Engine. What I posted is the foundation of one. An action engine is a case structure in a single iteration while loop and at least one uninitialized shift register. Let me know if you have questions. I will try to give more specifics when I am at my computer.
=====================
LabVIEW 2012


Message 5 of 14
(4,585 Views)

So here is what I was talking about above. Replace your stop vi with the while loop containing the case structure which contains your stop VI. Better yet create an Action Engine.

 

Stop Once.png

=====================
LabVIEW 2012


Message 6 of 14
(4,562 Views)

Ok Steve Chandler,

 

Thank you so much, i will try it as soon as possible. I will also try to learn the action engine .

 

May the force be with you.

Best Regards.

0 Kudos
Message 7 of 14
(4,544 Views)

Dear Steve Chandler,

 

i also added the "set velocity.vi" into the " stop.vi's case" because this vi is also needed to occur once during the whole program not evey iteration.

 

As you can see from the attachment, I did what you had said(, but this time everything is stopped (both the daqmx and motor)  , i suppose that i cant get out of the while loop wtih this solution , because it only stop and i cant go on to the other vi (move absolute.vi).

 

Please help me again. I just want to use "stop.vi" only once and then go on other vi.

 

The three wires and the TF boolean goes through in the false case.

 

REV(Stop-Only-Once-then-GoOn).pngstop.vi" only once

0 Kudos
Message 8 of 14
(4,517 Views)

My bad. The boolean constant connected to the while loop stop terminal needs to be set to true. The while loop only iterates one time and exists only so you can create the shift register.

 

There is an easier way. If you have a vi that needs to only execute once before your main application loop, then just put that code outside of the while loop.

=====================
LabVIEW 2012


0 Kudos
Message 9 of 14
(4,504 Views)

Dear Steve Chandler,

 

I corrected and tried it but now the "stop.vi" executes every iteration. So this is not working either.   Sorry I can't place these vi.s outside of the sub while loop, because they need to be inside of the while loop and work same time with DAQmx vi.

 

I did not understand what you mean from this sentence : "The while loop only iterates one time and exists only so you can create the shift register."  Crate shift register where?

 

rev1.png

 

 

0 Kudos
Message 10 of 14
(4,499 Views)