0% found this document useful (0 votes)
260 views15 pages

Interfacing 16X2 LCD To AVR Microcontroller (Atmega-8)

This document discusses interfacing a 16x2 LCD display to an AVR microcontroller. It describes the pinout of the LCD, including power, ground, data lines and control lines. It explains how to interface the LCD in both 4-bit and 8-bit modes, with programming steps that include initialization, writing commands, writing data, and displaying strings. The LCD can display 2 lines of 16 alphanumeric characters each in a 5x7 pixel grid and is commonly used in electronic projects and devices.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
260 views15 pages

Interfacing 16X2 LCD To AVR Microcontroller (Atmega-8)

This document discusses interfacing a 16x2 LCD display to an AVR microcontroller. It describes the pinout of the LCD, including power, ground, data lines and control lines. It explains how to interface the LCD in both 4-bit and 8-bit modes, with programming steps that include initialization, writing commands, writing data, and displaying strings. The LCD can display 2 lines of 16 alphanumeric characters each in a 5x7 pixel grid and is commonly used in electronic projects and devices.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 15

Interfacing 16X2 LCD to AVR

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

module which is commonly used by electronic


hobbyists and is used in many electronic
devices and project. It can display 2 lines of
16 character and each character is displayed
using 5×7 or 5×10 pixel matrix.
General view of 16X2 LCD

Pin Diagram of 16X2 LCD


LCD PIN DESCRIPTION
 Pin
 Function  Name
No
1 Ground (0V) Ground
2 Supply voltage; 5V (4.7V – 5.3V)  Vcc
3 Contrast adjustment; through a variable resistor  VEE
Selects command register when low; and data register Register
4
when high Select
5 Low to write to the register; High to read from the register Read/write

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

display alphabets and numbers


 Consists of two rows and each row can print 16

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

in 8 Bit or 4 Bit mode. These differs in how data


and commands are send to LCD.
 In 8 Bit mode character data (as 8 bit ASCII) and

LCD command are sent through the data lines D0


to D7. That is 8 bit data is send at a time and data
strobe is given through E of the LCD.
 But 4 Bit mode uses only 4 data lines D4 to
D7. In this 8 bit data is divided into two parts
and are sent sequentially through the data
lines. The idea of 4 bit communication is
introduced to save pins of microcontroller.
 4 bit communication is bit slower than 8 bit

but this speed difference has no significance


as LCDs are slow speed devices. Thus 4 bit
mode data transfer is most commonly used.
LCD PROGRAMMING STEPS
(4 Bit mode)
 Initialization
 Wait for atleast 15ms, Power on initialization

time for LCD16x2.


 Send 0x02 command which initializes LCD

16x2 in 4-bit mode.


 Send 0x28 command which configures LCD in

2-line, 4-bit mode and 5x8 dots.


 Send any Display ON command (0x0E, 0x0C)
 Send 0x06 command (increment cursor)
 Command write function
 First, send Higher nibble of command.
 Make RS pin low, RS=0 (command 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 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

latches the data present (on the pins D0 to


D7) and displays it on a 5x8 matrix, as RS is a
data register.
 Display String function
 This function takes a string (an array of

characters) and sends one character at a time


to the LCD data function till the end of the
string. A ‘for loop’ is used for sending a
character in each iteration. A NULL character
indicates end of the string.
THANK YOU 

You might also like