PV198 – One-chip Controllers, LCD Display / Dávid Danaj, Marek Neužil 1 PV198 – One-chip Controllers LCD Display PV198 – One-chip Controllers, LCD Display / Dávid Danaj, Marek Neužil 2 Content 1.LCD Display usage 2.LCD 1602A 3.Driver 4.Application § PV198 – One-chip Controllers, LCD Display / Dávid Danaj, Marek Neužil 3 LCD Display usage §Printers §Routers §Industrial equipment §… § § LCD 1602A – Overview PV198 – One-chip Controllers, LCD Display / Dávid Danaj, Marek Neužil 4 §LCD 1602A display driver §HD44780U Display Controller – Datasheet §4 bits connection §Connection via GPIO pins (7 outputs) LCD 1602A – Message PV198 – One-chip Controllers, LCD Display / Dávid Danaj, Marek Neužil 5 LCD 1602A – Scheme PV198 – One-chip Controllers, LCD Display / Dávid Danaj, Marek Neužil 6 LCD 1602A – Scheme PV198 – One-chip Controllers, LCD Display / Dávid Danaj, Marek Neužil 7 MK66FN2M0 MCU FRDM-K66F board GND 5V DAC0_OUT LCD_RS LCD_RW LCD_E LCD_DB4 LCD_DB5 LCD_DB6 LCD_DB7 LCD 1602A HD44780U Display Controller 1 2 3 4 5 6 7 8 9 10 11 12 13 14 VSS VCC VEE RS R/W E DB0 DB1 DB2 DB3 DB4 DB5 DB6 DB7 J3_12 – GND J3_10 – P5V_USB J4_11 – DAC0_OUT J1_14 – PTC2 J1_12 – PTC5 J1_10 – PTC12 J1_8 – PTC8 J1_6 – PTC16 J1_4 – PTC4 J1_2 – PTC3 We will use DAC output instead of potentiometer LCD 1602A – Driver PV198 – One-chip Controllers, LCD Display / Dávid Danaj, Marek Neužil 8 §Support of the 4-bit communication initialization §SysTick timer usage for delays §Basic command and data transfer functions § §Does not read busy flag – uses delays instead LCD 1602A – Driver Interface PV198 – One-chip Controllers, LCD Display / Dávid Danaj, Marek Neužil 9 §The LCD driver requires to define the following identifiers in the Pins tool for GPIO output pins: § •LCD_RS •LCD_RW •LCD_E § •LCD_DB4 •LCD_DB5 •LCD_DB6 •LCD_DB7 LCD 1602A – Driver Interface PV198 – One-chip Controllers, LCD Display / Dávid Danaj, Marek Neužil 10 §The following LCD driver functions are provided: §void LCD_4BitsInit(uint32_t systick_clk_freq, bool cursor_on, bool cursor_blinking) §void LCD_Clear() §void LCD_Home() §void LCD_SetPosition(uint8_t x, uint8_t y) §void LCD_PutChar(uint8_t character) §void LCD_Print(char s[]) §void LCD_SendCommand(uint8_t command) §void LCD_SendData(uint8_t data, MessageType_t messageType) §SysTick timer is used for implementation of delay Our task is to implement this function Application §LCD driver initialization §RTC peripheral initialization §Real date and time display demo § PV198 – One-chip Controllers, LCD Display / Dávid Danaj, Marek Neužil 11 Application PV198 – One-chip Controllers, LCD Display / Dávid Danaj, Marek Neužil 12 •Initialization sequence of the LCD driver BOARD_InitPins(); LCD_4BitsInit(BOARD_BOOTCLOCKRUN_CORE_CLOCK, false, false); •Runtime usage of the driver (example): LCD_SetPosition(0, 0); LCD_Print(“a string”); Initialization of GPIO pins (wired interface) with the generated code from the Pins tools Initialization of the LCD driver (using core clock frequency and without cursor) Displaying “a string” on the LCD screen at position 0,0 (the first column and first line) Application §Implement function according to message format picture: §void LCD_SendData(uint8_t data, MessageType_t messageType) § §Bonus: §Display floating text on the display § PV198 – One-chip Controllers, LCD Display / Dávid Danaj, Marek Neužil 13 Homework §Use LCD display with any project created before (accelerometer, temperature sensor, …) § § PV198 – One-chip Controllers, LCD Display / Dávid Danaj, Marek Neužil 14