You Are Here: Home » AVR ATmega Projects » LCD Projects » LCD interface

LCD interface




This example is based on a LCD module with the Hitachi HD44780 LCD-controller.You can get these displays in various kinds, from 1 to 4 lines and from 8 to 40 characters per line.

A display with 16 characters per line and 2 lines is used in this example. The display uses a power supply of 5V DC. The LCD controller can accept 8 bit data bytes or 4 bit nibbles. In this example the 4-bit mode is used. There are more to find on the internet. But I wanted to make my own 4-bit LCD interface, to develop my skills in C-programming.

LCD interface

Schematic and build

The interface uses the 4-bit mode of the LCD so you need only one port. Here PORTB is used, but you can use any other port.

See the schematic below.

Software

To make the software code is build with the WINAVR compilier.

The program can be adapted to use another port.  The program can write instructions and data to the LCD controller. There are also functions to control the display and to write text string to the LCD.

LCD interfa

The complete function set:

void LCD_init(void)   // init LCD
void LCD_inst(unsigned char inst)   // writes a instruction to the LCD
void LCDclr(void)   // clear display
void LCDhome(void)   // return home
void LCDoff(void) // LCD off
void LCDon(void)   // LCD on
void LCDcursor(void)  // cursor on
void LCDblink(void)  // blink on
void LCDall(void)   // cursor all on
void LCDline(x)   //go to first line
void LCDline(x)   //go to second line
void LCDgoto (x,y)   // goto position x,y
void LCDtext(data)   //write text to the LCD
void LCDint(data)   //write integer to the LCD

Download the complete code below.

For more detail:  LCD interface

Leave a Comment

You must be logged in to post a comment.

Read previous post:
RGB LED color mixer
RGB LED color mixer

Page 1 of 4 An RGB LED is a LED which has three LED's integrated in one packaging. These LED's...

Close
Scroll to top