Spi lcd 1.2 protocol

From BitWizard WIKI
Revision as of 16:23, 30 November 2015 by Cartridge1987 (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

To display a string on the LCD, just send over SPI the same bytes you would send to LCD, prefixed with the address of the LCD (the default address is 0x82).

Bytes above 0xf0 are "special".

0xf0 <xy> is set cursor. the <xy> byte is 3 bit line number and 5 bit position number. This addressing allows up to 8 lines of 32 characters.

0xf1 is clear LCD.

0xf2 <addr> is "set address". If you want to change the address the module reacts to. The address is stored in eeprom, and will remain this way after a powercycle.

0xf3 <contrast> is "set contrast". This will set the contrast to the value you specify. 0x40 is the default that works fine for the LCDs that we have.

0xf4 <backlight> is the "set backlight intensity" command. This will set the backlight intensity to the value specified.

0xf5 <byte> will send the byte as a command to the HD44780. You need this for example to use the user-defined characters.

0xff <byte> will send the byte to the LCD without special character processing. This allows you to send codes 0xf0 through 0xff to the LCD if required.

Other bytes are reserved and are currently implemented as a no-op.


Read identification

read the identification string of the board. ('spi_lcd 1.3').

data sent data recieved explanation
0x83 xx select destination with address 0x82 for READ.
0x01 xx identify
xx 0x73 's'
xx 0x70 'p'
xx 0x69 'i'
xx ... etc.

Send text to display

Display the string "Hello World!" (only the first 5 bytes of the string shown).

data sent data recieved explanation
0x82 xx select destination with address 0x82 for WRITE
0x48 xx 'H'
0x65 xx 'e'
0x6c xx 'l'
0x6c xx 'l'
0x6f xx 'o'
xx ... etc.

Set cursor position

move to line 1, character 5:

data sent data recieved explanation
0x82 xx select destination with address 0x82 for WRITE
0xf0 xx port 0x11 = set cursor position.
0x25 xx 0x25 = 001 00101 = line 1 position 5.