LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Simultaneous control of instruments

I have 2 vis running simultaneously that are both sending commands to the same instrument.  From what I have read, this should not be a problem, as the calls will block if the gpib bus is busy (in my case, I'm not concerned about the order the commands are processed).
 
Is this ok?  I found VISA vis that will get a lock on the bus until released and was wondering if I may need to use those
 
TIA,
Bill F
0 Kudos
Message 1 of 3
(2,536 Views)
Bill,

You may be OK, but what if one VI sends a Write command and then the other sends a Read? The second gets data that is relevant to the first???

It may be better and more versatile to have an Instrument Communication VI which runs indepedently. The other VIs send commands to the Instrument Communication VI via a queue and the data is returned the same way. Then if you want to do a Write then Read, simply put both commands on the queue. Or you could implement a Write+Read command in the Instrument Communication VI which would automatically handle this case.

Lynn
0 Kudos
Message 2 of 3
(2,518 Views)
Hi Bill,
What Lynn said is correct.  You may be able to get it to work, but it all depends on the timing of the commands.  If the program sends two reads in a row, the buffer will be read with the first read and then you will probably get a timeout error for the second read.  Resource reserved errors may result as well.  This also depends on how your instrument handles the commands.  Typically, sending commands from two different programs to the same instrument is not the preferred instrument control programming method, but if it works for your needs, then you should be fine.  If you want to keep the code for each program separate, you can create a subVI for each and use them in the same program.  I hope this information helps, but if you have any additional questions, just let me know!  Have a great day!
 
Chris R.
Applications Engineer
National Instruments
Chris R.
Applications Engineer
National Instruments
0 Kudos
Message 3 of 3
(2,502 Views)