SlideShare a Scribd company logo
1 of 70
Download to read offline
COURSE: Embedded systems and IC design

Passport number.: A01557194
UEL ID: U0957802

LECTURER: DR.Kanan
STUDENT: Aminu Iliyasu bugaje

Title: RFID based access system using 8051 and CPLD.
Aim
- To develop an RFID based system using microcontroller (8051) and CPLD.

Objectives
- To design an appropriate schematic diagram of the microcontroller based LCD interface
- To develop a C language program to interface and display the required information
- To simulate the requirements using appropriate software
- To write a VHDL code for the requirement using CPLD device
- To design the digital system using any of the design procedure.
- To simulate the code using Xilinx software to produce the appropriate results
- To compare the microcontroller based method with the CPLD based method.
Introduction
Wireless identification is an influential competency, and RFID exposes both a
physical object’s nature and position. With the advancement in embedded system and
communication, radio frequency identification radio frequency identification (RFID)
has been used in many application such as tracking, authentication system etc. The
RFID is a new technology that incorporates the use of electromagnetic coupling in the
radio frequency (RF) portion of the electromagnetic spectrum to uniquely identify an
object, animal, or person. An RFID system consists of three components: an antenna
and transceiver (often combined into one reader) and a transponder (the tag). The
antenna uses radio frequency waves to transmit a signal that activates the transponder.
When activated, the tag transmits data back to the antenna. RFID can read the tag using
RF, meaning that the RFID reader can be read from a distance, right through your
clothes, wallet, backpack or purse. In addition the RFID tag consists of unique ID for
each tag.

Moreover RFID technology is similar to the bar code identification systems;
however some big difference between RFID and bar code technology is that RFID does
not rely on the line-of-sight reading that bar code scanning requires working. While
reading the barcodes is time consuming, RFID readers can interrogate rates of more
than 40 tags in a second.
Additionally, lots of universities around the world nowadays use RFID for
various purposes such as student accessing system, student attendance systems. In such
universities the manual process of signing is eradicated because of its drawbacks such
as waste of time, the lecturer might forget the attendance sheet; student might also
forget to sign etc.
Lastly, RFID can be applied in many systems such as tracking livestock,
preventing forgery, controlling building accessing, supporting automated checkout,
developing smart home appliances, locating children etc. Therefore by using RFID,
abundant secured access systems can be established without investing vast amount of
money.

Microcontroller Design requirement
- Power supply:- A regulated +5v power is to be provided to the microcontroller

- Crystal speed:- A crystal of 11.0592MHz is needed for perfect baud rate generation and
timing

- Input/output pins: - The microcontroller has a total number of 32 I/O pin which the LCD
and the max232 will be connected to.

RFID Design requirement

- Name: RFID-IDR-232N

- Speed : 9600 baud RS232 serial interface

- Power: Fully operation with 5VDc power supply from USB port

- Data received: 12bytes of data received include start of heading, RFID ID and start of
text.
LCD interacing with AT89C51

Figure1. A 16x2 LCD interfaced to At89c51 microcontroller

The LCD used in the assignment is a (16x2) 16 pins; namely vcc,
vss, vee, en, rs, rw, the 8bit data pins and finally the backlight pins.

Vcc,Vss and VEE: Vcc and vss provides +5v and ground, respectively, while vee
(pin3) is used for lcd contrast adjustment.

Rs, Register select: The RS pin is used for the selection of either command is to be
send to the LCD or data is to be send to the LCD. If RS=0, the instruction command
code register is selected, allowing the user to send commands such as clear display,
cursor blink, cursor goto home etc. If RS=1 the data register is selected, allowing the
user to send data to be data to be displayed on the LCD such as Ascii code for A-Z or
0-9.
R/W, read/write: R/W input allows the user to write information to the LCD or read
information from it. R/W=1 when reading; R/W=0 when writing.

En, enable: The enable pin is used by the LCD to handle information existing to its
data pins. When data is delivered to data pins, a high to low pulse must be applied to
this pin inorder for LCD to latch in the data pins. (Mazidi 2000)

D0-D7 (8bit pins)
The 8bit data pins, are used to send information to the LCD such as Ascii code
for the letters a-z or 0-9 while making RS=1.

C language code to for LCD interfaced to 8051.

Functions for 89c51 sending data to LCD

void send_data(unsigned char send_data) //Lcd data function
{

lcd_data_pin=send_data;
en=1;
rs=1;
rw=0;

// enable high
// register select is high
// write in lcd

generate_delay(1);
en=0;
}

// enable is off
Function for commanding the LCD.

void send_command(unsigned char send_comm) //Lcd command funtion
{

lcd_data_pin=send_comm;
en=1;
rs=0;
rw=0;
generate_delay(1);
en=0;

}

Function for initializing the LCD.

void lcd_ini()

//Function to initialize the LCD

{ send_command(0x38);

// 2 line 5x7 matric (D0-D7, 8bit)

generate_delay(1);
send_command(0x0F);

// Display on, cursor blinking

generate_delay(1);
send_command(0x80);

//cursor to begin at 1st line, position 1

generate_delay(1);
send_command(0x01);
}

//clear LCD.
Serial communication

The At89c51 has been equipped with Universal Asynchronous reception
and transmission functionality (UART). The asynchronous serial data communication
is widely used for character-oriented transmission where each character is placed in
between the start and stop bits called framing.

