element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Embedded and Microcontrollers
  • Technologies
  • More
Embedded and Microcontrollers
Embedded Forum hai paul  sir  now i start to learn how to serial interfacing in 8051.i write the code for serial communication the program is working but it isnot logic can u please expline me sir. in this program,i remove  the fuctions of lcd(),lcdcmd(),display(),in wh
  • Blog
  • Forum
  • Documents
  • Quiz
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Embedded and Microcontrollers to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Not Answered
  • Replies 0 replies
  • Subscribers 478 subscribers
  • Views 111 views
  • Users 0 members are here
Related

hai paul  sir  now i start to learn how to serial interfacing in 8051.i write the code for serial communication the program is working but it isnot logic can u please expline me sir. in this program,i remove  the fuctions of lcd(),lcdcmd(),display(),in wh

Former Member
Former Member over 13 years ago

hai paul please answer me sir

 

#include<reg51.h>

#include<stdio.h>

#include<string.h>

 

sbit rs=P2^0;

sbit rw=P2^1;

sbit en=P2^2;

 

 

unsigned char tem[9];

void serialrx();

void cmp();

 

void lcdcmd(unsigned char l);

void lcddata(unsigned char l);

void display(unsigned char *dr);

//void delay(unsigned char s);

void delay(unsigned char l);

void lcd();

 

void lcdcmd(unsigned char l)

{

P1=l;

rs=0;

en=1;

rw=0;

en=0;

}

 

void lcddata(unsigned char l)

{

P1=l;

rs=1;

en=1;

rw=0;

en=0;

}

 

void display(unsigned char *dr)

{

 

while(*dr)

{

  lcddata(*dr++);

}

}

/*void delay(unsigned char l)

{

 

        int i ;

        for(i = 0 ; i<l ; i++)

        {

        TH0 = 0xFC ;

        TL0 = 0x18 ;

        TR0 = 1 ;         //start the timer

        while(!TF0);     //wait here till overflow occurs

        TR0 = 0 ;        //reset TR0

        TF0 = 0 ;        //reset TF0

        }

} */

void delay(unsigned char l)

{

  while(l--);

}

void lcd()

{

 

     lcdcmd(0x0c);

     delay(6);

lcdcmd(0x38);

delay(6);

     lcdcmd(0x06);

     delay(6);

 

 

}

void main()

{

        lcd();

    lcdcmd(0x80);

delay(1000);

    display("WARRIOR TRANS");

delay(1000);

lcdcmd(0xc0);

delay(1000);

    display("MISSION TOOL");

 

 

while(1)

{

    lcd();

    lcdcmd(0x80);

delay(1000);

    display("WARRIOR TRANS");

delay(1000);

lcdcmd(0xc0);

delay(1000);

    display("MISSION TOOL");

 

serialrx();

     cmp();

 

 

}

}

void cmp()

{

int a;

char b[9]="16722482";

  a=strcmp(b,tem);

 

 

if(a==0)

  {

     lcd();

lcdcmd(0x80);

display("                           ");

     delay(1000);

lcdcmd(0x80);

     display("AUTHORISED");

delay(1000);

lcdcmd(0xc0);

display("                           ");

     delay(1000);

lcdcmd(0xc0);

     display("          TOOL ");

 

 

  }

else

   {

      lcd();

lcdcmd(0x80);

display("                           ");

     delay(1000);

lcdcmd(0x80);

     display("UNAUTHORISED");

delay(1000);

lcdcmd(0xc0);

display("                           ");

     delay(1000);

lcdcmd(0xc0);

     display("          TOOL ");

 

}

 

}

 

 

void serialrx()

{

int i;

    TMOD=0x20;

    TH1=0xfd;

    SCON=0x50;

    TR1=1;

 

for(i=0;i<8;i++)

{

 

   while(RI==0);

     tem[i]=SBUF;

        RI=0;

}

  tem[i]='\0';

}

  • Sign in to reply
  • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube