TELEGRAM

Sunday, January 22, 2012

How to interface 16x2 LCD with 8051 microcontroller

Posted by Unknown at 9:42 PM 0 Comments

  • Hex Code
    Command to LCD Instruction Register
    1
    Clear screen display
    2
    Return home
    4
    Decrement cursor
    6
    Increment cursor
    E
    Display ON, Cursor ON
    80
    Force the cursor to the beginning of the 1st line
    C0
    Force cursor to the beginning of the 2nd line
    38
    Use 2 lines and 5x7 matrix










DESCRIBTION
  • 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.
CODE
  • /Program to test LCD. Display single character "A"

    #include<reg51.h>
    #define cmdport P3
    #define dataport P2
    #define q 100
    sbit rs = cmdport^0;  //register select pin
    sbit rw = cmdport^1;  // read write pin
    sbit e = cmdport^6;  //enable pin

    void delay(unsigned int msec)  // Function to provide time delay in msec.
    {
    int i,j ;
    for(i=0;i<msec;i++)
    for(j=0;j<1275;j++);
    }

    void lcdcmd(unsigned char item)  //Function to send command to LCD
    {
    dataport = item;
    rs= 0;
    rw=0;
    e=1;
    delay(1);
    e=0;
    }

    void lcddata(unsigned char item)  //Function to send data to LCD
    {
    dataport = item;
    rs= 1;
    rw=0;
    e=1;
    delay(1);
    e=0;
    }

    void main()
    {
    lcdcmd(0x38);  // for using 8-bit 2 row mode of LCD
    delay(100);
    lcdcmd(0x0E);  // turn display ON for cursor blinking
    delay(100);
    lcdcmd(0x01);  //clear screen
    delay(100);
    lcdcmd(0x06);  //display ON
    delay(100);
    lcdcmd(0x86);  // bring cursor to position 6 of line 1
    delay(100);
    lcddata('A');
    }

Tags:

Share This Post

Get Updates

Subscribe to our Mailing List. We'll never share your Email address.

0 comments:

THANKS FOR UR COMMENT ....

Categories

Labels

AERONAUTICAL AEROSPACE AGRICULTURE ANDROID Android project titles Animation projects Artificial Intelligence AUTOMOBILE BANK JOBS BANK RECRUITMENTS BIG DATA PROJECT TITLES Bio instrumentation Project titles BIO signal Project titles BIO-TECHNOLOGY BIOINFORMATICS BIOMEDICAL Biometrics projects CAREER CAT 2014 Questions CHEMICAL CIVIL Civil projects cloud computing COMP- PROJ-DOWN COMPUTER SCIENCE PROJECT DOWNLOADS COMPUTER(CSE) CONFERENCE Data mining Projects Data protection. Design projects DIGITAL SIGNAL PROCESSING IEEE Project titles Dot net projects EBOOKS ELECTRICAL MINI PROJECTS ELECTRICAL PROJECTS DOWNLOADS ELECTRONICS MINI PROJECTS ELECTRONICS PROJECT DOWNLOADS EMG PROJECTS employment Engineering projects Exams Facts final year projects FOOD TECHNOLOGY FREE IEEE 2014 project Free IEEE Paper FREE IEEE PROJECTS GATE GAte scorecard GOVT JOBS Green projects GSM BASED Guest authors HIGHWAY IEEE 2014 projects ieee 2015 projects IEEE computer science projects IEEE Paper IEEE PAPER 2015 ieee project titles IEEE projects IEEE Transactions INDUSTRIAL INNOVATIVE PROJECTS INTERFACING IT IT LIST Java projects labview projects LATEST TECHNOLOGY list of project centers Low cost projects m.com MARINE Matlab codes MATLAB PROJECT TITLES MATLAB PROJECTS MBA MBA 2015 projects MCA MECHANICAL MECHANICAL PROJECTS DOWNLOAD MINI PROJECTS modelling projects MP3 MP3 cutter Mp4 Networking topics ns2 projects online jobs PETROCHEMICAL PHYSIOLOGICAL MODELLING projects physiotheraphy Projects Power electronics power system projects PRODUCTION project centers project downloads Prosthesis projects RAILWAY RECRUITMENT 2012 Recent RECENT TECHNOLOGY RECENT TECHNOLOGY LIST RECRUITMENT Rehabilitation projects renewable power respiration projects RESUME FORMAT. Ring Tone Cutter Robotics projects. Robots in medical social network jobs Solar projects Songs Cutter Speech-music separation-Abstract structural engineering TECHNOLOGY technology management TELE COMMUNICATION Telegram project TEXTILE TOP ENGINEERING COLLEGES Training VLSI

Disclaimer

This blogs is an effort to club the scattered information about engineering and project titles and ideas available in the web. While every effort is made to ensure the accuracy of the information on this site, no liability is accepted for any consequences of using it. Most of the material and information are taken from other blogs and site with the help of search engines. If any posts here are hitting the copyrights of any publishers, kindly mail the details to educations360@gmail.com It will be removed immediately.

Alexa Rank

back to top