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

raju

  • Profile
  • Topics Started
  • Replies Created
  • Engagements

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • October 20, 2012 at 6:06 pm in reply to: How to interface 4bit mode LCD to 8051 Micro controller #8678
    raju
    Participant

    any one tell me where i mistake in code pleace see my code.

     

    #include<reg51.h>
    #include<stdio.h>

    sbit rs=P3^7;
    sbit en=P3^6;
    #define port P1

    void delayms(int delay);
    void lcdcmd(unsigned char l);
    void lcddata(unsigned char l);
    void display(unsigned char *dr);
    void delay(unsigned char s);
    void lcd();
    void enable();
    void lcdint();

    void enable()
    {
    en=0;
    delay(100);
    en=1;
    }
    void lcdcmd(unsigned char l)
    {

    int s;
    rs=0;
    s=l;
    port=((l>>4)&0x0F);
    enable();
    delay(1000);
    enable();
    port=(s&0x0F);
    enable();
    //enable();

    }

    void lcddata(unsigned char l)
    {
    int s;
    rs=1;
    s=l;
    port=((l>>4)&0x0F);
    enable();
    delay(1000);
    enable();
    port=(s&0x0F);
    enable();
    //enable();

    }

    void display(unsigned char *dr)
    {

    while(*dr)
    {
    lcddata(*dr++);
    }
    }

    void delay(unsigned char s)
    {
    while(s–);
    }
    void lcd()
    {
    port=0xFF;
    enable();
    delayms(7);
    port=0x30;
    enable();
    delayms(5);
    port=0x30;
    enable();
    delayms(5);
    port=0x30;
    enable();
    delayms(5);
    port=0x20;
    enable();
    delayms(5);

    }
    void lcdint()
    {
    lcd();
    lcdcmd(0x28);
    delay(100);
    lcdcmd(0x0C);
    delay(500);
    lcdcmd(0x06);
    delay(500);
    //lcdcmd(0x01);
    delay(500);

    }

    void main()
    {

    while(1)
    {

    lcdint();
    lcdcmd(0x80);
    lcddata(‘a’);
    }
    }

    void delayms(int delay)
    {

    int i ;
    for(i = 0 ; i<delay ; i++)
    {
    TMOD=0x01;
    TH0 = 0xFC ;
    TL0 = 0x17 ;
    TR0 = 1 ;
    while(!TF0);
    TR0 = 0 ;
    TF0 = 0 ;
    }
    }

    October 20, 2012 at 6:02 pm in reply to: How to interface 4bit mode LCD to 8051 Micro controller #8677
    raju
    Participant

     sir i want to  4 bit lcd display how to interface and correct coding for 4bit interface with 8051.

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)

RSS Recent Posts

  • Voltage comparator circuit verification May 10, 2026
  • What is this??? May 10, 2026
  • Why aren’t the power windows in my 2006 Volkswagen Polo 2006 working despite repairing the control unit circuit board? May 10, 2026
  • infiniBand Layer 1 specifications testing question May 8, 2026
  • block RF May 8, 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