This article is a continuation of the series of tutorials on the LPC2148 Microcontroller (ARM7). The aim of this series is to provide easy and practical examples that anyone can understand. In the previous tutorial, we have interfaced the GSM module with LPC2148 (ARM7). In this tutorial, we are going to see RFID Interfacing with LPC2148. So in this tutorial, we will use EM18 RFID Reader Module. Because it will give the data via serial communication. Before interfacing please have a look at How Does RFID Works?
Suggestion to read
Why EM18?
EM-18 RFID reader is one of the commonly used RFID readers to read 125KHz tags. It features low cost, low power consumption, small form factor, and easy to use. It provides both UART and Wiegand26 output formats. It can be directly interfaced with microcontrollers using UART and with PC using an RS232 converter. Just power the module, and it will read any RFID card within range.
It will output the card’s ID in a serial string, which can easily be read by any microcontroller. The spacing on the pins is 2.54 mm, which means the module will directly fit on a breadboard.
Features
- 5V supply
- 125kHz read frequency
- EM4001 64-bit RFID tag compatible
- 9600bps TTL and RS232 output
- Magnetic stripe emulation output
- 100mm read range
RFID Interfacing With LPC2148
Component Required
- EM18 Module
- LCD Module
- LPC2148 Development Board
Circuit Diagram
The full circuit diagram for interfacing the RFID module to LPC2148 is shown below. The unique ID code in the RFID card is read by the circuit and displayed on the 16×2 LCD display.
LCD:
RS – P1.16
RW – P1.17
EN – P1.18
Data Lines – P1.24 – P1.31
EM18 (RFID Reader):
RFID Reader TX – P0.1
Programming
Programming Steps
- Initialize the LCD
- Initialize the Serial Communication (9600 BaudRate)
- Receive the 12 bytes and display them into the LCD Display
In this tutorial, I’ve displayed the 12 bytes id. But you can play with that bytes. For example, You can verify the number. If it is matching you can run the motor.
Code
In this code, I’m reading the unique id number using the polling method and printing that to LCD. You can also try using a serial interrupt. You can download the project here.
#include <lpc214x.h> #define bit(x) (1<<x) void lcd_init(void); void cmd(unsigned char a); void dat(unsigned char b); void show(unsigned char *s); void lcd_delay(void); void ser_init(void); void tx(unsigned char c); unsigned char rx(void); void tx_string(unsigned char *s); int main() { int i; unsigned char id[12]; IO1DIR = 0xFFFFFFFF; ser_init(); lcd_init(); cmd(0x80); show("<<SHOW UR CARD>>"); cmd(0xc0); for(i=0; i<12; i++) { id[i]=rx(); dat(id[i]); } while(1); } void lcd_init() { cmd(0x38); cmd(0x0e); cmd(0x01); cmd(0x06); cmd(0x0c); cmd(0x80); } void cmd(unsigned char a) { IO1CLR=0xFF070000; IO1SET=(a<<24); IO1CLR=bit(16); //rs=0 IO1CLR=bit(17); //rw=0 IO1SET=bit(18); //en=1 lcd_delay(); IO1CLR=bit(18); //en=0 } void dat(unsigned char b) { IO1CLR=0xFF070000; IO1SET=(b<<24); IO1SET=bit(16); //rs=1 IO1CLR=bit(17); //rw=0 IO1SET=bit(18); //en=1 lcd_delay(); IO1CLR=bit(18); //en=0 } void show(unsigned char *s) { while(*s) { dat(*s++); } } void lcd_delay() { unsigned int i; for(i=0;i<=3000;i++); } void ser_init() { VPBDIV=0x02; //PCLK = 30MHz PINSEL0|=0x05; U0LCR=0x83; U0DLL=195; U0DLM=0; U0LCR=0x03; U0TER=(1<<7); } void tx(unsigned char c) { U0THR=c; while((U0LSR&(1<<5))==0); } void tx_string(unsigned char *s) { while(*s) { tx(*s++); } } unsigned char rx() { while((U0LSR&(1<<0))==0); return U0RBR; }
You can try this code with hardware.
In our next tutorial, we will see how to interface the Ultrasonic sensor with LPC2148 (ARM7). If you want to use FreeRTOS on LPC2148, then please refer FreeRTOS series.
You can also read the below tutorials.

Embedded Software | Firmware | Linux Devic Deriver | RTOS
Hi, I’m SLR. I am a tech blogger and an Embedded Engineer. I am always eager to learn and explore tech-related concepts. And also, I wanted to share my knowledge with everyone in a more straightforward way with easy practical examples. I strongly believe that learning by doing is more powerful than just learning by reading. I love to do experiments. If you want to help or support me on my journey, consider sharing my articles, or Buy me a Coffee! Thank you for reading my blog! Happy learning!