Shop OBEX P1 Docs P2 Docs Learn Events
Two RFID Card Reader ONE at a TIME ........Cards 10 and 11 Shows.."Unauthorized — Parallax Forums

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

sam_sam_samsam_sam_sam Posts: 2,286
edited 2007-05-07 17:08 in General Discussion
Hi EveryOne

I want to know if i have this right· 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, [noparse][[/noparse]WAIT($0A), STR buf\10]··· ' wait for hdr + ID
· #ELSE
··· SERIN RX1, T2400, [noparse][[/noparse]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, [noparse][[/noparse]WAIT($0A), STR buf\10]··· ' wait for hdr + ID
· #ELSE
··· SERIN RX2, T2400, [noparse][[/noparse]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·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
«1

Comments

  • FranklinFranklin Posts: 4,747
    edited 2007-03-29 22:49
    I think it would work but why? Two doors, one stamp?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-03-30 00:04
    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_samsam_sam_sam Posts: 2,286
    edited 2007-03-30 14:05
    ·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· 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·idea.gif·that you may have and all of your time finding them

    ·
    ·
    ·
    ·
    Sam
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-03-30 15:41
    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_samsam_sam_sam Posts: 2,286
    edited 2007-03-30 18:29
    ·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·idea.gif·that you may have and all of your time finding them
    ·
    ·
    ·
    ·
    Sam

    ·

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·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
  • FranklinFranklin Posts: 4,747
    edited 2007-03-30 19:58
    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 SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-03-30 20:32
    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_samsam_sam_sam Posts: 2,286
    edited 2007-03-30 20:54
    Chris Savage
    ·Can you tell if this would work if not i will try your ·idea.gif


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

    · #IF __No_SPRAM #THEN
    ··· SERIN RX1, T2400, 1000, No_Data1, [noparse][[/noparse]WAIT($0A), STR buf\10]
    · #ELSE
    ··· SERIN RX1, T2400, 1000, No_Data1, [noparse][[/noparse]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, [noparse][[/noparse]WAIT($0A), STR buf\10]····
    ··· #ELSE
    ··· SERIN RX2, T2400,· 1000, No_Data2, [noparse][[/noparse]WAIT($0A), SPSTR 10]
    · #ENDIF
    · HIGH Enable2································ ·' deactivate reader

    · No_Data2:
    GOTO Reader1

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·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 SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-03-30 21:46
    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
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-03-30 21:53
    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.Harrison. Posts: 484
    edited 2007-03-30 23:42
    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_samsam_sam_sam Posts: 2,286
    edited 2007-03-31 01:43
    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·............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·idea.gif·that you may have and all of your time finding them

    ·
    ·
    ·
    ·
    Sam
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2007-03-31 02:06
    Unsoundcode

    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...... smile.gif.......

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them

    ·
    ·
    ·
    ·
    Sam
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-03-31 02:44
    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_samsam_sam_sam Posts: 2,286
    edited 2007-03-31 02:48
    Harrison.
    Is this what you are talk about do i have the right 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, [noparse][[/noparse]WAIT($0A), STR buf\10]
    · #ELSE
    ··· SERIN RX1, T2400, [noparse][[/noparse]WAIT($0A), SPSTR 10]
    · #ENDIF
    · HIGH Enable1
    ·································
    · Reader2:
    ·· LOW Enable2
    · #IF __No_SPRAM #THEN
    ··· SERIN RX2, T2400, [noparse][[/noparse]WAIT($0A), STR buf\10]··· ' wait for hdr + ID
    · #ELSE
    ··· SERIN RX2, T2400, [noparse][[/noparse]WAIT($0A), SPSTR 10]
    · #ENDIF
    · HIGH Enable2··

    I change the routine

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·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 SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-03-31 03:23
    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_samsam_sam_sam Posts: 2,286
    edited 2007-03-31 03:38
    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·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 SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-03-31 04:37
    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_samsam_sam_sam Posts: 2,286
    edited 2007-03-31 04:49
    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 idea.gif·s and help


    ·And helping learn something new........smile.gif........smile.gif.......smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them

    ·
    ·
    ·
    ·
    Sam
  • Harrison.Harrison. Posts: 484
    edited 2007-03-31 04:50
    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 SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-03-31 04:58
    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_samsam_sam_sam Posts: 2,286
    edited 2007-03-31 05:11
    Harrison

    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..............smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them

    ·
    ·
    ·
    ·
    Sam
  • Harrison.Harrison. Posts: 484
    edited 2007-03-31 06:19
    @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_samsam_sam_sam Posts: 2,286
    edited 2007-03-31 06:40
    Harrison

    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...................idea.gif.....................hop.gif ................jumpin.gif ............................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·idea.gif·that you may have and all of your time finding them

    ·
    ·
    ·
    ·
    Sam
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2007-04-05 04:54
    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

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

    '
    [noparse][[/noparse] Program Code ]

    Reader1:

    DO
    · LOW Enable1
    ······················································
    · #IF __No_SPRAM #THEN
    ··· SERIN RX1, T2400, 150, No_Data1, [noparse][[/noparse]WAIT($0A), STR buf\10]
    · #ELSE
    ··· SERIN RX1, T2400, 150, No_Data1, [noparse][[/noparse]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, [noparse][[/noparse]WAIT($0A), STR buf\10]
    ··· #ELSE
    ··· SERIN RX2, T2400, 150, No_Data2, [noparse][[/noparse]WAIT($0A), SPSTR 10]
    · #ENDIF
    · HIGH Enable2

    ··EXIT

    · GOSUB Check_List

    · No_Data2:

    GOTO Reader1

    LOOP

    Check_List:

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·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 SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-04-06 23:39
    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_samsam_sam_sam Posts: 2,286
    edited 2007-04-09 13:15
    Chris

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





    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them

    ·
    ·
    ·
    ·
    Sam
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2007-04-09 13:24
    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, [noparse][[/noparse]WAIT($0A), STR buf\10]
    · #ELSE
    ··· SERIN RX1, T2400, [noparse][[/noparse]WAIT($0A), SPSTR 10]
    · #ENDIF
    · HIGH Enable1
    ·································
    · Reader2:
    ·· LOW Enable2
    · #IF __No_SPRAM #THEN
    ··· SERIN RX2, T2400, [noparse][[/noparse]WAIT($0A), STR buf\10]··· ' wait for hdr + ID
    · #ELSE
    ··· SERIN RX2, T2400, [noparse][[/noparse]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·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_samsam_sam_sam Posts: 2,286
    edited 2007-04-09 13:29
    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·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

    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·out·of·the·loop·whenever·either·rfid·reader·detected·a·card

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

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·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_samsam_sam_sam Posts: 2,286
    edited 2007-04-10 02:38
    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!

    '
    [noparse][[/noparse] Program Code ]

    DO

    Reader1:

    · LOW Enable1······················································
    · #IF __No_SPRAM #THEN
    ··· SERIN RX1, T2400, 150, No_Data1, [noparse][[/noparse]WAIT($0A), STR buf\10]
    · #ELSE
    ··· SERIN RX1, T2400, 150, No_Data1, [noparse][[/noparse]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, [noparse][[/noparse]WAIT($0A), STR buf\10]
    ··· #ELSE
    ··· SERIN RX2, T2400, 150, No_Data2, [noparse][[/noparse]WAIT($0A), SPSTR 10]
    · #ENDIF
    · HIGH Enable2

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

    Check_List:

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them

    ·
    ·
    ·
    ·
    Sam
Sign In or Register to comment.