A simple and reliable method we use is:-
1) convert RS232c (TTL) to RS485 using MAX3082
2) Use a checksum.
Example. Our data packets are preceeded with a D* preamble and terminated with a checksum.
Byte 1 "D"
Byte 2 "*"
Byte 3
Byte 4
Byte 5
Byte 6
Byte 7
Byte 8
Byte 9 Checksum
To calculate the checksum
WORD = BYTE3 + BYTE4 +BYTE5 +BYTE6 +BYTE7 +BYTE8
CHECKSUM=WORD.BYTE0 ^ $FF
VOILA.
Bookmarks