2020. 12. 9. 09:15ㆍ엔지니어링
#Checksum:
The first character is the low order byte and the second character is the high order byte of the 16 bit value.
This pattern repeats until there are no more characters.
If there is not a character for the high order byte set it to 0.
Once all of the values have been added up, add the carry back in if there is any.
If this generates a new carry add it back in too. Once there are no more carries, invert the result and convert it to a 4 byte ASCII value.
Example:
For the checksum for a command “BV123”<cr>
In the following x represents hexadecimal, it is not part of the checksum.
ASCII Hex value
B x42
V x56
1 x31
2 x32
3 x33
The first char is the low order byte and the second char is the high order byte.
If there is not a char to be the high order byte it is set to 0. This will generate the following 2 byte values
V B
x5642
2 1
x3231
3
x0033
These values are then added
X5642 + x3231 + x0033 = x88A6
Invert the bits = x7759 and then convert this to its 4 byte ASCII value:
Hex ASCII code
X7 = ‘7’ = x37
X7 = ‘7’ = x37
X5 = ‘5’ = x35
X9 = ‘9’ = x39
So the 4 byte ASCII checksum would be “7759”
When you get to larger sums the carry must be added back to the original number.
If the summation above would have been x588A6 then you would do the following
X88A6 + X0005 = x88AB => Invert => x7754 => ASCII “7754”.
'엔지니어링' 카테고리의 다른 글
PLD 증착 장비에서 무반사(AR) 코팅 퀄츠 글래스를 사용해야 하는 이유 (0) | 2020.12.17 |
---|---|
XG5000 M어드레스 Hex 변환 테이블 (0) | 2020.11.27 |
Ion Beam Neutralizer(이온빔 뉴트럴라이저) 유지 보수 내용 (0) | 2020.11.27 |