Dear Members,

I have a Philips P89C51RD2BN Microcontroller and a 125KHz RFID Reader from Sparr Electronics.The RFID reader just reads a tag and sent the TAG ID following a carriage-return/Line-Feed
EX:'041201938C'(CR)(LF)
I wrote a code so that the microcontroller reads the data from RFID reader via UART and checks the 7 byte of the data. But while debugging in the Keil compiler I can change the data for Sbuf. But the value is not assigned to any other variable or register.In this case to 'rfid' variable. Please help me in this problem.I have attached the code for your reference.
My baud rate is 9600 and my mcu clock is 11.0592Mhz.


#include(reg51.h)
unsigned char rfid;
void main(void)
{
unsigned char i;
TMOD=0X20;
TH1=0XFA;
SCON=0X50;
TR1=1;
while(1)
{
while(RI==0);
for(i=0;i<6;i++)
{
rfid=SBUF;
}
if(rfid==0x0b)
{
P2^=0xFF;
}
else if(rfid==0x08)
{
P0^=0xFF;
}
else
{
P2=0x04;
}
RI=0;
}
}