RFID RDM6300 Code.. Sample ?? Anyone ??


Closed Thread
Results 1 to 9 of 9

Hybrid View

  1. #1
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237

    Exclamation RFID RDM6300 Code.. Sample ?? Anyone ??

    Hi Thank you for reading….

    I have recently got my self some of these to play with.. RDM630(0) Em4100 Serial Output


    http://imall.iteadstudio.com/im120618002.html

    Question :-

    There seems to be a lack of example code around the internet…. Has anybody used these with PBP?

    Am I right in just reading what the serial is squirting out somehow ??

    Is there any samples to look at ?

    BR and Thank you.

    Andy

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,389


    Did you find this post helpful? Yes | No

    Default Re: RFID RDM6300 Code.. Sample ?? Anyone ??


  3. #3
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: RFID RDM6300 Code.. Sample ?? Anyone ??

    Here is a RFID example which uses serin to read 10 characters from a RFID reader.

    RFID by Ecoli-557

    Have a read and as usual if you need more help just ask.

  4. #4
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: RFID RDM6300 Code.. Sample ?? Anyone ??

    This is the example from the site in your original post it reads 14 tag IDs using I will look into converting this to PBP 2.5c for you.

    Code:
    #include <p18lf26j11.h>
    #include <delays.h>
    #include <usart.h>
    #include <string.h>
    
    #pragma config OSC = HS //High speed crystal
    #pragma config WDTEN = OFF //Disable watchdog timer
    #pragma config XINST = OFF //Disable Extended CPU mode
    
    //LED Pin Configuration
    #define LED1Pin LATAbits.LATA0
    #define LED1Tris TRISAbits.TRISA0
    #define LED2Pin LATAbits.LATA1
    #define LED2Tris TRISAbits.TRISA1
    #define LED3Pin LATAbits.LATA2
    #define LED3Tris TRISAbits.TRISA2
    
    #define RFIDVCCPin LATBbits.LATB4 //Define RFIDVCCPin as PORT B Pin 4
    #define RFIDVCCTris TRISBbits.TRISB4 //Define RFIDVCCTris as TRISB Pin 4
    
    //Flags & Data Reception Variables
    volatile char tagRecdFlag;
    volatile char tagComingFlag;
    volatile char tagCounter;
    volatile char tagRX[14] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
    
    //RFID Tag IDs
    char rfidTag1[14] = {0x02, 0x30, 0x35, 0x30, 0x30, 0x41, 0x44, 0x44, 0x38, 0x46, 0x46, 0x43, 0x3f, 0x03};
    char rfidTag2[14] = {0x02, 0x30, 0x35, 0x30, 0x30, 0x41, 0x44, 0x42, 0x46, 0x35, 0x37, 0x36, 0x30, 0x03};
    char rfidTag3[14] = {0x02, 0x30, 0x35, 0x30, 0x30, 0x41, 0x45, 0x33, 0x46, 0x36, 0x35, 0x44, 0x33, 0x03};
    
    //Function Prototypes
    void rx_handler(void);
    //Function Prototypes
    
    #pragma code rx_interrupt = 0x8
    void rx_int(void)
    {
        _asm goto rx_handler _endasm
    }
    #pragma code
    
    #pragma interrupt rx_handler
    void rx_handler(void)
    {
        unsigned char rxByte;
        rxByte = RCREG1; //Read character received from USART
    
        if (tagComingFlag == 0 && rxByte == 0x02)
        {
            tagRX[tagCounter] = rxByte;
            tagComingFlag = 1;
            tagCounter++;
        }   else if (tagComingFlag == 1)
            {
                tagRX[tagCounter] = rxByte;
                tagCounter++;
                if (tagCounter == 14)
                {
                    tagCounter = 0;
                    tagComingFlag = 0;
                    tagRecdFlag = 1;
                }
            }   else
                {
                    tagComingFlag = 0;
                    tagCounter = 0;
                }
        PIR1bits.RCIF = 0; //Clear interrupt flag
    }
    
    void main()
    {
            //Set LED Pins data direction to OUTPUT
            LED1Tris = 0;
            LED2Tris = 0;
            LED3Tris = 0;
            //Set LED Pins to OFF
            LED1Pin = 0;
            LED2Pin = 0;
            LED3Pin = 0;
    
            tagRecdFlag = 0; //Set in ISR if new RFID tag has been read
            tagComingFlag = 0; //Indicates if a tag is partially received
            tagCounter = 0; //Counts byte index
            
            //USART1 Initialization
            Open1USART(USART_TX_INT_OFF & USART_RX_INT_ON & USART_ASYNCH_MODE & USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_LOW, 25);
    
            //Interrupts
            RCONbits.IPEN = 1;  //Enable interrupt priority
            IPR1bits.RC1IP = 1;  //Make receive interrupt high priority
            INTCONbits.GIEH = 1; //Enable all high priority interrupts
            
            //Turn on RFID Module
            RFIDVCCTris = 0; //Set to output
            RFIDVCCPin = 1; //Turn on RFID Module
    
            while(1)
            {
                if (tagRecdFlag)
                {                 
                    //Toggle LED corresponding to which card was read
                    if (memcmp(tagRX, rfidTag1, 14) == 0)
                    {
                        LED1Pin = ~LED1Pin;
                    }
                    if (memcmp(tagRX, rfidTag2, 14) == 0)
                    {
                        LED2Pin = ~LED2Pin;
                    }
                    if (memcmp(tagRX, rfidTag3, 14) == 0)
                    {
                        LED3Pin = ~LED3Pin;
                    }
    
                    //Delay 1/2 sec & clear flags to prevent repeated card read
                    Delay10KTCYx(200);
                    tagRecdFlag = 0; 
                    tagComingFlag = 0; 
                    tagCounter = 0; 
                    }
            }
    }

  5. #5
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: RFID RDM6300 Code.. Sample ?? Anyone ??

    After a bit more reading.

    14 bytes because the output includes

    a start byte - 02
    10 tag characters
    2 CRC bytes
    an end byte - 03

    so with serin2 wait for 02 character and then read 10 characters into tag buffer like this

    SERIN2 rfid_data, 396, [WAIT($02),STR buf\10]

  6. #6
    Join Date
    May 2012
    Location
    Merseyside, UK
    Posts
    237


    Did you find this post helpful? Yes | No

    Default Re: RFID RDM6300 Code.. Sample ?? Anyone ??

    Hi..
    Thank you all for help..... I have just got something working ....

    Not quite sure how the number on the card relates to the hex number embeded in the card...Had to get that out via clever use of a MAX232 chip, hyperterminal and a few caps on the bench...!!

    Thank you all again...

  7. #7
    Join Date
    Jun 2009
    Location
    Sc*nthorpe, UK
    Posts
    333


    Did you find this post helpful? Yes | No

    Default Re: RFID RDM6300 Code.. Sample ?? Anyone ??

    Quote Originally Posted by andybarrett1 View Post

    Not quite sure how the number on the card relates to the hex number embeded in the card...
    There is no relation except for the CRC. My understanding is that you have to swipe the cards and capture the embedded numbers (Tag) which you can then use in your code. The output from the RFID is TTL level and using a MAX232 is one way forward.

    I have read some posts that suggest the CRC is used to catch bad data but the datasheet says the CRC is calculated using the card number. Examples I have seen ignore the CRC and end byte. I guess the cards are reasonably reliable and do not need CRC checking or end byte detection, who knows?

Similar Threads

  1. Please help with sample code on 12f675
    By critix in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 18th June 2013, 03:08
  2. please who can help me for sample code
    By jasem700 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 22nd February 2009, 20:41
  3. 18F8722 sample code
    By George in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th June 2008, 13:42
  4. Sample code for pwm
    By Md.Shah in forum mel PIC BASIC
    Replies: 1
    Last Post: - 10th October 2006, 16:59
  5. 12F675 code sample
    By marad73 in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 23rd May 2006, 13:53

Members who have read this thread : 1

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts