Sie sind auf Seite 1von 5

LCD interfacing with 8051 Microcontroller (AT89C51) - Circuit & C ProgramEnginee rsGarage Search this site: HomeInsightEG Labs

Microcontroller 8051 AVR PICElectronic Circuits Components TutorialsArticlesInvention StoriesSTORE Development Boards Arduino Atmel Renesas Microchip MoreDisplays 7 Segment Graphic LCD MoreICs Microcontrollers 8051 ARM AVR PIC MorePassive Components Capacitors Potentiometers Resistors Rheostats MoreProgrammers Sensors Encoders Motion Proximity Speed Temperature Ultrasonic MoreMore Request QuoteForumKnowledge Base Contributions How to Experts D. MohanKumarC-Programs My GarageAdvertisePost & EarnContact UsSkip to content Arduino Rs. 2350 | More Atmel Dev Board Rs. 2677 | More Multimeter Rs. 1230 | More PIC Dev Board Rs. 1292 | More RF Module Rs. 316 | More RFID Reader Rs. 3542 | More Zigbee Rs. 2111 | More How to interface 16x2 LCD with 8051 microcontroller (AT89C51)

MC016SummaryDescriptionCircuit DiagramVideoCodeComponentsStoreSummary 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. Description 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. Commonly used LCD Command codes: Hex CodeCommand to LCD Instruction Register 1Clear screen display 2Return home 4Decrement cursor 6Increment cursor EDisplay ON, Cursor ON 80Force the cursor to the beginning of the 1st line C0Force cursor to the beginning of the 2nd line 38Use 2 lines and 5x7 matrix

The pin description of this module is given below. Pin configuration: PinSymbolDescription 1VSSGround0 V 2VCCMain power supply+5 V

3VEEPower supply to control contrastContrast adjustment by providing a variable resistor through VCC 4RSRegister Select RS=0 to select Command Register RS=1 to select Data Register 5R/WRead/write R/W=0 to write to the register R/W=1 to read from the register 6ENEnableA high to low pulse (minimum 450ns wide) is given when data is sent to data pins 7DB0To display letters or numbers, their ASCII codes are sent to data pins (with RS=1). Also instruction command codes are sent to these pins. 8DB1 9DB2 10DB3 8-bit data pins 11DB4 12DB5 13DB6 14DB7 15Led+Backlight VCC+5 V 16Led-Backlight Ground0 V Programming the LCD: 1. Data pin8 (DB7) of the LCD is busy flag and is read when R/W = 1 & RS = 0. When busy flag=1, it means that LCD is not ready to accept data since it is busy with the internal operations. Therefore before passing any data to LCD, its command register should be read and busy flag should be checked.

2.

To send data on the LCD, data is first written to the data pins with R/W

= 0 (to specify the write operation) and RS = 1 (to select the data register). A high to low pulse is given at EN pin when data is sent. Each write operation is performed on the positive edge of the Enable signal. 3. To send a command on the LCD, a particular command is first specified to

the data pins with R/W = 0 (to specify the write operation) and RS = 0 (to select the command register). A high to low pulse is given at EN pin when data is sent.

Displaying single character A

on LCD

The LCD is interfaced with microcontroller (AT89C51). This microcontroller has 40 pins with four 8-bit ports (P0, P1, P2, and P3). Here P1 is used as output port which is connected to data pins of the LCD. The control pins (pin 4-6) are

controlled by pins 2-4 of P0 port. Pin 3 is connected to a preset of 10k? to adjust the contrast on LCD screen. This program uses the above concepts of interfacing the LCD with controller by displaying the character A on it. Circuit Diagram VideoCode This Code is only visible to Registered users. Please Login/Register Components 23,234-ReadsPreset 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... 80,142-ReadsAT89C51 Microcontroller AT89C51 is an 8-bit microcontroller and belongs to Atmel's 8051 family. ATMEL 89C51 has 4KB of Flash programmable and erasable read only memory (... 63,699-ReadsLCD 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... Store Welcome to the EngineersGarage store, in partnership with element14 EngineersGarage and element14 have teamed up to bring you the broadest selection of products to support your electronic design projects. With over 3500 suppliers and 400,000 stocked products, you can be certain to find the products you want with a great service and fantastic prices. Whether it is researching a technology, designing a new product or looking for parts to repair, you are now just a click away from 400,000+ electrical & electronic items. Microcontrollers (6,004)Sensors & Transducers (7,877)Programmers (145) Development Boards (1,195)Capacitors (34,783)RF Modules (300) GPS/GSM Modules (122)Zigbee (94)DC Motor (49) Stepper Motor (104)Gear Assembly (57) Check out the store now! Get a Quote! Thank you element14 & EngineersGarage Teams

86500 readsJoin us on Facebook for latest updatesInsight-Discover how Gadgets work?Ball Pen Capacitor Digital Thermometer Earphone Electric Bulb LED Memory Card Pendrive Optical Mouse Starter Webcam ...more User loginUsername: * Password: * Create new accountRequest new password StoreLooking for Electronic parts? Microcontrollers (6,004) Sensors & Transducers (7,877) Development Boards (1,195) Programmers (145) Capacitors (34,783) RF Modules (300) GPS/GSM Modules (122) Zigbee (94) DC Motor (49) Stepper Motor (104) Gear Assembly (57) Get a Quote! You are hereHome TopSkip to content Copyright 2012 EngineersGarage. All rights reserved. Privacy Policy

Das könnte Ihnen auch gefallen