Author Topic: 8051 Microcontroller/RFID Reader Communication  (Read 13785 times)

joe2Kool

  • Guest
8051 Microcontroller/RFID Reader Communication
« on: October 19, 2007, 06:25:34 pm »
Hello,

I\'m interfacing the 8051 microcontroller with APSX RW-210 RFID Reader/Writer Module.  I\'m using RS232 to communicate between the reader and microcontroller.  So far I looked into BIPOM\'s example code used and modified the source code from the serial file to send a command to the reader.  Now I want to retrieve a set bytes that suppose to be in HEX from the reader.  This set of bytes (32 bits to exact) is the ID of the RFID tag that the reader contains.  My problem is I don\'t know how to retrieve data back to the microcontroller so I can use it to my desire.  Can someone give me any advice on how to do this?

Thanks,
joe2Kool

vitaliy

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Re: 8051 Microcontroller/RFID Reader Communication
« Reply #1 on: October 20, 2007, 07:11:41 am »
I guess "getchr()" may help you

GETCHR    
 MODEL & PROTOTYPE:

        A: int getchr()


    ARGUMENTS:

        None


    RETURN VALUE:

        Value of a character read from the serial port.


    DESCRIPTION:

          This function reads a single character  from  the  console  serial
       port,  and returns it as a positive value in the range of 0  to  255.
       The  character  is  read  in  "raw"  format,  with  no   translations
       performed.


    EXAMPLES:

        while(getchr() != \'\\r\');        /* Wait for a RETURN */

GETCH    
 MODEL & PROTOTYPE:

        A: int getch()


    ARGUMENTS:

        None


    RETURN VALUE:

        Value of a character read from the serial port.


    DESCRIPTION:

          This function reads a single character  from  the  console  serial
       port, and returns it as a positive value in the range of 0 to 255. If
       the character is a carriage  return  (0x0D),  is  translated  into  a
       NEWLINE (0x0A) for compatibility with \'C\'.


    EXAMPLES:

        while(getch() != 0x1B);     /* Wait for an ESCAPE character */



    GETSTR
    MODEL & PROTOTYPE:

        S: int getstr(char *buffer, int size)
        A: int _getstr(register char *buffer, int size)


    ARGUMENTS:

        buffer  - Pointer to string to receive line
        size    - Maximum size of line to read


    RETURN VALUE:

        The number of characters received into the line.


    DESCRIPTION:

          The "getstr"  function reads a string of character from the serial
       port and places them into the specified character buffer until either
       a NEWLINE character is encountered, or the limit of "size" characters
       are read.

          The string is terminated with the standard  NULL  (00)  character.
       The trailing NEWLINE  \'\\n\'  character is NOT included in  the  output
       buffer.

          The BACKSPACE or DEL keys can be used to edit the input line.

          The "buffer"  must be located in EXTERNAL memory when the "getstr"
       function is used,  and INTERNAL memory when the "_getstr" function is
       used.


    EXAMPLES:

        getstr(input_line, 80);

joe2Kool

  • Guest
Re: 8051 Microcontroller/RFID Reader Communication
« Reply #2 on: October 20, 2007, 09:07:43 pm »
Thanks,
I decided to use the getstr but I got a problem verifying if data was received due to the fact I don\'t have the console of Micro-IDE connected.  I have the microcontroller connected directly to the RFID via RS232.  I don\'t  know if I should use a LCD to print the data for verification.  I was thinking of printing the data in this form LCD_printf ( getstr())
but I don\'t think this is correct.  I have little experience with LCD.  Also, I would like to retrieve the information in HEX form but I\'m pretty sure it returns data in ASCII.  Can you give me any advice on how to print the data to the LCD for verification?

Thanks,
joe2kool

vitaliy

  • Full Member
  • ***
  • Posts: 30
    • View Profile
Re: 8051 Microcontroller/RFID Reader Communication
« Reply #3 on: October 25, 2007, 01:48:03 am »
If the RFID sends  NULL-terminated ASCII
LCD_printf ( getstr());   will work.

mishink7

  • Guest
Re: 8051 Microcontroller/RFID Reader Communication
« Reply #4 on: October 27, 2009, 05:09:28 pm »
im working on the same thing connecting this rf reader to this microcontroller. Do you have the code or the example code for this