From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

ComRd does not seem to be emtpying input queue with serial com

I have a simple application that reads serial data from a device using ComRD(); there is no user interface. It just collects the data, waits for a keypress and then dumps the data to disk. However, the app drops data if I do not make the input queue large. If I make this queue large, then it just delays the amount of time that the app starts to drop data.

Using GetInQLen(), the application reports that the queue is growing in size. It seems to me that ComRd() should be reading the data and removing it from the input queue. Is this correct? Why would the input queue keep growing?

BTW: I am using an RS485 card overclocked to 875 Kbaud. The computer is setup to read the serial por
t at 115 Kbaud. I have an equivalent Win32 console app that works perfectly with this setup but am converting it to CVI in order to add a front end GUI to it.
0 Kudos
Message 1 of 3
(2,674 Views)
Hello,
It looks like you are not reading the date from the buffer fast enough, which results in the increasing queue size. If you are reading just binary data, you can check the length of the data, then read the data of the length you found out. Otherwise, you can configure, for example VISA, to read the data whenever the end of command character is reached.

Mika Fukuchi
Application Engineer
National Instruments
0 Kudos
Message 2 of 3
(2,674 Views)
That was exactly what I determined this morning. I made the changes to query the buffer before reading it and all my problems went away.
0 Kudos
Message 3 of 3
(2,674 Views)