LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

state machine with parallel Data Aquisition loop

I am using a state machine to step through a test sequence. While the test is running, I need to continuously monitor a voltage. If the voltage drops below a certain level, then I need send the state machine to the "end" frame. Any suggestions?
0 Kudos
Message 1 of 5
(2,847 Views)
First of all, I am assuming that you aren't having to stop mid-state (if so, you'll need to add code to do this).  I think a queued state machine could work well.  Set up a queue to hold the states and write to the queue at the end of each state (you'll need to assure that the queue is the last thing that executes in each state).  In your parallel process you can enqueue a value to carry you to the end state if the low voltage condition is met.
0 Kudos
Message 2 of 5
(2,845 Views)
Most of the applications I have written involve this sort of architecture.  Depending on the safety specs of the test, I have needed to shut things off in the state machine (power, motors, etc), immediately after receiving an out of range measurement.  I have made extensive use of the built in error handling (specifically cases structures wired to the error cluster), and more specifically, to the "stop" terminal in loops (loops that are inside states). 

I use a queue for the error, and upon detection of an erroneous measurement I enqueue a 'true' error cluster element with the appropriate error code, and then any code I have running inside the state machine will stop 'immediately' (at the end of the current loop iteration/state - depending on safety).

Hope this helps.
0 Kudos
Message 3 of 5
(2,840 Views)
Can you direct me to an example of this? I haven't used queues and am a little confused about how to implement. Thanks.
0 Kudos
Message 4 of 5
(2,826 Views)

Look at the following link for an example of a queued state machine.  It should be enough to get you going on how to use queues to carry out what you're needing to do.

http://sine.ni.com/apps/utf8/niepd_web_display.display_epd4?p_guid=B45EACE3DE6756A4E034080020E74861

0 Kudos
Message 5 of 5
(2,822 Views)