SPI hub for alpha-numeric display and keyboard based on LPC11U24 MCU
- Update the display:
- as the whole
- by line
- by row/column/length
- Control backlight value
- Set the state of two status LEDs
- Check for button presses
Byte offset | 0 | 1 | 2 | 3 |
---|---|---|---|---|
Meaning | Preamble 0xAA |
Data Len (Cmd.code + Data) |
Cmd.code + Op.code | Data |
Every packet must be started with a preamble.
Data length is provided in bytes and can't be longer than 127 bytes.
Command code is a higher nibble of the byte (bits 7..4).
Operation code is a lower nibble of the byte (bits 3..0).
Cmd.code | Meaning | Op.codes | Data |
---|---|---|---|
0b0000 | Update the display | See below | Text string |
0b0001 | Set backlight value | Backlight value (1..15) | No |
0b0010 | Set state of status LEDs | No | 1 byte (See below) |
Op.code | Meaning |
---|---|
0b0000 | Clear display |
0b0001 | Write to whole display |
0b0002 | Write line |
0b0002 | Write at row/column |
First data byte contents row and column number for addressing the LCD output.
Bit no. | 7 | 6..5 | 4..0 |
---|---|---|---|
Meaning | Reserved | Row index (0..3) |
Column index (0..19) |
Byte offset | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
---|---|---|---|---|---|---|---|---|
Value | 0xAA | 0x06 (5 bytes + Cmd.code) |
0x02 Write line |
0x00 Line 0 |
0x54 ('T') | 0x65 ('e') | 0x73 ('s') | 0x74 ('t') |
State of up to 7 LEDs can be set
Bit offset (MSB first) |
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|
Meaning | Reserved | LED6 | LED5 | LED4 | LED3 | LED2 | LED1 | LED0 |
0 means switch LED off, 1 - switch LED on.
Every byte transmitted from an SPI master will be responsed with a state of the buttons through MISO line.
Bit offset (MSB first) |
7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
---|---|---|---|---|---|---|---|---|
Meaning | BTN7 | BTN6 | BTN5 | BTN4 | BTN3 | BTN2 | BTN1 | BTN0 |
0 means switch button was not pressed, 1 - button was pressed.
All bits will be reser after readout.