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 Content 1.LCD Display usage 2.LCD 1602A 3.Driver 4.Application • 2 PV198 – One-chip Controllers, LCD Display / Dávid Danaj, Marek Neužil LCD Display usage §Printers §Routers §Industrial equipment §Consumer equipment, including some washing machines §Much more... • • 3 LCD 1602A – Overview PV198 – One-chip Controllers, LCD Display / Dávid Danaj, Marek Neužil §LCD 1602A display driver §HD44780U Display Controller – Datasheet §4 bits connection §Connection via GPIO pins (7 outputs) 4 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 VDD V0 RS R/W E DB0 DB1 DB2 DB3 DB4 DB5 DB6 DB7 GND P5V_USB DAC0_OUT PTA27 PTA26 PTA4 PTA6 PTA7 PTA8 PTA9 We will use DAC output instead of potentiometer and different pins 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 §Do note the pins are different than on the image :) • 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 •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) 12 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 §Generate something else on the LCD string. (Be creative) §The automatic tests check for initialization and if there is something on the screen §Avoid adding drivers, will break the project. • PV198 – One-chip Controllers, LCD Display / Dávid Danaj, Marek Neužil 14