motts
Joined: 10 Jan 2011 Posts: 29
|
RFID loop problem |
Posted: Sun Jan 16, 2011 4:14 pm |
|
|
Hi all, I am new for RFID. I have try to make the the reader continuously read my tag and print on my LCD and Hyper terminal. But my code is fail to do that, it just show 1 time tag number on lcd then I can't show other tag when I scan different tag. Does anyone have a good way to make it continuously and show the code on my LCD. Thk for help, god bless.. my code:
Code: |
#include <18f4550.h>
#fuses HS,NOLVP,NOWDT,NOPROTECT
#use delay(clock=20000000) // 40 MHz crystal on PCB
#use rs232(baud=9600, UART1) // hardware UART; uses RC6/TX and RC7/RX
#define use_portb_lcd TRUE
#include <lcd.c>
int16 i;
char value[12];//12 values of tag ID
void main() {
lcd_init();
do
{
for (i=0; i<12; i++) { //read in the 12 values
value[i]=getc();
}
if(value[1]=='0' && value[2]=='C' && value[3]=='0' && value[4]=='0' && value[5]=='2' && value[6]=='7' && value[8]=='8' && value[5]=='5' && value[9]=='6' && value[10]=='D'){
printf("ID = 0C0027856D,Apple\r\n");
lcd_putc("\fID = 0C0027856D");
lcd_putc("\nItem = Apple");
}if(value[1]=='1' && value[2]=='2' && value[3]=='0' && value[4]=='0' && value[5]=='C' && value[6]=='2' && value[7]=='7' && value[8]=='C' && value[9]=='1' && value[10]=='C'){
printf("ID = 1200C27C1C,Orange\r\n");
lcd_putc("\fID = 1200C27C1C");
lcd_putc("\nItem = Orange");
}if(value[1]=='1' && value[2]=='2' && value[3]=='0' && value[4]=='0' && value[5]=='C' && value[6]=='2' && value[7]=='8' && value[8]=='8' && value[9]=='F' && value[10]=='3'){
printf("ID = 1200C288F3,Grape\r\n");
lcd_putc("\fID = 1200C288F3");
lcd_putc("\nItem = Grape");
}if(value[1]=='1' && value[2]=='2' && value[3]=='0' && value[4]=='0' && value[5]=='C' && value[6]=='2' && value[7]=='8' && value[8]=='F' && value[9]=='0' && value[10]=='3'){
printf("ID = 1200C28F03,Peach\r\n");
lcd_putc("\fID = 1200C28F03");
lcd_putc("\nItem = Peach");
}if(value[1]=='0' && value[2]=='D' && value[3]=='0' && value[4]=='0' && value[5]=='6' && value[6]=='A' && value[7]=='C' && value[8]=='8' && value[9]=='F' && value[10]=='6'){
printf("ID = 0D006AC8F6,Pear\r\n");
lcd_putc("\fID = 0D006AC8F6");
lcd_putc("\nItem = Pear");
}if(value[1]=='0' && value[2]=='D' && value[3]=='0' && value[4]=='0' && value[5]=='6' && value[6]=='A' && value[7]=='A' && value[8]=='9' && value[9]=='3' && value[10]=='D'){
printf("ID = 0D006AA93D,Apricot\r\n");
lcd_putc("\fID = 0D006AA93D ");
lcd_putc("\nItem = Apricot");
}
}while(true);
} |
Can Anyone help me just make it continuously scan and show different tag number ? |
|