0% found this document useful (0 votes)
103 views

LCD Interfacing

This document provides information about using character LCDs with AVR microcontrollers. It discusses the HD44780 LCD, which is a 16x2 LCD with 16 columns and 2 rows commonly used in embedded systems. The HD44780 has 8 data pins and operates in either 8-bit or 4-bit mode. It also describes connecting the LCD to an ATmega328p microcontroller and using a library written by Peter Fleury to simplify programming the LCD. The library handles all the complex configuration needed to interface with the LCD.
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)
103 views

LCD Interfacing

This document provides information about using character LCDs with AVR microcontrollers. It discusses the HD44780 LCD, which is a 16x2 LCD with 16 columns and 2 rows commonly used in embedded systems. The HD44780 has 8 data pins and operates in either 8-bit or 4-bit mode. It also describes connecting the LCD to an ATmega328p microcontroller and using a library written by Peter Fleury to simplify programming the LCD. The library handles all the complex configuration needed to interface with the LCD.
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/ 4

Department of Computer Engineering

Faculty of Engineering
University of Peradeniya

CO321 Embedded Systems - 2018

Using Character LCD with AVR


____________________________________________________________

Introduction

Liquid Crystal Display (LCD)

LCDs can be used to display anything. Although there are many types of LCDs in the market, the
ones that are commonly used for embedded systems, robotics, etc. are of character LCD and
graphical LCD. In this lab, only character LCDs will be discussed.

Figure 1: Character LCD and a graphic LCD

HD44780 LCD

This is by far the most famous character LCD that is available (figure 2). It is a 16×2 LCD
module i.e. it has 16 columns and 2 rows for display. Each character is displayed in a 7×5 pixel
matrix.
There two modes of operation: 8 bit mode and 4 bit mode.

● In 8 bit mode, 8 bits are sent to the LCD from the microcontroller.
● In 4 bit mode, 4 bits are sent to the LCD from the microcontroller.
Operation of the LCD

Table 1: Pins on the HD44780 and their meaning


Pin Function Name

No
1 Ground (0V) Ground

2 Supply voltage; 5V (4.7V – 5.3V) Vcc

3 Contrast adjustment; the best way is to use variable resistor such as Vo / VEE

a potentiometer. The output of the potentiometer is connected to

this pin. Rotate the potentiometer knob forward and backwards to

adjust the LCD contrast.

4 Selects command register when low, and data register when high RS
(Register
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; Extra Enable
voltage push is required to execute the instruction and EN(enable)
signal is used for this purpose. Usually, we make it en=0 and when
we want to execute the instruction we make it high en=1 for some
milliseconds. After this we again make it ground that is, en=0.

7-14 Data pins D0-D7

15 Backlight VCC (5V) Led+

16 Backlight Ground (0V) Led-


Figure 2: Pin Connections in HD44780

Connecting the LCD to ATMEGA328p

Configuring the LCD is a very tedious job. Hence, for this exercise, we are using the following
library by Peter Fleury (code is in the course page). You can have a look at the source code and
see for yourself the how complex it is.

Description of LCD library: http://homepage.hispeed.ch/peterfleury/doxygen/avr-gcc-


libraries/group__pfleury__lcd.html

The connections to the ATMEGA328p is described in the lcd.h. However, you can
change them according to your need. The following figure is such an example.
Figure 3: Connection diagram

Programming the LCD

There are many steps one needs to follow when programming the LCD. However, as
mentioned earlier, doing this from scratch is hard and time taking. Therefore, we’ll only
look at how to use the library.

A sample code is provided in the course page (test_lcd.c)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy