LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial Data Record Timing

I was wondering if I might get some help in debugging some timing issues for my serial data recording.  Currently I am trying to create a loop that records data from a meter that outputs a comma-delimited string every 5 seconds.  I have attached the VI that I am currently trying to debug.
 
The problem I am facing now is that sometimes I am not catching the correct string.  It is catching either the tail end of a previous print, and then the read buffer is never cleared, so the data needed array cells 5, and 11 are not correct.
 
I was thinking that somehow I could simply wait on the data to arrive, do the reading etc, then wait 5 sec for the next bit of data -> or simply wait for the next complete string.  If anyone has any suggestions please let me know, and code examples would be great.
 
Please let me know if you have any questions.
 
Thanks
0 Kudos
Message 1 of 3
(2,841 Views)
Vessel:

I hope all is well. If you are still experiencing this issue, feel free to try the following:

1. Change the size of your buffer using the "VISA set I/O Buffer Size.vi". It is possible that your buffer is not big enough to keep all your data.
2. Try to flush the buffer using "VISA Flush Buffer.vi" so that you clear all data and thus start at the beginning on the next read.

Please try the above steps and let me know what you find.

Regards,

Rudi N.

0 Kudos
Message 2 of 3
(2,806 Views)
Hi Vessel,
I noticed another point: I suppose, your meter is configured to send this string every five seconds. Since the timing of your meter and the PC is not exactly the same, you have some timing interference effects, so that after a while your "Bytes at Port"- node executes, while the meter is sending the data (9600 Baud is not very fast). That's why you get only parts of the string.
A better approach to this problem would be to periodically call the "Bytes at Port"- node until the expected amount of Bytes is given back (if you expect a defined number of bytes). Or you read in all data you receive in a short time loop and check for some end-of-String condition, after this you can parse the String for the coma-separated values.
Perhaps I could help you, maybe you post your solution to the problem,
Dave
Greets, Dave
0 Kudos
Message 3 of 3
(2,799 Views)