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
  • Advertise
You are here: Home / Topics / black boxes on 16×2 LCD

black boxes on 16×2 LCD

|

Microcontroller › 8051 › black boxes on 16×2 LCD

  • This topic has 13 replies, 9 voices, and was last updated 11 years, 10 months ago by Ganesh Selvaraj.
Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • November 1, 2011 at 7:01 am #1368
    sachin
    Participant

    i am begineer in microcontroler and making project at89c51 based “A” character display. i make it and after on supply lcd shows black boxes on first row.i am not able to rectify it.what is generally cause of this ? how to solve it? plz tell me step by step…………………………..

    November 1, 2011 at 8:40 am #6772
    Qaisar
    Participant

    black boxes means data is not transfering to lcd ..

    visit post ”lcd interfacing to 8051 by qurat ain” i put code and diagram there. 

    first try that code and diagram . if still u r unable to interface lcd then check ur haedware and lcd connection.

    November 1, 2011 at 8:40 am #6773
    Qaisar
    Participant

    black boxes means data is not transfering to lcd ..

    visit post ”lcd interfacing to 8051 by qurat ain” i put code and diagram there. 

    first try that code and diagram . if still u r unable to interface lcd then check ur haedware and lcd connection.

    November 10, 2012 at 9:00 pm #8733
    Sajjad
    Participant

    i have the same problem….. i get the results on simulations but i get black boxes on harware…. :( kindly help me out… i am using thi engineers garage code…..

     

     

     

     

    November 11, 2012 at 5:48 am #8734
    AJISH ALFRED
    Participant

    Black boxes on the first row means “LCD not initialized”. Only after proper initialization an LCD can display characters.

    Problem could be either hardware or software. First check your circuit connections and then your code.

    If possible post your connection diagram here.

    November 11, 2012 at 11:44 am #8737
    Sajjad
    Participant

    wysiwyg_imageupload:6726:THIS IS THE CUIRCUIT DAIGRAM I AM USING. i get black boxes in ist row. kindly tell me if there is any flaw? 

    November 11, 2012 at 11:49 am #8738
    Sajjad
    Participant

     

    
    

    //Program to Display string on LCD using AVR Microcontroller (ATmega16)

    /*
    LCD DATA port—-PORT B
    signal port


    PORT D
    rs


    PD0
    rw


    PD1
    en


    PD2
    */
     
    #include<avr/io.h>
    #include<util/delay.h>
     
    #define LCD_DATA PORTB //LCD data port
     
    #define ctrl PORTD
    #define en PD2 // enable signal
    #define rw PD1 // read/write signal
    #define rs PD0 // register select signal
     
    void LCD_cmd(unsigned char cmd);
    void init_LCD(void);
    void LCD_write(unsigned char data);
     
    int main()
    {
    DDRB=0xff;
    DDRD=0x07;
    init_LCD(); // initialization of LCD
    _delay_ms(50); // delay of 50 mili seconds
    LCD_write_string(“EngineersGarage”); // function to print string on LCD
    return 0;
    }
     
    void init_LCD(void)
    {
    LCD_cmd(0x38); // initialization of 16X2 LCD in 8bit mode
    _delay_ms(1);
     
    LCD_cmd(0x01); // clear LCD
    _delay_ms(1);
     
    LCD_cmd(0x0E); // cursor ON
    _delay_ms(1);
     
    LCD_cmd(0x80); // —8 go to first line and –0 is for 0th position
    _delay_ms(1);
    return;
    }
     
    void LCD_cmd(unsigned char cmd)
    {
    LCD_DATA=cmd;
    ctrl =(0<<rs)|(0<<rw)|(1<<en);
    _delay_ms(1);
    ctrl =(0<<rs)|(0<<rw)|(0<<en);
    _delay_ms(50);
    return;
    }
     
    void LCD_write(unsigned char data)
    {
    LCD_DATA= data;
    ctrl = (1<<rs)|(0<<rw)|(1<<en);
    _delay_ms(1);
    ctrl = (1<<rs)|(0<<rw)|(0<<en);
    _delay_ms(50);
    return ;
    }
     
    void LCD_write_string(unsigned char *str) //store address value of the string in pointer *str
    {
    int i=0;
    while(str!=’’) // loop will go on till the NULL character in the string 
    {
    LCD_write(str); // sending data on LCD byte by byte
    i++;
      }
    return;
    }

    THIS IS THE CODE i am using. 
    i have used the control pins and data pins according to code…

    November 11, 2012 at 1:08 pm #8739
    anand
    Participant

    Did you try adjusting the contrast of LCD with potentiometer connected. These boxes also would be seen if you set the contrast to dark…

    November 11, 2012 at 1:23 pm #8740
    Sajjad
    Participant

    yes i did.. but nothing changes. :( i only get these boxes nothing else :(

    November 14, 2012 at 12:21 pm #8746
    AJISH ALFRED
    Participant

    Hi Sajjad,

    In your code, you are writing into ctrl which is defined as portD (#define ctrl PORTD) at somany lines, but you haven’t connected the portD of your controller to anywhere !

    March 25, 2014 at 1:44 pm #11387
    Bala murugan
    Participant

    I have same problem ….i was using engineersgarage circuit and code but not working .plz help me

    wysiwyg_imageupload:11996:

    March 25, 2014 at 7:09 pm #11388
    Ashutosh Bhatt
    Participant

    try to do one thing. connect RW pin of LCD to ground. and read LCD datasheet for proper operation initialization.

    March 27, 2014 at 3:34 am #11393
    SHAH DISHANT H.
    Participant

    The issue seems with Initilisation process. Send following commands.

    0x38

    0x0E

    0x01

    0x06

    0x80

     

    Provide enough delay inbetween. What is the frequency of crystal you have connected?

    March 27, 2014 at 5:56 am #11397
    Ganesh Selvaraj
    Participant

    And also check if you connected everything properly… one loose contact and the LCD won’t work like we expect it to… #personal_experience

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

RSS Recent Posts

  • getting no where fast 8 x 8 led matrix January 23, 2026
  • Expensive hobby January 23, 2026
  • analog logic of shmidt trigger bjt circuit January 22, 2026
  • Micro mouse January 22, 2026
  • Best practices for accurate LiPo battery monitoring on ESP32? January 22, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 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
  • Advertise