Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I stop the VISA serial read vi's from mugging my CPU?

Hi.

I'm acquiring NMEA0183 strings through a serial port, and for the first time I'm using the VISA Serial drivers. However when it's waiting to read data from a port the VISA Read Bytes from Serial Port vi absolutely hammers the CPU. (CPU usage at 100%, Kernal usage at 80%). I've initialised the VISA session to terminate a read on LF/CR to return whole NMEA strings and that's working just fine. The serial read process itself sits in its own dedicated program and enqueues sttrings as they come in for processing elsewhere. However when my whole program is running I have a lot of other things going on and I can't afford that kind of load on the processor. (The PC is a 600MHz 128Mb machine).


As a stop-gap I've added a delay loop that waits for bytes at the serial port. Unfortunately as soon as the remote instrument start transmiting it switches to the Read Serial Port routine and once again the CPU is mugged by VISA Read Bytes from Serial Port until the transmission is over.

Basicaly my questions are:
Why does the VISA Read Bytes from Serial Port vi
dominate the processor?
and
Is there anything I can do to give it a modicum of self control when setting up the port?

I'd like to not have to change back to using the old serial drivers as that means ripping apart my set up dialogs (and writing a serial port moderator to catch the termination strings).

Thanks for your time,

Tom
0 Kudos
Message 1 of 6
(4,095 Views)
Shetland:

I am not sure which VI you are referring to. "VISA Bytes at Serial Port" is a read property node that just queries the OS for the number of bytes available. This does not take long at all. "VISA Read" on the other hand, is known to have the problem you have seen on Win32. The problem specifically is when you are waiting for data that has not yet arrived. So if you know the correct number of bytes to read, this should not cause the problem either.

For the fix to decrease CPU usage while waiting, go to: ftp.ni.com/support/visa/drivers/win32/2.5/patch
Copy the file NiViAsrl.dll over your existing one in the VXIpnp bin directory.

Dan Mondrik
Senior Software Engineer, NI-VISA
National Instruments
0 Kudos
Message 2 of 6
(4,095 Views)
Hello,
When using the VISA open VI, set "access mode" to 0. This should solve the problem.
0 Kudos
Message 3 of 6
(4,094 Views)
I am experiencing the same problem but I dont want to switch the file you suggested because the file is located in C:\VXIPNP\WinNT\bin the version of the file is NiViAsrl.dll 3.3.1.49152
 
What would you suggest to improve the CPU usage of my VI.
 
Thanks in advance
0 Kudos
Message 4 of 6
(3,889 Views)
I have seen this on older VISA versions ... have you tried the most recend version for your OS?
 
Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 5 of 6
(3,854 Views)
Sorry,
 
Wasn't VISA slowing me down.  It was a display chart.  I reduced the display frequency and that returned my CPU Usage.
 
I get most of my daily workout jumping to conclusions!
 
Thanks
0 Kudos
Message 6 of 6
(3,836 Views)