PDA

View Full Version : capture tag id - code to GET RFID TAG ID



priiya p
05-07-2012, 02:51 PM
Hi,
I am trying to do a small project RFID based door lock system using PIC24H Mic, but I'm failing to interface the PIC24 and Red Bee RFID. Can you please help me.....?


How will the output at rx pin of REDBEE RFID be? I want to send the tag id to the PIC. How do I do this? Sample C code or Suggestions would be of great help !

I tried the following the below logic, but it didn't work.
Program:


/****I am trying to transmit the tag data from rx pin of REDBEE RFID to PIC pin RB10/RB11. But I couldn't get the tag id to the PIC, The LCD interface is working fine. I used some library functions, some of which I described briefly below *****/


A part of my code is :


uint8_t u8_c;
u8_c = inChar(); //get character
outChar(u8_c); // Write a character to the serial port
for (int i =0; i< 15; i++)
{
array[i] = u8_c;
}
outStringLCD(array); // display the tag on LCD
writeLCD(0xC0,0,1,1);


Function and its brief description:
1) uint8_t inChar(void)
/*** Read a character from the serial port.
This function blocks until a character is read. ***/

2) void outString (const char * psz_s)
/*** Write a null-terminated string to the serial port. ***/


3) void outChar (uint8_t u8_c)
/*** A system-dependent macro to output one character.
Write a character to the serial port.
This function blocks until a character is written. ***/


4) void outUint8Decimal (uint8_t u8_x)
/***Output u8_x as decimal value. ***/




5) uint8_t isCharReady (void)
/*** Determine if a character is ready to be read
from the serial port.
Returns: non-zero value if character is ready,
zero otherwise ***/


5) uint16_t inString (char * psz_buff,int16_t u16_maxCount)
/*** Reads a string into psz_buff, assumes psz_buff
can hold at least u16_maxCount+1 characters. ***/


6) #define CONFIG_INT1_TO_RP(pin) _INT1R = pin
/*** This maps an input internal to the PIC to
an input pin. For example, CONFIG_INT1_TO_RP(10) maps
the INT1 edge-triggered interrupt to port P, pin 10 ***/


For more functions available in library:
http://www.ece.msstate.edu/courses/ece3724/main_pic24/docs/_p_i_c24_support.html


Above functions reference links:
pic24_uart.h:
http://www.ece.msstate.edu/courses/ece3724/main_pic24/docs/pic24__uart_8h.html


pic24_uart.c:
http://www.ece.msstate.edu/courses/ece3724/main_pic24/docs/pic24__uart_8c.html


pic24_serial.h:
http://www.ece.msstate.edu/courses/ece3724/main_pic24/docs/pic24__serial_8h.html




Please let me know how could I write program to get tag ID to PIC ???? Please help !
Thanks.......