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
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
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
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
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