Difference between revisions of "Reading RFID tags"
From Mech
Jump to navigationJump to searchJames Cooper (talk | contribs) (→Code) |
James Cooper (talk | contribs) (→Code) |
||
Line 12: | Line 12: | ||
== Code == |
== Code == |
||
#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; |
|||
Inputs: |
|||
char value[12]; |
|||
⚫ | |||
ENABLE: 0 V when enabled, and 5 V when not enabled |
|||
void main() { |
|||
SOUT: Serial Output |
|||
for (i=0; i<12; i++) { //read in the 12 values |
|||
GND: 0 V |
|||
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]); // \r is carriage return, \n is scroll up //display 10 unique id digits |
|||
} |
|||
== Further Reading == |
== Further Reading == |
Revision as of 17:14, 4 February 2009
Original Assignment
Interface your PIC with an RFID reader (see here) and demonstrate recognition of various RFID tags.
Overview
Circuit
Code
#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]; 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]); // \r is carriage return, \n is scroll up //display 10 unique id digits }