Shop OBEX P1 Docs P2 Docs Learn Events
AppKit: SN75176 in a RS485 Network.....I had some time to PLAY with these DEMOs — Parallax Forums

AppKit: SN75176 in a RS485 Network.....I had some time to PLAY with these DEMOs

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

I want to know if·I have the right ·idea.gif

This will the frist time that i will
be using this chip and talking from one Basic Stamp to another Basic Stamp

AppKit: Using the SN75176 in a RS485 Network
Has the send and Receiver Demo Code it has the follows.........

Send Demo················································· · Receiver Demo

Input··· 2·······················································Output 2··
output·· 0····················································· Output 0
High···· 0······················································ ·low 0


If pin <> 1 Then Loop1···································· ·loop1:
··· SEROUT 1,N2400,("H")································· serin 1,N2400,bo
············································

Loop1:························································· ·If bo <> "H"· Then is_Low
············································
Button2,0,255,0,b0,1,preloop···························· High 2

Goto Loop1···················································· goto Loop1
····································································
preloop2:······················································· is_Low:
SEROUT 1,N2400,("L")······································· Low2
·····································································GoTo Loop1

Loop2:···························································
BUTTON 2,1,255,250,b0,1,Loop_again
goto Loop2

loop_again:
SEROUT 1,N2400,("H")
goto LOOP1




Now my question is this if i want to SEND.....
RFID card # or Tag·Names· ····
·Do you have to put· this at the top
of what i want to send· and put this at bottom
································
I am not sure·which one you·have to have frist....· ("L") or ("H")

SEROUT 1,N2400,("L")

The·Data that you want to·SEND>>>>>>>>SEROUT 1,N2400, DEC· tagNum, "·"
I do not know if this is right or not

SEROUT 1,N2400,("H")



For the· Receiver end what do i have to put to receive the data

·SERIN 1,N2400· What else would i need

Thanks to anyone that can help me with this Project
I·have order the chips and will get them·next week so i·will have wait until i get them to play with them


·

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

·
·
·
·
Sam

