LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

com reading buffer sychronization

I am writing a code to do the data acquisition. A device continousely sends 8 bytes(2 bytes each time) data to COM port every 9ms after sending notice. Since 8 bytes data represent 4 different meaning values (A, B, C, and D) and no more notice between every 8 bytes, how to correctly interpret the data group is very important. Currently, my code checks the number of available bytes in the reading buffer and extract data when buffer has 8 bytes. However, when I test the code, the values are not stable and in different order. I think this is because the data are wrongly interpreted. Do you have any idea how to solve this problem? I did not put any extra delay in the program and did not use any figures.

Thank you
0 Kudos
Message 1 of 6
(3,269 Views)
What is the sending notice?? Is this a special character that you could use as a termination character??
 
0 Kudos
Message 2 of 6
(3,264 Views)
The sending message is a special byte to ask the device start sending bytes. this message only is send one times. when the device got the message, it generates a lot of group data and sends to COM. It generates 8 bytes  group data each 9ms, and there is no special bit to tell which byte is the start of the group. So if the device generate data slowly, my program have enough time to extract 8 bytes one after one, however, if the device generates data quikly (9ms), my program thinks other byte to be the first byte. This case every happened becaue buffer overflow. But now, no buffer overflow anymore after I improved the complex GUI. Do you know how to solve this problem? Is there any method to gurantee extract each byte succesfully with fast speed? Thank you
0 Kudos
Message 3 of 6
(3,262 Views)
All I can say at this time is show us the code and some sample data.
0 Kudos
Message 4 of 6
(3,259 Views)
Here is the VI

the baud rate is 115200. Thank you
0 Kudos
Message 5 of 6
(3,243 Views)
Could you save for previous and make that a 7.0 format??
0 Kudos
Message 6 of 6
(3,239 Views)