[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question on How the Checksum is Computed, please help!

From: C. Kemp
Subject: Re: Question on How the Checksum is Computed, please help!
Date: Thu, 2 May 2002 10:59:53 +0100 (BST)

The last two bytes are the 'checksum' but they are adjusted so that the 
xor combination of the odd bytes equals the xor combination of the even 
bytes.  The line you are missing is:

/* XOR the byte with the current checksum */
i->checksum[i->BufferCount & 1] ^= rx_byte;

which is performed on every byte as it arrives.  The two checksum stores 
are set to zero before the message is processed, and then the check below 
is performed after the above code has been performed on the two checksum 



On Thu, 2 May 2002, marjon wrote:

> I would like to ask on how the checksum is computed?
> This was the line I found in gnokii, module FBxx_RX_StateMachine(char 
> rx_byte):
> ----> if (checksum[0] == checksum[1])
> But what is the received bytes were like this:
> :1e:0c:00:7f:00:02:d1:80:cf:f1
> I mean, I get checksum[0] = 0xcf & checksum[1] = f1
> But they would never be equal right? so the program would not pass
> through the  if statement?  But as I understand, it does? how is this?
> Please explain.
> Marjon
> _______________________________________________
> gnokii-users mailing list
> address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]