Wednesday, August 24, 2016

Library for interfacing alphanumeric LCD modules with AVR microcontrollers

This library provides an interface between the microcontroller and LCD module. Note that this code is not for I2C modules.

Library for interfacing alphanumeric LCD modules with AVR microcontrollers - ATmega328P

Main features:

- Supports 16x1, 16x2, 16x4, 20x4, 20x2, 32x2, 40x2 LCD display modules
- Option for automatically wrapping the text to a new line
- Numbers can be padded with zeros to maintain user interface layout
- Scrolling a string of characters
- Includes two types of big digits numerical fonts for making a clock
- Has support for user defined fonts and other special fonts included by default in the LCD memory
- Support for 8 and 4 bit mode interface
- LCD backlight dimming or on/off control using PWM 

Contents:

 

Hardware interfacing ATmega328 AVR microcontroller with a 16x2 LCD module with PWM brightness control

This LCD modules can be connected in 4 bit mode or 8 bit mode. Using 4 bit mode is recommended because it uses less pins but the code is a bit more complex. In the following example I use 4 bit mode.


Hardware interfacing AVR ATmega328 with an 16x2 LCD module with PWM brightness control