BS2 SERIN 8 Byte String
Jeff_5_
Posts: 36
Ok i have a Basic Stamp hooked into my RFID reader. MY reader outputs an 8 byte string. The first four byes are a unique tag id. The nest four are a 3 digit decimal value that varies with tag range. The last byte is NULL. Ex. 1nKQ (4byte Tag ID) 103_ (3 digit dec.) or 1nKq93_ _ Few questions how can i read in the first four bytes in to one variable via serin? I want to read in the Tag id store it then compare it to the next reads to verify same tag. Also i want to the the next four bytes in to a variable to can compare the decimal number to see if it fall within a certain range. I really just need to know how to read in two 4 byte strings in to two different variables. for comparison.
Comments
Jeff T.
You end up with a byte array in memory. It's up to you to process the raw bytes.
If i do this
Tag VAR Byte
SERIN 1, 84, [Tag/8]
Can i need compare Tag to a value. Like
It Tag="1234"
Then do some other function
So if your RFID tag was actually 1234 in ASCII format then Tag(0) would contain "1", Tag(1) would contain "2", Tag(2) "3" and Tag(3) "4"
BTW it's a backslash "\" not a forward slash "/" and the array should be declared Tag VAR Byte(8)
Jeff T.
I want to have a function activated by holding a push button for 5 seconds that will read and store 3 tag ids (ONLY THE FIRST FOUR BYTES) I dont care about the distance here. This i will be saved and names TAG1 TAG2 TAG3
Now in the main program Read Again in a loop all 8 bytes (TAG4) then run a loop these does these comparisons
If Range (last four bytes) is great than 80 and if TAG4 Equals TAG1 or TAG2 or TAG3 Then do some code.
This would be much easier if i could read my tag ids into a single variable for comparison.