ABLab
Solutions
EM-18 RFID reader interfacing
with ATmega16
1
ABLab
Solutions
Sneha Palace, Plot No.60,Laxmi Vihar, Near Appolo Hospital, Bhubaneswar-751005
Website: www.ablab.in | E-m...
ABLab
Solutions
Sneha Palace, Plot No.60,Laxmi Vihar, Near Appolo Hospital, Bhubaneswar-751005
Website: www.ablab.in | E-m...
ABLab
Solutions
Sneha Palace, Plot No.60,Laxmi Vihar, Near Appolo Hospital, Bhubaneswar-751005
Website: www.ablab.in | E-m...
ABLab
Solutions
Sneha Palace, Plot No.60,Laxmi Vihar, Near Appolo Hospital, Bhubaneswar-751005
Website: www.ablab.in | E-m...
ABLab
Solutions
Sneha Palace, Plot No.60,Laxmi Vihar, Near Appolo Hospital, Bhubaneswar-751005
Website: www.ablab.in | E-m...
ABLab
Solutions
Sneha Palace, Plot No.60,Laxmi Vihar, Near Appolo Hospital, Bhubaneswar-751005
Website: www.ablab.in | E-m...
Upcoming SlideShare
Loading in...5
×

Em 18 rfid reader interfacing with a tmega16

2,697

Published on

