L11: LCD displays. Multiple-file projects [P11] Interfacing an LCD |
[11 Dec] |
3.6. External complex peripherals: The LCD example
3.6.1. Hardware: LCD technology and controllers
We describe the typical HD44780 controller assembled in the standard kit: LM1602L.
3.6.2. Software driver: LCD C libraries
To interface complex peripherals easily to our circuits, C language functions must be available for the target µC. In some way this is the repetition of the plan C2 in software: multiple component files (C functions) in the same top project.
3.6.3. Examples
3.6.3.1. 1-digit BCD adder with LCD: Adder_BCD_1digit_LCD
This is the design phase #2 of this project: enhance the 1-digit BCD adder project in P9 so that operation result is represented in the LCD display instead of the 7-segment digits.
These are Internet references (1) (2) with sets of high-level C functions to interface LCD displays.
Discussion:
How to add the LCD display hardware?
What functions in the main program has to be modified to interface the LCD?
What is the variable var_LCD_flag used for?
What RAM variables are required now that we like to write text and numbers as ASCII messages? When is necessary to use an array of char? What kind of functions are required to change data types in C?
What variables are required if instead of a simple BCD addition, the circuit has to subtract, multiply or perform divisions? Discuss what kind of numbers: uint8_t (char), uint16_t (int), uint32_t (double int) or float are required to operate.
Optional. As a kind of capstone final project that goes beyond CSD, can you infer how to adapt to a µC PIC18F46K22 the ALU application developed in LAB4.2, thus in the line of implementing a commercial calculator?
3.6.3.2. Serial transmitter with LCD: Serial_TX_LCD (design phase #2)
Enhance the basic design phase #1 asynchronous serial transmitter Serial_TX tutorial application with an LCD so that ASCII messages can be represented to indicate how the system operates.
Activity #1: Study the Serial_TX_LCD circuit and explain what new variables are required to write a message on the LCD screen. How the hardware-software diagram is modified? In which function LCD writing operations will be placed? How to prevent writing the LCD continuously in the main loop?