- COMPILER -MIKRO C PRO
- SIMULATION -PROTEUS 8.1
- MICROCONTROLLER – AT89S51
- CRYSTAL – 11.0592MHz(use this crystal to get baud rate of 9600)
HARDWARE
CIRCUIT
OUTPUT DATA ON PC APPLICATION (X-CTU)
SIMULATION
DOWNLOAD SIMULATION FILES
PROGRAM
//RX PIN 10 (P3_0) //RFID(EM-18 MODULE)
//TX PIN 11 (P3_1)
char cardletter;
void card1(void);
void card2(void);
void card3(void);
void rfid(void);
void main() {
uart1_init(9600);
Delay_ms(100); // Wait for UART module to stabilize
UART1_Write_Text(“HI”);
while (1)
{
rfid();
}
}
void rfid(void)
{
if (UART1_Data_Ready())
{
cardletter = UART1_Read();
card1();
card2();
card3();
} Z
}
void card1(void)//card no.1000699A58BB(PRINTED NO.10539512)
{
if(cardletter==’6′)
{
while(!(UART1_Data_Ready()));
cardletter = UART1_Read();
if(cardletter==’C’)
{
UART1_Write_Text(“card found 1”);UART1_Write(0XD);}
}
}
void card2(void)//card no.180089205DEC (PRINTED NO.13708285)
{
if(cardletter==’B’)
{
while(!(UART1_Data_Ready()));
cardletter = UART1_Read();
if(cardletter==’D’)
{
UART1_Write_Text(“card found 2”);UART1_Write(0XD);
}
}
}
void card3(void)//card no.1800893719BF (PRINTED NO.13714105)
{
if(cardletter==’9′)
{
while(!(UART1_Data_Ready()));
cardletter = UART1_Read();
if(cardletter==’B’)
{ UART1_Write_Text(“card found 3”);UART1_Write(0XD);}
}
}