BS2P to BS2

robban35robban35 Posts: 32
edited June 2011 in BASIC Stamp Vote Up0Vote Down

I am trying to send a word from my BS2p to my BS2.

Here´s the program for BS2p
' {$STAMP BS2p}
' {$PBASIC 2.5}

SEROUT 2, 17405,["HELLO"]
goto t

here´s my BS2 program
sdata VAR word
SERIN 0, 16780, [sData]
DEBUG sdata,CR
PAUSE 1000

but all i get is a bunch of numbers or no recieve

please help.



  • 2 Comments sorted by Date Added Votes
  • Mike GreenMike Green Posts: 22,601
    edited June 2011 Vote Up0Vote Down
    WORD means something different from what you think. It refers to a 16-bit number, just like BYTE refers to an 8-bit number. Your SERIN in the BS2 program is expecting a number in the range of 0 to 65535. Normally, the SERIN would skip non-numeric characters until it sees the first digit and stop at the first non-digit after that.

    Look in the Basic Stamp Syntax and Reference Manual in the chapters on the SERIN and SEROUT statements for descriptions of what they can do, what kinds of data they can receiver and transmit, and how to write the various "formatters".

    Look particularly at the description of the STR formatter. Remember that the Stamps don't have real strings like what you'll find in PC versions of Basic. There's limited variable storage on the Stamps (a total of 26 bytes on the BS2) and each character of a string takes a byte. The BS2p has more storage, but it's a different area and not usable for variables. There's a way to receive bytes (SPSTR formatter) into this separate area and access them (GET and PUT statements), but it's not really a string variable.
Sign In or Register to comment.