Documente Academic
Documente Profesional
Documente Cultură
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 objects 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.
- Name: RFID-IDR-232N
- 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.
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.
void send_data(unsigned char send_data) //Lcd data function { lcd_data_pin=send_data; en=1; rs=1; rw=0; generate_delay(1); en=0; } // enable is off // enable high // register select is high // write in 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; }
void lcd_ini()
generate_delay(1);
send_command(0x80); generate_delay(1); send_command(0x01); } //clear LCD. //cursor to begin at 1st line, position 1
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)
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 0 C /T 0 M1 1 M0 0 Gate 0 C /T 0 M1 0 M0 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)
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.
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
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
is Receive = card_number
Yes No
#include<reg51.h> sfr lcd_data_pin=0x80;//p0 port sbit rs=P2^4; sbit rw=P2^5; sbit en=P2^6; // Register select pin // Read Write pin // 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) { 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;} //Function to provide delay
void send_data(unsigned char send_data) //Lcd data function { lcd_data_pin=send_data; en=1; rs=1; rw=0; generate_delay(1); en=0; } send_str(unsigned char *data_) { int l; for(l=0;data_[l]!=0;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 send_data(data_[l]); //Function to send string // register select
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;}}}}}
{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; TL1=TH1=0XFD; TH0=0xA5; TL0=0xFE; TR0=1; // EA=1; //ES=1; IE=0x92;} // Trigger Timer 1 //Enable 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); 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 //Place cursor to second position of first line
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 LCDs 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/MAX3002MAX3012 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).
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 LCD_register_select LCD_read_write LCD_enable : out std_logic_vector(7 downto 0); : out std_logic; : out std_logic; : out std_logic;
reset
:in std_logic;
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 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 if (reset = '1') then reception_reister data_received <= (others=>'0'); <= (others=>'0'); <= '0';
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;
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);
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_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_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);
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_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);
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);
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 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
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
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<="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'; N
end if; end if; end process; receiver_cleaar <= receiver_cleared; end rfid_assignment;
Comparison between the Microcontroller based and the CPLD based system.
Microcontroller
CPLD
Microcontroller has built in CPU, and other peripherals such as ADC, UART, and PWM etc. Therefore the
CPLD only consists of logical blocks of gates that can be rewired electrically using Very high speed hardware descriptive language. Therefore the UART hardware has to be built through VHDL program for the RFID application.
inbuilt UART was simply configured using C language for the RFID application.
Microcontroller programmed by
is software
CPLDs are programmed based on Hardware approach called VHDL language suited for very fast applications.
approach which can be C language, assembly language etc. suited for medium
performance and control. Microcontroller instruction by executes instruction CPLD supports concurrent
(sequentially). Microcontroller is moderately slow for processing complex system CPLDs are used where low power and high speed are
applications
required.
Lcd simulation.
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 datas from an RFID reader. These datas 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