LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use a timer together with an event.

Try using Highlighted Execution and other debugging tricks to see what's not working the way you want.
Jarrod S.
National Instruments
0 Kudos
Message 11 of 12
(1,750 Views)

Dennis,

 

Am I interpreting this correctly? Queue 1 sends commands to the pumps and queue 2 requests measurements of flow, pressure, and so on.

 

It looks like the queue 2 commands are enqueued only in the time out event case.  However, that case never executes because nothing is wired to the timeout terminal (the little hourglass in the upper left corner).  If nothing is wired, it defaults to -1 which means never time out.

 

How are you running this program?  When you hit the run button with the Configuration button false, the program will halt immediately.  The Run Continuously button should not be used for running a program.  It is for limited kinds of testing during development.  Add an event case for your Configuration and a consumer case for the initialization.  Then you can remove the case structure and while loop surrounding producer and consumer loops.  They are they are the only loops you need.

 

It seems like the VISA reads and writes in the consumer loop are more complicated than they need to be.  Unless your device has unusual behavior, you should not need to flush the buffer every time.  Write the command.  Read the entire response in one read (make byte count bigger than the largest possible response from the instrument).  Format the data to a number using the offset input rather than multiple reads. The offset will let you skip any header or prefix in the response string and the string to number functions will ignore any characters after the numeric part.

 

Lynn 

Message 12 of 12
(1,744 Views)