Hello all!
I ran into a problem. The Serial and SoftSerial libraries have no idea what timeout is.
I looked a lot of webpages and did not find a solution.
As is well known, many protocols such as ModBus use timeout.
Where timeout is the gap between packets and should be> = 1.5 the duration of the transmission of one byte.
Since the data packet may have different lengths. Marker timeout. can signal the end of a packet,
as well as a marker to allow the transfer of a new packet.
I use packets with a length of 2 bytes or more, and do not use the checksum, so I cannot use the ModBus library.
So the question is: where should I change the Serial library and / or SoftSerial to get such a marker?
I understand that I have to insert a code of something like timeout = micros () and (or) to start another timer to count the timeout
which is reset when receiving a new byte or an interrupt is triggered if more timeout.
I hope for your help and thank you in advance.
I ran into a problem. The Serial and SoftSerial libraries have no idea what timeout is.
I looked a lot of webpages and did not find a solution.
As is well known, many protocols such as ModBus use timeout.
Where timeout is the gap between packets and should be> = 1.5 the duration of the transmission of one byte.
Since the data packet may have different lengths. Marker timeout. can signal the end of a packet,
as well as a marker to allow the transfer of a new packet.
I use packets with a length of 2 bytes or more, and do not use the checksum, so I cannot use the ModBus library.
So the question is: where should I change the Serial library and / or SoftSerial to get such a marker?
I understand that I have to insert a code of something like timeout = micros () and (or) to start another timer to count the timeout
which is reset when receiving a new byte or an interrupt is triggered if more timeout.
I hope for your help and thank you in advance.
Last edited: