RFID Reader EM18 Interface with PIC18F4550
Introduction
EM18 RFID reader module is used to read RFID cards which work at 125 kHz.
When a RFID card comes in the range of the reader, the unique data in the card is received by the reader in the form of RF signal.
The reader then transmits this data in byte form on its serial transmit pin.
This data can be read by a microcontroller using USART communication or can be viewed on PC terminal.
For more information on EM18 RFID reader and how to use it, refer the topic RFID Reader EM18in the sensors and modules section.
For information on USART in PIC18F4550 and how to use it, refer the topic on USART in PIC18F4550 in the PIC inside section.
EM-18 RFID Reader Module
EM18 RFID reader module is used to read RFID cards which work at 125 kHz.
When a RFID card comes in the range of the reader, the unique data in the card is received by the reader in the form of RF signal.
The reader then transmits this data in byte form on its serial transmit pin.
This data can be read by a microcontroller using USART communication or can be viewed on PC terminal.
For more information on EM18 RFID reader and how to use it, refer the topic RFID Reader EM18in the sensors and modules section.
For information on USART in PIC18F4550 and how to use it, refer the topic on USART in PIC18F4550 in the PIC inside section.
EM-18 RFID Reader Module
Interfacing Diagram
RFID Reader Module Interfacing with PIC18F4550
RFID Reader Module Interfacing with PIC18F4550
Example
Read the RFID tags using EM-18 RFID reader and send this data serially to the PIC18F4550 microcontroller. Then, display the 12 Byte unique ID on LCD16x2 display.
Read the RFID tags using EM-18 RFID reader and send this data serially to the PIC18F4550 microcontroller. Then, display the 12 Byte unique ID on LCD16x2 display.
Programming
- Initialize USART communication.
- Initialize LCD16x2 display.
- Now, wait for 12-byte to receive and then display it on LCD16x2.
Program
/*
* 125 kHz RFID interface with PIC18F4550
* http://www.electronicwings.com
*
*/
#include <string.h>
#include <stdio.h>
#include <pic18f4550.h>
#include "Configuration_Header_File.h"
#include "LCD_16x2_8-bit_Header_File.h"
#include "USART_Header_File.h"
void main(void)
{
unsigned char i;
unsigned char ID[13];
OSCCON=0x72; /* select internal oscillator freq = 8 Mhz */
LCD_Init(); /* initialize LCD16x2 */
USART_Init(9600); /*initialize USART Communication with 9600 baud rate */
memset(ID,0,13);
LCD_String_xy(0,0,"RFID: ");
while(1)
{
for(i=0;i<12;i++)
{
ID[i]=USART_RxChar(); /* Receiving Data and Storing it in data_in */
}
LCD_String_xy(1,0,ID); /* Send Received data to LCD */
memset(ID,0,13);
}
}
- Initialize USART communication.
- Initialize LCD16x2 display.
- Now, wait for 12-byte to receive and then display it on LCD16x2.
Program
/*
* 125 kHz RFID interface with PIC18F4550
* http://www.electronicwings.com
*
*/
#include <string.h>
#include <stdio.h>
#include <pic18f4550.h>
#include "Configuration_Header_File.h"
#include "LCD_16x2_8-bit_Header_File.h"
#include "USART_Header_File.h"
void main(void)
{
unsigned char i;
unsigned char ID[13];
OSCCON=0x72; /* select internal oscillator freq = 8 Mhz */
LCD_Init(); /* initialize LCD16x2 */
USART_Init(9600); /*initialize USART Communication with 9600 baud rate */
memset(ID,0,13);
LCD_String_xy(0,0,"RFID: ");
while(1)
{
for(i=0;i<12;i++)
{
ID[i]=USART_RxChar(); /* Receiving Data and Storing it in data_in */
}
LCD_String_xy(1,0,ID); /* Send Received data to LCD */
memset(ID,0,13);
}
}
No comments:
Post a Comment