Pages

How to Connect LCD HD44780 with AVR


LCD HD44780 is one of LCD that is commonly used by many students and developers in many countries for learning objectives. If we want to use this LCD, we should connect it with a microcontroller as the control system. The most popular microcontroller for students and developers is AVR, a kind of microcontroller from Atmel.  
There is a simple way to communicate LCD HD44780 with AVR microcontroller. You can use library that have been made by winavr.scienprog.com team so it will be easy to set your AVR microcontroller. These are the steps:
1.       You should have the library in your work directory. You can download lcd_lib.h, lcd_lib.c and datasheet of LCD here.
2.       The default output port for LCD that is defined in the library is port D. You can change the port by making some changes on preprocessor in the header file at this part:
#define LDP PORTD
#define LCP PORTD
#define LDDR DDRD
#define LCDR DDRD
3.       There are some basic functions that you can use. You can learn it from demo program that have been made by winavr.scienprog.com team. At that demo program you can learn some basic function such as sending a char, sending a string, moving the cursor in LCD, etc. You can download demo program and datasheet here.
4.       This library uses 4 bit data to operate the LCD so you use only 4 LCD data pins. You can see the configuration of the LCD pin below.

PIN
Description
If using the library
1
GND
connect it to GND
2
Vcc
connect it to Vcc (put 1k resistor to reduce the current)
3
Vee
connect it to GND (if you don’t want to change contrast)
4
R/S
to PD0
5
R/W
to PD1
6
E
to PD2
7
D0

8
D1

9
D2

10
D3

11
D4
to PD4
12
D5
to PD5
13
D6
to PD6
14
D7
to PD7
15
D8
V+ (only if LCD has backlight)
16
D9
GND (only if LCD has backlight)

5.       Make design of your system and apply it. If you want to be more expert, you can upgrade your system for example by adding a keypad or push button to your system as input device.  This is a basic skill to make more advanced device such as digital clock, digital game, etc.


http://electricalgaze.com

1 comment: