N and V column

Column #120: You Can’t Touch That: Non-contact Access Control
The Nuts and Volts of BASIC Stamps (Volume 6) Page 67
Open Sesame
Most security systems will have more than one legal user, so let's update the program to work
with multiple tags. To be honest with you, I had to go back to the BS1 manual on several
occasions for this program because the BS1 – while very cool – is not quite as convenient as
its big brother the BS2. It's very inexpensive though (especially with OEM parts), and is
worth considering for a low-cost access control system.
After we've recorded our tag IDs we can put them into a simple EEPROM-based table for
storage. Here's what my table looks like:
Tags:
EEPROM ("0F0184F20B")
EEPROM ("0F01D9D263")
EEPROM ("04129C1B43")
EEPROM ("0000000000")
EEPROM ("0000000000")
Remember that your table will be different as the RFID tag strings are unique. By using the
Memory Map feature of the BASIC Stamp Editor IDE I found I had room for five tags. Since
I only had three to work with I padded the table for the unused positions. A program constant
will prevent us from searching past the known tag strings.
The next step is to setup our control outputs. For this security program we will turn off the
reader and lock the door.
Reset:
HIGH Enable
LOW Latch
After basic setup we drop into the heart of the program where the reader is activated and we
wait on a tag ID string. Now you'll see what I was just talking about with the BS1 not being
quite as convenient as the BS2 – there is no STR modifier with the BS1 and its memory
cannot be treated like an array; everything must be done one byte at a time.
Main:
LOW Enable
SERIN RX, T2400, ($0A),
tag0, tag1, tag2, tag3, tag4,
tag5, tag6, tag7, tag8, tag9
HIGH Enable