How to interface 16x2 LCD with 8051 microcontroller (AT89C51)
It is very important to keep a track of the working of almost all the automated and semi-automated devices, be it a washing machine, an autonomous robot or anything else. This is achieved by displaying their status on a small display module. LCD (Liquid Crystal Display) screen is such a display module and a 16x2 LCD module is very commonly used. These modules are replacing seven segments and other multi segment LEDs for these purposes. The reasons being: LCDs are economical, easily programmable, have no limitation of displaying special & even custom characters (unlike in seven segments), animations and so on. LCD can be easily interfaced with a microcontroller to display a message or status of a device. This topic explains the basics of a 16x2 LCD and how it can be interfaced with AT89C51 to display a character.
A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers.
1. Command/Instruction Register - stores the command instructions given to the LCD. A command is an instruction given to LCD to do a predefined task like initializing, clearing the screen, setting the cursor position, controlling display etc.
2. Data Register - stores the data to be displayed on the LCD. The data is the ASCII value of the character to be displayed on the LCD.
Command to LCD Instruction Register
Clear screen display
Display ON, Cursor ON
Force the cursor to the beginning of the 1st line
Force cursor to the beginning of the 2nd line
Use 2 lines and 5x7 matrix
Main power supply
Power supply to control contrast
Contrast adjustment by providing a variable resistor through VCC
RS=0 to select Command Register
RS=1 to select Data Register
R/W=0 to write to the register
R/W=1 to read from the register
A high to low pulse (minimum 450ns wide) is given when data is sent to data pins
To display letters or numbers, their ASCII codes are sent to data pins (with RS=1). Also instruction command codes are sent to these pins.
8-bit data pins
This Code is only visible to Registered users. Please Login/Register
A preset is a three legged electronic component which can be made to offer varying resistance in a circuit. The resistance is varied by adjusting the rotary control over it. The adjustment can be done by using a small screw driver or...
LCD (Liquid Crystal Display) screen is an electronic display module and find a wide range of applications. A 16x2 LCD display is very basic module and is very commonly used in various devices and circuits. These modules are preferred over seven segments...
Free TI Design & Simulation Tools
WEBENCH Design Environments are unique and powerful software tools that deliver customized power, lighting, filtering, clocking and sensing designs in seconds. These easy-to-use tools help you generate, optimize and simulate designs that conform to your unique specifications. They allow you to make value-based tradeoffs at a design, system and supply chain level before your design is committed to production.
Design & Simulation Tools
Sensors, Filter, Clock and Amplifier Design
Download Tools, Models and Symbols