PDA

View Full Version : Two RFID Card Reader ONE at a TIME ........Cards 10 and 11 Shows.."Unauthorized



sam_sam_sam
03-30-2007, 12:12 AM
Hi EveryOne

I want to know if i have this right· http://forums.parallax.com/images/smilies/idea.gif·using Two RFID· Card·readers with one Basic Stamp.............. Read one card reader at a TIME.......................

Is there AnyThing· that·I need to add to this Routine to make this work

Enable1········· PIN···· 0······················ ' low = reader..1 on
RX1············ ··PIN···· 1······················ ' serial from reader..1

Enable2········· PIN·····2······················ ' low = reader..2 on
RX2·············· PIN·····3······················ ' serial from reader..2



Reader1:
· LOW Enable1··································· ' activate the reader
· #IF __No_SPRAM #THEN
··· SERIN RX1, T2400, [WAIT($0A), STR buf\10]··· ' wait for hdr + ID
· #ELSE
··· SERIN RX1, T2400, [WAIT($0A), SPSTR 10]
· #ENDIF
· HIGH Enable1·································· ' deactivate reader..1

Display_Tag:
· DEBUG "Tag Identification number is: ", CR
··· FOR idx = 0 TO 9··························· ' scan bytes in tag

····· #IF __No_SPRAM #THEN
······· DEBUG buf(idx)
····· #ELSE
······· GET idx, Char······················· ' read char from SPRAM
······· DEBUG Char
····· #ENDIF
····NEXT
· DEBUG CR
· PAUSE 500
· GOTO·Reader2···························· ' GoTo Reader...2



Reader2:
· LOW Enable2··································· ' activate the reader..2
· #IF __No_SPRAM #THEN
··· SERIN RX2, T2400, [WAIT($0A), STR buf\10]··· ' wait for hdr + ID
· #ELSE
··· SERIN RX2, T2400, [WAIT($0A), SPSTR 10]
· #ENDIF
· HIGH Enable2·································· ' deactivate reader..2

Display_Tag:
· DEBUG "Tag Identification number is: ", CR
··· FOR idx = 0 TO 9··························· ' scan bytes in tag

····· #IF __No_SPRAM #THEN
······· DEBUG buf(idx)
····· #ELSE
······· GET idx, Char······················· ' read char from SPRAM
······· DEBUG Char
····· #ENDIF
····NEXT
· DEBUG CR
· PAUSE 500
· GOTO·Reader1···························· ' GoTo Reader...1

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

Post Edited (sam_sam_sam) : 5/6/2007 2:48:23 PM GMT

Franklin
03-30-2007, 05:49 AM
I think it would work but why? Two doors, one stamp?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen

Unsoundcode
03-30-2007, 07:04 AM
Hi Sam, unless the intention is to activate the RFID readers in turn 1 2 1 2 1 2 etc you will need a time out for your SERIN's to work independently.

Jeff T.

sam_sam_sam
03-30-2007, 09:05 PM
·Stephen

Thank You For Your Reply

I think it would work but why? Two doors, one stamp?

This is for my ONE Gate for my Drive Way for ONE·going IN·and ONE going OUT


Jeff T.

Thank You For Your Reply

Hi Sam, unless the intention is to activate the RFID readers in turn 1 2 1 2 1 2 etc you will need a time out for your SERIN's to work independently.



Yes My......·intention is to activate the RFID readers in turn 1 2 1 2 1 2 etc

How would i do this...... you will need a time out for your SERIN's to work independently.

Do you have·any· http://forums.parallax.com/images/smilies/idea.gif·how much of a·

TIME OUT·for·the SERIN's that will need

Can you give an example of how to do this or a post where some else has done before





▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

Chris Savage
03-30-2007, 10:41 PM
Sam,

Just for clarification, the way the code is right now only one person can come and go at a time…That is, if someone leaves, another can’t leave until they come back since the SERIN won’t read that RFID Reader until the other was read. Is this what you intended?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

sam_sam_sam
03-31-2007, 01:29 AM
·Chris Savage

ThanK You For Your Reply


