Help with code...RFID and BS2
Jeff_5_
Posts: 36
Ok I am new to PBasic and working on writing a program using the parallax rfid reader. MY questions is how can i move on VAR to another. I want to write a function the reads up to five tags at once and stores them in a table.
This is What i have:
Enable PIN 0
RX PIN 1
buf VAR Byte(10)
idx VAR Byte
char VAR Byte
I read in my Tag here
SERIN RX, T2400, [noparse][[/noparse]WAIT($0A), STR buf\10]
Then
For idx=0 to 9
Read idx,char
Debug char
That will print one tag but instead in printing that on tag i want to store in in to a Variable called TAG1 then read a Tag again and Store it in to TAG2 and so on reading up to 5 tags.
Its almost like reading the tags and saving them to a table so then i can compare with them.
This is What i have:
Enable PIN 0
RX PIN 1
buf VAR Byte(10)
idx VAR Byte
char VAR Byte
I read in my Tag here
SERIN RX, T2400, [noparse][[/noparse]WAIT($0A), STR buf\10]
Then
For idx=0 to 9
Read idx,char
Debug char
That will print one tag but instead in printing that on tag i want to store in in to a Variable called TAG1 then read a Tag again and Store it in to TAG2 and so on reading up to 5 tags.
Its almost like reading the tags and saving them to a table so then i can compare with them.
Comments
'SKIP 6' skips the first 6 characters of the tag ID. 'HEX4 buf' converts the last four characters into one numerical value and stores it in buf.
Rich H
The Simple Servo Tester, a kit from Gadget Gangster.
if i had
buf VAR word
Tag1 VAR word
Tag2 VAR work
LOW Enable ' activate the reader
SERIN RX, T2400, 150, Notag_, [noparse][[/noparse]WAIT($0A),SKIP 6, HEX4 buf] ' wait for hdr + ID
HIGH Enable
how can i now move whats in buf to Tag1. Then read again and move buf to Tag2 and so on.
Tag1 = buf
How can i make this work in a loop to where i can read up to 5 tags and store them in the Varabiles Tag1 Tag2 Tag3 Tag4 and Tag5. I think there is a way to do it with a loop but im not sure. I know i will have to compare them all together to make sure i dont store the same tag in two spots.