November 22, 2024, 01:16:19 PM

News:

Be sure to checkout our Vixen interfaces in the Library forum -- if you want PC automation at near zero cost, EFX-TEK and Vixen is a great combination of tools.


RFID reader

Started by pbronson, February 22, 2008, 06:32:42 AM

Previous topic - Next topic

pbronson

Just a quick question from a newbie. I am planning a RFID controlled door latch deadbolt based on the Weiser 1000 system and am curious whether the Prop-1 would be sufficient to handle 2 or 3 ID tags? I am very new at this and would appreciate any info..

Thanks,
Pete

pbronson

I am questioning whether the Prop-1 has enough memory for multiple ID tags. Seems like I heard that it would work for one tag but not multiple tags.

Thanks

JonnyMac

February 22, 2008, 08:04:10 AM #2 Last Edit: February 22, 2008, 01:17:51 PM by JonnyMac
I had to go look though my old Parallax code to remember, and it turns out that you can.  This program will let you store and search for up to five different RFID tags with the Parallax RFID Reader.  Funny, I wrote this program but didn't remember doing it... guess there's been a few other programs in between.

Since I wrote the original program (while working for Parallax) I've taken the liberty to update the listing; just to make it a tad easier to read and follow.  For those wondering why it's so verbose... well, the BS1 doesn't support arrays, so we can't check the incoming data with a loop.

' =========================================================================
'
'   File....... RFID.BS1
'   Purpose.... RFID Tag Reader / Simple Security System
'   Author..... (c) Parallax, Inc. -- All Rights Reserved
'   E-mail..... support@parallax.com
'   Started....
'   Updated.... 22 FEB 2008 by Jon Williams, EFX-TEK
'
'   {$STAMP BS1}
'   {$PBASIC 1.0}
'
' =========================================================================


' -----[ Program Description ]---------------------------------------------
'
' Reads tags from a Parallax RFID reader and compares to known tags (stored
' in EEPROM table).  If tag is found, the program will disable a lock.


' -----[ Revision History ]------------------------------------------------


' -----[ I/O Definitions ]-------------------------------------------------

SYMBOL  Enable          = 0                     ' low = reader on
SYMBOL  RX              = 1                     ' serial from reader
SYMBOL  Spkr            = 2                     ' speaker output
SYMBOL  Latch           = 3                     ' lock/latch control


' -----[ Constants ]-------------------------------------------------------

SYMBOL  LastTag         = 2                     ' 3 tags; 0 to 2


' -----[ Variables ]-------------------------------------------------------

SYMBOL  tag0            = B0                    ' RFID bytes buffer
SYMBOL  tag1            = B1
SYMBOL  tag2            = B2
SYMBOL  tag3            = B3
SYMBOL  tag4            = B4
SYMBOL  tag5            = B5
SYMBOL  tag6            = B6
SYMBOL  tag7            = B7
SYMBOL  tag8            = B8
SYMBOL  tag9            = B9

SYMBOL  tagNum          = B10                   ' from EEPROM table
SYMBOL  pntr            = B11                   ' pointer to char in table
SYMBOL  char            = B12                   ' character from table


' -----[ Initialization ]--------------------------------------------------

Reset:
  HIGH Enable                                   ' turn of RFID reader
  LOW Latch                                     ' lock the door!


' -----[ Program Code ]----------------------------------------------------

Main:
  LOW Enable                                    ' activate the reader
  SERIN RX, T2400, ($0A)                        ' wait for header
  SERIN RX, T2400, tag0, tag1, tag2, tag3, tag4 ' get tag bytes
  SERIN RX, T2400, tag5, tag6, tag7, tag8, tag9
  HIGH Enable                                   ' deactivate reader

  tagNum = 0                                    ' start with first tag

Check_List:
  pntr = tagNum * 10 + 0                        ' point to character
  READ pntr, char                               ' read char from DB
  IF char <> tag0 THEN Bad_Char                 ' compare with tag data

  pntr = tagNum * 10 + 1
  READ pntr, char
  IF char <> tag1 THEN Bad_Char

  pntr = tagNum * 10 + 2
  READ pntr, char
  IF char <> tag2 THEN Bad_Char

  pntr = tagNum * 10 + 3
  READ pntr, char
  IF char <> tag3 THEN Bad_Char

  pntr = tagNum * 10 + 4
  READ pntr, char
  IF char <> tag4 THEN Bad_Char

  pntr = tagNum * 10 + 5
  READ pntr, char
  IF char <> tag5 THEN Bad_Char

  pntr = tagNum * 10 + 6
  READ pntr, char
  IF char <> tag6 THEN Bad_Char

  pntr = tagNum * 10 + 7
  READ pntr, char
  IF char <> tag7 THEN Bad_Char

  pntr = tagNum * 10 + 8
  READ pntr, char
  IF char <> tag8 THEN Bad_Char

  pntr = tagNum * 10 + 9
  READ pntr, char
  IF char <> tag9 THEN Bad_Char
    GOTO Tag_Found                              ' all match -- good tag

Bad_Char:
  tagNum = tagNum + 1                           ' point to next tag data
  IF tagNum <= LastTag THEN Check_List          ' keep going of tags left

Bad_Tag:
  DEBUG "Unknown", CR
  SOUND Spkr, (25, 80)                          ' groan
  PAUSE 1000
  GOTO Main

Tag_Found:
  DEBUG "Tag ", #tagNum, CR                     ' for testing
  HIGH Latch                                    ' remove latch
  SOUND Spkr, (114, 165)                        ' beep
  LOW Latch                                     ' restore latch
  GOTO Main

  END


' -----[ Subroutines ]-----------------------------------------------------


' -----[ EEPROM Data ]-----------------------------------------------------

Tags:
  EEPROM ("0F0184F20B")                         ' valid tags
  EEPROM ("0F01D9D263")
  EEPROM ("04129C1B43")
  EEPROM ("0000000000")                         ' space for other tags
  EEPROM ("0000000000")
Jon McPhalen
EFX-TEK Hollywood Office

pbronson

Thanks for the help. I am looking forward to this project.

Pete