As explained earlier (refer RFID interfacing with 8051 & with AVR), an RFID module consists of an RFID Reader, a line converter (usually MAX232) and a COM port. The line converter of this module converts the TTL logic voltage of RFID Reader to RS232 logic. Therefore, to convert the voltage level from such an RFID module, another MAX232 is used to interface it with a microcontroller.
One can also use an RFID Reader directly to interface with the controller, thus avoiding the need of voltage level converters. Here both the MAX232s have been eliminated from the circuit and RFID reader is directly connected with the PIC microcontroller.
The following table explains the pin diagram of the RFID Reader module.
Supply Voltage; 5V
Beep or LED drive
High is RS232, Low is Weigand
TTL output data
Weigand Data 1
Weigand Data 0
Another part of the RFID system is RFID tag, which contains 12 bytes of unique data. As the tag comes in the range of the Reader Module, it gets activated and transmits this unique code. (For more detail on working of RFID system, refer the article on RFID) The objective here is to receive this 12 byte unique code and display on a 16x2 LCD using PIC18F4550.
With the RFID interfacing, this article also explains the USART interrupt which is an internal interrupt. (For external interrupts, refer PIC Hardware interrupts) The internal interrupts, unlike hardware interrupts, are associated with internal peripherals of the controller. To use the USART interrupt, following registers have to be configured accordingly.
1. INTCON (Interrupt Control Register)
PEIE/GIEL: This bit is used to enable/disable all the peripheral interrupts (Internal interrupts) of the controller. But GIE/GIEH bit must be set to high first.
1 = Enables all Peripheral Interrupts
0 = Disables all Peripheral Interrupts
GIE/GIEH: This is Global Interrupt Enable bit. This bit is set to high to enable all interrupts of the PIC18F4550.
1 = Enables interrupts
0 = Disables all interrupts
2. PIR1 (Peripheral Interrupt Request 1)
TXIF: This is Transmission interrupt flag which is set to high when TXREG* is empty.
RCIF: This is Reception interrupt flag which is set to low when reception is complete.
*TXREG : EUSART Transmit Register (The data to be transmitted is stored in this register)
3. PIE1 (Peripheral Interrupt Enable 1)
TXIE: This bit is used to enable/disable the Transmission (Tx) interrupt.
RCIE: This bit is used to enable/disable the Reception (Rx) interrupt.
The connections of RFID reader module and LCD with the microcontroller are shown in the circuit diagram tab.
1. Set the baud rate of PIC’s USART of to 9600 bps.
2. Set the SPEN and CREN bits to ‘1’ (RCSTA Register).
3. Set the GIE and PEIE to ‘1’ (INTCON Register).
4. Store the 12 byte data into an array when Reception Interrupt is generated.