Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
ctboard:peripherals:lcd [2016/02/25 12:31] – [Programming Example] feur | ctboard:peripherals:lcd [2017/08/29 09:25] (current) – [LCD] ruan | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== LCD ====== | ====== LCD ====== | ||
- | The LCD character display can be used in three different ways: | + | The LCD character display can be used in two different ways: |
- | * Output ASCII characters over a simple LCD controller | + | * Output |
- | * Output binary values in HEX representation (max. 128 bit) | + | * Output |
- | * Access the display directly over the I²C interface | + | Each RGB colour of the [[lcd_bg|background light]] is controlled by a 16 bit PWM controller. \\ \\ |
- | Each colour of the background light is controlled by a 16 bit PWM controller. \\ \\ | + | |
- | + | ||
- | > {{ctboard: | + | |
- | > Supported | + | |
- | \\ | + | |
- | + | ||
- | ===== ASCII Interface ===== | + | |
- | + | ||
- | The integrated LCD controller must allways be accessed with 16 bit half words! \\ \\ | + | |
- | + | ||
- | ==== Programming Example ==== | + | |
- | + | ||
- | The code snippet bellow shows how to use the ASCII interface of the LCD. | + | |
- | + | ||
- | <code c> | + | |
- | #include " | + | |
- | + | ||
- | CT_LCD-> | + | |
- | </ | + | |
- | \\ | + | |
- | + | ||
- | <code asm> | + | |
- | ADDR_LCD_ASCII | + | |
- | + | ||
- | LDR r0, =ADDR_LCD_ASCII | + | |
- | LDR r1, #13 ; Load position on display into r1. | + | |
- | LDR r2, " | + | |
- | + | ||
- | ; Thumb instruction set | + | |
- | LSLS r1, #8 ; Shift position 8 bits to the left | + | |
- | ORRS r2, r1 ; Combine position with ASCII character | + | |
- | + | ||
- | ; ARM instruction set | + | |
- | ORRS r2, r1, LSL #8 ; Shift and combine position value with ASCII character | + | |
- | + | ||
- | STRH r2, [r0, #0] ; Write ascii_char at position 13 on the LCD. | + | |
- | </ | + | |
- | \\ | + | |
- | + | ||
- | ==== Registers ==== | + | |
- | + | ||
- | The Registers are read / write. | + | |
- | + | ||
- | \\ {{ctboard_lcd_ascii_reg.svg}} \\ \\ | + | |
- | + | ||
- | ==== Display Positions ==== | + | |
- | + | ||
- | \\ {{ctboard_lcd_ascii.svg? | + | |
- | + | ||
- | ===== Binary Interface ===== | + | |
- | + | ||
- | The binary interface can be used to display binary values in HEX representation. | + | |
- | A maximum of 128 bits can be displayed. \\ \\ | + | |
- | + | ||
- | ==== Programming Example ==== | + | |
- | + | ||
- | The code snippet bellow shows how to use the ASCII interface of the LCD. | + | |
- | + | ||
- | <code c> | + | |
- | #include " | + | |
- | + | ||
- | CT_LCD-> | + | |
- | CT_LCD-> | + | |
- | CT_LCD-> | + | |
- | CT_LCD-> | + | |
- | </ | + | |
- | \\ | + | |
- | + | ||
- | <code asm> | + | |
- | ADDR_LCD_BIN | + | |
- | + | ||
- | LDR r0, =ADDR_LCD_BIN | + | |
- | STRB r1, [r0, #0] ; Write byte of data to LCD. | + | |
- | STRH r1, [r0, #2] ; Write halfword of data to LCD. | + | |
- | STR r1, [r0, #4] ; Write word of data to LCD. | + | |
- | STRD r1, [r0, #0] ; Write doubleword of data to LCD. | + | |
- | </ | + | |
- | \\ | + | |
- | + | ||
- | ==== Registers ==== | + | |
- | + | ||
- | The Registers are read / write. | + | |
- | + | ||
- | \\ {{ctboard_lcd_bin_reg.svg}} \\ \\ | + | |
- | + | ||
- | ==== Display Positions ==== | + | |
- | + | ||
- | \\ {{ctboard_lcd_bin.svg? | + | |
- | + | ||
- | ===== I²C Interface ===== | + | |
- | + | ||
- | FIXME | + | |
- | + | ||
- | ===== Background Light ===== | + | |
- | + | ||
- | Each colour of the background light is controlled by a 16 bit PWM generator. \\ | + | |
- | The brightness can be regulated from 0x0000 (0% / off) to 0xffff (100%). To adapt the brightness curve to the human eye a adadption to a logarithmic scale has to be done manually. \\ \\ | + | |
- | + | ||
- | ==== Programming Example ==== | + | |
- | + | ||
- | The code snippet bellow shows how to set the background light on the LCD. | + | |
- | + | ||
- | <code c> | + | |
- | #include " | + | |
- | + | ||
- | CT_LCD-> | + | |
- | CT_LCD-> | + | |
- | CT_LCD-> | + | |
- | </ | + | |
- | \\ | + | |
- | + | ||
- | <code asm> | + | |
- | ADDR_LCD_BG | + | |
- | + | ||
- | LDR r0, =ADDR_LCD_BG | + | |
- | STRH r1, [r0, #0] ; Set PWM value for red background light. | + | |
- | STRH r1, [r0, #2] ; Set PWM value for green background light. | + | |
- | STRH r1, [r0, #4] ; Set PWM value for blue background light. | + | |
- | </ | + | |
- | \\ | + | |
- | + | ||
- | ==== Registers ==== | + | |
- | + | ||
- | The Registers are read / write. | + | |
- | + | ||
- | \\ {{ctboard_lcd_pwm_reg.svg}} \\ \\ | + | |
===== Diagram ===== | ===== Diagram ===== | ||
\\ {{ctboard_lcd.svg? | \\ {{ctboard_lcd.svg? |