From 11:00 PM CDT Friday, Nov 8 - 2:30 PM CDT Saturday, Nov 9, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate non-blocking commands to a serial device

I have a serial device which accepts non-blocking commands. This is, if you send a command that takes 1 minute, while this happens, you can send more commands and they will be executed. Once a command is done, it sends back a code that relates to that command, so you know it is finished.

 

I have a VI which tries to communicate with this serial device (see attachment). It does work, but it blocks the execution until a command is finished. So I can send commands one by one, but not in parallel, or in a delayed non-block way. The problem is the while loop which waits until the device outputs something.

 

I need to do something similar, but non blocking. The VI should be able to send several commands while others are executed.

 

This subVI is controlled from a main VI, which is just a State Machine with a few states, where each state is some action which is sent to this subVI, and then to the serial device.

 

 

0 Kudos
Message 1 of 3
(2,504 Views)

Use another loop that does nothing but read from the serial port.  Report the data to whoever needs it with a Queue.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 3
(2,498 Views)

I see, the problem is that with the way I have done the main VI, if I put a while true loop there, it would block my main VI in that point forever (see attachment). (the subVI from the first message is the green homemade icon here)

 

I am learning labview, so I am more than willing to change it if necessary.

0 Kudos
Message 3 of 3
(2,491 Views)