Just for clarification, the way the code is right now only one person can come and go at a time…That is, if someone leaves, another can’t leave until they come back since the SERIN won’t read that RFID Reader until the other was read. Is this what you intended?

How can i fix SERIN so that both can·be readed·ONE·AT· A TIME·so this is not a problem

I want to able to open the Gate with ONE Reader as·I leave and closed the Gate with the other Reader·when the Wife leave to go to work

I need to learn how to this because i have a few people that want the same set up that

I·have if·I can get this to work






▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them
·
·
·
·
Sam

·

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

Post Edited (sam_sam_sam) : 3/30/2007 8:57:25 PM GMT

Franklin
03-31-2007, 02:58 AM
Take a look at the serin command, the timeout feature is explained there. It just gives the serin command a time limit and if nothing is read it will go where you direct it, the other reader in your case. Why not a push button to get out and the card to get back in? Would be simpler (but not as challenging I would suppose)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen

Chris Savage
03-31-2007, 03:32 AM
Franklin,

Your idea isn’t too bad…Recently I suggested a customer use a sensor to detect when a person is scanning a card. He loved the idea…I will share it here in case it helps…

The customer was unable to sufficiently scan several RFID Reader Modules quick enough to be sure not to lose any data. My suggestion involved using a simple IR detector at the panel where the tag was scanned. It simply makes an I/O pin go LOW when it detects an object. For this customer scanning several pins for a LOW takes no time and then he would do a SERIN (with Timeout) for the reader whose IR was triggered. This worked perfectly and he’s had no missed reads since then. This might be an alternative for you. Take care.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

sam_sam_sam
03-31-2007, 03:54 AM
Chris Savage
·Can you tell if this would work if not i will try your ·http://forums.parallax.com/images/smilies/idea.gif


Reader1:
· LOW Enable1··································· ' activate the reader

· #IF __No_SPRAM #THEN
··· SERIN RX1, T2400, 1000, No_Data1, [WAIT($0A), STR buf\10]
· #ELSE
··· SERIN RX1, T2400, 1000, No_Data1, [WAIT($0A), SPSTR 10]
· #ENDIF
· HIGH Enable1
··································· ' deactivate reader
No_Data1:

· LOW Enable2··································· ' activate the reader
· #IF __No_SPRAM #THEN
··· SERIN RX2, T2400,· 1000, No_Data2, [WAIT($0A), STR buf\10]····
··· #ELSE
··· SERIN RX2, T2400,· 1000, No_Data2, [WAIT($0A), SPSTR 10]
· #ENDIF
· HIGH Enable2································ ·' deactivate reader

· No_Data2:
GOTO Reader1

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

Post Edited (sam_sam_sam) : 3/31/2007 2:13:10 AM GMT

Chris Savage
03-31-2007, 04:46 AM
It would be easier to follow this code if you didn’t have the conditional compilation included…Waiting a whole second you could miss data at the other reader though. You don’t need the GOTO Reader2 since that line would be executed next anyway. Other than that is should work…Have you tried it? What happened?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

Unsoundcode
03-31-2007, 04:53 AM
Hi Sam, your code looks good, the timeout could be shorter. Try reducing it until you get the best results.

The IR detector is a good idea and one you should consider in this app. If you decide to include the IR detector you might include something like this to look for a reader being activated.

DO WHILE (IN0=0) AND (IN1 =0)······ 'IN0 and IN1 would be the IR detectors
LOOP
IF IN0=1 THEN
GOSUB Reader1
ELSEIF IN1=1 THEN
GOSUB Reader2
ENDIF

Whatever way you choose make the two reader routines into subroutines, that's a simple case of altering the last couple of lines to include a RETURN and calling them in turn from within your main loop with a GOSUB.

No_Data1:

RETURN

Jeff T.

Harrison.
03-31-2007, 06:42 AM
What you could do is enable both readers, and check the serial pins of each one in a constant loop (using something like IN0=0). The moment one of the serial pins change, you know that reader detected something. Then you disable both readers and jump to the read subroutine for the respective reader. In the subroutine, enable the specific reader that triggered the read loop and read in the tag again.

