LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI VISA serial still slow compare to using Windows serial via .NET?

About 5 or so years ago we were using serial communication via NI Visa and we found that there's a large overhead latency associated with using NI Visa to send and read back response to a serial device (FTDI virtual USB device).

 

Is that still true any more or has NI Visa serial handling become much better?   Our software engineer recently just wrote an interface using a .NET Serial class to do the serial communication instead of using NI Visa.  We found that difference was only 10 us using his benchmarking code shown below for both .NET case and VISA case.

.NET Interface Code:

.NET code.png

 

VISA Serial Code:
VISA code.png

 

Is the benchmarking code valid to do the speed comparison?  Maybe I should actually use a hardware probe to measure the actual hardware timing.


0 Kudos
Message 1 of 6
(3,326 Views)

I have never heard of any problems or delays using NI-VISA.

 

Are you using the same USB FTDI devices you used back then in your comparison?  I think it is possible there were problems with the serial drivers with that came with your USB serial port causing problems.  Or perhaps the chips that were used in that device were counterfeit and were causing problems.

0 Kudos
Message 2 of 6
(3,314 Views)

I'm guessing that waiting around for bits to be transfered is the slowest part of the whole thing and any code would have to be horribly inefficient in order to notice any difference.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 3 of 6
(3,309 Views)

Can you post your actual code.

 

From what little LabVIEW I can see in your pictures, I would say it was not programmed very well to begin with.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 6
(3,286 Views)

A colleague of mine, with almost no LabVIEW experience, tried doing a VISA read (in LabVIEW) of a microprocessor that transmitted its data using some insane "Baud rate" (well over 112K).  Once he got the idea of how VISA works (with a little help and experimentation from me), the data just flew in ...  We certainly didn't see any "slowness" in NI VISA.

 

Bob Schor

0 Kudos
Message 5 of 6
(3,279 Views)

Thank you for all the replies.  So far we have only observed 15 us difference using the benchmark codes I showed.  I only have the screen shots that the software engineer sent me so I can't post the real codes.

 

Sounds like most people here don't have issues with NI VISA serial communication being slow.  We'll probably stick with using NI VISA serial over the .NET Serial class since NI VISA plays more nicely with other instruments on other communication protocols (GPIB, etc.).  There are also fewer cleaning up and closing the port you have to do manually compared to using the .NET Serial class.  We haven't had issues with the NI VISA locking up the program if the port wasn't closed properly like we do with .NET Serial interface.   

 

I'll do an actual hardware timing with a logic analyzer to see what is the timing when I use a really light weight serial terminal program like Bray++ or serial interface via Raspberry Pi.  If there's no difference then I can put this to rest.

0 Kudos
Message 6 of 6
(3,232 Views)