sireesha7
Newbie level 3
- Joined
- Feb 8, 2014
- Messages
- 4
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 57
i am doing a project on "rfid based shopping trolley".
please help me for programming the rfid tags... i read the tag id serially and i should display the details of that particular i.d on the lcd..
here is my program
but i need to modify this program as
all the card no's(tag i.d's) are to placed in an array...when a card is read ... i to have compare received card i.d with all the card no's in the array and i have to display the details of that card i.d on lcd
NOTE: use a loop for comparing received card i.d and card i.ds in array
please help me for programming the rfid tags... i read the tag id serially and i should display the details of that particular i.d on the lcd..
here is my program
but i need to modify this program as
all the card no's(tag i.d's) are to placed in an array...when a card is read ... i to have compare received card i.d with all the card no's in the array and i have to display the details of that card i.d on lcd
NOTE: use a loop for comparing received card i.d and card i.ds in array
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 #include<reg52.h> #include<string.h> unsigned int data_out; sfr lcd_data_pin=0x90; //P1 port sbit rs=P2^0; //Register select sbit sbit rw=P2^1; //Read/Write sbit sbit en=P2^2; //Enable pin unsigned char card_id[12]; void delay(unsigned int count) //Function to provide delay { int i,j; for(i=0;i<count;i++) for(j=0;j<1275;j++); } void lcd_cmd(unsigned char comm) //Lcd command funtion { lcd_data_pin=comm; en=1; rs=0; rw=0; delay(1); en=0; } void lcd_data(unsigned char disp) //Lcd data function { lcd_data_pin=disp; en=1; rs=1; rw=0; delay(1); en=0; } lcd_string(unsigned char *disp) //Function to send string { int x; for(x=0;disp[x]!=0;x++) { lcd_data(disp[x]); } } void lcd_init() //Function to initialize the LCD { lcd_cmd(0x38); delay(5); lcd_cmd(0x0F); delay(5); lcd_cmd(0x80); delay(5); } void recieve() //Function to recieve data serialy from RS232 { unsigned char k; for(k=0;k<12;k++) { while(RI==0); card_id[k]=SBUF; RI=0; } } void main() { int l; TMOD=0x20; //Enable Timer 1 TH1=0XFD; SCON=0x50; TR1=1; // Triggering Timer 1 lcd_init(); lcd_cmd(0x81); //Place cursor to second position of first line lcd_string("RFID BASED"); delay(100); lcd_cmd(0xc0); lcd_string("SHOPPING TROLLEY"); delay(100); lcd_cmd(0x01); lcd_string("UNIQUE ID:"); delay(200); while(1) { recieve(); lcd_cmd(0xC1); //Place cursor to second position of second line for(l=0;l<12;l++) { lcd_data(card_id[l]); } if(strcmp(card_id,"42006B613E76")) { lcd_cmd(0x01); lcd_cmd(0x80); lcd_string("Product cost=100"); lcd_cmd(0xC0); delay(20); lcd_string("exp date=mar2016"); } else if(strcmp(card_id,"42006B613E77")) { lcd_cmd(0x01); lcd_cmd(0x80); lcd_string("Product cost=150"); lcd_cmd(0xC0); delay(20); lcd_string("exp date=mar2015"); } else { lcd_cmd(0x01); lcd_cmd(0x80); lcd_string("Product cost=200"); lcd_cmd(0xC0); delay(20); lcd_string("exp date=mar2017"); } } }
Last edited by a moderator: