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

 try

|

Microcontroller › 8051 › INTERFACING LCD TO 8051 BY Qurat-ul-ain ›  try

November 2, 2011 at 9:53 am #6778
sourabh
Participant

 

try this
 
 
 
 
#include<reg52.h>
sbit rs   = P1^3;
sbit rw   = P1^4;
sbit en   = P1^6;
 
 
int i;
 
void delay(unsigned int);
void data1();
void cmd(int);
void lcdin();
void lcd(int);
 
void main()
{
  
  char *a;
 
  a=””;                                       //write your string here
  lcdin();
  
  for(i=0;a!=’’;i++)
  lcd(a);
   while(1);
}
 
void delay(unsigned int b)
{ int i,j;
   for(i=0;i<b;i++)
   for(j=0;j<1275;j++);
}
 
void data1()
{
 rs=1;
 rw=0;
 en=1;
 delay(1);
 en=0;
 delay(1);
}
 
 
void cmd(int a)
{
 P2=a;
 rs=0;
 rw=0;
 en=1;
 delay(1);
 en=0;
 delay(1);
}
 
void lcdin()
{
 cmd(0x38);
 cmd(0x0e);
 cmd(0x01);
 cmd(0x06);
 cmd(0x80);
}
 
void lcd(int a)
{ 
  
  P2=a;
  data1();
}

RSS Recent Posts

  • can a AT89C51 be used as a rom? May 21, 2025
  • Welcome to GTSMT PCB Assembly Solutions Provider May 21, 2025
  • Telegram Based Alarm - Sensor cable protection May 21, 2025
  • Chinese Tarrifs – 104%!?! May 21, 2025
  • An Update On Tarrifs May 21, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 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