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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/15/09 12:26
Modified:
  06/15/09 13:55

Read: times


 
#166087 - Still not out of time for C
Responding to: ???'s previous message
i've missed the deadline for my project but my teacher gave me another shot at it and we both decided i should try to write the program in Keil as i wasn't able to do it in assemble. So if you still want to help me please do. I remind u that i have a 89s52 controller conected to a rfid card reader.The reader provides a 12 bytes ID (0x0A+10 data bytes+0x0D)from a tag that is swiped in front of it. I have to compare the ID received from reader with one stored in memory .
For the moment i only wrote a small program that glows a led if i receive something from the reader
#include <REGX52.h> 

#define Baud_rate 0xF4

void main(){
	TMOD=0x20;
	SCON=0x50;
	TH1=Baud_rate;
	TL1=Baud_rate;
	TR1=1;

	while(1){
	while(RI==0);
	P1_0=0;
	RI=0;
	}
}


 

Now i want to write a code for reading an ID,checking if it starts with 0A and ends with 0D,store the rest 10 bytes and glow a led at the end of this operations but it is not working.Pls help me.


#include <REGX52.h> 
#include<string.h>

#define Baud_rate 0xF4

init();
void store();

void main(){
	init();
	while(1){
		while(RI==0);  //waiting for receive
		P1_0=1;
		store();		
	}
}

init(){
	TMOD=0x20;
	SCON=0x50;
	TH1=Baud_rate;
	TL1=Baud_rate;
	TR1=1;
	return;
}

void store(){
	char *var,i,tagno[10];
   	
	while(RI==0);
	*var=SBUF;
	RI=0;
	if(var==0x0A){				 //check if first byte is 0x0A
		var=&tagno[0];
  		for(i=0;i<9;i++){
  			while(RI==0);
			*var=SBUF;
			RI=0;
			var++;
  		}
		while(RI==0);
		*var=SBUF;
		RI=0;
		if(var==0x0D){P1_0=0;}	 //check if last byte is 0x0D
	 }
}

 



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