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 / Replies /                              

                             

|

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

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++);
}

RSS Recent Posts

  • Harman Kardon radio module BMW noise February 16, 2026
  • Arduino standalone minimal February 16, 2026
  • analog logic of shmidt trigger bjt circuit February 16, 2026
  • CR2/CR123A Batteries In Projects February 16, 2026
  • Math problem February 15, 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