N
N
Nikolay Zhivotenko2015-09-05 15:41:15
Programming
Nikolay Zhivotenko, 2015-09-05 15:41:15

How to correctly receive data from the com port?

The laboratory has a Belarusian device MNIPI E7-20 (Immittance meter). The instrument communicates with the PC via the RS-232C interface. And is in a state of continuous data transmission. Those. every (different in size) period of time, it sends a packet of 22 bytes to the port. Each packet starts with a sync byte - 0xAA.
In addition, due to errors, the device can "eat" part of the data packet and send it to the port.
The operation of the device looks like:
0829356a8913401896d1b1ec761f8323.png
SUBZH: How to properly organize data reception? How can I make the program wait for the synchronization byte, and immediately after it read the data packet?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Armenian Radio, 2015-09-05
@gbg

Correctly read data from the port into the buffer, and then asynchronously look for the beginning and end of the packets.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question