LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Boolean comparison to advance frames in a sequence

I am writing a LabVIEW program where I execute a sequence of analog outputs with a PXI-6733 card.  Most of the analog outputs are time based, so I have chosen to use a sequence with the following structure:
Frame0: AO Assignment, Frame1: Wait function, Frame2: AO Assignment, Frame3: Wait function, etc.
However, I have a couple of analog output transitions where the transition is not based on time, but on a comparison of a variable (voltage or elapsed
time) to a constant.  For the voltage variable, I am taking readings with a PXI-6250 card.  What I need to have happen is the following: 1.  Arrive at the specified frame in the sequence. 2.  Wait in that frame until the variable crosses a threshold (I am using the greater than or equals comparison function) 3.As soon as that function returns true, go to the next frame in the sequence and continue from there.  I am having trouble advancing from one frame to another based on a boolean value.  Any ideas?  The only thing that I have thought of so far is to use a case structure in the frame where I want to wait.  The false state of the case would be null, and the true state of the case would contain the rest of the code that I want to execute, in yet another set of sequence frames.  I am trying to avoid that as it could messy fairly quickly.  So if there is some way to "pause" a sequence frame and then advance based on a boolean comparison that would be great.  Thank you!

0 Kudos
Message 1 of 4
(3,271 Views)
It sounds like what you want to "pause" your program is a while loop. Take a look at the following.
 
 
 
NOTE: You will want to put in a Wait.vi with some constant into the while loop, otherwise it will eat up all your CPU and you will run at 100% making that comparison millions of times a second.


Message Edited by jrpe on 11-07-2007 03:57 PM
Jeff


Using Labview 7 Express
0 Kudos
Message 2 of 4
(3,263 Views)
I think what you should really do is drop the sequence structure entirely and use a state machine. Look at the shipping examples and design patterns (File>New...).
0 Kudos
Message 3 of 4
(3,258 Views)
The NI support engineer also suggested that I take a look at the state machine structure.  I have never used it before, so that will be a good opportunity for me to learn.  Thanks!  
0 Kudos
Message 4 of 4
(3,251 Views)