LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Slow serial communications using VISA Read

I am not impressed with the speed of the VISA Read vi in LabView 7. Reading only 45 bytes in a tight loop I can only read at about 20 loops/sec, even though when I 'scope' the input line the data is finished being aquired long before the loop begins again. Even at 115.2 Kbaud. I have tried selecting the 'Do I/O sychronously' but it does not help. Why is it so slow (I am trying to run at 40 loops/sec which is only 45 bytes X 40 = 1800 bytes/sec)?

I am thinking about buying a 3rd party COMM driver *.DLL and using the Call Library Function Node to get faster response. Has anyone done that? I am considering the COMM-DRV/Lib software from WCSC(Willies Computer Software Company). Has anyone used it? They say many people have used
their software with Labview.

Thanks.
0 Kudos
Message 1 of 12
(5,467 Views)
I'm surprise that you're seeing this performance hit - can you attach an example?

Implementation methods will greatly impact the performance of VISA read - for example, do you read 1 byte at a time? I know from apps I've written with VISA that I can sustain data rates much higher than what you're seeing.

An option is to use queuing - you may wish to have two processes - one reads via visa (over and over in rather large chunks) and stores it in a queue, and the other actually performs the data processing.
0 Kudos
Message 2 of 12
(5,467 Views)
I am reading a fixed number of bytes (45 currently in the example, at a time). I can read a burst of data very fast (>230 KBaud) but when I begin to loop in a while loop the rep speed is very slow. It seems like once it finishes gathering the data it takes a long time to return from the VISA Read. I have attached the program. It is very simple. I am running this program on a DELL 2.8 GHz Pent. IV with 512 MB RAM.
0 Kudos
Message 3 of 12
(5,467 Views)
Let me take a look at this - in the mean time, what brand hardware are you using?
0 Kudos
Message 4 of 12
(5,467 Views)
Chris, as I said in last post I have a DELL 2.8 GHz, Pent.IV (XPS system) with 512 MB RAM. I have used the vi with both the standard RS-232 (COM2, up to 115.2 Kbaud) port and also the Sealevel USB to RS422 (COM5, up to 230.4 Kbaud)converter. With each COM, I was not able to get more than ~20 cycles/sec with the vi I sent.

Thanks for the help.

Rob
0 Kudos
Message 5 of 12
(5,467 Views)
Thanks, give me a couple of days to see if I can get an answer.
0 Kudos
Message 6 of 12
(5,467 Views)
Hi,

"Rob_FFTI" wrote in message news:506500000008000000D4CF0000-1079395200000@exchange.ni.com...

> I am thinking about buying a 3rd party COMM driver *.DLL and using the
> Call Library Function Node to get faster response. Has anyone done
> that?

I have used both MSCOMM32.OCX (that comes with VB6 and VC++6) and
Adontec's SuperCom with LabView 6.1, with excellent results.
Haven't compared performance with VISA, and don't know about LabView 7,
sorry.
Since mscomm is quasi free, you can always try this before buying any external
package. I would not use it for commercial purposes, as there is no source
available, and there might be issues with redistribution.

regards, Matt
0 Kudos
Message 7 of 12
(5,218 Views)
You don't mention what type of hardware you're talking to. Is the instrument capable of more than 20 queries/sec? At higher baud rates, I would also recomend using hardware handshaking. The other thing to try is use VISA Bytes at Serial Port to determine exactly how many bytes are available. With a fixed byte count, VISA Read will wait until that number of bytes are available, the timeout value is reached, or the termination character is detected (when you've got term char detection enabled).
0 Kudos
Message 8 of 12
(5,467 Views)
I modified the vi to write 45 bytes and then read 45 bytes and used a loopback connector on the built-in COM port. I also logged the data to get the time per cycle and # of cycles/min.

I get 5-6ms per loop (150 loops per second), which is close to the actual transmission time for 45 bytes at 115.2k (4ms). This was tested on an AMD 2500XP+ (1.9GHz).

However, if I have NI-SPY open I get 114 loops/sec (NI-SPY minimized) and only 13 loops/sec (NI-SPY maximized).

Do you have NI-SPY open and running the same time your program is running? If so, the performance will drop off considerably.

Have you verified NI-SPY isn't open?
0 Kudos
Message 9 of 12
(5,467 Views)
No, I have not verified NI-SPY isn't open. Why would it automatically open (I did not open it)? I will look at that.

Thanks.
0 Kudos
Message 10 of 12
(5,467 Views)