LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

serial communication using CVI

Hi,
I'm currently running version 8.0. (or 8.0.1)
My program triggers on a termination character (0x0D), at which point it reads what ever is in the rx buffer untill it encounters the termination character. If there is any more data in the buffer, that is left for the next cycle. Now, the reasons why this all appears strange is that I have three pressure gauges, and they each send data by them selves every second. they send in the order of 20 bytes each time, so it is really very little data. Each of the gauges have their own com port and so I have three identical com callbacks, one for each gauge. My program will happily run for over one hour before the problem occurs, and what is also strange is that even though they all send the same amount of data, it is always the same routine that stops working first. I have incorporated a button to clear the rx buffer when this happens, just in case there are any left-over characters in it, but that has no effect. I also know that the data is still coming in but the COM callback is just never called. All rather odd I would say 🙂

Anyway, I have a feeling I will be going down the route of the async timers... Still, any thought as of why this is going on would be greatful as I don't mind workarounds, but I hate not knowing why I have to resort to them 🙂

Cheers,
Mattias
0 Kudos
Message 11 of 14
(1,483 Views)
Offhand it's hard to say what the problem could be. We would have to take some time to investigate and debug your scenario.  If you'd like to do that, I'd start by trying to find out if you're still getting data when the callback(s) stops firing.  You can manually read from the queue and see if it's still being filled with fresh, properly terminated data.  If not, you can try a program like Portmon to see if there is data actually being transferred, but somehow not received by the library.  If not, then you can assume there's something going on at the gauge.  In this manner, you can determine where the hold up is.

Mert A.
National Instruments
0 Kudos
Message 12 of 14
(1,465 Views)
Hi,
From what I have done so far I know that I am still getting data sent from the gauges. This I know because they send data automatically without being prompted, and when the program falls over and stops reading data, if I shut it down and then start it back up again, without sending any other commads to the gauges, it all works again for another hour or so (I have to admit that I have not yet had the patience to find the exact time it takes, or if it is the same number of received packages before it falls over). What I havn't done is to inspect the buffers when it falls over. I have only tried to clear them but to no avail. I think the next step will be to read the buffers and see if they get data, but doesn't tell my program about it...

Cheers,
Mattias
0 Kudos
Message 13 of 14
(1,459 Views)
 I would also be tempted to make a call to GetInQLen  each time you are invoked.  Check to see if the buffer is getting more and more backed up.  Just a diagnostic point....
0 Kudos
Message 14 of 14
(1,452 Views)