Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/20/09 11:00
Read: times


 
#166281 - v
Responding to: ???'s previous message

#include <REGX52.h>   

#define Baud_rate 0xF4                    //setting 2400 bauds/sec
char i=0,j=0,buf[12],var[10],buf2[10];
bit aux=0;
char contor;
 
init(){
	TMOD=0x20;                 //initializing serial
	SCON=0x50;
	TH1=Baud_rate;
	TL1=Baud_rate;
	EA=1;
	ES=1;
	TR1=1;
}

void main(){
	buf2[0]=0x30;buf2[1]=0x34;buf2[2]=0x31;   //valid ID is stored in this variable
	buf2[3]=0x35;buf2[4]=0x44;buf2[5]=0x38;
	buf2[6]=0x41;buf2[7]=0x31;buf2[8]=0x46;
	buf2[9]=0x031;
	P2_0=0;                            //glow led 

	init();
	while(1);
}

void serial_IT(void) interrupt 4
{
	if(RI){
			buf[i]=SBUF;                 //move the received character to variable buf
			//delay(100);
			RI=0;
			}
		if(i<12) i++;         //making loop to store all 12 bytes from reader         
		else{           //if i already received 12 bytes
		i=0;            //clear i
		if(buf[0]==0x0A){         //if first character is 0x0A
		P2_1=0;                   //glow LED
		if(buf[11]==0x0D){        //if last character is 0x0D
			P2_2=0;            //glow another LED
			for(j=0;j<9;j++){            
				var[j]=buf[j+1];   //storing the middle 10 bytes of received string in another variable
				if(var[j]!=buf2[j]) aux=1; //compare with stored ID;if mismatch the set aux
					}
				}
			}
		if(aux==0){   //if no mismatch found then the ID received from reader is valid 
			P2_3=0;   //so glow led
			}
	
		}
		
}
 
 


this code makes the microcontroller receive a ID from reader,store it ,compare it with one in memory and glow led conected to P2.3 if it's valid.After reading a tag(valid or not) i am not able to read another one.Here is the point were i got stuck and have no idea on how to resolve it.

List of 54 messages in thread
TopicAuthorDate
Project using 89s52            01/01/70 00:00      
   RET (Where?)            01/01/70 00:00      
      Loops?            01/01/70 00:00      
         Loops?            01/01/70 00:00      
            with a quick glance            01/01/70 00:00      
               with a quick glance            01/01/70 00:00      
                  search for ...            01/01/70 00:00      
            Loops Something like this            01/01/70 00:00      
               School work?            01/01/70 00:00      
                  Nope            01/01/70 00:00      
               Loops Something like this            01/01/70 00:00      
                  ?...Doesnot Work...?            01/01/70 00:00      
                     ?...Doesnot Work...?            01/01/70 00:00      
                        Correct            01/01/70 00:00      
                        You sure you get a line feed before RFID?            01/01/70 00:00      
                            You sure you get a line feed before RFID?            01/01/70 00:00      
                              Try This            01/01/70 00:00      
                                 Try This            01/01/70 00:00      
                                 error            01/01/70 00:00      
                                    it's bible time            01/01/70 00:00      
                                       it's bible time            01/01/70 00:00      
                                    Is it ERROR or DOUBT???            01/01/70 00:00      
                                       Is it ERROR or DOUBT???            01/01/70 00:00      
                                 Compare            01/01/70 00:00      
                                    Simulate your function.            01/01/70 00:00      
                                       Simulate your function.            01/01/70 00:00      
                                          Use the free Keil C compiler Evaluation            01/01/70 00:00      
                                    COMPARE            01/01/70 00:00      
                                       compare            01/01/70 00:00      
                                          Still not out of time for C            01/01/70 00:00      
                                             Still not out of time for C            01/01/70 00:00      
                                                Read up on pointer            01/01/70 00:00      
                                                   Read up on pointer            01/01/70 00:00      
                                                      Me or you?            01/01/70 00:00      
                                                   Or do not use a pointer            01/01/70 00:00      
                                                      working code            01/01/70 00:00      
                                                         Describe your work process            01/01/70 00:00      
                                                            v            01/01/70 00:00      
                                                               Did you read? Did you debug?            01/01/70 00:00      
                                                         Why dont you define correct id in "code" space            01/01/70 00:00      
                                                            Hoping to get someone relegated?            01/01/70 00:00      
   Reading or Transmitting Data            01/01/70 00:00      
      Reading or Transmitting Data            01/01/70 00:00      
   a trip to the wild blue younder            01/01/70 00:00      
      This is where it gets lost            01/01/70 00:00      
   The fundamental problem is...            01/01/70 00:00      
      Same as its always been,            01/01/70 00:00      
         Yep I cannot think            01/01/70 00:00      
            Yep I cannot think            01/01/70 00:00      
               Why too late?            01/01/70 00:00      
            for a simple task ...            01/01/70 00:00      
               More than one way to skin a cat            01/01/70 00:00      
                  my $0.02            01/01/70 00:00      
                     If you can not code it in ASM ...            01/01/70 00:00      

Back to Subject List