How to calculate checksum?
Posted
by
Patel Rikin
on Super User
See other posts from Super User
or by Patel Rikin
Published on 2012-06-11T04:16:47Z
Indexed on
2012/06/11
4:42 UTC
Read the original article
Hit count: 983
checksum
I m developing instrument driver and i want to know how to calculate checksum of frame.
Explanation:
Expressed by characters [0-9] and [A-F].
Characters beginning from the character after [STX] and until [ETB] or [ETX] (including [ETB] or [ETX]) are added in binary.
The 2-digit numbers, which represent the least significant 8 bits in hexadecimal code, are converted to ASCII characters [0-9] and [A-F].
The most significant digit is stored in CHK1 and the least significant digit in CHK2.
This is sample frame :
<STX>2Q|1|2^1||||20011001153000<CR><ETX><CHK1><CHK2><CR><LF>
and i want to know what is value of chk1 and chk2 and i am new in this so i m totally blank about how to calculate checksum
i am not getting above 3rd and 4th point.
can any one provide sample code for c#.
Please help me.
© Super User or respective owner