Checksum Question

I haven't had to calculate a checksum since my Programmer classes because none of the devices I use ever need it, and now some of the syntax is eluding me.
I need to set up a loop and have it add each byte as the loop progresses. I can get started, but I can't remember how to capture each byte individually and then move to the next. If anyone can push me in the right direction with a simple example it would be great.
I need to set up a loop and have it add each byte as the loop progresses. I can get started, but I can't remember how to capture each byte individually and then move to the next. If anyone can push me in the right direction with a simple example it would be great.
0
Comments
Jeff
nPosition++;
Otherwise you won't increment your addition and you'll never escape your "while"
Yes, I forgot that... I was sort of writing it on the fly while working on other code
The hex characters are just a human representation of the data. The computer doesn't understand "$FF" any different than "255" because it is all just binary 11111111. The hex characters are often used because they break down into bytes nicely. Basically, the F is 15 decimal and 1111 in binary. If you ever do work with bitwise operations, or assembly language code, there is a lot of thinking in binary and hex makes it easy to write and convert (at least in my mind
I think the concept you are missing is that each pair of hex characters translates into a single CHAR. CHARs are "An intrinsic data type representing an 8-bit unsigned integer. " If a single hex character requires 4 bits, 2 hex characters will use 8 bits. Another way to look at it is using currency. I could give you a ten dollar bill, I could give you 10 one dollar bills, or I could give you 1000 pennies. They are all worth the same.
Last attempt, because I am not sure that I am making sense (even to myself right now
Hopefully one of my explanations helps you on the path to understanding.
Jeff
Jeff