mot1639
Member level 1
- Joined
- Jul 10, 2011
- Messages
- 32
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Activity points
- 1,513
Hi all
I bought wavetrend RFID l-Rx201 , for long range RFID tag reader , and it small and work great in my PC.
now I come to integrated to micro controller (pic18f25k22) and use mikroc as a compiler .
the red box is one packet that shows the tag information and receiver info . under green line , 0x23 0x3A, it is tag Id which is 9018. and the 0x33 and 0x00 is a dont care value and it always should be same . the 0x6C it is signal strength and it always change depend on the tag if it is near to RFID receiver or far a way (it is from 0x00 to 0xFF. )
now i write simple code to chick if the RFID tag in area or not , if it is is blink LED , and if not, it keep led off , ( this code work fine) it similer for the one in bottom but remove the compare if and move LED to IF loop in i=4...
now I try to develop the code to switch on the LED if the RFID signal strength is bigger than 180 , that mean bigger than 0xB4 which mean the tag is near to RFID receiver for about 5m , if it is more than 5m (that mean it should be lower than 0xB4) it shold not give me LED ,
the problem now it always give LED if I am far or near to RFID ?????????? but if the tag not in area of the RFID receiver, it will keep the LED OFF.
now ,how can I mange to compare the hex value of the signal strength ????? if i wanted to be more than 0xb4 ?????
this is a code
please any one to advice , regards
I bought wavetrend RFID l-Rx201 , for long range RFID tag reader , and it small and work great in my PC.
now I come to integrated to micro controller (pic18f25k22) and use mikroc as a compiler .
the red box is one packet that shows the tag information and receiver info . under green line , 0x23 0x3A, it is tag Id which is 9018. and the 0x33 and 0x00 is a dont care value and it always should be same . the 0x6C it is signal strength and it always change depend on the tag if it is near to RFID receiver or far a way (it is from 0x00 to 0xFF. )
now i write simple code to chick if the RFID tag in area or not , if it is is blink LED , and if not, it keep led off , ( this code work fine) it similer for the one in bottom but remove the compare if and move LED to IF loop in i=4...
now I try to develop the code to switch on the LED if the RFID signal strength is bigger than 180 , that mean bigger than 0xB4 which mean the tag is near to RFID receiver for about 5m , if it is more than 5m (that mean it should be lower than 0xB4) it shold not give me LED ,
the problem now it always give LED if I am far or near to RFID ?????????? but if the tag not in area of the RFID receiver, it will keep the LED OFF.
now ,how can I mange to compare the hex value of the signal strength ????? if i wanted to be more than 0xb4 ?????
this is a code
Code:
unsigned long i;
char tmp;
char hexStrn [4] = {0x23,0x3A,0x33,0x00};
void main() {
initialization(); // config the value
LED();
i=1;
found =1;
while(1){
if (UART1_Data_Ready()){
tmp = UART1_Read(); // read the received data,
if (found==0){
if (tmp>0xB4){ [COLOR="#FF0000"]// compare the signal strength [/COLOR]
LED();
found=1;
}
}
if(hexStrn[i] == tmp)
{
i++;
if (i==4){
i=0;
found=0;
}
}
else
{
i=0;
}
}
}
}
please any one to advice , regards