From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to Run Multiple Simultaneous VI's with GPIB

I am having a bit of a problem.  I have limited experience designing VI's, but have made a few that do what I want.  I work in a physics lab running a dilution refrigerator.  I have designed VI's for temperature control (using PID modules), superconducting magnet control (setting voltages and currents) and for data collection (reading voltages from multimeters) all using GPIB interfaces and Visa controls.  My problem is that I need to do all three of these things at once.  The temperature control program needs to run constantly, reading a voltage from one meter and setting output on a current source.  The magnet control is not so time sensitive.  The data collection needs to run pretty fast.  I have tried simply running two VI's simultaneously, but LabView just locks up.  I assume this is due to both programs trying to use the GPIB card at the same time.  So, what I am wondering is if there is a simple way to make two or three VI's run in parallel, all accessing a single GPIB card, without locking up LabView.  I have read Application Note 114 on "Using LabVIEW to Create Multithreaded VI's for Maximum Performance and Reliablility" which makes it sound possible, but I can't figure out the easiest way to make it work.  Any help would be greatly appreciated.
Thanks,
Joel
0 Kudos
Message 1 of 3
(3,906 Views)
Joel,

this is more a design problem of your app.
I had a similar problem in a multi-seat test stand, where some of the instruments needed to be shared between the different seats, while at any given time just one seat can  use it.
There are at least two solutions:
1. I had a named semaphore 'device_used?' with a size of 1 and some  acess VIs for the equipment. These where simpel wrappers around the driver. These wrapper first acquire 'device_used?', than perform their action(s) and finally release it .
2. If your access this quite short in time you could as well use a kind of 'superdriver' VI that performs the complete hw access for a task. You can than call this single VI from all your main VIs. Each of those instants have to wait untril the superdriver is free , so just one can access it at any given time.

Just my Euro 0.02!
Greetings from Germany!<br>-- <br>Uwe
0 Kudos
Message 2 of 3
(3,902 Views)

Joel

You can use the feature that a single vi called by more applications blocks the second caller until the first one is finished.
The only thing to remind is that you should NOT make this vi reentrant 

So if you built a Query vi that sends a cmd and waits for the answer of that instrument, you can simply do the job.
As long as cmd and data stay coupled.

Attached is a simple example that we normally use:

 

greetings from the Netherlands
0 Kudos
Message 3 of 3
(3,887 Views)