0% found this document useful (0 votes)
15 views5 pages

Exp 5

The document outlines an experiment to interface a 16x2 LCD with an ATmega2560 microcontroller in 8-bit mode, focusing on displaying text. It details the necessary components, theoretical background on LCD operation, and the steps to configure and control the LCD using Embedded C programming. Additionally, it includes pin configuration and circuit connection instructions for successful implementation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views5 pages

Exp 5

The document outlines an experiment to interface a 16x2 LCD with an ATmega2560 microcontroller in 8-bit mode, focusing on displaying text. It details the necessary components, theoretical background on LCD operation, and the steps to configure and control the LCD using Embedded C programming. Additionally, it includes pin configuration and circuit connection instructions for successful implementation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Experiment-5

Aim:
Interfacing 16x2 LCD in 8-bit Mode.

Objective:
The objective of this lab is to interface a 16x2 LCD with an ATmega2560
microcontroller in 8-bit mode and display the text on the LCD. This
experiment will help you understand how to configure and control an LCD
using Embedded C programming.

Components Required:
1. ATmega2560 Microcontroller (or Arduino Mega board)

2. 16x2 LCD Module

3. Breadboard

4. Connecting Wires

5. Potentiometer (10kΩ) for contrast adjustment

Theory:
16x2 LCD Overview
• A 16x2 LCD has two rows, each capable of displaying 16 characters.

• It operates in either 4-bit mode or 8-bit mode. In 8-bit mode, all


8 data lines (D0-D7) are used to send data or commands to the
LCD.

• The LCD requires three control signals:

o RS (Register Select): Determines whether the data sent is a


command (RS = 0) or data (RS = 1).
o RW (Read/Write): Determines whether the LCD is being
read from (RW = 1) or written to (RW = 0).

o EN (Enable): Used to latch data into the LCD. A high-to-low


pulse on EN triggers the LCD to process the data.

Pin Configuration

LCD 16x2 Commands


While interfacing an LCD16x2 with any microcontroller, firstly we need to
initialize the LCD. For that, we need to send some commands. Similarly,
to clear the display or to change the position, we need to send
commands. So basically, we can say that LCD16x2 is controlled by using
commands.
• Now, while printing a character on LCD16x2, we need to send the
ASCII code of that character to LCD16x2.
• Suppose we want to print a character ‘H’ on the LCD, then we
should send 0x48 (ASCII code of ‘H’) data to the LCD16x2. The
LCD16x2 has its controller, which does the printing job on the
LCD16x2.

Order to configure LCD:


1. Initialize the LCD in 8-bit mode

2. Display ON, Cursor OFF, Blink OFF

3. Increment cursor, No display shift

4. Clear display

5. Print data
Circuit Diagram
1. Connect the data lines (D0-D7) of the LCD to PORTF (PF0-PF7) of the
ATmega2560.

2. Connect the control lines as follows: RS -> PK0 RW -> PK1 EN -> PK2

3. Connect the contrast pin (VO) to the middle pin of a 10kΩ


potentiometer. The other two pins of the potentiometer should be
connected to +5V and GND.

4. Connect VSS to GND and VDD to +5V.

5. Connect A (LED+) to +5V and K (LED-) to GND for backlight

Code:
Proteus Demonstration:

You might also like