Definition
- Initial value:
checksum = 0 - For each byte:
checksum = checksum + command byte
checksum = checksum &0xff- Convert checksum to ASCII high byte and ASCII low byte
Example
- command = $012[Enter]
- checksum = 0x24 + 0x30 + 0x31 + 0x32 = 0xB7
- checksum & 0xff = 0xB7
- checksum ASCII high byte: ASCII(0x42) = B
- checksum ASCII low byte = ASCII(0x37) = 7
- command with checksum = $012B7[Enter]