AnsweredAssumed Answered

Help on checksum

Question asked by VRFuser on Mar 3, 1998
Hi All,
I have an urgent problem and hope that someone of you (kind guy) can help

I read field instruments on a RS485 network with a self made driver.
Because of the distance sometime packets from field fall destroyed by noise.
So I decided to implement a checksum control on incoming packets.

Instruments are flowmeters and their protocol is a binary string.
Its organizations is for example (MSB):
1 byte for header
1 byte for data length
29 byte for data, coded as:
    0-3rd byte is a 32 bit single precision floating point IEEE standard
    4-7th    byte is a 32 bit long integer
    8-11th   byte is an ASCII string
and so on.

Last byte is a one byte checksum that is the XOR of all the previous bytes.

The driver is working perfectly, I let Direct I/O to convert each byte
sequence into appropriate data type.
Until now I didn't have a checksum control, so the problem arise only now.

How can I calculate the XOR checksum in a situation like this?

I tried to receive data in an array or a string, instead of specific
variables inside Direct I/O, and this let me calculate the checksum but then
I was not able to convert the array or string into consistent data.

So I am stuck.

Any help will be greatly appreciate.

Marco Barbieri
Proart Srl