Exercise 3: LCD display
Main topics:
- Displaying string on the LCD display
- Displaying the text stored in the program's memory on the LCD display (pgmspace.h library)
- Displaying special characters in the LCD display
- Displaying floating point numbers in the LCD display
Activity 1
Goal:
Write a library for LCD support.
Then display:
1) Single sign
2) Selected special character
3) Text at the selected x and y position
4) Text from the program memory
5) A floating point value using the printf function
Connection:
LCD display → Microcontroller
1) D4 → PA4
2) D5 → PA5
3) D6 → PA6
4) D7 → PA7
5) E → PA3
6) RS → PA2
Realization:
Library should contain the functions:
void lcdinit (void); // LCD display initialization
void lcd_write_command (uint8_t data); // a function that sends a single command to LCD display
void lcd_clear (void); // function executing the instruction "clear display"
void lcd_write_data (uint8_t data); // a function that sends a single data to LCD display
void lcd_set_xy (uint8_t x, uint8_t y); // function to set cursor to xy position
void
lcd_write_text_xy (uint8_t x, uint8_t y, char * text); //function
displaying the text in the data memory (!!!) starting from xy position.
void lcd_write_text_P(const char *text); //function displaying the text in the program memory.
When you're finished, compare the result with the video below: