Checksum calculation – Kistler-Morse KM Weigh II User Manual

Page 73

Advertising
background image

Appendix C. Seral Comments

C-3

Checksum Calculation

The one-byte checksum is calculated by adding the Hex values of all ASCII characters between the
start of message character ‘>’ or acknowledge character ‘A’ and the checksum character ’ss.’
Overflows from the addition are ignored.

Example:

Request

To request gross engineering units (such as weight) from a Weigh II, the command is:

>aaWssr

If the Weigh II’s address is ‘3’, the command is:

>03Wssr

Calculating the checksum ‘ss’ as the sum of the Hex values of all characters between ‘>’ and’ss’:

03W ASCII = 30 Hex + 33 Hex + 57 hex = BA Hex
‘0’ ‘3’ ‘W’

Therefore, the ASCII string transmitted to the Weigh II is:

> 0 3 W B A CR
3E 30 33 57 42 41 0D Hex

Response

The response to a request for gross engineering units is:

A±dddddddssr

If the weight is +6384, the response is:

A+0006384ssr

Calculating the checksum ‘ss’ as the sum of the Hex values of all characters between ‘A’ and ‘ss’:

+0006384 ASCII = 2B Hex+30 Hex+30 Hex+30 Hex+36 Hex+33 Hex+38 Hex+34 Hex = 190 Hex
‘+’ ‘0’ ‘0’ ‘0’ ‘6’ ‘3’ ‘8’ ‘4’

Ignoring the overflow, the checksum is 90 Hex. Therefore, the ASCII string transmitted back to the
master is:

A + 0 0 0 6 3 8 4 9 0 CR
41 2B 30 30 30 36 33 38 34 39 30 0D Hex

Advertising