LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is NI-VISA reentrant?

Maybe reentrant isn't the right word but...

 

I have four instruments on four different com ports

 

I believe that I should be able to read all four of these instruments simultaneously.

 

But it does not seem to work that way.

 

It appears the instruments are read consecutively but not necessarily in the same order every time. (VISA race?)

 

I have set all the sub-vi's related to the instruments to be "Preallocated clone reeentrant execution".

 

InsCapture.PNG

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 1 of 20
(1,648 Views)

Sample code...

InsCapture.PNG

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 20
(1,610 Views)

In your first post because you have "Value" property nodes, I don't think it is possible to synchronize. Each property node runs separately in the UI thread. The only way to try would be to wait for all property nodes to finish then run in parallel.

 

I don't think VISA can run in parallel, but not completely sure. Make sure there are no possible blocking subVIs in your reentrant VIs. (I cannot open them from the snippet.) I am only guessing about VISA; my guess comes from the fact of looking at the old GPIB functions. There are special VIs for looking at all devices.

 

mcduff

0 Kudos
Message 3 of 20
(1,607 Views)

Interesting...

 

I will remove the indicators and see if it's any faster

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 20
(1,598 Views)

Right click on your VISA read/write functions and see what mode they're in. From this help article, it sort of implies that it's not multithreaded:

 

https://www.ni.com/en-us/support/documentation/supplemental/18/choosing-between-synchronous-and-asyn...

 

Mind if I ask if this is causing some issue of some kind? Are you simply trying to read three instruments simultaneously? If so, how "simultaneous" do you need it to be?

 

Edit: I had another thought, it's possible the VCP drivers you're using are not multithreaded. If they all call the same driver then it might be blocking one level *under* VISA. That's way outside anything I have experience with, but it might be an avenue for some research.

0 Kudos
Message 5 of 20
(1,587 Views)

I am sure, it is possible to write simultaneously to several com ports via LabView and Visa

 

That is why , I would guess it is possible to read simultaneously, too

 

can you open "dc measurement.vi" and "ac measurement.vi" separately and run each .vi?

like press the run button in vi_1, wait until you get some readings

then press the run button in vi2 ... ?

 

 

 

 

0 Kudos
Message 6 of 20
(1,588 Views)

@BertMcMahan wrote:

Right click on your VISA read/write functions and see what mode they're in. From this help article, it sort of implies that it's not multithreaded:

 

https://www.ni.com/en-us/support/documentation/supplemental/18/choosing-between-synchronous-and-asyn...

 

Mind if I ask if this is causing some issue of some kind? Are you simply trying to read three instruments simultaneously? If so, how "simultaneous" do you need it to be?

 

Edit: I had another thought, it's possible the VCP drivers you're using are not multithreaded. If they all call the same driver then it might be blocking one level *under* VISA. That's way outside anything I have experience with, but it might be an avenue for some research.


I will give that article a review...

 

Well in general I am trying to speed up acquisition time. As it is now I can get about a four second loop rate and would like to get that down to one second or less to catch frequency variations when the generator is step loaded.

 

I am not really using any "drivers" the Yokogawa meters and the Agilent use SCPI commands. 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 7 of 20
(1,570 Views)

@RTSLVU wrote:

I am not really using any "drivers" the Yokogawa meters and the Agilent use SCPI commands. 


There is a USB to VCP driver somewhere in the mix (unless this is Ethernet... in which case I can offer some other suggestions). I assume this is USB, so when you plug in your device to your PC, there is some driver that gets installed to tell your computer "Hey, you can communicate with me via a terminal protocol". For example, a common chip for this is the CP2102. I have no idea if that chip is used by Agilent, it's just an example. I meant *that* driver might not be multithreaded, but I would honestly be surprised if that's the case here.

 

Can you post your actual device-reading subVI's? If they use Bytes at Port and a timeout, then they'll take forever. It surprises me that it takes more than a couple hundred ms per instrument query. If it's configured properly with termchars it should be very fast (unless there's a LOT of data to transfer, but I don't know what it is you're reading).

0 Kudos
Message 8 of 20
(1,560 Views)

@BertMcMahan wrote:

@RTSLVU wrote:

I am not really using any "drivers" the Yokogawa meters and the Agilent use SCPI commands. 


There is a USB to VCP driver somewhere in the mix (unless this is Ethernet... in which case I can offer some other suggestions). I assume this is USB, so when you plug in your device to your PC, there is some driver that gets installed to tell your computer "Hey, you can communicate with me via a terminal protocol". For example, a common chip for this is the CP2102. I have no idea if that chip is used by Agilent, it's just an example. I meant *that* driver might not be multithreaded, but I would honestly be surprised if that's the case here.


Ohhh So you mean it could be the FTDI virtual serial port driver...

 

Crap I hope that's not it. 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 9 of 20
(1,549 Views)

Yes, the FTDI driver. I *seriously* doubt that's the case but I wanted to throw it out there.

 

Can you post your subVI's? If you can post the whole thing in a zip file we can poke at it some more.

0 Kudos
Message 10 of 20
(1,544 Views)