EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
You are here: Home / Topics / Help me to create a 16×2 LCD display in AT 89s52

Help me to create a 16×2 LCD display in AT 89s52

|

Microcontroller › 8051 › Help me to create a 16×2 LCD display in AT 89s52

  • This topic has 7 replies, 7 voices, and was last updated 9 years, 11 months ago by balaji.n.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • December 1, 2010 at 9:19 pm #485
    Manas Paul
    Participant

    I am trying to create a LCD dispaly in AT89S52.I was full copy the (How to display number on 16×2 LCD using 8051 microcontroller (AT89C51) ) program and design the circuit. But it is not working.I had change at the first time the header file.

     

    Please Help me to create a 16×2 in AT89S52 microcontroller,with circuit design and C program.Thank You.

    December 4, 2010 at 6:29 am #5183
    dagakshay
    Participant

    the code must work it might be soome loose connection in the the circuit… what extaclly you getting on LCD.. i mean your LCD is fully blank, or some boxes in first line… or the back light of LCD is not glowing at all…

    have you used variable resistance??… it is use to set the contarst… try to set that….

    plz be a bit more specify about your problem so that i can help you out….

    March 21, 2011 at 2:36 am #5777
    Rajesh
    Participant

    I am getting black sqaure boxes on the LCDJHD 162.   can any one help?

    March 22, 2011 at 9:25 am #5793
    dagakshay
    Participant

    this type of cases comes when the controller will not a be able to communicate with LCD…
    check the connections onces… see weather you code is properly working… check your delay function you have there must be atleast 50 micro second delay….

    April 7, 2011 at 1:31 pm #5923
    chuduc
    Participant

    My english is very bad I can not express their answers, Here is my code written for lcd16x2, hope it is for your help

     

    #include “reg52.h”
    const unsigned char clr=1,home=2,d_on=15,d_off=12,set=56;
    sbit     rs=P2^0;                     
    sbit     rw=P2^1;                     
    sbit     e=P2^2;                      

    /*  P0 noi voi LCD data
         noi 3 bit thap cua P2 voi chan cam LCD_CONTROL
         co the su dung board thi nghiem 89_v2 de chay chuong trinh
         cac lenh su dung:
        int_lcd();        cai dat lcd
        lenh(clr);        xoa lcd
        lenh(home);        dua con tro ve dau dong
        lenh(d_on);        mo display,blink
        lenh(set);        che do 16×2
        dat(1 ki tu);        xuat 1 ki tu ra lcd
        dat_str(“chuoi”);    xuat 1 chuoi ki tu ra lcd
    */

    void delay(unsigned int msec)  // chuong trinh con tao thoi gian tre ms
    {
        int i,j ;
            for(i=0;i<msec;i++)
            for(j=0;j<1275;j++);
    }
    //


    void busy()    //chuong trinh con kiem tra lcd co ban ko
    {
        rs=0;
        rw=1;
        P0_7=1;                          
        while(P0_7!=0)
        {
            e=0;
            e=1;
        }
    }
    //


    void lenh(unsigned char ma)    //chuong trinh con xuat lenh len LCD
    {
        busy();

        rs=0;
        rw=0;                        
        e=1;
        P0=ma;
        e=0;
    }
    //


    void dat(unsigned char ma)    //chuong trinh con xuat du lieu len LCD
    {
        busy();
        
        rs=1;
        rw=0;        
        e=1;
        P0=ma;
        e=0;
    }
    //


    void mov(unsigned char row, unsigned char col)    //chuong trinh di chuyen con tro
    {
        lenh(128 | (row << 6) | col);    //row =0 la hang dau,=1 la hang 2
    }
    //


    void dat_str(unsigned char *str)    //chuong trinh xuat ra LCD mot chuoi ki tu
    {
        while (*str!=’’)
        {
            dat(*str);
            str++;    
        }
    }
    //


    void int_lcd()    //chuong trinh con cai dat LCD
    {
        delay(2);                    //doi 2ms
        lenh(set);                    //8bit, 2 line
        //lenh(d_on);                      //display on, cursor on,blinking on
        lenh(d_off);                       //display on,cursor off,blinking off
        lenh(clr);                    //clear display
        lenh(home);                    //return home
    }
    //


    void main()
    {
        int_lcd();
        lenh(home);
        dat_str(“chu nguyen duc”);
        while(1);
    }

     

    I‘ll post the schematic tomorrow,If any problem please contact me: [email protected]. Goodlucky!!:D

    August 26, 2012 at 2:49 pm #8507
    mon
    Participant

    i also have a problem about this project…the lcd has no display other than the background light…

    plzzzz help me…

    thx in advance…

    August 28, 2012 at 5:59 pm #8511
    AJISH ALFRED
    Participant

    Hi all,

    Following are the two common issues beginners found to be struggling with.

    1) LCD display contains only black boxes in the first line

    2) LCD shows nothing but the backlight

     

    The second one occurs mostly due to the bad code. Only hardware error possible is with the RS pin, where it might be shorted to ground.

    Here one should note that the LCD got initialized. This happens only when the controller is able to communicate successfully so far with the LCD module.

     

    The first case occurs both due to software or hardware issues. Here the LCD not even got initialized, which means the controller might not be able to communicate with the LCD module, or the instructions sent might be wrong. There are often hardware issues as well.

     

    So first make sure that your hardware connections are proper, then try to debug the code.

    September 3, 2012 at 3:34 pm #8526
    balaji.n
    Participant

                                                 /*LCD DRIVER*/

     

    //PROGRAMED BY BALAJI ANY BUG REPORT:mail id:[email protected]

     

    #include<reg51.h>                  //HEADER FILE IN KEIL 3
     #define S P3               //DEFINE PORT HERE

     

    sbit rs=P2^0;              //PLEASE SELECT CONTROL BIT FOR LCD
    sbit rw= P2^1;
    sbit en=P2^2;

     

    void cmdwrite(int value);  //FUNCTION FOR COMMAND WRITE
    void datawrite(int value); //FUNCTION FOR DATAWIRTE
    void delay(int itime);       //FUNCTION FOR DELAY

     

    void main()
    {
    S=0X00;                       //PORT CONFIGURE AS THE OUTPUT
    cmdwrite(0x38);
    cmdwrite(0x0E);
    cmdwrite(0X01);
    cmdwrite(0X06);
    cmdwrite(0X84);
    datawrite(0x41);//PASSING THE VALUE FOR DISPLAY THE CHAR A
    datawrite(0x42);

    }
     void cmdwrite(int value)
    {
    S=value;
    rs=0;
    rw=0;
    en=1;
    delay(1);
    en=0;
    }
    void datawrite(int value)
    {
    S=value;      
    rs=1;
    rw=0;
    en=1;
    delay(1);
    en=0;
    }
    void delay(int itime)    //USER DEFINED DELAY
    {
     int i,j;
    for(i=0;i<itime;i++)    //IF U WANT TO MORE DELAY CHANGE THE PASSING THE VALUE
     for(j=0;j<1275;j++);
    }

  • Author
    Posts
Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Looking for amplifier ic August 12, 2022
  • alternate of 80386/486 microprocessor August 12, 2022
  • Trying to troubleshot 1960s Panasonic transistor radio August 12, 2022
  • Company name: any suggestions? August 12, 2022
  • uc3843 Buck-boost August 11, 2022

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools