This is an old revision of the document!
LCD is used to display information to user. The Home-Lab is equipped with standard 2×16 alphanumeric HD44780-based LCD (datasheet). LCD can be controller 4-bit or memory-mapped mode. Following examples are using 4-bit mode. LCD data bits are connectet to PORTA.
LCD can connecteddirectly to StudyBoard (starting from V.3) or by using extension cable (all versions).
2×16 LCD with backlight connected to StudyBoard v.3.1:
1×16 LCD without backlight connected to StudyBoard v.2.2 with extension cable:
Both connection types have electrically identical connection to AVR.
Example code here uses Peter Fleury LCD driver (see the external link below).
#include <stdlib.h> #include <avr/io.h> #include <avr/pgmspace.h> #include "lcd.h" /*PS for Distance Lab use: #include <util/lcd.h> #include <util/lcd.c> */ int main(void) { // Initialize display, cursor off lcd_init(LCD_DISP_ON); // Clear display and home cursor lcd_clrscr(); // Put string to display (line 1) with linefeed lcd_puts("LCD Test Line 1\n"); }
It is also possible to use low cost graphical LCD with AVR. Cheap way is to use old mobile phone LCD which can be found almost in every home.
Following example uses Nokia 3310/5110 Graphical 84×84 LCD. The initial driver is written by Tony Myatt, 2007.