Checksum Checking...

I was experimenting with the VEX LCD, and wanted to make sure I understood the checksum correctly from this page.

Could someone please verify this is the correct datastream to send to the LCD to give a “HELLO WORLD” command? (I’m running in to an error (that is, nothing is displaying), and wanted to eliminate this possible cause.) I’m mainly concerned that I may have calculated the checksum incorrectly, as I’m unfamiliar/unpracticed in calculating these… :slight_smile:

Data:     0xAA, 0x55, 0x1e, 0x12,     0x01,      0x48, 0x45, 0x4C, 0x4C, 0x4F, 0x20, 0x57, 0x4F, 0x52, 0x4C, 0x44, 0x20, 0x20, 0x20, 0x20, 0x20,      0x44
Meaning: |--- Standard bytes ---| |-Light on-| |--------------------------------------HELLO WORLD text------------------------------------------| |-Checksum-|

Thanks for the help!


I got 0xBD rather than 0x44… Did you Sum Bytes 5 through 21 and discard everything above 8 bits??

The Vex LCD Page is a little fuzzy… What does Byte 4 mean by “Two Bytes to follow”??? and gives a Value of 0x12?

I will run the Summation again…

The answer is 0x43, don’t forget checksum is 0x100 - sum of bytes 5 through 21. (that was done on a calculator so hopefully no typo).

See this code

I got 0xBD the Second time and the Third Time:

0xAA, 0x55, 0x1e, 0x12,     
0x01, 0x48, 0x45, 0x4C, 0x4C, 0x4F, 0x20,  (  0x195  )
0x57, 0x4F, 0x52, 0x4C, 0x44, 0x20, ( 0x1A8  )
0x20, 0x20, 0x20, 0x20,     ( 0x80 )

Check Sum ( 0x3BD )  8 Bit Unsigned ( 0xBD )

Meaning: |--- Standard bytes ---| 
|-Light on-| |HELLO |
|    |

0 - 0xBD = 0xFFFFFF43

Masked to 8 bit = 0x43

Ahh Yes… Your Right… I forgot to execute the Final step…

Checksum = (unsigned char) 0 - <Sum of Bytes 5..21>

In the Windows 7 Calculator, clicking the “+/-” key gives the 0xFFFFFF43

In “skimming” the above Code, I interpreted the the End Result as an Unsigned Char of the Summation… Rather than the Unsigned Char of the Two’s Complement of an Unsigned Char of the Summation…

0xBD = 0b10111101
0x43 = 0b01000011

That worked perfectly, thanks! :slight_smile:

In case anyone was wondering, I’m working on making a small library for the VEX LCD to communicate with the Arduino… :slight_smile:

I’ve posted a blog entry on how to use the LCD with an Arduino unit, if anyone wants to try.

I’m still working on some library functions to make it easier, though…