Forum Replies Created
Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
shanthiParticipant
ok thank u so much..i need a help in the same code that the code is not applying for switch case..it is showing me an error..
i tried changing the second ifelse ladder with switchcase bt isnt working…could anyone help me with this
shanthiParticipantthis 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 Idconst unsigned char Tag1[11]= {‘0′,’0′,’1′,’5′,’3′,’9′,’7′,’6′,’5′,’1’};// to store tag numbersconst 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 numberunsigned char area[4];// to store area numberunsigned int n=11; // no. of bytes in tag idvoid 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 casesTMOD=0x20;TH1=0xFD;SCON=0x50;TR1=1;lcdinit();delay(25);welcome();delay(25);while(1){receive(); // function to recieve tag id into arrayv1=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++;elseif(c==Tag2)v2++;elseif(c==Tag3)v3++;elseif(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 calledif(v1==n)bus1();elseif(v2==n)bus2();elseif(v3==n)bus3();elseif(vn==n)nomatch();//Function to initialize the Real Time Clock (RTC)rtcinit();delay(25);//Funtion to Obtain the Time From the RTCrtc();}// end of while loop}//end of main function// Welcome functionvoid 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!=’