Published in: Business, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,697
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
96
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Em 18 rfid reader interfacing with a tmega16

  1. 1. ABLab Solutions EM-18 RFID reader interfacing with ATmega16 1
  2. 2. ABLab Solutions Sneha Palace, Plot No.60,Laxmi Vihar, Near Appolo Hospital, Bhubaneswar-751005 Website: www.ablab.in | E-mail: info@ablab.in | Ph: 91-674-6573832 Table of Contents Project Description .................................................................................................... 3 Hardwares Required .................................................................................................. 3 Softwares Required ................................................................................................... 3 C Program.................................................................................................................. 4 Connection Guide ...................................................................................................... 7 Update Yourself......................................................................................................... 7 2
  3. 3. ABLab Solutions Sneha Palace, Plot No.60,Laxmi Vihar, Near Appolo Hospital, Bhubaneswar-751005 Website: www.ablab.in | E-mail: info@ablab.in | Ph: 91-674-6573832 Project Description In this project, we will interface a EM-18 RFID Reader with the microcontroller and we will show the RFID Tag to the RFID Reader and we will display the unique ID of the RFID Tag in the 16X2 alphanumeric LCD. Hardwares Required  AVR Trainer Board-100-1pcs  AVR USB Programmer-1pcs  12V DC Adapter-1pcs  16X2 Alphanumeric LCD(JHD162A)-1pcs  1 to 1 Connector-7pcs  EM-18 RFID Reader Module  RFID Tag-1pcs  10 to 10 FRC Female Connector-2pcs  USB AM-AF Cable(Optional)-1pcs Softwares Required  AVR Studio 4  WinAVR -2010  SinaProg Hex Downloader  USBasp Driver 3
  4. 4. ABLab Solutions Sneha Palace, Plot No.60,Laxmi Vihar, Near Appolo Hospital, Bhubaneswar-751005 Website: www.ablab.in | E-mail: info@ablab.in | Ph: 91-674-6573832 C Program //**************************************************************// //Microcontroller :ATmega16 //System Clock :8MHz //Baud Rate :9600 //Data Bits :8 //Stop Bits :1 //Parity :No Parity //Project :EM-18 RFID reader interfacing with ATmega16 //AVR Compiler :AVR-GCC 4.3.2 //Author :ABLab Solutions // :www.ablab.in // :info@ablab.in //Date :1st January 2012 //**************************************************************// #include<avr/io.h> /*Includes io.h header file where all the Input/Output Registers and its Bits are defined for AVR microcontroller*/ #define F_CPU 8000000 /*Defines a macro for the delay.h header file. F_CPU is the microcontroller frequency value for the delay.h header file. Default value of F_CPU in delay.h header file is 1000000(1MHz)*/ #include<util/delay.h> /*Includes delay.h header file which defines two functions, _delay_ms (millisecond delay) and _delay_us (microsecond delay)*/ #define LCD_DATA_PORT PORTB /*Defines a macro for the lcd.h header File. LCD_DATA_PORT is the microcontroller PORT Register to which the data pins of the LCD are connected*/ #define LCD_CONT_PORT PORTC /*Defines a macro for the lcd.h header File. LCD_CONT_PORT is the microcontroller PIN Register to which the control pins of the LCD are connected*/ 4
  5. 5. ABLab Solutions Sneha Palace, Plot No.60,Laxmi Vihar, Near Appolo Hospital, Bhubaneswar-751005 Website: www.ablab.in | E-mail: info@ablab.in | Ph: 91-674-6573832 #define LCD_RS PC0 /*Defines a macro for the lcd.h header file. LCD_RS is the microcontroller Port pin to which the RS pin of the LCD is connected*/ #define LCD_RW PC1 /*Defines a macro for the lcd.h header file. LCD_RW is the microcontroller Port pin to which the RW pin of the LCD is connected*/ #define LCD_EN PC2 /*Defines a macro for the lcd.h header file. LCD_EN is the microcontroller Port pin to which the EN pin of the LCD is connected*/ #include<avr/lcd.h> /*Includes lcd.h header file which defines all the functions for all Alphanumeric LCD*/ #include<avr/usart.h> /*Includes usart.h header file which includes all the usart functions*/ void main(void) { DDRB=0xff; /*All pins of PortB are declared output (data pins of LCD are connected)*/ DDRC=0x07; /*PC0, PC1 and PC2 pins of PortC are declared output (control pins of LCD connected)*/ unsigned char rfid_data[11]; /*Variable declaration*/ usart_init(); /*USART initialization*/ lcd_init(); /*LCD initialization*/ 5
  6. 6. ABLab Solutions Sneha Palace, Plot No.60,Laxmi Vihar, Near Appolo Hospital, Bhubaneswar-751005 Website: www.ablab.in | E-mail: info@ablab.in | Ph: 91-674-6573832 /*Start of infinite loop*/ while(1) { lcd_command_write(0x80); /*Cursor moves to 1st row 1st column*/ /*For loop to read the RFID card value*/ for(unsigned char i=0;i<10;i++) { rfid_data[i]=usart_data_receive(); /*Data receive from RFID Reader */ lcd_data_write(rfid_data[i]); /*RFID card number display in Alphanumeric LCD*/ } } } /*End of Program*/ 6
  7. 7. ABLab Solutions Sneha Palace, Plot No.60,Laxmi Vihar, Near Appolo Hospital, Bhubaneswar-751005 Website: www.ablab.in | E-mail: info@ablab.in | Ph: 91-674-6573832 Connection Guide The step-by-step procedure for EM-18 RFID Reader interfacing with ATmega16 are as follows:  Insert the DC Pin of 12V DC Adapter to the DC Socket of AVR Trainer Board-100  Connect PORTB header with LCD data header of AVR Trainer Board-100 with a 10 to 10 FRC Female Connector.  Connect RS, RW & EN pin of LCD control header with PD0, PD1 & PD2 pin of PORTD header respectively of AVR Trainer Board-100 with 1 to 1 Connectors.  Connect the ISP Header of AVR Trainer Board-100 with AVR USB Programmer Header with a 10 to 10 FRC Female Connector.  Connect the 16X2 Alphanumeric LCD to the LCD Header of AVR Trainer Board- 100.  Connect the VCC, GND, SEL and RS232 pin of EM-18 RFID Reader to VCC, GND, VCC and PD0 pins of AVR Trainer Board-100 with 1 to 1 connectors.  Connect the AVR USB Programmer to the PC/Laptop’s USB Port.  Switch on the power with the help of Power Switch of AVR Trainer Board-100  Download the EM-18 RFID Reader interfacing with ATmega16 Hex file to AVR Trainer Board-100.  Show the RFID Tag to the RFID Reader and see the output. Update Yourself For more Softwares, Tutorials, Sample Codes, Installation Guides, User Guides, User Manuals, Videos, Products & Components and Updates, Please Visit us at: www.ablab.in Mail us at: Info@ablab.in View us at: www.youtube.com/ablabsolutions Like us at: www.facebook.com/ablab.in Join us at: www.facebook.com/groups/ablabsolutions 7

×