Check Sum Question - for you math people
JohnMichnr
Junior Member
Hey All - I have a Hitachi LCOS video wall cube that says it's check sum is a "twos complement" check sum. Looking Two's compliment up on Wikipedia I find that it is a inversion of the bit in a byte plus one. So I am thinking that I can calculate the checksum by doing this:
sum (addition of the Bytes in question)
CheckSum = !Sum + 1
Will that work ? or do I have to go into the bits in the byte and invert each one? before I add one.
Anybody got any suggestions?
sum (addition of the Bytes in question)
CheckSum = !Sum + 1
Will that work ? or do I have to go into the bits in the byte and invert each one? before I add one.
Anybody got any suggestions?
Comments
-
JohnMichnr wrote:Hey All - I have a Hitachi LCOS video wall cube that says it's check sum is a "twos complement" check sum. Looking Two's compliment up on Wikipedia I find that it is a inversion of the bit in a byte plus one. So I am thinking that I can calculate the checksum by doing this:
sum (addition of the Bytes in question)
CheckSum = !Sum + 1
Will that work ? or do I have to go into the bits in the byte and invert each one? before I add one.
Anybody got any suggestions?
!Sum will make Sum = 1 if it's currently 0, otherwise it will make it 0. So, no matter what's it's value, you are going to wind up with 0 or 1. You need to do a bitwise operation. -
Yeah now that I go back and re-read the exact defintion of Not, I gues all it does is produce a true/false result.
So it is back to the bitwise not on each bit. -
CheckSum = ~Sum + 1 is what you're looking for, I believe.
-
Yeah - that is what I am going to try - the other thing that works in teh Windows calculator is taking sum and subtracting it from 0. Cause the twos compliment is just the inverse of the number (negative. I think I'll try both and see what happens.
-
isnt it BNOT? binary not?

edit:
damnit... BNOT == ~ :P -
I was asked to post the description of the command protocol for this issue. I am going to try to do this.
I don't know how to do the little quote boxes
FORMAT of COMMANDS TO THE PROJECTOR
(A) When individually specifying a projector
STX + BC + CMD + PARA + CS + SN
STX - Start command (fixed to 02H) 1 Byte
BC - Byte count from CMD to the last byte of PARA 1 Byte
CMD - Command code 1 Byte
PARA* Parameter Variable
CS - Value when the sum of the lower 8 bits from BC to CS is 0. Two?s complement. 1 Byte
SN - Projector No.. FFH corresponds to all projectors. 1 Byte
Obviously the area I am looking at is the CS. And I think the BNOT (~) is the way to go about it. I'll be trying that this morning with some strings. -
Make "count" or somesuch equal to the sum of all the bytes from BC to the last PARA byte. BAND it with $FF to make sure it's 255 or less. Then...
CS = 256 - count.
- Chip
Categories
- All Categories
- 2.5K AMX General Discussion
- 922 AMX Technical Discussion
- 514 AMX Hardware
- 502 AMX Control Products
- 3 AMX Video Distribution Products
- 9 AMX Networked AV (SVSI) Products
- AMX Workspace & Collaboration Products
- 3.4K AMX Software
- 151 AMX Resource Management Suite Software
- 386 AMX Design Tools
- 2.4K NetLinx Studio
- 135 Duet/Cafe Duet
- 248 NetLinx Modules & Duet Modules
- 57 AMX RPM Forum
- 228 MODPEDIA - The Public Repository of Modules for Everyone
- 943 AMX Specialty Forums
- 2.6K AMXForums Archive
- 2.6K AMXForums Archive Threads
- 1.5K AMX Hardware
- 432 AMX Applications and Solutions
- 249 Residential Forum
- 182 Tips and Tricks
- 146 AMX Website/Forums