Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

vi runs slow

I had a vi that reads from 3 serial ports (using visa blocks) and 1 DAQ card. This was done using LabView version 6.1 and everything worked okay. Now, I have to read from 2 other serial ports, that means I have 5 serial ports and 1 DAQ. I also upgraded the Labview version I had to 7.0. However, the performance of the new modified code is significantly lower. I was able to read about 10 samples per second, but now i could barely read 2 samples per second. I tried to make it run in parallel and any other methods i think may improve it, but none worked. Why is the performance reduced significantly and what should I do to increase it? Thanks.
0 Kudos
Message 1 of 3
(3,197 Views)
Reading from 5 serial ports and 1 DAQ channel will probably have some speed issues, especially if you are using the Traditional DAQ drivers instead of the DAQmx drivers. Serial reads and DAQ reads are blocking calls. So what that means is that, when you do a serial read of 100 bytes or when you do a DAQ read of 1000 scans, LabVIEW will block all other operations. This means that any other operations that you may have in parallel or in series to that thread will be suspended until that read has completed. So as you can see, doing this many reads in parallel is not recommended in time sensitive applications.

A.S.
Anu Saha
Academic Product Marketing Engineer
National Instruments
0 Kudos
Message 2 of 3
(3,197 Views)
Hi Lan.

I second A.S.'s comments and would like to throw out an idea.

From your question, it is not clear when you saw the drop-off in performance.

Was it due to going from 3 to 5 ports or the LV upgrade?

You did not mention if you were doing your VISA calls syncronously or asyncronously? This could be the issue in either of the above cases.

Check me on the following if I have this backwards;
When a VISA call is made syncronously, (?) all other VISA calls stall until the the first completes. This would end up making all of your VISA calls wait in line for their turn to run.

Right-click on the VISA call (read/write) and slect this option.

Otherwise, I would encourage you to post something we can look at. You could be hanging threads, just gues
sing now.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 3
(3,197 Views)