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 / this is the

this is the

|

Microcontroller › 8051 › what does these warnings mean???? › this is the

February 12, 2012 at 12:40 pm #7143
shanthi
Participant

this is the code.. 

 

 

#include<absacc.h>
#include<reg52.h>
sbit rs=P2^0;
sbit rw=P2^1;
sbit e=P2^2;
 
unsigned char c[11];// to receive tag Id
const unsigned char Tag1[11]= {‘0′,’0′,’1′,’5′,’3′,’9′,’7′,’6′,’5′,’1’};// to store tag numbers
const unsigned char Tag2[11]= {‘0′,’0′,’1′,’5′,’3′,’9′,’7′,’6′,’5′,’0’};
const unsigned char Tag3[11]= {‘0′,’0′,’1′,’5′,’3′,’9′,’4′,’7′,’9′,’8’};
unsigned int bn; // to store bus number
unsigned char area[4];// to store area number
unsigned int n=11;  // no. of bytes in tag id
 
 void delay(unsigned int );
 void lcdinit(void);
 void rtcinit(void);
 void lcdcmd(unsigned char);
 void welcome(void);
 void receive(void);
 void bus1(void);
 void bus2(void);
 void bus3(void);
 void nomatch(void);
 void rtc(void);
 void bcdconv(unsigned char) ;
 void lcddata(unsigned char );
 void lcdstring(unsigned char * );
 
 
void main()
{
  unsigned int i;    
  unsigned int v1,v2,v3,vn; // variables in switch cases
  TMOD=0x20;
  TH1=0xFD;
  SCON=0x50;
  TR1=1;
  lcdinit();
  delay(25);
  welcome();
  delay(25);
  while(1)
   {
         receive(); // function to recieve tag id into array
         v1=v2=v3=vn=0;
         for(i=0;i<n;i++) // loop to compare the recieved tag and the id’s stored in tags
          {
                if(c==Tag1)
                  v1++;   
                else
                  if(c==Tag2)
                    v2++;  
                 else 
                   if(c==Tag3)
                     v3++;
                 else
                   if(c!=(Tag1&&Tag2&&Tag3))
                     vn++;
           }  // end of for loop
    
 
 //if value of any variable is n i.e., the number of bytes then the coresponding fumction is called 
 
        if(v1==n)
            bus1();
        else
           if(v2==n)
           bus2();
       else
           if(v3==n)
                bus3();
       else
          if(vn==n)
             nomatch();
 
     //Function to initialize the Real Time Clock (RTC)
      rtcinit();
      delay(25);
    //Funtion to Obtain the Time From the RTC
      rtc();
 
  }// end of while loop
 
}//end of main function
 
 
// Welcome function
void welcome()
{
  unsigned int i=0;
  unsigned char c[]=”WELCOME TO RFID”;
  unsigned char d[]=”BUS ID SYSTEM”;
  lcdcmd(0x01); 
  delay(1);
  lcdcmd(0x80); //
  delay(1);
  for(i=0;c!=’’;i++) 
     lcddata(c);
  lcdcmd(0xc0);
  delay(1);
  for(i=0;d!=’’;i++)
     lcddata(d);
}
 
// function to recieve the tag id from reader
void receive()
{
  unsigned char t;
  for(t=0;t<n;t++)
   { 
      while(RI==0); //wait until value of RI is set to 1
      c[t]=SBUF;   //load SBUF value into array ‘c’
      RI=0; //clear value of RI to 0
   }
}
 
// Function to send the details of bus 1
void bus1()
{
    lcdcmd(0x01); 
    delay(10);
    lcdcmd(0x80);  
    delay(10);
    lcdstring(“Bus Number : 1” );  
    delay(10);
    lcdcmd(0xc0); 
    delay(10);
    lcdstring(“Area : RJY”);
    delay(10);
}
 
//function to store area of bus  2
void bus2()
{
    lcdcmd(0x01); 
    delay(10);
    lcdcmd(0x80);
    delay(10);
    lcdstring(“Busnumber : 2” );
    delay(10);
    lcdcmd(0xc0);  
    delay(10);
    lcdstring(“Area : KKD”);
    delay(10);
 }
 
//Function to  store  Bus 3 details
void bus3()
{
    lcdcmd(0x01);  
    delay(10);
    lcdcmd(0x80); 
    delay(10);
    lcdstring(“Busnumber : 3” );
    delay(10);
    lcdcmd(0xc0);
    delay(10);
    lcdstring(“Area : ABC”);
    delay(10);
  }
 
//Function to display the unauthorized entry of buses into the arena of the college
void nomatch()
{
    lcdcmd(0x01); 
    delay(10);
    lcdcmd(0x80);  
    lcdstring(“Unauthorised entry”);
    delay(10);
}
 
// function to display time from the RTc
void rtc()
{
    unsigned char hr,min,sec;
    hr=XBYTE[4];
    bcdconv(hr);
    delay(10);
    lcddata(‘:’);
 
    min=XBYTE[2];
    bcdconv(min);
    delay(10);
    lcddata(‘:’);
 
    sec=XBYTE[0];
    bcdconv(sec);
}
 
//Function to convert hex values into BCD
void bcdconv(unsigned char v)
{
  unsigned char x,y;
  x=v&0x0F;
  x=x|0x03;
  y=v&0xF0;
  y=y>>4;
  y=y|0x30;
  lcddata(y);
  lcddata(x);
}
 
//LCD initialisation function
void lcdinit()
{
     lcdcmd(0x38);  
     delay(1);
     lcdcmd(0xE0);  
     delay(1);
     lcdcmd(0x01); 
     delay(1);
     lcdcmd(0x06);  
     delay(1);
}
 
//function to display string
void lcdstring(unsigned char *str)
{
    int i=0;
    for(   ;str!=’’;i++)
      { 
          lcddata(str);
           delay(1);
        }
}
 
 // lcd function to display a single character 
void lcddata(unsigned char value)
{
    P1 = value;
    rs= 1;
    rw=0;
    e=1;
    delay(1);
    e=0;
}
 
 
void lcdcmd(unsigned char value)
{
    P1 = value;
    rs= 0;
    rw=0;
    e=1;
    delay(1);
    e=0;
}
// Function to initialize the Real Time clock
void rtcinit()  
{
    delay(200);
    XBYTE[10]=0x20;  //turn ON the oscillator
    XBYTE[11]=0x83;  
    XBYTE[0]=0x55;
    XBYTE[2]=0x58;
    XBYTE[4]=0x16;
    XBYTE[7]=0x19;
    XBYTE[8]=0x10;
    XBYTE[9]=0x04;
    XBYTE[11]=0x03;
}
 
//Function to generate delay 
void delay(unsigned int count)
{
  unsigned int i,j;
  for(i=0;i<count;i++)
    for(j=0;j<1275;j++);
}
 

RSS Recent Posts

  • LED circuit for 1/6 scale diorama May 15, 2025
  • stud mount Schottky diodes May 14, 2025
  • using a RTC in SF basic May 14, 2025
  • Hi Guys May 14, 2025
  • Can I use this charger in every country? May 14, 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