Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial ViRead missing receive characters

When using VISA 2.0 or 2.6 we find that ViRead()
drops a few read characters once in a while reading
from the serial port. The baud rate used was 9600 baud. We are reading a block of about 80 characters
approximately 10 times a second. We are sure that the data was sent and go into the serial port, but polling
using ViRead() drops 5-10 characters periodically. Has
anyone had a similar experience? Might this be a Windows OS problem?
0 Kudos
Message 1 of 3
(3,274 Views)
Hello Kent,

Thank you for your question regarding VISA. It sounds like you�ve been losing characters occasionally when using VISA. You may be loosing the data after trying to perform manipulations on the characters. One possible solution might be to manually format this data using the sprintf( ) function. The following link has more information on troubleshooting this issue.

http://digital.ni.com/public.nsf/websearch/9A3589A05F21A1B186256CE9006448D4?OpenDocument

Other resources can be found on the ni.com website by clicking the support tab at the top of the home page. Then search from Technical Resources at the top of this page for your topic. I hope these resources help! Let me know if you need any other support with this issue.

Shea C.
Applications Engi
neering
0 Kudos
Message 2 of 3
(3,274 Views)
Kent:

I've got several random thoughts that might help:
1) The latest version of NI-VISA is 3.0.1 and we have fixed a number of things related to Serial. In particular, if I recall correctly, we fixed a case where there was a couple of error conditions that we had not been returning, and now do. So that might clue you in to the problem if you upgrade and at least get a VISA error code when this happens.
2) Call viSetBuf to set the I/O input (aka receive) buffer to a value higher than what you expect to receive. That means that as long as the Windows driver can keep up, it will hold the data until VISA gets it.
3) Try using hardware flow control (RTS/CTS) if possible. A lot of people forget that if you don't specify flow control, data loss is quite
likely. Using hardware flow control means that even if the Windows driver can't keep up, the UART can keep the device from sending more data.

I hope you find at least one of these suggestions helpful.

Dan Mondrik
National Instruments
Message 3 of 3
(3,275 Views)