ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Wait until true in a sequence structure

I am communicating to a serial device using RS-232. I have a set of sequenced commands being sent to the device and I need to have the sequence wait until I receive specific strings from the device. Is there a simple way to have the sequence wait until I receive those commands? The problem is that it may take several seconds for the hardware to execute the command and I do not want to continue the commands until it completes the previous steps.

Nick
0 Kudos
Message 1 of 2
(9,673 Views)
You just have to put your instrument read inside a while loop. Terminate the while loop when the correct data is read or when a timeout value is reached (an error condition). Instead of a sequence structure, you'd probably be better off using a state machine architecture. There's a couple of shipping examples that shows this architecture. Much more flexible that a sequence structure.
Message 2 of 2
(9,668 Views)