top of page

RFID Reader EM18 Interface with 8051

Updated: Mar 9

RFID EM18


EM18 RFID reader module is used to read RFID cards that work at 125 kHz.


When an RFID card comes in the range of the reader, the unique data in the card is received by the reader in the form of an 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 UART communication or can be viewed on the PC terminal.


For more information on the EM18 RFID reader and how to use it, refer to the topic RFID Reader EM18  in the sensors and modules section.


For information on UART in 8051 and how to use it, refer to the topic on UART in 8051 in the 8051 inside section.


RFID Reader




 

8051 RFID Reader Connection Diagram




RFID Interface with 8051


  • Connect LCD data pins to PORT2 sequentially.

  • Connect LDC RS pin to P1.5, RW pin to P1.6, and E to P1.7 of the microcontroller.

  • RFID TX pin connects to the P3.0(RXD) of the microcontroller.

 

Example


Read the RFID tags using an EM-18 RFID reader and send this data serially to the 8051 microcontroller. Then, display the 12 Byte unique ID on the LCD16x2 display.


Programming Step


  • Initialize UART communication.

  • Initialize the LCD16x2 display.

  • Now, wait for 12-byte to receive and then display it on LCD16x2.


RFID EM18 Reader Code 8051


/*
 * 8051_RFID_project_file.c
 *
 * http://www.electronicwings.com
 */

#include<reg51.h>
#include<string.h>
#include <stdio.h>
#include"UART_H_file.h"	/* Add UART Library */
#include"LCD_8_BIT.h"	/* Add LCD16x2 Library */

void main()
{
	int l;
	char RFID[15];
	memset(RFID,0,15);
	UART_Init();	/* Initialize UART communication  */
	LCD_Init();	/* Initialize LCD16x2 display */
	LCD_String_xy(0,0);/* Set row and column position at 0,0 location */
	LCD_String("RFID:");
	while(1)
	{
		for(l=0;l<12;l++)
		{ 
			RFID[l]=UART_RxChar();
		}
		LCD_String_xy(0,1);
		LCD_String(RFID);  /* Print 12 digit tag on LCD */	 
	}	
}

Components Used





4 views0 comments

Comments


bottom of page