Garbage in from RFID


+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    May 2009
    Location
    Montreal, QC, Canada
    Posts
    118

    Default Garbage in from RFID

    Hi,
    I can not get arround to read the RFID reader.
    I was able to properly read my RFID by connecting to pin 3 from my computer's serial port and using hyperterminal so I know the RFID module is working.

    Running my code bellow I see the word "test" on my LCD so I know the LCD is properly connected but everytime I get a beep out of my RFID tag I get garbage characters and different characters every time I use the same tag, I am using the dev board that came with Pickit2 (16F887) and connected LCD in 4 bit mode to port B0-B3, RS to B4 and EN to B5 with output of RFID to port C7.

    Any help would be appreciated to get me started.

    Thank you.

    Code:
    INCLUDE "modedefs.bas"
    DEFINE OSC 4
    TRISB = %11000000
    ADCON0 = %00000000
    ANSELH = %00000000
    WPUB = %00000000
    IOCB = %00000000
    
    DEFINE LCD_DREG PORTB   ' Set LCD Data port
    DEFINE LCD_DBIT 0       ' Set starting Data bit (0 or 4) if 4-bit bus
    DEFINE LCD_RSREG PORTB  ' Set LCD Register Select port
    DEFINE LCD_RSBIT 4      ' Set LCD Register Select bit
    DEFINE LCD_EREG PORTB   ' Set LCD Enable port
    DEFINE LCD_EBIT 5       ' Set LCD Enable bit
    DEFINE LCD_BITS 4       ' Set LCD bus size (4 or 8 bits)
    DEFINE LCD_LINES 2      ' Set number of lines on LCD
    DEFINE LCD_COMMANDUS 2000' Set command delay time in us
    DEFINE LCD_DATAUS 50    ' Set data delay time in us
    define HSER_RCSTA 90h
    'DEFINE HSER_TXSTA 20h
    DEFINE HSER_BAUD 9600
    DEFINE HSER_SPBRG 25
    define HSER_CLROERR
    A0 var byte
    A1 var byte
    A2 var byte
    A3 var byte
    A4 var byte
    A5 var byte
    A6 var byte
    A7 var byte
    A8 var byte
    A9 var byte
    A10 var byte
    A11 var byte
    
    
    LCDOUT $FE,1,"test"   'clear lcd
    pause 1000
    LCDOUT $FE,1
     
    
    main:
    HSERIN [A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11]   
    LCDOUT $FE,1,A0,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11
     
    goto main
      
    End
    Last edited by lilimike; - 13th November 2009 at 05:39.

  2. #2
    Join Date
    Aug 2005
    Posts
    95

    Default

    Are you connecting your reader via a max232 chip to your pic.

    Sphere

  3. #3
    Join Date
    May 2009
    Location
    Montreal, QC, Canada
    Posts
    118

    Default

    Well I was hoping to connect directly to pin RX!
    Maybe I am missing some knowledge?
    Can this be done?

  4. #4
    Join Date
    Aug 2005
    Posts
    95

    Default

    The signal needs to be inverted if using the hardware serial pin on your pic hence the reason for the max232. You could just use serin2 comand and run it in inverted mode.

    Sphere

  5. #5
    Join Date
    May 2009
    Location
    Montreal, QC, Canada
    Posts
    118

    Default

    Sphere,

    You sent me to the right direction and I finally got it working, I spent a lot of time trying to understanding the mode value from serin2 because in the PBP manual it says bit 15 is not used but it is not specified anywhere (that I could find) that it should be set to 1 but I got it now.

    Thanks for your help.

    Mike

  6. #6
    Join Date
    Aug 2005
    Posts
    95

    Default

    No problem.

    Sphere

  7. #7
    Join Date
    Dec 2009
    Posts
    2

    Thumbs up hello

    '************************************************* ***************
    INCLUDE "MODEDEFS.BAS"

    '***********************DEFINITIONS*************** ************************
    DEFINE Osc 4
    '--------------------------------------------------------------------------------------------
    '***********************SERIAL COMM DEFINITION**********************
    DEFINE HSER_TXSTA 24h
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_BAUD 19200

    DEFINE LCD_DREG PORTb
    DEFINE LCD_DBIT 4
    DEFINE LCD_RSREG PORTb
    DEFINE LCD_RSBIT 0
    DEFINE LCD_EREG PORTb
    DEFINE LCD_EBIT 3

    cmcon=7
    trisb=%00000010
    trisa=%00000001

    a var word
    b var word
    c var word
    d var word
    e var word

    ANAPROGRAM:

    hserin [hex2 a,hex2 b,hex2 c,hex2 d,hex2 e]
    pause 50
    LCDOut $fe, 1,hex2 a,hex2 b,hex2 c,hex2 d,hex2 e
    pause 10

    goto anaprogram

    end

Similar Threads

  1. Replies: 3
    Last Post: - 12th March 2008, 06:33
  2. parallax rfid reader module interface with PC
    By jonil22 in forum Off Topic
    Replies: 2
    Last Post: - 3rd February 2008, 07:54
  3. Parallx rfid reader module interface with PC
    By jonil22 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 31st January 2008, 09:50
  4. Free Web based RFID Online Courses
    By Thirumoorthy in forum General
    Replies: 0
    Last Post: - 19th November 2007, 14:38
  5. Free web based RFID online Course
    By Lesikar in forum GPS
    Replies: 0
    Last Post: - 19th October 2007, 23:28

Posting Permissions

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