LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Toggle Boolean / Switch after VI Successfully Executes

Solved!
Go to solution

I am using a stepper motor that changes direction during the execution.  I currently have a Boolean control that sends a digital output to the proper port of the controller to reverse directions.  I do have to, however, switch the Boolean from "true" to "false" or vice versa after every run so the motor knows to reverse the direction.  Is there a way to code this into my VI?  I basically just want my VI to understand what the Boolean is set to and at the end of the execution switch the value of the Boolean to the opposite value.  If my code is needed it can be provided.

 

Emily

0 Kudos
Message 1 of 4
(3,152 Views)
This is what uninitialized shift registers were born to do.  Just be sure to add code to handle the first time you run the VI (perhaps use "First Call?").  If you want to simply change the value of the control, a local variable is a simple method, just read the value pass it through the NOT function, and write to a local variable.
Message Edited by Darin.K on 08-17-2009 01:56 PM
0 Kudos
Message 2 of 4
(3,148 Views)

I appreciate the fast response, but I am unsure how to proceed even with the advice.  I have attached my code...maybe you could be more specific?  My boolean operation occurs in the 2nd sequence.

Thanks,

 

Emily

0 Kudos
Message 3 of 4
(3,142 Views)
Solution
Accepted by topic author ejb3439

Sorry I only have LV8.2, you could post a version saved for this, or my guess is that with code posted there are plenty of people who could help you very quickly.

 

Here is an example of the two methods I described.  The while loop with shift register is a bit more general, I use it when I want a value to be "remembered" when I run the VI again.

0 Kudos
Message 4 of 4
(3,128 Views)