The 8051 has two pins that are used specifically for transferring and
receiving data serially; there two pins are called TxD and RxD having TTL
compatibility, therefore a driver (MAX 232 is required to make them RS232
compatible. (Mazidi 2000)

Baud rate consideration is one of the essential elements to put in place
while using the microcontroller serial communication pins. The Baud rate is the speed
at which data is transmitted serially. That is the number of bits transmitted or received
per second. It is generally expressed in bps (bits per second). AT89C51 microcontroller
can be set to transfer and receive serial data at different baud rates using software
instructions. Timer1 is used to set the baud rate of serial communication for the
microcontroller. Therefore Timer1 is used in mode2 which is an 8-bit auto reload mode.
To get baud rates well-matched with the RFID, TH1 should be loaded with the values
as shown: (Mazidi 2000)

Baud Rate (bps)

TH1 (Hex value)

9600

FD

4800

FA

2400

F4

1200

E8

In this assignment the baud rate used is 9600bps.
8051 Serial communication Registers

-

SBUF: is an 8bit register used mainly for serial communication. For a byte to be
transferred via the TxD line, it must be placed in the SBUF register. The SBUF holds
the byte of data when it is received by 8051 RxD line.
successfully sent or received. (Mazidi 2000)

- SCON: is an 8bit register used to program the start bit, stop bit and data bit etc.
SM0
0

SM1
1

SM2
0

REN
1

TB8
0

RB8
0

TI
0

RI
0

-TMOD register is a 8bit register, the lower bits are for timer0 and upper 4 bits are for
timer1. In this each case, the lower 2bit are used to the timer mode and the upper 2 bit
to specify the operation.
Gate

C
/T
0

0

M1

M0

Gate

1

0

0

C
/T
0

M1

M0

0

0

TCON (timer control) register is an 8 bit register, the upper four bit are used to store
the TF and TR bits of timer0 and 1. The lower 4 bit are set aside for controlling the
interrupt bits
TF1
0

TR1
1

TF0
0

TR0
0

IE1
0

IT1 IE0 IT0
0
0
0
(Mazidi 2000)
Programming the 8051 serial communication

When programming 8051 to either receive or transmit bytes serially,
- The TMOD reigister is loaded with value 0x20, indicating the used of timer 1 in mode2(8
bit auto reload).
- TH1 is load to set the baud rate
- SCON register is load value 0x50, indicating serial mode 1, where an 8bit data is framed
with start and stop bits,
- TR1 must be set to 1 to start timer 1
- RI or TI are cleared by TI=0 or RI =0 instruction
- When reception is completed RI =1, the SBUF has the byte.

Sample function code for initializing 8051 UART

void serial_in()

{ SCON=0x50;
TR1=1;
TMOD=0x22;
TL1=TH1=0XFD;
TH0=0xA5;
TL0=0xFE;

//TR0=1;
// EA=1;
//ES=1;
IE=0x92;}

// Trigger Timer 1
Function for microcontroller to receive the RFID card number using interrupt
void recieve() interrupt 4 // Function to recieve data serialy from RS232
{
recieve_id[rec_count]=SBUF;
RI=0;
rec_count++;
}

// Reset the serial interrupt after recieving the byte
Function for microcontroller to count the time using interrupt 1

void timer0(void) interrupt 1
{count=count+1;
if(count==40)
{send_command(0xc3);
lcd_ascii(hr);
send_data(':');
lcd_ascii(min);
send_data(':');
lcd_ascii(sec);
count=0;
generate_delay(100);
sec=sec+1;
if(sec>59)
{sec=0;
min=min+1;
if(min>59)
{ min=0;hr=hr+1;if(hr>23){hr=0;}}}}}
System Flowchart
The flowchart gives a brief overview on how the system program works
out. The flowchart is shown below.

START

Configure all ports, UART
and devices

Display scan
card on LCD
message
Scan card on RFID
reader

is
Receive =
card_number
Yes

Display
Access granted and
student info.

No

Display Access
denied
Wrong id

Figure 2 Entire system flowcharts
#include<reg51.h>
sfr lcd_data_pin=0x80;//p0 port
sbit rs=P2^4;

// Register select pin

sbit rw=P2^5;

// Read Write pin

sbit en=P2^6;

// Enable pin

unsigned char recieve_id[12];
unsigned char rec_count=0;
unsigned int hr=0; int sec=0; int min=0;
int i,count;
sbit led=P2^0;
sbit led2=P2^1;
unsigned char message[]=" Name:Aminu bugaje Age:22 school:Legenda ";
void generate_delay(unsigned int x)
{

//Function to provide delay

int i,j;
for(i=0;i<x;i++)
for(j=0;j<1275;j++);

}
void send_command(unsigned char send_comm) //Lcd command funtion
{

lcd_data_pin=send_comm;
en=1;
rs=0;
rw=0;
generate_delay(1);
en=0;}
void send_data(unsigned char send_data) //Lcd data function
{

lcd_data_pin=send_data;
en=1;
rs=1;

// register select

rw=0;
generate_delay(1);
en=0;
}
send_str(unsigned char *data_)

//Function to send string

{
int l;
for(l=0;data_[l]!=0;l++)
{

send_data(data_[l]);

}
return 0;
}
void lcd_initialization()
{

send_command(0x38);
generate_delay(5);
send_command(0x0F);
generate_delay(5);
send_command(0x80);
generate_delay(5);

}

//Function to initialize the LCD
void lcd_ascii(unsigned int display)
{int y;
y=display/10;
send_data(y+48);
y=display%10;
send_data(y+48);
}
void timer0(void) interrupt 1
{count=count+1;
if(count==40)
{send_command(0xc3);
lcd_ascii(hr);
send_data(':');
lcd_ascii(min);
send_data(':');
lcd_ascii(sec);
count=0;
generate_delay(100);
sec=sec+1;
if(sec>59)
{sec=0;
min=min+1;
if(min>59)
{ min=0;hr=hr+1;if(hr>23){hr=0;}}}}}
void recieve() interrupt 4 //
{

Function to recieve data serialy from RS232

recieve_id[rec_count]=SBUF;

RI=0;

// Reset the serial interrupt after recieving the byte

rec_count++;
}
void check_card()
{if(( recieve_id[1]=='0')&&( recieve_id[2]=='0') &&( recieve_id[3]=='1')&&(
recieve_id[4]=='5')&&( recieve_id[5]=='9')&&( recieve_id[6]=='4')&&(
recieve_id[7]=='1')&&( recieve_id[8]=='9')&&( recieve_id[9]=='5')&&(
recieve_id[10]=='0'))
{
led2=1;
generate_delay(200);

send_command(0x01);
send_command(0xc0);
send_str("Access granted");
generate_delay(200);
led2=0;
send_command(0x01);

send_command(0x80);
send_str("Name:Aminu bugaje");
send_command(0xc3);
send_str("ID:u0957802");
generate_delay(400);
send_command(0x01);

send_command(0x80);
send_str("DOB:23/01/90");
send_command(0xc0);
send_str("22yrs");
send_command(0xc7);
lcd_ascii(hr);
send_data(':');
lcd_ascii(min);
send_data(':');
lcd_ascii(sec);
generate_delay(400);
send_command(0x01);
send_str("legenda kolej");
send_command(0x01);
send_str("legenda kolej");
generate_delay(400);
send_command(0x01);
send_command(0x01);
send_command(0x80);
send_str("You came at:");
send_command(0xc3);
generate_delay(100);
lcd_ascii(hr);
send_data(':');lcd_ascii(min);send_data(':'); lcd_ascii(sec);
generate_delay(200);send_command(0x01);}
else if(( recieve_id[1]=='1')&&( recieve_id[2]=='1') &&( recieve_id[3]=='1')&&(
recieve_id[4]=='5')&&( recieve_id[5]=='9')&&( recieve_id[6]=='4')&&(
recieve_id[7]=='1')&&( recieve_id[8]=='9')&&( recieve_id[9]=='5')&&(
recieve_id[10]=='0'))
{led2=1;
generate_delay(200);

send_command(0x01);
send_command(0xc0);
send_str("Access granted");
generate_delay(200);
led2=0;
send_command(0x01);

send_command(0x80);
send_str("Name:Aewal bugaje");
send_command(0xc3);
send_str("ID:u0957802");
generate_delay(400);
send_command(0x01);

send_command(0xc0);
send_str("age:25yrs");
send_command(0xc9);lcd_ascii(hr);send_data(':');lcd_ascii(min);send_data(':');lcd_ascii(
sec);generate_delay(400);send_command(0x01);send_str("inti
kolej");generate_delay(400);send_command(0x01);send_command(0x01);send_comma
nd(0x80);send_str("You came
at:");send_command(0xc3);generate_delay(100);lcd_ascii(hr);send_data(':');
lcd_ascii(min);send_data(':');lcd_ascii(sec);generate_delay(200);send_command(0x01);

}
else
{
led2=1;
generate_delay(200);
send_command(0x01);
send_command(0x84);
send_str("wrong id!!!");
send_command(0xc3);
send_str("Access denied!!!");
generate_delay(200); led2=0;}}
void serial_in()
{ SCON=0x50;
TR1=1;
TMOD=0x22;

//Enable Timer 1

TL1=TH1=0XFD;
TH0=0xA5;
TL0=0xFE;
TR0=1;
// EA=1;
//ES=1;
IE=0x92;}

// Trigger Timer 1
void main()
{unsigned char k;
lcd_initialization();
serial_in();
send_command(0x80);

//Place cursor to second position of first line

send_str("receiver waiting");
generate_delay(200);
while(1)
{
send_command(0x01);
send_command(0x80);

//Place cursor to second position of first line

send_str("receiver waiting");
send_command(0xc4);

//Place cursor to second position of first line

send_str("scan please");
while(rec_count!=12);
send_command(0x01);
send_command(0xC1);
for(k=1;k<11;k++)
{send_data(recieve_id[k]);
}rec_count=0;
check_card();
}
}

//Place cursor to second position of second line
Complex programmable logic device
(CPLD)
A complex programmable logic device (CPLD) comparises of multiple blocks of
logical gates on a single chip with internal wiring resource to connect the circuit blocks
and a bank of macrocells. Each logical circuit block is similar to a PLA or a PAL. The
logical gates are reprogrammable with the capabilities of performing multitude of logical
functions. Macrocells are functional blocks that perform combinational or sequential
logic, and also have the added flexibility for true or complement, along with varied
feedback paths. (Brown 2005 pp 101).
CPLD execute a variety of valuable tasks in systems design due to their unique
capabilities and as the market leader in programmable logic solutions, where Xilinx
provides a total solution to a designer’s CPLD needs
Explain the requirements if this had to be designed using CPLD.
Considering the features and benefits of using CPLDs can help enable ease of
design, lower development costs, and speed products to market. When designing systems
with CPLD, certain things must be put in place such as its logic density and I/O’s,
performance, voltage and power and finally packaging.
This section is to explore the flexibility and capability of CPLD for creating an
RS232 serial interface. The CPLD is not same as the microcontroller where an inbuilt
UART is available in the microcontroller. In this case the UART hardware module has to
design using very high speed hardware descriptive language VHDL which will lead to
the accomplishment of the RFID based system using CPLD.
The main goal will be to send string of characters or numbers from an RFID
reader to a CPLD Dev. Board and display on an LCD.
Base on the assignment requirement, the following devices are needed:
-

Xilinx CoolRunner-II CPLD’s chip with complete power supply and reset circuit
-

Clock generator

-

JTAG programmer

-

Level translator for LCD and MAX232
Schematic summary
The main parts in the schematic for this assignment are the CPLD Dev Board,
16x2 LCD, power supply, MAX232, JTAG, Level translator.
Design requirements.
Power regulation
The power regulation circuit converts the +12v from the adaptor to a steady +3.3v
output to the CPLD.
CPLD Dev Board
The development board contains a PLCC Xilinx cool runner II CPLD chip with
power supply section and JTAG connectors for programming. The Xilinx cool runner II
CPLDs deliver the high speed and ease of used associated with the XC9500/XL/XV
CPLD family with extremely low power versality of the XPLA3 family in a single
CPLD. This means that the exact same part can be used for high speed data
communications etc.
16X2 LCD connection
The 16x2 LCD makes 11 digital I/O connections to the CPLD when used in 8 bit
mode. The rest of the LCD’s pin are power connection and contrast from the 10kΩ
potentiometer.
Clock generator
Mostly a clock above 10MHz will be fine for this assignment. The clock is used
as a timing device.
`

MAX 232 circuit
The RS232 interface circuit consists of the CPLD, its 25.175MHz crystal clock

and the MAX232. The max232 translates the +12V higher voltage RS232 signals into
TTL logic that can be understood by the CPLD.
Level translator.
The CPLD device provides an output voltage of 3.3volts whereas the LCD and
the Max232 require 5v to operate, therefore the use of a level translator is necessary for
this design. The MAX30xxx family was chosen for this purpose.
The MAX3000E/MAX3001E/MAX3002–MAX3012 8channel level translators
provide the level shifting necessary to allow data transfer in a multi voltage system.
Externally applied voltages, VCC and V, set the logic levels on either side of the device.
Logic signals present on the VLL side of the device appear as a higher voltage logic
signal on the V side of the device, and vice-versa. (Max3004 datasheet).
Digital system using Dip trace software

Complete circuit interfaced to CPLD via Level translator
JTAG programmer interfaced to CPLD via TCK,TDI,TDO and TMS pins

MAX232 interfaced to CPLD via Level translator
LCD interfaced to CPLD via Level translator.
VHDL code for the requirement.
The VHDL code the RFID based system is shown below. As can be seen, it consists of
ENTITY, which is a description of the pins (PORTS) of the circuit, and of an
ARCHITECTURE, which describes how the circuit should function.
-- Name: Aminu iliyasu bugaje
------------------------------------------------------library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity lcdass is
port (

receiver_input

:in std_logic;

receiver_cleaar :out std_logic;
LCDDATAPORT

: out std_logic_vector(7 downto 0);

LCD_register_select

: out std_logic;

LCD_read_write

: out std_logic;

LCD_enable

reset

: out std_logic;

:in std_logic;

---clk in std_logic;
receiver_clock

:in std_logic;

user_identity_string_received:in std_logic;
data_received

: out std_logic_vector (7 downto 0);

enable_reception :in std_logic
); end lcdass;
architecture rfid_assignment of lcdass is
signal CARD_IDENTITY0: std_logic_vector(7 downto 0);
signal CARD_IDENTITY1: std_logic_vector(7 downto 0);
signal CARD_IDENTITY2: std_logic_vector(7 downto 0);
signal CARD_IDENTITY3: std_logic_vector(7 downto 0);
signal CARD_IDENTITY4: std_logic_vector(7 downto 0);
signal CARD_IDENTITY5: std_logic_vector(7 downto 0);
signal CARD_IDENTITY6: std_logic_vector(7 downto 0);
signal CARD_IDENTITY7: std_logic_vector(7 downto 0);
signal CARD_IDENTITY8: std_logic_vector(7 downto 0);
signal CARD_IDENTITY9: std_logic_vector(7 downto 0);
signal reception_reister

:std_logic_vector (7 downto 0);

signal reception_counter :std_logic_vector (3 downto 0);
signal count_received

:std_logic_vector (3 downto 0);

signal reception_error_in :std_logic;
signal receiver_overflow:std_logic;
signal received_count1:std_logic;
signal received_count2:std_logic;

signal receiver_busy

:std_logic;

signal receiver_cleared :std_logic;
Signal uart_pnt:std_logic_vector(3 downto 0);
signal Reception_buffer_register :std_logic_vector(32 downto 0);
begin
-- UART reception code
process (receiver_clock , reset) begin
if (receiver_busy

= '1') then

reception_counter <= reception_counter + 1;
if (reception_counter = 7) then
if ((received_count2= '1') and (count_received = 0)) then
receiver_busy
else

<= '0';
count_received <= count_received + 1;
if (count_received > 0 and count_received < 9) then
reception_reister(conv_integer(count_received) - 1) <= received_count2;
end if;
if (count_received = 9) then
receiver_busy

<= '0';

if (reset = '1') then
reception_reister
data_received

<= (others=>'0');
<= (others=>'0');

reception_counter <= (others=>'0');
count_received

<= (others=>'0');

reception_error_in <= '0';

receiver_overflow <= '0';
receiver_cleared <= '1';
received_count1 <= '1';
received_count2 <= '1';
receiver_busy <= '0';
for j in 0 to 50 loop
Reception_buffer_register(j)<='0';
end loop;
uart_pnt<="0000";
elsif (rising_edge(receiver_clock )) then
received_count1 <= receiver_input;
received_count2<= received_count1;
if (user_identity_string_received= '1') then
data_received <= reception_reister;
receiver_cleared <= '1';
end if;
if (enable_reception = '1') then -- data is received when receiver=1;
if (receiver_busy= '0' and received_count2= '0') then
receiver_busy<= '1';
reception_counter <= X"1";
count_received <= X"0";
end if;

-if uart_pnt="0000" then

CARD_IDENTITY0(0)<=reception_reister(0);CARD_IDENTITY0(1)<=reception_reister(0);
CARD_IDENTITY0(2)<=reception_reister(0);CARD_IDENTITY0(3)<=reception_reister(0);
CARD_IDENTITY0(4)<=reception_reister(0);CARD_IDENTITY0(5)<=reception_reister(0);
CARD_IDENTITY0(6)<=reception_reister(0);CARD_IDENTITY0(7)<=reception_reister(0);
end if;
if uart_pnt="0001" then

CARD_IDENTITY1(0)<=reception_reister(0);CARD_IDENTITY1(1)<=reception_reister(0);

CARD_IDENTITY1(2)<=reception_reister(0);CARD_IDENTITY1(3)<=reception_reister(0);

CARD_IDENTITY1(4)<=reception_reister(0);CARD_IDENTITY1(5)<=reception_reister(0);

CARD_IDENTITY1(6)<=reception_reister(0);CARD_IDENTITY1(7)<=reception_reister(0);
end if;
if
if uart_pnt="0010" then

CARD_IDENTITY2(0)<=reception_reister(0);CARD_IDENTITY2(1)<=reception_reister(0);

CARD_IDENTITY2(2)<=reception_reister(0);CARD_IDENTITY2(3)<=reception_reist
er(0);

CARD_IDENTITY2(4)<=reception_reister(0);CARD_IDENTITY2(5)<=reception_reist
er(0);

CARD_IDENTITY2(6)<=reception_reister(0);CARD_IDENTITY2(7)<=reception_reist
er(0);
end if;
if
uart_pnt="0011" then

CARD_IDENTITY3(0)<=reception_reister(0);CARD_IDENTITY3(1)<=reception_reister(0);

CARD_IDENTITY3(2)<=reception_reister(0);CARD_IDENTITY3(3)<=reception_reister(0);

CARD_IDENTITY3(4)<=reception_reister(0);CARD_IDENTITY3(5)<=reception_reister(0);

CARD_IDENTITY3(6)<=reception_reister(0);CARD_IDENTITY3(7)<=reception_reister(0);
end if;
if uart_pnt="0100" then

CARD_IDENTITY4(0)<=reception_reister(0);CARD_IDENTITY4(1)<=reception_reister(0);

CARD_IDENTITY4(2)<=reception_reister(0);CARD_IDENTITY4(3)<=reception_reister(0);

CARD_IDENTITY4(4)<=reception_reister(0);CARD_IDENTITY4(5)<=reception_reister(0);

CARD_IDENTITY4(6)<=reception_reister(0);CARD_IDENTITY4(7)<=reception_reister(0);

end if;
if uart_pnt="0101" then

CARD_IDENTITY5(0)<=reception_reister(0);CARD_IDENTITY5(1)<=reception_reister(0);

CARD_IDENTITY5(2)<=reception_reister(0);CARD_IDENTITY5(3)<=reception_reister(0);

CARD_IDENTITY5(4)<=reception_reister(0);CARD_IDENTITY5(5)<=reception_reister(0);

CARD_IDENTITY5(6)<=reception_reister(0);CARD_IDENTITY5(7)<=reception_reister(0);
end if;

if uart_pnt="0110" then

CARD_IDENTITY6(0)<=reception_reister(0);CARD_IDENTITY6(1)<=reception_reister(0);

CARD_IDENTITY6(2)<=reception_reister(0);CARD_IDENTITY6(3)<=reception_reister(0);

CARD_IDENTITY6(4)<=reception_reister(0);CARD_IDENTITY6(5)<=reception_reister(0);

CARD_IDENTITY6(6)<=reception_reister(0);CARD_IDENTITY6(7)<=reception_reister(0);
end if;
if uart_pnt="0111" then

CARD_IDENTITY7(0)<=reception_reister(0);CARD_IDENTITY7(1)<=reception_reister(0);

CARD_IDENTITY7(2)<=reception_reister(0);CARD_IDENTITY7(3)<=reception_reister(0);

CARD_IDENTITY7(4)<=reception_reister(0);CARD_IDENTITY7(5)<=reception_reister(0);

CARD_IDENTITY7(6)<=reception_reister(0);CARD_IDENTITY7(7)<=reception_reister(0);
end if;
if uart_pnt="1000" then

CARD_IDENTITY8(0)<=reception_reister(0);CARD_IDENTITY8(1)<=reception_reister(0);

CARD_IDENTITY8(2)<=reception_reister(0);CARD_IDENTITY8(3)<=reception_reister(0);

CARD_IDENTITY8(4)<=reception_reister(0);CARD_IDENTITY8(5)<=reception_reister(0);

CARD_IDENTITY8(6)<=reception_reister(0);CARD_IDENTITY8(7)<=reception_reister(0);
end if;

if uart_pnt="1001" then

CARD_IDENTITY9(0)<=reception_reister(0);CARD_IDENTITY9(1)<=reception_reister(0);

CARD_IDENTITY9(2)<=reception_reister(0);CARD_IDENTITY9(3)<=reception_reister(0);

CARD_IDENTITY9(4)<=reception_reister(0);CARD_IDENTITY9(5)<=reception_reister(0);

CARD_IDENTITY9(6)<=reception_reister(0);CARD_IDENTITY9(7)<=reception_reister(0)
end if;

if uart_pnt="0011" then

uart_pnt<="0000";

-- code to compare the RFID card number with the stored coded number
if(card_identity0=0 and card_identity1=0 and card_identity2=1 and
card_identity3=5 and card_identity4=0and card_identity5=1 and
card_identity6=5 and card_identity7=0 and card_identity8=1 and card_identity9=5) then
--- if correct then dispaly students info on lcd AMINU, age, school
--initialize LCD
LCD_register_select<='0'; LCD_read_write
<='0';LCDDATAPORT<="00111000";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write command 0x38
LCD_register_select<='0'; LCD_read_write
<='0';LCDDATAPORT<="00001110";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write command 0x0e
LCD_register_select<='0'; LCD_read_write
<='0';LCDDATAPORT<="00000110";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write command 0x06
LCD_register_select<='0'; LCD_read_write
<='0';LCDDATAPORT<="00000001";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write command 0x01

--SEND MY NAME TO THE LCD "AMINU"
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01000001";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data A
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01001101";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data M
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01001001";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data I
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01001110";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data N
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01010101";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data U
--SEND MY UEL ID TO THE LCD "u095782"
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01010101";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data U
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="00110000";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data 0
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="00111001";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data 9
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="00110101";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data 5
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="00110111";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data 7
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="00111000";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data 8
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="00110000";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data 0

LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="00110010";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data 2
--SEND MY AGE TO THE LCD "AGE:22 YEARS"
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01000001";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data A
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01000111";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data G
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01000101";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data E
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="00111010";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data :
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="00110010";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data 2
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="00110010";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data 2
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01011001";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data Y
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01000101";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data E
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01000001";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data A

LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01010010";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data R
--SEND MY COLLGE: TO THE LCD " COLLEGE:LINTON"
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01000011";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data C
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01000001";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data O
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01001100";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data L
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01001100";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data L
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01000101";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data E
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01000111";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data G

LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01000101";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data E
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="00111010";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data :
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01001100";LCD_enable<='1';

for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data L
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01001010";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data I
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01001110";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data N
LCD_register_select<='1'; LCD_read_write
<='0';LCDDATAPORT<="01010100";LCD_enable<='1';
LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01010100";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data

T

LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01001111";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data

O

LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01001110";LCD_enable<='1';
for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data
end if;
end if;
if (received_count2= '0') then
reception_error_in<= '1';
else
receiver_cleared <= '0';
reception_error_in<= '0';
if (receiver_cleared = '1') then
receiver_overflow<= '0';
else
receiver_overflow<= '1';
end if;
end if;
end if;
end if;
end if;
end if;
end if; if (enable_reception = '0') then
receiver_busy

<= '0';

end if; end if; end process; receiver_cleaar <= receiver_cleared;
end rfid_assignment;

N
Comparison between the Microcontroller based and the CPLD based system.

Microcontroller

CPLD

Microcontroller has built in

CPLD only consists of logical

CPU, and other peripherals

blocks of gates that can be

such as ADC, UART, and

rewired electrically using Very

PWM

the

high speed hardware descriptive

inbuilt UART was simply

language. Therefore the UART

configured using C language

hardware has to be built through

for the RFID application.

VHDL program for the RFID

etc.

Therefore

application.
Microcontroller

is

CPLDs are programmed based

software

on Hardware approach called

approach which can be C

VHDL language suited for very

language, assembly language

fast applications.

programmed

etc.

by

suited

for

medium

performance and control.
Microcontroller
instruction

by

executes
instruction

CPLD

supports

concurrent

logical execution of instruction.

(sequentially).
Microcontroller is moderately slow
for

processing

applications

complex

system

CPLDs are used where low
power

and

required.

high

speed

are
Xilinx simulation using testbench approach
Lcd simulation.
Uart code and LCD code together

Lcd and UART together
LCD and UART together

Conclusions
Firstly in the first section of the assignment, an 8051 microcontroller based RFID
system was built with an RS232 interface via max232 which worked perfectly, while the
second section was by using a CPLD device where hardware module for an RS232
interface was made using VHDL and by using the code the CPLD was able to receive
data’s from an RFID reader. These data’s where translated and displayed on an LCD
display which was achieved successfully.
Additionally, the difference between microcontroller based design and the CPLD
design was that, the microcontroller had its in built CPUs with other peripherals such are
UART, with distinct input/output ports programmed using software approach to instruct
the CPU based on the commands while CPLD consists of group of isolated number of
logical gates which are attached together using VHDL code used for complex and high
speed application.
Lastly, RFID can be applied in many systems such as tracking livestock,
preventing forgery, controlling building accessing, supporting automated checkout,
developing smart home appliances, locating children etc. Therefore by using RFID,
abundant secured access systems can be established without investing vast amount of
money.

Reference
a. Mazidi.M.A., Mazidi J.G., 2000,“8051 Microcontroller and Embedded Systems”,Upper
Saddle River, N.J. Pearson Edu. Inc.
b. Brown.S, Vranesic.Z. , 2005,” Fundamentals of Digital Logic with VHDL Design”, 2nd
Edition, Mc Graw Hill International Edition.
c. Volnei A. Pedroni, 2004, Circuit Design with VHDL, 1st ed. MIT Press Cambridge,
Massachusetts London, England
Appendix
Keil Uvsion
Radio frequency identification system
Radio frequency identification system
Radio frequency identification system
Radio frequency identification system
Radio frequency identification system
Radio frequency identification system
Radio frequency identification system
Radio frequency identification system
Radio frequency identification system

More Related Content

What's hot

Analog I/O in PIC16F877A
Analog I/O in PIC16F877AAnalog I/O in PIC16F877A
Analog I/O in PIC16F877AMohamed Bedair
 
Fpga implementation of multi protocol data
Fpga implementation of multi protocol dataFpga implementation of multi protocol data
Fpga implementation of multi protocol dataeSAT Publishing House
 
Practical Data Communications & Networking for Engineers & Technicians
Practical Data Communications & Networking for Engineers & Technicians Practical Data Communications & Networking for Engineers & Technicians
Practical Data Communications & Networking for Engineers & Technicians Living Online
 
Xcs 234 microprocessors
Xcs 234 microprocessorsXcs 234 microprocessors
Xcs 234 microprocessorssweta suman
 
Embedded Systems,Embedded Systems Project,Winter training,
Embedded Systems,Embedded Systems Project,Winter training,Embedded Systems,Embedded Systems Project,Winter training,
Embedded Systems,Embedded Systems Project,Winter training,Technogroovy
 
Programming pic microcontrollers
Programming pic microcontrollersProgramming pic microcontrollers
Programming pic microcontrollersMAIYO JOSPHAT
 
Full Custom IC Design Implementation of Priority Encoder
Full Custom IC Design Implementation of Priority EncoderFull Custom IC Design Implementation of Priority Encoder
Full Custom IC Design Implementation of Priority EncoderBhargavKatkam
 
Pic microcontrollers for_beginners
Pic microcontrollers for_beginnersPic microcontrollers for_beginners
Pic microcontrollers for_beginnersPraveen Chary
 
Review on Transmission and Reception of Data through USB in VHDL
Review on Transmission and Reception of Data through USB in VHDLReview on Transmission and Reception of Data through USB in VHDL
Review on Transmission and Reception of Data through USB in VHDLIRJET Journal
 
Multiple Channel Serial I/O Interfacing using FPGA Kit
Multiple Channel Serial I/O Interfacing using FPGA KitMultiple Channel Serial I/O Interfacing using FPGA Kit
Multiple Channel Serial I/O Interfacing using FPGA Kitijsrd.com
 
Datasheet stvc070 wt 03
Datasheet stvc070 wt 03Datasheet stvc070 wt 03
Datasheet stvc070 wt 03Display module
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051guest70d48b1
 
Embedded &amp; pcb design
Embedded &amp; pcb designEmbedded &amp; pcb design
Embedded &amp; pcb designTanveer Behl
 
RF based Wireless Robot using 8051 Microcontroller
RF based Wireless Robot using 8051 MicrocontrollerRF based Wireless Robot using 8051 Microcontroller
RF based Wireless Robot using 8051 MicrocontrollerRahul Kumar
 

What's hot (20)

Analog I/O in PIC16F877A
Analog I/O in PIC16F877AAnalog I/O in PIC16F877A
Analog I/O in PIC16F877A
 
Fpga implementation of multi protocol data
Fpga implementation of multi protocol dataFpga implementation of multi protocol data
Fpga implementation of multi protocol data
 
Practical Data Communications & Networking for Engineers & Technicians
Practical Data Communications & Networking for Engineers & Technicians Practical Data Communications & Networking for Engineers & Technicians
Practical Data Communications & Networking for Engineers & Technicians
 
Badal sharma
Badal sharmaBadal sharma
Badal sharma
 
Chapter5 dek3133
Chapter5 dek3133Chapter5 dek3133
Chapter5 dek3133
 
Xcs 234 microprocessors
Xcs 234 microprocessorsXcs 234 microprocessors
Xcs 234 microprocessors
 
Embedded Systems,Embedded Systems Project,Winter training,
Embedded Systems,Embedded Systems Project,Winter training,Embedded Systems,Embedded Systems Project,Winter training,
Embedded Systems,Embedded Systems Project,Winter training,
 
Intrerfacing i
Intrerfacing iIntrerfacing i
Intrerfacing i
 
Digital i o
Digital i oDigital i o
Digital i o
 
Programming pic microcontrollers
Programming pic microcontrollersProgramming pic microcontrollers
Programming pic microcontrollers
 
Full Custom IC Design Implementation of Priority Encoder
Full Custom IC Design Implementation of Priority EncoderFull Custom IC Design Implementation of Priority Encoder
Full Custom IC Design Implementation of Priority Encoder
 
Pic microcontrollers for_beginners
Pic microcontrollers for_beginnersPic microcontrollers for_beginners
Pic microcontrollers for_beginners
 
Review on Transmission and Reception of Data through USB in VHDL
Review on Transmission and Reception of Data through USB in VHDLReview on Transmission and Reception of Data through USB in VHDL
Review on Transmission and Reception of Data through USB in VHDL
 
Multiple Channel Serial I/O Interfacing using FPGA Kit
Multiple Channel Serial I/O Interfacing using FPGA KitMultiple Channel Serial I/O Interfacing using FPGA Kit
Multiple Channel Serial I/O Interfacing using FPGA Kit
 
Datasheet stvc070 wt 03
Datasheet stvc070 wt 03Datasheet stvc070 wt 03
Datasheet stvc070 wt 03
 
Microcontroller 8051
Microcontroller 8051Microcontroller 8051
Microcontroller 8051
 
Embedded &amp; pcb design
Embedded &amp; pcb designEmbedded &amp; pcb design
Embedded &amp; pcb design
 
DAC and sensor interfacing with PIC
DAC and sensor interfacing with PICDAC and sensor interfacing with PIC
DAC and sensor interfacing with PIC
 
Important questions
Important questionsImportant questions
Important questions
 
RF based Wireless Robot using 8051 Microcontroller
RF based Wireless Robot using 8051 MicrocontrollerRF based Wireless Robot using 8051 Microcontroller
RF based Wireless Robot using 8051 Microcontroller
 

Similar to Radio frequency identification system

Biometric smart card polling system12
Biometric smart card polling system12Biometric smart card polling system12
Biometric smart card polling system12premkarthik06
 
Rfid interfacing & controlling with 8051
Rfid interfacing & controlling with 8051Rfid interfacing & controlling with 8051
Rfid interfacing & controlling with 8051Akshay Dhole
 
RFID based Access Control using 8051 Micro Controller
RFID based Access Control using 8051 Micro ControllerRFID based Access Control using 8051 Micro Controller
RFID based Access Control using 8051 Micro ControllerCircuitsToday
 
Tracking police man using rf proximity card
Tracking police man using rf proximity cardTracking police man using rf proximity card
Tracking police man using rf proximity cardAlbert Jose
 
Vehicle tracking system with thiefth protection
Vehicle tracking system with thiefth protectionVehicle tracking system with thiefth protection
Vehicle tracking system with thiefth protectionSarfz Ahmad
 
Moving message display
Moving message displayMoving message display
Moving message displayviraj1989
 
Training Report on embedded Systems and Robotics
Training Report on embedded  Systems and RoboticsTraining Report on embedded  Systems and Robotics
Training Report on embedded Systems and RoboticsNIT Raipur
 
RFID Based Toll Gate System
RFID Based Toll Gate SystemRFID Based Toll Gate System
RFID Based Toll Gate SystemAmeer Khan
 
Wireless fuel level sensor using rfid
Wireless fuel level sensor using rfidWireless fuel level sensor using rfid
Wireless fuel level sensor using rfidSriteja Rst
 
Fire Fighter Robot with Night Vision Camera (1).pptx
Fire Fighter Robot with Night Vision Camera (1).pptxFire Fighter Robot with Night Vision Camera (1).pptx
Fire Fighter Robot with Night Vision Camera (1).pptxSyedMohiuddin62
 
Robotic Project - published paper
Robotic Project - published paperRobotic Project - published paper
Robotic Project - published paperRobert Rosier
 
Micro Controller 8051 of Speedo Meter using KEIL Code
Micro Controller 8051 of Speedo Meter using KEIL CodeMicro Controller 8051 of Speedo Meter using KEIL Code
Micro Controller 8051 of Speedo Meter using KEIL CodeSunil Kumar R
 
Basic Study on the WT12 Family of Bluetooth Devices
Basic Study on the WT12 Family of Bluetooth DevicesBasic Study on the WT12 Family of Bluetooth Devices
Basic Study on the WT12 Family of Bluetooth DevicesPremier Farnell
 
NFCRFID Ripe for Application Expansion_ElectronicDesign
NFCRFID Ripe for Application Expansion_ElectronicDesignNFCRFID Ripe for Application Expansion_ElectronicDesign
NFCRFID Ripe for Application Expansion_ElectronicDesignHamed M. Sanogo
 
RFID based smart shopping cart and billing system
RFID based smart shopping cart and billing systemRFID based smart shopping cart and billing system
RFID based smart shopping cart and billing systemlaharipothula
 
Mypptinslideshare 180508104046 (1)
Mypptinslideshare 180508104046 (1)Mypptinslideshare 180508104046 (1)
Mypptinslideshare 180508104046 (1)raviteja srinivasula
 
Wireless humidity and temperature monitoring system
Wireless humidity and temperature monitoring systemWireless humidity and temperature monitoring system
Wireless humidity and temperature monitoring systemSagar Srivastav
 
Electronic voting machine using RFID
Electronic voting machine using RFIDElectronic voting machine using RFID
Electronic voting machine using RFIDBharath Chapala
 

Similar to Radio frequency identification system (20)

Biometric smart card polling system12
Biometric smart card polling system12Biometric smart card polling system12
Biometric smart card polling system12
 
Rfid interfacing & controlling with 8051
Rfid interfacing & controlling with 8051Rfid interfacing & controlling with 8051
Rfid interfacing & controlling with 8051
 
RFID based Access Control using 8051 Micro Controller
RFID based Access Control using 8051 Micro ControllerRFID based Access Control using 8051 Micro Controller
RFID based Access Control using 8051 Micro Controller
 
Tracking police man using rf proximity card
Tracking police man using rf proximity cardTracking police man using rf proximity card
Tracking police man using rf proximity card
 
Vehicle tracking system with thiefth protection
Vehicle tracking system with thiefth protectionVehicle tracking system with thiefth protection
Vehicle tracking system with thiefth protection
 
Moving message display
Moving message displayMoving message display
Moving message display
 
Training Report on embedded Systems and Robotics
Training Report on embedded  Systems and RoboticsTraining Report on embedded  Systems and Robotics
Training Report on embedded Systems and Robotics
 
RFID Based Toll Gate System
RFID Based Toll Gate SystemRFID Based Toll Gate System
RFID Based Toll Gate System
 
Wireless fuel level sensor using rfid
Wireless fuel level sensor using rfidWireless fuel level sensor using rfid
Wireless fuel level sensor using rfid
 
Akash uid ppt3
Akash uid ppt3Akash uid ppt3
Akash uid ppt3
 
Intel Quark HSUART
Intel Quark HSUARTIntel Quark HSUART
Intel Quark HSUART
 
Fire Fighter Robot with Night Vision Camera (1).pptx
Fire Fighter Robot with Night Vision Camera (1).pptxFire Fighter Robot with Night Vision Camera (1).pptx
Fire Fighter Robot with Night Vision Camera (1).pptx
 
Robotic Project - published paper
Robotic Project - published paperRobotic Project - published paper
Robotic Project - published paper
 
Micro Controller 8051 of Speedo Meter using KEIL Code
Micro Controller 8051 of Speedo Meter using KEIL CodeMicro Controller 8051 of Speedo Meter using KEIL Code
Micro Controller 8051 of Speedo Meter using KEIL Code
 
Basic Study on the WT12 Family of Bluetooth Devices
Basic Study on the WT12 Family of Bluetooth DevicesBasic Study on the WT12 Family of Bluetooth Devices
Basic Study on the WT12 Family of Bluetooth Devices
 
NFCRFID Ripe for Application Expansion_ElectronicDesign
NFCRFID Ripe for Application Expansion_ElectronicDesignNFCRFID Ripe for Application Expansion_ElectronicDesign
NFCRFID Ripe for Application Expansion_ElectronicDesign
 
RFID based smart shopping cart and billing system
RFID based smart shopping cart and billing systemRFID based smart shopping cart and billing system
RFID based smart shopping cart and billing system
 
Mypptinslideshare 180508104046 (1)
Mypptinslideshare 180508104046 (1)Mypptinslideshare 180508104046 (1)
Mypptinslideshare 180508104046 (1)
 
Wireless humidity and temperature monitoring system
Wireless humidity and temperature monitoring systemWireless humidity and temperature monitoring system
Wireless humidity and temperature monitoring system
 
Electronic voting machine using RFID
Electronic voting machine using RFIDElectronic voting machine using RFID
Electronic voting machine using RFID
 

Radio frequency identification system

  • 1. COURSE: Embedded systems and IC design Passport number.: A01557194 UEL ID: U0957802 LECTURER: DR.Kanan STUDENT: Aminu Iliyasu bugaje Title: RFID based access system using 8051 and CPLD.
  • 2. Aim - To develop an RFID based system using microcontroller (8051) and CPLD. Objectives - To design an appropriate schematic diagram of the microcontroller based LCD interface - To develop a C language program to interface and display the required information - To simulate the requirements using appropriate software - To write a VHDL code for the requirement using CPLD device - To design the digital system using any of the design procedure. - To simulate the code using Xilinx software to produce the appropriate results - To compare the microcontroller based method with the CPLD based method.
  • 3. Introduction Wireless identification is an influential competency, and RFID exposes both a physical object’s nature and position. With the advancement in embedded system and communication, radio frequency identification radio frequency identification (RFID) has been used in many application such as tracking, authentication system etc. The RFID is a new technology that incorporates the use of electromagnetic coupling in the radio frequency (RF) portion of the electromagnetic spectrum to uniquely identify an object, animal, or person. An RFID system consists of three components: an antenna and transceiver (often combined into one reader) and a transponder (the tag). The antenna uses radio frequency waves to transmit a signal that activates the transponder. When activated, the tag transmits data back to the antenna. RFID can read the tag using RF, meaning that the RFID reader can be read from a distance, right through your clothes, wallet, backpack or purse. In addition the RFID tag consists of unique ID for each tag. Moreover RFID technology is similar to the bar code identification systems; however some big difference between RFID and bar code technology is that RFID does not rely on the line-of-sight reading that bar code scanning requires working. While reading the barcodes is time consuming, RFID readers can interrogate rates of more than 40 tags in a second. Additionally, lots of universities around the world nowadays use RFID for various purposes such as student accessing system, student attendance systems. In such universities the manual process of signing is eradicated because of its drawbacks such as waste of time, the lecturer might forget the attendance sheet; student might also forget to sign etc.
  • 4. Lastly, RFID can be applied in many systems such as tracking livestock, preventing forgery, controlling building accessing, supporting automated checkout, developing smart home appliances, locating children etc. Therefore by using RFID, abundant secured access systems can be established without investing vast amount of money. Microcontroller Design requirement - Power supply:- A regulated +5v power is to be provided to the microcontroller - Crystal speed:- A crystal of 11.0592MHz is needed for perfect baud rate generation and timing - Input/output pins: - The microcontroller has a total number of 32 I/O pin which the LCD and the max232 will be connected to. RFID Design requirement - Name: RFID-IDR-232N - Speed : 9600 baud RS232 serial interface - Power: Fully operation with 5VDc power supply from USB port - Data received: 12bytes of data received include start of heading, RFID ID and start of text.
  • 5. LCD interacing with AT89C51 Figure1. A 16x2 LCD interfaced to At89c51 microcontroller The LCD used in the assignment is a (16x2) 16 pins; namely vcc, vss, vee, en, rs, rw, the 8bit data pins and finally the backlight pins. Vcc,Vss and VEE: Vcc and vss provides +5v and ground, respectively, while vee (pin3) is used for lcd contrast adjustment. Rs, Register select: The RS pin is used for the selection of either command is to be send to the LCD or data is to be send to the LCD. If RS=0, the instruction command code register is selected, allowing the user to send commands such as clear display, cursor blink, cursor goto home etc. If RS=1 the data register is selected, allowing the
  • 6. user to send data to be data to be displayed on the LCD such as Ascii code for A-Z or 0-9. R/W, read/write: R/W input allows the user to write information to the LCD or read information from it. R/W=1 when reading; R/W=0 when writing. En, enable: The enable pin is used by the LCD to handle information existing to its data pins. When data is delivered to data pins, a high to low pulse must be applied to this pin inorder for LCD to latch in the data pins. (Mazidi 2000) D0-D7 (8bit pins) The 8bit data pins, are used to send information to the LCD such as Ascii code for the letters a-z or 0-9 while making RS=1. C language code to for LCD interfaced to 8051. Functions for 89c51 sending data to LCD void send_data(unsigned char send_data) //Lcd data function { lcd_data_pin=send_data; en=1; rs=1; rw=0; // enable high // register select is high // write in lcd generate_delay(1); en=0; } // enable is off
  • 7. Function for commanding the LCD. void send_command(unsigned char send_comm) //Lcd command funtion { lcd_data_pin=send_comm; en=1; rs=0; rw=0; generate_delay(1); en=0; } Function for initializing the LCD. void lcd_ini() //Function to initialize the LCD { send_command(0x38); // 2 line 5x7 matric (D0-D7, 8bit) generate_delay(1); send_command(0x0F); // Display on, cursor blinking generate_delay(1); send_command(0x80); //cursor to begin at 1st line, position 1 generate_delay(1); send_command(0x01); } //clear LCD.
  • 8. Serial communication The At89c51 has been equipped with Universal Asynchronous reception and transmission functionality (UART). The asynchronous serial data communication is widely used for character-oriented transmission where each character is placed in between the start and stop bits called framing. The 8051 has two pins that are used specifically for transferring and receiving data serially; there two pins are called TxD and RxD having TTL compatibility, therefore a driver (MAX 232 is required to make them RS232 compatible. (Mazidi 2000) Baud rate consideration is one of the essential elements to put in place while using the microcontroller serial communication pins. The Baud rate is the speed at which data is transmitted serially. That is the number of bits transmitted or received per second. It is generally expressed in bps (bits per second). AT89C51 microcontroller can be set to transfer and receive serial data at different baud rates using software instructions. Timer1 is used to set the baud rate of serial communication for the microcontroller. Therefore Timer1 is used in mode2 which is an 8-bit auto reload mode. To get baud rates well-matched with the RFID, TH1 should be loaded with the values as shown: (Mazidi 2000) Baud Rate (bps) TH1 (Hex value) 9600 FD 4800 FA 2400 F4 1200 E8 In this assignment the baud rate used is 9600bps.
  • 9. 8051 Serial communication Registers - SBUF: is an 8bit register used mainly for serial communication. For a byte to be transferred via the TxD line, it must be placed in the SBUF register. The SBUF holds the byte of data when it is received by 8051 RxD line. successfully sent or received. (Mazidi 2000) - SCON: is an 8bit register used to program the start bit, stop bit and data bit etc. SM0 0 SM1 1 SM2 0 REN 1 TB8 0 RB8 0 TI 0 RI 0 -TMOD register is a 8bit register, the lower bits are for timer0 and upper 4 bits are for timer1. In this each case, the lower 2bit are used to the timer mode and the upper 2 bit to specify the operation. Gate C /T 0 0 M1 M0 Gate 1 0 0 C /T 0 M1 M0 0 0 TCON (timer control) register is an 8 bit register, the upper four bit are used to store the TF and TR bits of timer0 and 1. The lower 4 bit are set aside for controlling the interrupt bits TF1 0 TR1 1 TF0 0 TR0 0 IE1 0 IT1 IE0 IT0 0 0 0 (Mazidi 2000)
  • 10. Programming the 8051 serial communication When programming 8051 to either receive or transmit bytes serially, - The TMOD reigister is loaded with value 0x20, indicating the used of timer 1 in mode2(8 bit auto reload). - TH1 is load to set the baud rate - SCON register is load value 0x50, indicating serial mode 1, where an 8bit data is framed with start and stop bits, - TR1 must be set to 1 to start timer 1 - RI or TI are cleared by TI=0 or RI =0 instruction - When reception is completed RI =1, the SBUF has the byte. Sample function code for initializing 8051 UART void serial_in() { SCON=0x50; TR1=1; TMOD=0x22; TL1=TH1=0XFD; TH0=0xA5; TL0=0xFE; //TR0=1; // EA=1; //ES=1; IE=0x92;} // Trigger Timer 1
  • 11. Function for microcontroller to receive the RFID card number using interrupt void recieve() interrupt 4 // Function to recieve data serialy from RS232 { recieve_id[rec_count]=SBUF; RI=0; rec_count++; } // Reset the serial interrupt after recieving the byte
  • 12. Function for microcontroller to count the time using interrupt 1 void timer0(void) interrupt 1 {count=count+1; if(count==40) {send_command(0xc3); lcd_ascii(hr); send_data(':'); lcd_ascii(min); send_data(':'); lcd_ascii(sec); count=0; generate_delay(100); sec=sec+1; if(sec>59) {sec=0; min=min+1; if(min>59) { min=0;hr=hr+1;if(hr>23){hr=0;}}}}}
  • 13. System Flowchart The flowchart gives a brief overview on how the system program works out. The flowchart is shown below. START Configure all ports, UART and devices Display scan card on LCD message Scan card on RFID reader is Receive = card_number Yes Display Access granted and student info. No Display Access denied Wrong id Figure 2 Entire system flowcharts
  • 14. #include<reg51.h> sfr lcd_data_pin=0x80;//p0 port sbit rs=P2^4; // Register select pin sbit rw=P2^5; // Read Write pin sbit en=P2^6; // Enable pin unsigned char recieve_id[12]; unsigned char rec_count=0; unsigned int hr=0; int sec=0; int min=0; int i,count; sbit led=P2^0; sbit led2=P2^1; unsigned char message[]=" Name:Aminu bugaje Age:22 school:Legenda "; void generate_delay(unsigned int x) { //Function to provide delay int i,j; for(i=0;i<x;i++) for(j=0;j<1275;j++); } void send_command(unsigned char send_comm) //Lcd command funtion { lcd_data_pin=send_comm; en=1; rs=0; rw=0; generate_delay(1); en=0;}
  • 15. void send_data(unsigned char send_data) //Lcd data function { lcd_data_pin=send_data; en=1; rs=1; // register select rw=0; generate_delay(1); en=0; } send_str(unsigned char *data_) //Function to send string { int l; for(l=0;data_[l]!=0;l++) { send_data(data_[l]); } return 0; } void lcd_initialization() { send_command(0x38); generate_delay(5); send_command(0x0F); generate_delay(5); send_command(0x80); generate_delay(5); } //Function to initialize the LCD
  • 16. void lcd_ascii(unsigned int display) {int y; y=display/10; send_data(y+48); y=display%10; send_data(y+48); } void timer0(void) interrupt 1 {count=count+1; if(count==40) {send_command(0xc3); lcd_ascii(hr); send_data(':'); lcd_ascii(min); send_data(':'); lcd_ascii(sec); count=0; generate_delay(100); sec=sec+1; if(sec>59) {sec=0; min=min+1; if(min>59) { min=0;hr=hr+1;if(hr>23){hr=0;}}}}}
  • 17. void recieve() interrupt 4 // { Function to recieve data serialy from RS232 recieve_id[rec_count]=SBUF; RI=0; // Reset the serial interrupt after recieving the byte rec_count++; } void check_card() {if(( recieve_id[1]=='0')&&( recieve_id[2]=='0') &&( recieve_id[3]=='1')&&( recieve_id[4]=='5')&&( recieve_id[5]=='9')&&( recieve_id[6]=='4')&&( recieve_id[7]=='1')&&( recieve_id[8]=='9')&&( recieve_id[9]=='5')&&( recieve_id[10]=='0')) { led2=1; generate_delay(200); send_command(0x01); send_command(0xc0); send_str("Access granted"); generate_delay(200); led2=0; send_command(0x01); send_command(0x80); send_str("Name:Aminu bugaje"); send_command(0xc3); send_str("ID:u0957802"); generate_delay(400); send_command(0x01); send_command(0x80);
  • 19. else if(( recieve_id[1]=='1')&&( recieve_id[2]=='1') &&( recieve_id[3]=='1')&&( recieve_id[4]=='5')&&( recieve_id[5]=='9')&&( recieve_id[6]=='4')&&( recieve_id[7]=='1')&&( recieve_id[8]=='9')&&( recieve_id[9]=='5')&&( recieve_id[10]=='0')) {led2=1; generate_delay(200); send_command(0x01); send_command(0xc0); send_str("Access granted"); generate_delay(200); led2=0; send_command(0x01); send_command(0x80); send_str("Name:Aewal bugaje"); send_command(0xc3); send_str("ID:u0957802"); generate_delay(400); send_command(0x01); send_command(0xc0); send_str("age:25yrs"); send_command(0xc9);lcd_ascii(hr);send_data(':');lcd_ascii(min);send_data(':');lcd_ascii( sec);generate_delay(400);send_command(0x01);send_str("inti kolej");generate_delay(400);send_command(0x01);send_command(0x01);send_comma nd(0x80);send_str("You came at:");send_command(0xc3);generate_delay(100);lcd_ascii(hr);send_data(':'); lcd_ascii(min);send_data(':');lcd_ascii(sec);generate_delay(200);send_command(0x01); }
  • 20. else { led2=1; generate_delay(200); send_command(0x01); send_command(0x84); send_str("wrong id!!!"); send_command(0xc3); send_str("Access denied!!!"); generate_delay(200); led2=0;}} void serial_in() { SCON=0x50; TR1=1; TMOD=0x22; //Enable Timer 1 TL1=TH1=0XFD; TH0=0xA5; TL0=0xFE; TR0=1; // EA=1; //ES=1; IE=0x92;} // Trigger Timer 1
  • 21. void main() {unsigned char k; lcd_initialization(); serial_in(); send_command(0x80); //Place cursor to second position of first line send_str("receiver waiting"); generate_delay(200); while(1) { send_command(0x01); send_command(0x80); //Place cursor to second position of first line send_str("receiver waiting"); send_command(0xc4); //Place cursor to second position of first line send_str("scan please"); while(rec_count!=12); send_command(0x01); send_command(0xC1); for(k=1;k<11;k++) {send_data(recieve_id[k]); }rec_count=0; check_card(); } } //Place cursor to second position of second line
  • 22. Complex programmable logic device (CPLD) A complex programmable logic device (CPLD) comparises of multiple blocks of logical gates on a single chip with internal wiring resource to connect the circuit blocks and a bank of macrocells. Each logical circuit block is similar to a PLA or a PAL. The logical gates are reprogrammable with the capabilities of performing multitude of logical functions. Macrocells are functional blocks that perform combinational or sequential logic, and also have the added flexibility for true or complement, along with varied feedback paths. (Brown 2005 pp 101). CPLD execute a variety of valuable tasks in systems design due to their unique capabilities and as the market leader in programmable logic solutions, where Xilinx provides a total solution to a designer’s CPLD needs Explain the requirements if this had to be designed using CPLD. Considering the features and benefits of using CPLDs can help enable ease of design, lower development costs, and speed products to market. When designing systems with CPLD, certain things must be put in place such as its logic density and I/O’s, performance, voltage and power and finally packaging. This section is to explore the flexibility and capability of CPLD for creating an RS232 serial interface. The CPLD is not same as the microcontroller where an inbuilt UART is available in the microcontroller. In this case the UART hardware module has to design using very high speed hardware descriptive language VHDL which will lead to the accomplishment of the RFID based system using CPLD. The main goal will be to send string of characters or numbers from an RFID reader to a CPLD Dev. Board and display on an LCD. Base on the assignment requirement, the following devices are needed: - Xilinx CoolRunner-II CPLD’s chip with complete power supply and reset circuit
  • 23. - Clock generator - JTAG programmer - Level translator for LCD and MAX232 Schematic summary The main parts in the schematic for this assignment are the CPLD Dev Board, 16x2 LCD, power supply, MAX232, JTAG, Level translator. Design requirements. Power regulation The power regulation circuit converts the +12v from the adaptor to a steady +3.3v output to the CPLD. CPLD Dev Board The development board contains a PLCC Xilinx cool runner II CPLD chip with power supply section and JTAG connectors for programming. The Xilinx cool runner II CPLDs deliver the high speed and ease of used associated with the XC9500/XL/XV CPLD family with extremely low power versality of the XPLA3 family in a single CPLD. This means that the exact same part can be used for high speed data communications etc. 16X2 LCD connection The 16x2 LCD makes 11 digital I/O connections to the CPLD when used in 8 bit mode. The rest of the LCD’s pin are power connection and contrast from the 10kΩ potentiometer. Clock generator Mostly a clock above 10MHz will be fine for this assignment. The clock is used as a timing device.
  • 24. ` MAX 232 circuit The RS232 interface circuit consists of the CPLD, its 25.175MHz crystal clock and the MAX232. The max232 translates the +12V higher voltage RS232 signals into TTL logic that can be understood by the CPLD. Level translator. The CPLD device provides an output voltage of 3.3volts whereas the LCD and the Max232 require 5v to operate, therefore the use of a level translator is necessary for this design. The MAX30xxx family was chosen for this purpose. The MAX3000E/MAX3001E/MAX3002–MAX3012 8channel level translators provide the level shifting necessary to allow data transfer in a multi voltage system. Externally applied voltages, VCC and V, set the logic levels on either side of the device. Logic signals present on the VLL side of the device appear as a higher voltage logic signal on the V side of the device, and vice-versa. (Max3004 datasheet).
  • 25. Digital system using Dip trace software Complete circuit interfaced to CPLD via Level translator
  • 26. JTAG programmer interfaced to CPLD via TCK,TDI,TDO and TMS pins MAX232 interfaced to CPLD via Level translator
  • 27. LCD interfaced to CPLD via Level translator.
  • 28. VHDL code for the requirement. The VHDL code the RFID based system is shown below. As can be seen, it consists of ENTITY, which is a description of the pins (PORTS) of the circuit, and of an ARCHITECTURE, which describes how the circuit should function.
  • 29. -- Name: Aminu iliyasu bugaje ------------------------------------------------------library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity lcdass is port ( receiver_input :in std_logic; receiver_cleaar :out std_logic; LCDDATAPORT : out std_logic_vector(7 downto 0); LCD_register_select : out std_logic; LCD_read_write : out std_logic; LCD_enable reset : out std_logic; :in std_logic; ---clk in std_logic; receiver_clock :in std_logic; user_identity_string_received:in std_logic; data_received : out std_logic_vector (7 downto 0); enable_reception :in std_logic ); end lcdass; architecture rfid_assignment of lcdass is signal CARD_IDENTITY0: std_logic_vector(7 downto 0); signal CARD_IDENTITY1: std_logic_vector(7 downto 0); signal CARD_IDENTITY2: std_logic_vector(7 downto 0); signal CARD_IDENTITY3: std_logic_vector(7 downto 0); signal CARD_IDENTITY4: std_logic_vector(7 downto 0);
  • 30. signal CARD_IDENTITY5: std_logic_vector(7 downto 0); signal CARD_IDENTITY6: std_logic_vector(7 downto 0); signal CARD_IDENTITY7: std_logic_vector(7 downto 0); signal CARD_IDENTITY8: std_logic_vector(7 downto 0); signal CARD_IDENTITY9: std_logic_vector(7 downto 0); signal reception_reister :std_logic_vector (7 downto 0); signal reception_counter :std_logic_vector (3 downto 0); signal count_received :std_logic_vector (3 downto 0); signal reception_error_in :std_logic; signal receiver_overflow:std_logic; signal received_count1:std_logic; signal received_count2:std_logic; signal receiver_busy :std_logic; signal receiver_cleared :std_logic; Signal uart_pnt:std_logic_vector(3 downto 0); signal Reception_buffer_register :std_logic_vector(32 downto 0); begin -- UART reception code process (receiver_clock , reset) begin if (receiver_busy = '1') then reception_counter <= reception_counter + 1; if (reception_counter = 7) then if ((received_count2= '1') and (count_received = 0)) then receiver_busy else <= '0';
  • 31. count_received <= count_received + 1; if (count_received > 0 and count_received < 9) then reception_reister(conv_integer(count_received) - 1) <= received_count2; end if; if (count_received = 9) then receiver_busy <= '0'; if (reset = '1') then reception_reister data_received <= (others=>'0'); <= (others=>'0'); reception_counter <= (others=>'0'); count_received <= (others=>'0'); reception_error_in <= '0'; receiver_overflow <= '0'; receiver_cleared <= '1'; received_count1 <= '1'; received_count2 <= '1'; receiver_busy <= '0'; for j in 0 to 50 loop Reception_buffer_register(j)<='0'; end loop; uart_pnt<="0000"; elsif (rising_edge(receiver_clock )) then received_count1 <= receiver_input; received_count2<= received_count1; if (user_identity_string_received= '1') then
  • 32. data_received <= reception_reister; receiver_cleared <= '1'; end if; if (enable_reception = '1') then -- data is received when receiver=1; if (receiver_busy= '0' and received_count2= '0') then receiver_busy<= '1'; reception_counter <= X"1"; count_received <= X"0"; end if; -if uart_pnt="0000" then CARD_IDENTITY0(0)<=reception_reister(0);CARD_IDENTITY0(1)<=reception_reister(0); CARD_IDENTITY0(2)<=reception_reister(0);CARD_IDENTITY0(3)<=reception_reister(0); CARD_IDENTITY0(4)<=reception_reister(0);CARD_IDENTITY0(5)<=reception_reister(0); CARD_IDENTITY0(6)<=reception_reister(0);CARD_IDENTITY0(7)<=reception_reister(0); end if; if uart_pnt="0001" then CARD_IDENTITY1(0)<=reception_reister(0);CARD_IDENTITY1(1)<=reception_reister(0); CARD_IDENTITY1(2)<=reception_reister(0);CARD_IDENTITY1(3)<=reception_reister(0); CARD_IDENTITY1(4)<=reception_reister(0);CARD_IDENTITY1(5)<=reception_reister(0); CARD_IDENTITY1(6)<=reception_reister(0);CARD_IDENTITY1(7)<=reception_reister(0); end if; if
  • 33. if uart_pnt="0010" then CARD_IDENTITY2(0)<=reception_reister(0);CARD_IDENTITY2(1)<=reception_reister(0); CARD_IDENTITY2(2)<=reception_reister(0);CARD_IDENTITY2(3)<=reception_reist er(0); CARD_IDENTITY2(4)<=reception_reister(0);CARD_IDENTITY2(5)<=reception_reist er(0); CARD_IDENTITY2(6)<=reception_reister(0);CARD_IDENTITY2(7)<=reception_reist er(0); end if; if uart_pnt="0011" then CARD_IDENTITY3(0)<=reception_reister(0);CARD_IDENTITY3(1)<=reception_reister(0); CARD_IDENTITY3(2)<=reception_reister(0);CARD_IDENTITY3(3)<=reception_reister(0); CARD_IDENTITY3(4)<=reception_reister(0);CARD_IDENTITY3(5)<=reception_reister(0); CARD_IDENTITY3(6)<=reception_reister(0);CARD_IDENTITY3(7)<=reception_reister(0); end if; if uart_pnt="0100" then CARD_IDENTITY4(0)<=reception_reister(0);CARD_IDENTITY4(1)<=reception_reister(0); CARD_IDENTITY4(2)<=reception_reister(0);CARD_IDENTITY4(3)<=reception_reister(0); CARD_IDENTITY4(4)<=reception_reister(0);CARD_IDENTITY4(5)<=reception_reister(0); CARD_IDENTITY4(6)<=reception_reister(0);CARD_IDENTITY4(7)<=reception_reister(0); end if;
  • 34. if uart_pnt="0101" then CARD_IDENTITY5(0)<=reception_reister(0);CARD_IDENTITY5(1)<=reception_reister(0); CARD_IDENTITY5(2)<=reception_reister(0);CARD_IDENTITY5(3)<=reception_reister(0); CARD_IDENTITY5(4)<=reception_reister(0);CARD_IDENTITY5(5)<=reception_reister(0); CARD_IDENTITY5(6)<=reception_reister(0);CARD_IDENTITY5(7)<=reception_reister(0); end if; if uart_pnt="0110" then CARD_IDENTITY6(0)<=reception_reister(0);CARD_IDENTITY6(1)<=reception_reister(0); CARD_IDENTITY6(2)<=reception_reister(0);CARD_IDENTITY6(3)<=reception_reister(0); CARD_IDENTITY6(4)<=reception_reister(0);CARD_IDENTITY6(5)<=reception_reister(0); CARD_IDENTITY6(6)<=reception_reister(0);CARD_IDENTITY6(7)<=reception_reister(0); end if; if uart_pnt="0111" then CARD_IDENTITY7(0)<=reception_reister(0);CARD_IDENTITY7(1)<=reception_reister(0); CARD_IDENTITY7(2)<=reception_reister(0);CARD_IDENTITY7(3)<=reception_reister(0); CARD_IDENTITY7(4)<=reception_reister(0);CARD_IDENTITY7(5)<=reception_reister(0); CARD_IDENTITY7(6)<=reception_reister(0);CARD_IDENTITY7(7)<=reception_reister(0); end if;
  • 35. if uart_pnt="1000" then CARD_IDENTITY8(0)<=reception_reister(0);CARD_IDENTITY8(1)<=reception_reister(0); CARD_IDENTITY8(2)<=reception_reister(0);CARD_IDENTITY8(3)<=reception_reister(0); CARD_IDENTITY8(4)<=reception_reister(0);CARD_IDENTITY8(5)<=reception_reister(0); CARD_IDENTITY8(6)<=reception_reister(0);CARD_IDENTITY8(7)<=reception_reister(0); end if; if uart_pnt="1001" then CARD_IDENTITY9(0)<=reception_reister(0);CARD_IDENTITY9(1)<=reception_reister(0); CARD_IDENTITY9(2)<=reception_reister(0);CARD_IDENTITY9(3)<=reception_reister(0); CARD_IDENTITY9(4)<=reception_reister(0);CARD_IDENTITY9(5)<=reception_reister(0); CARD_IDENTITY9(6)<=reception_reister(0);CARD_IDENTITY9(7)<=reception_reister(0) end if; if uart_pnt="0011" then uart_pnt<="0000"; -- code to compare the RFID card number with the stored coded number if(card_identity0=0 and card_identity1=0 and card_identity2=1 and card_identity3=5 and card_identity4=0and card_identity5=1 and card_identity6=5 and card_identity7=0 and card_identity8=1 and card_identity9=5) then
  • 36. --- if correct then dispaly students info on lcd AMINU, age, school --initialize LCD LCD_register_select<='0'; LCD_read_write <='0';LCDDATAPORT<="00111000";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write command 0x38 LCD_register_select<='0'; LCD_read_write <='0';LCDDATAPORT<="00001110";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write command 0x0e LCD_register_select<='0'; LCD_read_write <='0';LCDDATAPORT<="00000110";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write command 0x06 LCD_register_select<='0'; LCD_read_write <='0';LCDDATAPORT<="00000001";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write command 0x01 --SEND MY NAME TO THE LCD "AMINU" LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01000001";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data A LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01001101";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data M LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01001001";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data I LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01001110";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data N LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01010101";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data U
  • 37. --SEND MY UEL ID TO THE LCD "u095782" LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01010101";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data U LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="00110000";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data 0 LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="00111001";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data 9 LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="00110101";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data 5 LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="00110111";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data 7 LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="00111000";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data 8 LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="00110000";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data 0 LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="00110010";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data 2 --SEND MY AGE TO THE LCD "AGE:22 YEARS" LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01000001";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data A LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01000111";LCD_enable<='1';
  • 38. for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data G LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01000101";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data E LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="00111010";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data : LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="00110010";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data 2 LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="00110010";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data 2 LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01011001";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data Y LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01000101";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data E LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01000001";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data A LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01010010";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data R --SEND MY COLLGE: TO THE LCD " COLLEGE:LINTON" LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01000011";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data C LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01000001";LCD_enable<='1';
  • 39. for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data O LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01001100";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data L LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01001100";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data L LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01000101";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data E LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01000111";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data G LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01000101";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data E LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="00111010";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data : LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01001100";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data L LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01001010";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data I LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01001110";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data N LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01010100";LCD_enable<='1';
  • 40. LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01010100";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data T LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01001111";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data O LCD_register_select<='1'; LCD_read_write <='0';LCDDATAPORT<="01001110";LCD_enable<='1'; for j in 1 to 10000 loop end loop;LCD_enable<='0'; -- write data end if; end if; if (received_count2= '0') then reception_error_in<= '1'; else receiver_cleared <= '0'; reception_error_in<= '0'; if (receiver_cleared = '1') then receiver_overflow<= '0'; else receiver_overflow<= '1'; end if; end if; end if; end if; end if; end if; end if; if (enable_reception = '0') then receiver_busy <= '0'; end if; end if; end process; receiver_cleaar <= receiver_cleared; end rfid_assignment; N
  • 41. Comparison between the Microcontroller based and the CPLD based system. Microcontroller CPLD Microcontroller has built in CPLD only consists of logical CPU, and other peripherals blocks of gates that can be such as ADC, UART, and rewired electrically using Very PWM the high speed hardware descriptive inbuilt UART was simply language. Therefore the UART configured using C language hardware has to be built through for the RFID application. VHDL program for the RFID etc. Therefore application. Microcontroller is CPLDs are programmed based software on Hardware approach called approach which can be C VHDL language suited for very language, assembly language fast applications. programmed etc. by suited for medium performance and control. Microcontroller instruction by executes instruction CPLD supports concurrent logical execution of instruction. (sequentially). Microcontroller is moderately slow for processing applications complex system CPLDs are used where low power and required. high speed are
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47. Xilinx simulation using testbench approach
  • 48.
  • 49.
  • 50.
  • 52. Uart code and LCD code together Lcd and UART together
  • 53. LCD and UART together Conclusions Firstly in the first section of the assignment, an 8051 microcontroller based RFID system was built with an RS232 interface via max232 which worked perfectly, while the second section was by using a CPLD device where hardware module for an RS232 interface was made using VHDL and by using the code the CPLD was able to receive data’s from an RFID reader. These data’s where translated and displayed on an LCD display which was achieved successfully.
  • 54. Additionally, the difference between microcontroller based design and the CPLD design was that, the microcontroller had its in built CPUs with other peripherals such are UART, with distinct input/output ports programmed using software approach to instruct the CPU based on the commands while CPLD consists of group of isolated number of logical gates which are attached together using VHDL code used for complex and high speed application. Lastly, RFID can be applied in many systems such as tracking livestock, preventing forgery, controlling building accessing, supporting automated checkout, developing smart home appliances, locating children etc. Therefore by using RFID, abundant secured access systems can be established without investing vast amount of money. Reference a. Mazidi.M.A., Mazidi J.G., 2000,“8051 Microcontroller and Embedded Systems”,Upper Saddle River, N.J. Pearson Edu. Inc. b. Brown.S, Vranesic.Z. , 2005,” Fundamentals of Digital Logic with VHDL Design”, 2nd Edition, Mc Graw Hill International Edition. c. Volnei A. Pedroni, 2004, Circuit Design with VHDL, 1st ed. MIT Press Cambridge, Massachusetts London, England
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.