CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

RFID loop problem

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
motts



Joined: 10 Jan 2011
Posts: 29

View user's profile Send private message

RFID loop problem
PostPosted: Sun Jan 16, 2011 4:14 pm     Reply with quote

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 ?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jan 16, 2011 8:52 pm     Reply with quote

Quote:
it just show 1 time tag number

See this thread on the same topic:
http://www.ccsinfo.com/forum/viewtopic.php?p=124094
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group