MP Lab04 - LCD PDF
MP Lab04 - LCD PDF
MP Lab04 - LCD PDF
Lab 04
Introduction and implementation of LCD interfacing on
ATMEGA16 microcontroller
Instructor
Asma Ramay
Department of Electrical Engineering CIIT, Islamabad
Objectives:
Introduction to LCD interfacing with microcontroller.
Tools:
VMLab, Winavr, Proteus ISIS .
Liquid Crystal Display (LCD)
The most commonly used Character based LCDs are based on Hitachi's
HD44780 controller or other which are compatible with HD44580. Below
given is figure of such an LCD.
LCD Pinout:
LCD Interfacing:
R/W pin is used select between the read or write operation. You can either
send command or either send the required data to display on the LCD. Since
same pins from D0 to D7 are used for both command and data, RS pin is used
to identify between the command and data.
To send command to LCD, we will first set RS pin to zero. If we want to send
data to LCD, we will set the RS pin as high. EN is enable pin which is used to
synchronize the whole operation of sending data or command to LCD. The
LCD will not read any pins for command or data until we give high to low
transition to enable pin. This is important because we want to make sure that
the data on the LCD pins is right before LCD reads it. By enable pin we can
control when LCD should read the data on its pins.
The above procedure for reading from or writing to LCD is illustrated with the
help of following timing diagrams:
The table below summarizes command set of Hitachi 44780 based LCDs
LCD Initialization:
The table below provides address for various display locations on a 16X4 LCD:
Finally ASCII chart containing character code for most commonly used
characters is given below:
The subroutine for sending character to the LCD will look like:
In Lab Task:
10
Interface a keypad and LCD to ATMEGA16. Scan the keypad for pressed
key and display it on LCD.
11