Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Improving VISA serial port functional execution speed

The speed at which a VI seems to complete a data transfer to a serial port seems to extremely slow with the VISA functions. The "old" serial port VI functions that do not seem to be included with LabVIEW 7 ran much faster. How can I make the VISA functions run at the same speed. Conversely, where are the "old," non-VISA serial port functions located in LabVIEW 7? They are no longer found with the serial instrument I/O.
0 Kudos
Message 1 of 11
(4,826 Views)
This is surprising. The VISA functions are generally faster than the old serial VIs.

If you are transfering very small amounts of data, you might consider changing your VISA Writes and Reads to be synchronous. (Right click on the function and select "Do I/O Synchronously" (or something like that).) This will avoid the setup for asynchronous I/O and the polling waiting for completion. (All of this happens under the hood, and it can take a few milliseconds. This is significant with small amounts of data at high baud rates.)

If that's not what's going on, or if the synchronous I/O doesn't help, report back here with more details. E.g., how much data, what baud rates, what benchmark results?

Brian
0 Kudos
Message 2 of 11
(4,826 Views)
Brian,
Your recommendation worked well. Thanks for your time and assistance.

Steve
0 Kudos
Message 3 of 11
(4,825 Views)
Brian,

I read this thread because I also feel my serial I/O is slow. So I tried your suggestion of making both my VISA read and writes synchronous, but no luck. It did not change my loop speed at all. I am working at 230.4 Kbaud (I am using a Sea Level USB-to-RS422 converter that has drivers that appear to Windows as another serial port). I am transferring 45 bytes per loop cycle. I only get 20 loops per second. Any other ways to speed the serial port up?

Thanks.

Rob_FFTI
0 Kudos
Message 4 of 11
(4,829 Views)
Hi. I've got some speed Problems with serial too. Are there any other tricks for a speedup of the serial VISA? thx chosn
0 Kudos
Message 5 of 11
(4,487 Views)
The speed problems could be how you have written your code or how the instrument is sending data. Can you attach the VI you've written and some details on what you are talking to?
0 Kudos
Message 6 of 11
(4,471 Views)

I ran some tests a while back.  I can't find the actual numbers right now but here are the results in a nutshell

1 - USB-serial adapter will always be much slower than a regular built in COM port or PCI adapter.  The extra time seems to be in the time it takes to communicate between LV and the actual hardware.

2 - PCMCIA adapter was twice as fast as USB adapter.

That said, you need to make sure your code is as clean and efficient as possible.  Code needs to be optimized to minimize the number of VISA Reads and writes.  Also, if possible, avoid hardware handshaking if possible and unecessary flushing of buffer. 

I'll second the suggestion by Dennis to post your code and what you are communicating with.

0 Kudos
Message 7 of 11
(4,464 Views)
Ok. ;-) I've got a Onboard standard Serial Device.
With a Baudrate of 19200 I receive continously (without any pauses) Messages which i have to decode.

Each message is about 30 characters long. The messages are separated through "Newline" (\n).

In a sub-vi i decode the message string. (looking for \n, separate the different messages and store them into "cmdarray").

In the main program i read one element from "cmdarray", delete this element from the array, and send it to a case-structure with the decisions of the defined commands.

Finally in the case structure I execute the things (lamps, bars) matching to the command received via rs232.
But everything is so slow. If i disconnect the rs232-cable, Labview is going on to "decode" the previously received commands via rs232.
I tried the Labview-integrated termination character recognition but then it becomes more slow....
Any hints?

mfg
j_f
0 Kudos
Message 8 of 11
(4,431 Views)
The hint remains as before. POST YOUR CODE. You could be spending time decoding the message, building the array, executing these commands.
0 Kudos
Message 9 of 11
(4,432 Views)
Ok, I first had to remove the confidential parts... And yesterday i was on my way home... Smiley Happy

Here are the vis....
and the transfered messages:

Measurement:

 Temp1:28.1C
 Temp2:29.7C
 Temp3:32.3C

 U0corr:3.28V
 U1corr:3.27V
 U2corr:3.25V
 U3corr:3.26V
 U4corr:3.28V
 U5corr:3.30V
 U6corr:3.28V
 U7corr:3.27V
 U8corr:3.28V
 U9corr:3.29V

greets,
j_f

Edit:
PS: Version 7.1.1

Message Edited by j_f on 08-10-2007 02:34 AM

Message Edited by j_f on 08-10-2007 02:34 AM

Download All
0 Kudos
Message 10 of 11
(4,417 Views)