Showing results for 
Search instead for 
Did you mean: 

the problem when using LabVIEW VISA

Recently I met a problem when I use a labview program to communicate with my circuit board via serial port (RS232).
Because the laptop has no serial port, I tried to use a USB to RS232 cable. There are many random codes when the labview program reads the serial port.
However, when I use other serial port programs, such as WinWedge, there is no such a problem. So I am sure the USB cable is ok.
And the worse thing is that sometimes the labview program can't read anything from the port.
It is interesting that the same labview program and USB cable seem to work well on another PC. I am really very confused.
Thanks to all.
0 Kudos
Message 1 of 4

Labview has no problem with virtual com ports. It works fine.

The problem is probably at your code OR :

I had a similar problem and the problem was that the virtual com was not correctly defined at my system... i was receiving some correct and some random bytes.... very strange...! As i had not set correctly the port, it should not work at all..

0 Kudos
Message 2 of 4
Thanks to Pnt
The program works well now. I noticed there was a VISA error code, -1073807253. Then I spent a lot of time to search for
possible resolutions. Fortunately, I found several suggestions regarding to the usage of LabVIEW VISA.
The suggestions are concluded as follow. They should be useful to people who encountered the same problem.
1. set a delay after the VISA configure serial port.
I think this may be the most possible reason for the random codes. The port has not completely configured before writing
and reading.
2. delay after write.(such as 100ms)
However, my program seems to work well without this delay.
3. Flush the I/O buffer everytime after read.
4. I also used a property node of Bytes at Port before VISA Read. Read the port only if the Bytes at Port is not 0.
5. Some people suggested set I/O buffer size.
It's weird My program doen't work if I set the receive buffer size.
I don't know which is necessary, and which is not. Because the program always works well on my own computer even I didn't
do the above changes. And I can't debug it one by one on another computer. Anyway, such a problem should be resolved
according the above suggestions.

帖子被Shijun在12-16-2007 11:11 PM时编辑过了
0 Kudos
Message 3 of 4
hello, your notes have been very helpful, do you have a jpg, or copy of your VI to share? I'm using a rs232 for the first time with labview, and am having a little difficulty with the coding (and yea, I've tried out the examples) 🙂

0 Kudos
Message 4 of 4