Answer the question
In order to leave comments, you need to log in
Waiting for a full package from a com port, how to implement?
There are scales, data packets of 12 bytes are dumped into the com port. I wrote a program + face on pyqt5, the problem is that the program starts immediately listening to the port when loading and trying to parse these packets, sometimes it happens that at the moment the port is opened, something like desynchronization occurs, although there is an end-of-packet indicator, and it starts throw the wrong packages, it feels like the end of the previous package and the beginning of the current package.
It is necessary somehow to wait for the full packet when opening and start listening exactly as it should, although according to my logic, the parity, stop bit, packet size indicators in the com port settings should just stop this at the hardware level, or am I thinking wrong?
Com port settings (speed, parity, etc.) according to the manual for the scale.
Answer the question
In order to leave comments, you need to log in
start-stop bits are supposed to clearly delimit each byte. and rarely encountered problems with incorrect reading of characters.
do you have a problem with crooked bytes or determining the start of a packet??
if you have a problem only with determining the beginning of the packet, then just wait for the characters of the beginning of the packet, then write the packet to the buffer and send it for processing.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question