Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

checksum calculation ?

Status
Not open for further replies.

jit_singh_tara

Full Member level 6
Joined
Dec 22, 2006
Messages
325
Helped
9
Reputation
18
Reaction score
4
Trophy points
1,298
Location
Delhi , India
Activity points
4,293
how to do checksum calculation for 4 bytes say:

0x25,0x62,0x3f,0x52 , and verify it at the receiver....?
 

Just add them all and send the result to the receiver.
Add every byte you receive at the receiver and then verify the received checksum
 

A simple but effective checksum is two's compliment.
Sum all the bytes, disgarding the overflows, then compliment the final result and add 1. (twos compliment)

At the othe end, add the bytes to the checksum, disgarding the overflows, the result should be 0.
 
0x25 + 0x62 + 0x3F + 0x52 = 0x118

low byte --> 0x18

and now just use 2's complement. (invert all bits and add 1)

0x18 = 0001 1000 b

inverting
1110 0111 b

adding one

1110 1000 b

So the checksum is 0xE8
 

Checksum 0xE8

0xE8 + 0x25 + 0x62 + 0x3F + 0x52 = 0x00.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top