Shop OBEX P1 Docs P2 Docs Learn Events
Serial data between BS2's — Parallax Forums

Serial data between BS2's

ee95816ee95816 Posts: 1
edited 2006-07-12 22:24 in BASIC Stamp
I am pretty new at using these things, and so far things have worked out as expected.··But I am having trouble sending·a single character from one BS2 to another serially.· I am using·SEROUT to send the data and SERIN to receive the data.· All I get on the reciveing end is gibberish.· The code looks to be fairly simple based on the help files, but I am getting nowhere.· Below is my code, can anybody alleviate my ignorance?


thanks in advance


Sending Unit

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

· SEROUT 1, 16780, [noparse][[/noparse]"H"]


Reciveing Unit

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

sData VAR Byte
SERIN 1, 16780, [noparse][[/noparse]sData]
DEBUG DEC sData

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2006-07-12 22:12
    Look up SERIN or SEROUT in PBASIC Help.··Toward the end of those entries is a recommended set-up for Stamp-to-Stamp comms.

    If you want to see an H in DEBUG, then that line should be:

    DEBUG sData
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-07-12 22:19
    Even beyond what PJ said, you may have a synchronicity problem. Try the following in the receiving Stamp:

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


    sData VAR Byte
    sData = $FF

    Retry:
    SERIN 1, 16780, [noparse][[/noparse]sData]

    If sData = $FF THEN Retry
    DEBUG sData

    END


    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • steve_bsteve_b Posts: 1,563
    edited 2006-07-12 22:24
    have you connected a common ground between the 2 stamps?
    The tx line from one stamp has to go to the rx line of the other!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."
Sign In or Register to comment.