Shop OBEX P1 Docs P2 Docs Learn Events
BS2P to BS2 — Parallax Forums

BS2P to BS2

robban35robban35 Posts: 32
edited 2011-06-01 08:37 in BASIC Stamp
Hi!

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

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

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

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


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

please help.

regards
Robban

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-06-01 08:37
    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.