Interfacing 16X2 LCD To AVR Microcontroller (Atmega-8)
Interfacing 16X2 LCD To AVR Microcontroller (Atmega-8)
Microcontroller (Atmega-8)
LCD (Liquid Crystal Display) is an electronic
display which is commonly used nowadays in
applications such as calculators, laptops,
tablets, mobile phones etc.
16×2 character LCD module is a very basic
6 Sends data to data pins when a high to low pulse is given Enable
7 DB0
8 DB1
9 DB2
10 DB3
8-bit data pins
11 DB4
12 DB5
13 DB6
14 DB7
15 Backlight VCC (5V) Led+
16 Backlight Ground (0V) Led-
FEATURES OF LCD 16X2
Operating Voltage is 4.7V to 5.3V
Current consumption is 1mA without backlight
Alphanumeric LCD display module, meaning can
characters.
Each character is build by a 5×8 pixel box
Can work on both 8-bit and 4-bit mode
It can also display any custom generated
characters
Available in Green and Blue Backlight
Interfacing LCD with ATMEGA8
We will discuss here about character based LCDs,
their interfacing with ATMEGA* microcontrollers,
and its various interfaces (8-bit/4-bit),
programming.
16×2 LCD can be interfaced with a microcontroller
connect it to ground.
Give High to Low pulse at Enable (E).
Send lower nibble of command.
Give High to Low pulse at Enable (E).
Data write function
First send Higher nibble of data.
Make RS pin high, RS=1 (data reg.)
Make RW pin low, RW=0 (write operation) or
connect it to ground.
Give High to Low pulse at Enable (E).
Send lower nibble of data.
Give High to Low pulse at Enable (E).
LCD PROGRAMMING STEPS
(8 Bit mode)
Initialize LCD16x2:
It is very easy to initialize a LCD16x2
Power ON the LCD
Wait for 15 ms (‘Power ON’ initialization time for
LCD16x2)
Send 0x38 command to initialize 2 line, 5x8
matrix, 8-bit mode LCD16x2
Send any ‘Display ON’ command (0x0E, 0x0C) to
LCD16x2
Send 0x06 command (increment cursor) to
LCD16x2
Command Write function
Send the command value to the LCD16x2 data
port.
Make RS pin low, RS = 0 (command reg.)
Make RW pin low, RW = 0 (write operation)
Give high to low pulse at the Enable (E) pin of
minimum delay 450 ns.
When we give an enable pulse, the LCD latches
the data present at D0 to D7, and execute as
command since RS is command reg.
Data write function
Send command to the data port.
Make the RS pin High, RS = 1 (Data reg.)
Make the RW pin Low, RW = 0 (Write
operation)
Give high to low pulse at the Enable (E) pin
When we give an enable pulse the LCD