Note that the above is only possible if the person holds the tag to the reader long enough for the reader to read the tag twice. That is, the first time for the initial triggering, then the second time to actually retrieve the data from the correct reader.

sam_sam_sam
03-31-2007, 08:43 AM
Chris Savage

Thank You for your help in this project

I have no way of testing this routine until next weekend I just order two Card Reader Today
but will try it and let you know how well it works

Thanks for pointing out this·............http://forums.parallax.com/images/smilies/smile.gif.............

Waiting a whole second you could miss data at the other reader though. You don’t need the GOTO Reader2 since that line would be executed next anyway

I will have to test and adj delay for the· SERIN and the time that the gate takes to open and close

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

sam_sam_sam
03-31-2007, 09:06 AM
Unsoundcode (http://forums.parallax.com/member.php?u=47123)

Thanks for your reply

Do you where I·get some IR·detectors that are not fooled by the sun·light and will work with a Basic Stamp·and will not cost an arm or a leg Just in case i need to go this route

I·Thank·anyone could give an web link to find this type IR·detectors...... http://forums.parallax.com/images/smilies/smile.gif.......

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

Chris Savage
03-31-2007, 09:44 AM
Harrison,

Your idea could work…If you’ve ever kept the RFID Reader enabled and printed what it sees you will find that holding a tag within range will send the tag ID several times a second. So it is possible to get to quick readings to use in that manner. It is certainly worth testing. I will see if I have time this weekend to do that very thing. Take care.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

sam_sam_sam
03-31-2007, 09:48 AM
Harrison. (http://forums.parallax.com/member.php?u=40649)
Is this what you are talk about do i have the right http://forums.parallax.com/images/smilies/idea.gif

Main:

· LOW Enable1
· LOW Enable2

DO
·LOOP UNTIL IN1 =·0 OR IN3 = 0

·IF IN1 = 1 THEN
··· HIGH Enable1
··· HIGH Enable2
·GOSUB Reader1

·ELSE
·IF IN3 = 1 THEN
·· HIGH Enable1
·· HIGH Enable2
·GOSUB Reader2

·ENDIF
·ENDIF

DO

·Reader1:

·· LOW Enable1
· #IF __No_SPRAM #THEN
··· SERIN RX1, T2400, [WAIT($0A), STR buf\10]
· #ELSE
··· SERIN RX1, T2400, [WAIT($0A), SPSTR 10]
· #ENDIF
· HIGH Enable1
·································
· Reader2:
·· LOW Enable2
· #IF __No_SPRAM #THEN
··· SERIN RX2, T2400, [WAIT($0A), STR buf\10]··· ' wait for hdr + ID
· #ELSE
··· SERIN RX2, T2400, [WAIT($0A), SPSTR 10]
· #ENDIF
· HIGH Enable2··

I change the routine

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

Post Edited (sam_sam_sam) : 3/31/2007 3:43:49 AM GMT

Chris Savage
03-31-2007, 10:23 AM
Sam,

There’s no need to keep doing the LOW commands within the DO…LOOP structure. Also, you’re looking for a LOW on the serial lines. By default they will be HIGH. Take care.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

sam_sam_sam
03-31-2007, 10:38 AM
Chirs

Is this what you are talking about changing

Thank You for all of your help

Main:

· LOW Enable1
· LOW Enable2

DO
·LOOP UNTIL IN1 =·0 OR IN3 = 0

·IF IN1 =·0 THEN
··· HIGH Enable1
··· HIGH Enable2
·GOSUB Reader1

·ELSE
·IF IN3 =·0 THEN
·· HIGH Enable1
·· HIGH Enable2
·GOSUB Reader2

·ENDIF
·ENDIF


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

Post Edited (sam_sam_sam) : 3/31/2007 3:44:51 AM GMT

Chris Savage
03-31-2007, 11:37 AM
Something like that...Of course testing will be the ultimate way of proving some of these concepts. Take care.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

sam_sam_sam
03-31-2007, 11:49 AM
Chris

Thank You for all of your help and i will POST how well it works

To Everyone

That has reply to this POST

Thank You for all of you http://forums.parallax.com/images/smilies/idea.gif·s and help


·And helping learn something new........http://forums.parallax.com/images/smilies/smile.gif........http://forums.parallax.com/images/smilies/smile.gif.......http://forums.parallax.com/images/smilies/smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

Harrison.
03-31-2007, 11:50 AM
If the code doesn't work then you may have to switch the conditional to IN1 = 1 since I believe True mode serial is non inverted. Also, the BS2 may not be fast enough to capture the serial stream so you may have to do the following (I posted this right after you posted your response about testing the code you posted earlier):
---
You will most likely have to shadow the pin states in variables since the incoming serial stream is a bunch of highs and lows, meaning that your if statement may not actually see what your while statement saw.

In other words:




s_in1 var bit
s_in2 var bit

DO
s_in1 = IN1
s_in2 = IN2
LOOP UNTIL (s_in1 = 1) OR (s_in2 = 1)

IF s_in1 = 1 then
' reader stuff goes here
ENDIF

' etc....


Post Edited (Harrison.) : 3/31/2007 4:55:00 AM GMT

Chris Savage
03-31-2007, 11:58 AM
Harrison,

Non-inverted is idle-HIGH…So when there’s no data the line will already be HIGH. He wants to grab it when it goes LOW. Take care.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

sam_sam_sam
03-31-2007, 12:11 PM
Harrison (http://forums.parallax.com/member.php?u=40649)

Let me see if i understand what you are saying

s_in1·var·bit················ 'Dose·this hold the valve of the SERIN
s_in2·var·bit

DO
·····s_in1·=·IN1··············'Then when the valve changes then gose to which ever card·reader had the card at the reader
·····s_in2·=·IN2
LOOP·UNTIL·(s_in1·=·1)·OR·(s_in2·=·1)

Thank You Have been alot of help to me in this Project..............http://forums.parallax.com/images/smilies/smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

Harrison.
03-31-2007, 01:19 PM
@Chris - Ah now I see. I never actually understood what the logic states for inverted and non-inverted serial were. I always memorized the constants and names.

@Sam - According to what Chris said, you will have to switch back to using 0 as the break out of loop condition. The bit variables are used to store the pin states for comparing by the while and if statements. This allows you to take a snapshot of the state of the pins. You have to do this since the pin state may have changed between the while loop and the if statement that actually reads the card. The revised and slightly more comented code is below:





s_in1 var bit ' holds pin state for comparing, not the actual serial data
s_in2 var bit

DO
s_in1 = IN1 ' store the pin state immediately, which allows you to figure out which sensor triggered first
s_in2 = IN2 ' note that IN1 & IN2 are the serial pins coming from the rfid readers
LOOP UNTIL (s_in1 = 0) OR (s_in2 = 0) ' quit out of the loop whenever either rfid reader detected a card

IF s_in1 = 0 then
' reader stuff goes here
ENDIF

' etc....


Post Edited (Harrison.) : 3/31/2007 6:26:33 AM GMT

sam_sam_sam
03-31-2007, 01:40 PM
Harrison (http://forums.parallax.com/member.php?u=40649)

Thank You for Explaning this to me i want understand what is going on in these code routine so i can use them again






Thanks for the idea's.............·These guys·are having way to much fun .............They are all smiles




Start...................http://forums.parallax.com/images/smilies/idea.gif.....................http://forums.parallax.com/images/smilies/hop.gif ................http://forums.parallax.com/images/smilies/jumpin.gif ............................http://forums.parallax.com/images/smilies/smile.gif............ That all folks it getting LATE..






All jokes a side this give some thing to work on next week when the Card Readers· get here and i get the Gate Opener
And will Post this Project when it done and working


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

sam_sam_sam
04-05-2007, 11:54 AM
Hi EveryOne

Chirs

The Card Readers came in Today and·I Had Some Time to PLAY with it

The routine that you said would work it dose not But·Thanks for the help that you gave me·I knew what to look for·when you·scan one card reader1 it dose not run check_list until you scan the second card reader

·I came up with something that dose work and i will· share it with you

You can not make the nodata less than 100

If you try to make it less it only reads one card reader but·not the other

·But if you make·nodata· 150 that works the best

You can·HOLD·ONE·CARD on·EACH·READER at the same time and it will READ EACH CARD ONE AT A TIME· with the name of each card about one second or less·for each card ( Card Reader1... Reads Tag1... and Card Reader2..... Reads Tag2... )

One other thing I had to put this·GOSUB Check_List· in because it would not· go to· Check_List·with out this

·One other thing i had to add was EXIT because sometime it would not go to the other reader

These seem to work very well i try it about 30 or 40 time so far so good

' -----[ Initialization ]--------------------------------------------------
Reset:
· HIGH Enable1·································· ' turn off RFID reader1
· HIGH Enable2·································· ' turn off RFID reader2
· LOW Latch····································· ' lock the door!

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

Reader1:

DO
· LOW Enable1
·················································· ····
· #IF __No_SPRAM #THEN
··· SERIN RX1, T2400, 150, No_Data1, [WAIT($0A), STR buf\10]
· #ELSE
··· SERIN RX1, T2400, 150, No_Data1, [WAIT($0A), SPSTR 10]
· #ENDIF
· HIGH Enable1

EXIT

· GOSUB Check_List

'Reader2
··················································
No_Data1:

· LOW Enable2

· #IF __No_SPRAM #THEN
··· SERIN RX2, T2400, 150, No_Data2, [WAIT($0A), STR buf\10]
··· #ELSE
··· SERIN RX2, T2400, 150, No_Data2, [WAIT($0A), SPSTR 10]
· #ENDIF
· HIGH Enable2

··EXIT

· GOSUB Check_List

· No_Data2:

GOTO Reader1

LOOP

Check_List:

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

Post Edited (sam_sam_sam) : 4/6/2007 6:39:56 PM GMT

Chris Savage
04-07-2007, 06:39 AM
Sam,

Your code doesn’t actually look like what I was describing and you still have the extra stuff from conditional compilation in there. I think that is confusing the issues for you. I don’t have two RFID Cards at home currently, but I will get a hold of one in the next few days and see if I can’t come up with a sample code that reads either of two readers. It could be as late as Monday as I am not at Parallax currently. Take care.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

sam_sam_sam
04-09-2007, 08:15 PM
Chris

Thank You for any and all help that you can give in this Project





▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

sam_sam_sam
04-09-2007, 08:24 PM
Chris

I frist try this

Main:

· LOW Enable1
· LOW Enable2

DO
·LOOP UNTIL IN1 =·0 OR IN3 = 0

·IF IN1 =·0 THEN······ ·' I try this with IN1 = 1· Also it still did not work
··· HIGH Enable1
··· HIGH Enable2
·GOSUB Reader1

·ELSE
·IF IN3 =·0 THEN····· · ' I try this with IN1 = 1· Also it still did not work
·· HIGH Enable1
·· HIGH Enable2
·GOSUB Reader2

·ENDIF
·ENDIF

DO

·Reader1:

·· LOW Enable1
· #IF __No_SPRAM #THEN
··· SERIN RX1, T2400, [WAIT($0A), STR buf\10]
· #ELSE
··· SERIN RX1, T2400, [WAIT($0A), SPSTR 10]
· #ENDIF
· HIGH Enable1
·································
· Reader2:
·· LOW Enable2
· #IF __No_SPRAM #THEN
··· SERIN RX2, T2400, [WAIT($0A), STR buf\10]··· ' wait for hdr + ID
· #ELSE
··· SERIN RX2, T2400, [WAIT($0A), SPSTR 10]
· #ENDIF
· HIGH Enable2



The problem is that when you scan the frist card read it would wait until you scan the second card reader
until it would read the card·

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

Post Edited (sam_sam_sam) : 4/9/2007 1:35:23 PM GMT

sam_sam_sam
04-09-2007, 08:29 PM
Chris

I will try this if i have time today when i get home from work and let you know if i can
get this code to work

s_in1·var·bit·····'·holds·pin·state·for·comparing, ·not·the·actual·serial·data
s_in2·var·bit

DO
·····s_in1·=·IN1·····'·store·the·pin·state·immedia tely,·which·allows·you·to·figure·out·which·sensor· triggered·first
·····s_in2·=·IN2·····'·note·that·IN1·&·IN2·are·the·serial·pins·coming·from·the·rfid·read ers
LOOP·UNTIL·(s_in1·=·0)·OR·(s_in2·=·0)·····'·quit·o ut·of·the·loop·whenever·either·rfid·reader·detecte d·a·card

It dose not read cards at all

IF·s_in1·=·0·then
····'·reader·stuff·goes·here
ENDIF

'·etc....

I tried this routine and this dose not work at all

LOOP·UNTIL·(s_in1·=·0)·OR·(s_in2·=·0)·····'·quit·o ut·of·the·loop·whenever·either·rfid·reader·detecte d·a·card

It dose quit the loop but dose not go to check_list routine no matter how i write it

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

Post Edited (sam_sam_sam) : 4/10/2007 2:33:47 AM GMT

sam_sam_sam
04-10-2007, 09:38 AM
This rountine work very well so far
I have tested 50 to 60 time so far so good

Is there any way to shorten it

Reset:
· HIGH Enable1·································· ' turn of RFID reader1
· HIGH Enable2·································· ' turn of RFID reader2
· LOW Latch····································· ' lock the door!

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

DO

Reader1:

· LOW Enable1··········································· ···········
· #IF __No_SPRAM #THEN
··· SERIN RX1, T2400, 150, No_Data1, [WAIT($0A), STR buf\10]
· #ELSE
··· SERIN RX1, T2400, 150, No_Data1, [WAIT($0A), SPSTR 10]
· #ENDIF
· HIGH Enable1

·· EXIT
· GOSUB Check_List
·················································
No_Data1:

· LOW Enable2
· #IF __No_SPRAM #THEN
··· SERIN RX2, T2400, 150, No_Data2, [WAIT($0A), STR buf\10]
··· #ELSE
··· SERIN RX2, T2400, 150, No_Data2, [WAIT($0A), SPSTR 10]
· #ENDIF
· HIGH Enable2

·· EXIT
· GOSUB Check_List
· No_Data2:
GOTO Reader1
LOOP

Check_List:

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

sam_sam_sam
04-11-2007, 02:59 AM
Chris

I will get a hold of one in the next few days and see if
I can’t come up with a sample code that reads either of two readers.

If you could do this it would be a great when you have the time
·I would like to see what you come with

Thank You All Of Your Help In this Project

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

Chris Savage
04-11-2007, 04:37 AM
Sam,

Okay, I have two readers now…I will see what I can put together…It is unclear which BASIC Stamp you’re using though since you still have the conditional compilation code in what you posted…

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

Chris Savage
04-11-2007, 05:40 AM
Okay, the following program works with two RFID Readers (more could be added). The biggest problem is getting the readers far enough apart. I tried this on the PDB and it wasn’t working, but if I only enabled one unit it would work. Finally I realized that the two were canceling each other out. So you really need a couple of feet between the readers. All this code does is display the tag. If you hold a tag in front of both readers they will (pretty much) alternately display. Hopefully this will help you. Take care.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

sam_sam_sam
04-11-2007, 09:03 AM
Chris

Thank You for posting this routine i will try this maybe before the weeken

and let you know how it gose.............................................. ........http://forums.parallax.com/images/smilies/smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

Chris Savage
04-27-2007, 04:49 AM
Sam,

How did the code work out for you?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

sam_sam_sam
04-27-2007, 10:34 PM
Chris Savage

I tried this on the bench and it seem to work ok I am still working on running the
·cables and boxs for the Basic Stamp and Card Readers and Power Board to run all
of it maybe this weeken i will have it all hook up and see how well it works

This Project has been alot of work and have had not much time for any thing else

This is also part of the same Project

http://forums.pa (http://forums.parallax.com/showthread.php?p=647598)[/url][url=http://forums.parallax.com/showthread.php?p=647598]rallax.com/forums/default.aspx?f=15&m=187815 (http://forums.parallax.com/showthread.php?p=647598)

Update i had time to hook up every thing and seem to work ok



▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

Post Edited (sam_sam_sam) : 4/30/2007 9:52:31 PM GMT

sam_sam_sam
05-06-2007, 09:53 PM
Hi EveryOne

The project that I have been working on works ok

The problem that I have run in to is this

The names come up in the·debug window with the name that gave each card but card # 10 and # 11 Say · "Unauthorized" with a string
of numbers

Can any one tell how i can fix this problem

This is what i have tried

·

tagNum········· VAR···· Nib···· I have change this to Byte and Word and i still get this



I could be wrong but i think that i might have to something with this line but I am not sure what

·LOOKUP tagNum,
········ [Name0, Name1, Name2, Name3, Name4, Name5, Name6, Name7, Name8, Name9, Name10, Name11], idx··

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

Post Edited (sam_sam_sam) : 5/6/2007 3:00:29 PM GMT

Chris Savage
05-06-2007, 11:38 PM
Sam,

My guess is that your idx variable is declared as a byte and from a quick glance it appears you have more than 255 bytes in your table. Because of this the idx variable will wrap causing problems. You may need to increase it to a word variable. Take care.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

Chris Savage
05-06-2007, 11:39 PM
Confirmed...you have 289 bytes of data being indexed by a variable which can only handle 256.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

sam_sam_sam
05-07-2007, 01:24 AM
Chris


Thank You for your very FAST Reply.................http://forums.parallax.com/images/smilies/smile.gif

That was what was wrong



·http://forums.parallax.com/images/smilies/hop.gif·...................... Now it work very well.........................http://forums.parallax.com/images/smilies/jumpin.gif




I did not think about the idx variable needing to be a·WORD


I·knew that one of the variable need to be changed but which ONE

Thank You For all of your help and all of your time in helping get this project working so well


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

sam_sam_sam
05-07-2007, 08:50 AM
Hi EveryOne

Is there an easy way to·count to see how many·bytes there are·in a variable that you are using

I know this may be·a stupid question but i want to learn from this

Thanks to anyone that can point me in the right way so i can learn some more............http://forums.parallax.com/images/smilies/smile.gif



▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

Chris Savage
05-07-2007, 11:08 AM
Sam,

I don’t understand your question. There is 1 byte in a byte variable and 2 bytes in a Word variable. Is this what you mean? There is also 1/2 byte in a nibble and 1/8 byte in a bit. Take care.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

sam_sam_sam
05-07-2007, 06:37 PM
Chris

What I asking is is there an easy way to see how much variable space you are using for one variable

Or how do you count the bits for a variable that you are using spaces count as one bit and letters
as one· bit count·and numbers· as one bit count··

·Do I have this right

Do you have count the variable space by hand or can you use memory map to see how much variable
space for one variable




▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

sam_sam_sam
05-07-2007, 08:02 PM
Chris

Please help me understand this

··
...............There is 1 byte in a byte variable and 2 bytes in a Word variable.
There is also 1/2 byte in a nibble and 1/8 byte in a bit.


·Is this what you mean? How did you get this count ?.............
·
.......·you have 289 bytes of data being indexed by a variable


Is this to mean that all the DATA that is in the data for the " card #" and the "Tag Names"
are count as Bytes in the· indexed variable

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam

Chris Savage
05-07-2007, 09:11 PM
Sam,

It should be pretty straight forward in that each variable uses only the space declared for it. If you declare a variable as a Word it uses 2 bytes. Declare it as a Byte and it uses one byte. You can check the memory map to see how much variable space you’ve used overall. The memory map is how I calculated how many bytes were in your DATA statements.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

sam_sam_sam
05-08-2007, 12:08 AM
Chris

Now I see how you got the count·of byte,s in the Memory Map Page

Because i got the same 290 byte,s count

I am sorry that some time it· takes awhile for something to sink in this old·head of· mine


Chris

·Thank You helping understand what i doing· and taking the to help me get there.........http://forums.parallax.com/images/smilies/smile.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them

·
·
·
·
Sam