Difference between revisions of "Reading RFID tags"

From Mech
Jump to navigationJump to search
Line 12: Line 12:


== Code ==
== Code ==
/*
/*
RFID_Input.c J.Cooper and C.Ryan 2009-2-04
RFID_Input.c J.Cooper and C.Ryan 2009-2-04
Read in from RFID Card on pin RC7
Read in from RFID Card on pin RC7
Write out RFID unique number on pin RC6
Write out RFID unique number on pin RC6
*/
*/


#include <18f4520.h>
#include <18f4520.h>
#fuses HS,NOLVP,NOWDT,NOPROTECT
#fuses HS,NOLVP,NOWDT,NOPROTECT
#use delay(clock=40000000) // 40 MHz crystal on PCB
#use delay(clock=40000000) // 40 MHz crystal on PCB
#use rs232(baud=2400, UART1) // hardware UART; uses RC6/TX and RC7/RX
#use rs232(baud=2400, UART1) // hardware UART; uses RC6/TX and RC7/RX

int16 i;
int16 i;
char value[12];//12 values of tag ID
char value[12];//12 values of tag ID

output_low(PIN_D7); //Set enable to low
output_low(PIN_D7); //Set enable to low

void main() {
void main() {
for (i=0; i<12; i++) { //read in the 12 values
for (i=0; i<12; i++) { //read in the 12 values
value[i]=getc();
value[i]=getc();
}
}
printf("rfid# %c %c %c %c %c %c %c %c %c %c \r\n", value[1] value[2] value[3] value[4] value[5] value[6] value[7] value[8] value[9] value[10]); //display 10 unique id digits
printf("rfid# %c %c %c %c %c %c %c %c %c %c \r\n", value[1] value[2] value[3] value[4] value[5] value[6] value[7] value[8] value[9] value[10]); //display 10 unique id digits
}
}


== Further Reading ==
== Further Reading ==

Revision as of 17:27, 4 February 2009

Original Assignment

Interface your PIC with an RFID reader (see here) and demonstrate recognition of various RFID tags.


Overview

Radio Frequency Identification (RFID) reads passive RFID transponder tags up to 4 inches away from the reader. The RFID communicates using rs232 and transmits a 12-byte ASCII string. The first byte (start byte) is always $0A and the last byte (stop byte) is always $0D. The 10 middle digits are the 10 unique id digits that are unique to every RFID transponder.

Circuit

Code

/*
   RFID_Input.c J.Cooper and C.Ryan 2009-2-04
   Read in from RFID Card on pin RC7
   Write out RFID unique number on pin RC6
*/
#include <18f4520.h>
#fuses HS,NOLVP,NOWDT,NOPROTECT        
#use delay(clock=40000000)         // 40 MHz crystal on PCB
#use rs232(baud=2400, UART1)      // hardware UART; uses  RC6/TX and RC7/RX

int16 i;
char value[12];//12 values of tag ID

output_low(PIN_D7); //Set enable to low

void main() {
     for (i=0; i<12; i++) { //read in the 12 values
           value[i]=getc();
     }
     printf("rfid# %c %c %c %c %c %c %c %c %c %c \r\n", value[1] value[2] value[3] value[4] value[5] value[6] value[7] value[8] value[9] value[10]); //display 10 unique id digits
}

Further Reading

Product Website

Data Sheet