Post Edited (sam_sam_sam) : 5/17/2007 2:48:37 PM GMT

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2007-05-11 16:40
    Sam,

    Once you have your hands on the parts, it will become clearer.

    Each chip can be selected as "talker" or "listener". Its usual for all chips to sit in "listener" mode as a default. When
    one node wants to talk, it flips to "talker" mode sends the data, then returns to "listener". You can have many listeners
    connected at one time and have them respond based on an identifying character the talker sends.

    Doing it this way allows all nodes to both talk and listen using one pair of wires. But, only one node can talk at a time.

    If you wish, you can set up two separate circuits so you don't have to switch from talker to listener. On a stamp without a comm buffer, it doesn't make much sense to do it that way because the Stamp can't do two things at once.

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • Tracy AllenTracy Allen Posts: 6,656
    edited 2007-05-12 17:10
    The example in the Appkit is not complete for what you want to do, as it is a one-way deal where the first Stamp with the button only sends to the second Stamp that only listens and sets the LED. To amplify what Tom said, you want a two way exchange, in essence as follows:

    Send Demo                                                    Receiver Demo
    ' pin p0 is direction, , low=listen, high=talk          ' pin p0 is direction, low=listen, high=talk
    ' pin p1 id data i/o                                         ' pin p1 is data i/o
    DO                                                              DO
        HIGH 0                                                       LOW 0
        PAUSE 3
        SEROUT 1,N2400,[noparse][[/noparse]"H"]                                   SERIN 1,N2400,[noparse][[/noparse]char]
        LOW 0                                                        HIGH 0
                                                                         PAUSE 3
        SERIN 1,N2400,[noparse][[/noparse]char]                                     SEROUT 1,N2400,[noparse][[/noparse]tagID]
        DEBUG ? tagID
        PAUSE 500             
    LOOP                                                          LOOP
    



    The PAUSEs gives time for the line to turn around and for the listening Stamp to be ready.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2007-05-13 21:30
    Tracy Allen

    Thank you for a fast reply to this Question that I had on· my post

    Send·Demo····················································Receiver·Demo
    '·pin·p0·is·direction,·,·low=listen,·high=talk··········'·pin·p0·is·direction,·low=listen,·high=talk
    '·pin·p1·id·data·i/o·········································'·pin·p1·is·data·i/o


    Thank you for explaning the flow control (low=listen,·high=talk·) and how it work i was not clear on this part of the code



    DO······························································DO
    ····HIGH·0·······················································LOW·0
    ····PAUSE·3
    ····SEROUT·1,N2400,[noparse][[/noparse]"H"]···································SERIN·1,N2400,[noparse][[/noparse]char]

    When do you use the··SEROUT·1,N2400,[noparse][[/noparse]"L"]· Command and how is it used
    ····LOW·0························································HIGH·0
    ·····································································PAUSE·3

    Thank you show me what i had to put to send the data to the other Basic Stamp
    My thinking was that it was something like that but··[noparse][[/noparse] that ]· i had use this for SerIn or SerOut lines

    ····SERIN·1,N2400,[noparse][[/noparse]char]·····································SEROUT·1,N2400,[noparse][[/noparse]tagID]

    ····DEBUG·?·tagID
    ····PAUSE·500
    LOOP··························································LOOP


    Thank You for helping me ·understand how to set this up·and how to get it to work

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··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-05-14 20:13
    Tom Sisk

    If you wish, you can set up two separate circuits so you don't have to switch from talker to listener. On a stamp without a comm buffer, it doesn't make much sense to do it that way because the Stamp can't do two things at once.


    I know that a Basic Stamp can only do one thing at a time but could i set it up so·that only one·Stamp·talkes·and· and listenes with out using a·switch· to do the·talking to listening and the other Stamp has the switch to do the··talking to listening

    ·( Can i do talk and listen in code for the Basic Stamp at the road)
    · (I may do both Basic Stamps talk and listen in code )

    Example when the Card Reader at the Road Sends Card #....... and that· Card #.......·would go to the house with out·using a switch ( I would have one CARD at the Card·Reader Box at the road for anyone who dose not have a card and if i know the person ) I would a send a card # that in the list to open the gate from the house that Stamp would have a switch to TALK OR LISTEN


    ·
    Send to the house To A·LCD Display....Some One A The Gate TagID # 0F024367D2·(OR)
    And Card Names and #·

    ·Now Basic Stamp at the Road Is waiting In a LOOP For a Card # To What To Do Next

    For card # In list to open gate or waiting for card #0F024357D7 to·Go To·Card Reader to scan again this Card Would at the Card Reader Box·at the house

    Some One A The Gate
    TagID # 0F024367D2

    Open Gate Cards are in Data List

    GoTo Reader
    TagID # 0F024357D7

    I hope that you can understand what i am tring to do in this example that i have here



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

    ·
    ·
    ·
    ·
    Sam

    Post Edited (sam_sam_sam) : 5/14/2007 8:17:59 PM GMT
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2007-05-17 03:31
    Hi EVERYONE

    I had some time to PLAY with these DEMOs

    I had to Play with the code some what to get it to work



    'Send Demo

    ·

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}



    ·btnwk VAR Byte


    INPUT··· 15
    OUTPUT·· 1
    HIGH···· 1


    ·DO


    IF (IN15 <> 1) THEN Loop1
    ··· SEROUT 0,16468,1,[noparse][[/noparse]"H"]


    Loop1:

    BUTTON 15,0,255,0,Btnwk,1,preloop2
    GOTO Loop1


    preloop2:
    SEROUT 0,16468,1,[noparse][[/noparse]"L"]



    Loop2:
    BUTTON 15,1,255,250,Btnwk,1,Loop_again
    GOTO Loop2


    loop_again:
    SEROUT 0,16468,1,[noparse][[/noparse]"H"]
    GOTO LOOP1


    LOOP

    ·

    'Receiver Demo

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}


    string· VAR Byte

    PAUSE 100························· ' This was ADD so that when the Basic Stamps where Power UP the led would NOT

    ········································ ' come ON and stay ON until the button was pushed


    OUTPUT 15
    OUTPUT 1
    LOW 1


    ·

    DO

    loop1:
    SERIN 0,16468,100,loop1,[noparse][[/noparse]string]·····
    ' SERIN 0,16468,100 This adj time to wait incoming,loop1,[noparse][[/noparse]string]

    DEBUG string, CR··························· ' This was ADD to see what data was sent from one Basic Stamp to

    ··················································· The other Basic Stamp

    IF (string <> "H" ) THEN is_Low

    HIGH 15

    GOTO Loop1

    is_Low:
    LOW 15
    GOTO Loop1


    LOOP

    ·I know what you all are going to say that all i am doing is turning ON and OFF an led light with two Basic Stamps

    and you are right but i had to understand how you send data from one Stamp to othe other Stamp









    hop.gif...............These GUYs are so HAPPY that i got this to work and so am I....................jumpin.gif







    Thanks to ALL that have helped me with this project




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

    ·
    ·
    ·
    ·
    Sam

    Post Edited (sam_sam_sam) : 5/17/2007 4:00:10 AM GMT
Sign In or Register to comment.