RFID Interfacing with 8051
What is RFID?
Radio Frequency Identification (RFID) is a wireless Identification technology that uses radio waves to identify the presence of RFID tags.
The RFID system is based on two basic elements:-
1. RFID tag:- The RFID tag includes a microchip with a radio antenna mounted on a substrate that carries 12-byte unique identification numbers.
2. RFID Module:- The RFID Module is used to read unique IDs from the tags. whenever an RFID tag comes in range, the RFID reader reads its unique ID and Transmits it serially to the microcontroller.
Image of RFID Module:-
Task 1: To display an RFID Tag value on a Serial monitor.
#include<reg51.h>
#include "lcd.h"
#include "Uart.h"
char d[12];
unsigned int len=0;
void uart_begin();
void transfer(unsigned char a);
unsigned char receive();
void str(unsigned char b[]);
void restr();
void main ()
{
uart_begin();
str("Show RFID Tag :");
receive_string();
}
void uart_begin()
{
SCON=0x50;//usingg mode2 and enable port to high to receive dataa
TMOD=0x20;//to turn on timer 1 and mode2
TH1=0xFD;//baud rate 9600
TR1=1;// turn on timer1
}
void transfer(unsigned char a)
{
SBUF=a;// store the character in empty registerr
while(TI==0);//wait till flag turns to 1
TI=0;// clear again
}
unsigned char receive()
{
while(RI==0);
RI=0;
return SBUF;
}
void str(unsigned char b[])
{
unsigned int i;
for (i=0;b[i]!='\0';i++)
{
transfer(b[i]);
}
}
void recstr()
{
int i;
for(i=0;i<12;i++)
{
d[i]=receive();
}
}
Task 2:- Print The received message on 4 bit lcd
Code:-
0 Comments