I-7000
Remote I/O 007
back
Q.How to calculate
the checksum ?
Ans: The steps to calculate the checksum are given as following:
-
step
1: checksum=0
-
step 2: for all
command byte checksum = checksum + command byte
-
step
3: checksum=checksum&0xff
-
step 4 : convert
checksum to ASCII high byte and ASCII low byte
for
example,
command
= $012[Enter]
checksum
= $+0+1+2 = 0x24+0x30+0x31+0x32= 0xB7
checksum
& 0xff = 0xB7
checksum
ASCII high byte = ASCII B = 0x42
checksum
ASCII low byte = ASCII 7 = 0x37
command
with checksum = $012B7[Enter]
¡@
Written by David Chen
Date:2002/12/24 |