Shop OBEX P1 Docs P2 Docs Learn Events
SERIN hell no, it won't go — Parallax Forums

SERIN hell no, it won't go

lee555lee555 Posts: 1
edited 2005-03-01 22:28 in BASIC Stamp
I would like to send 3 or 4 values to my stamp (bs2)
sendings is not the problem, receiving is the problem
send in vb (
value1=x······· ( ASCII)
value2=190···· (0-200)
value3=195···· (0-200)
value4=116···· (0-200)
total_value as string· = value1 & value2 & ......
) ok


'

Main:
· SERIN 16,$4054,PAUSEit,500,PAUSEit,[noparse][[/noparse]DEC3 val2,DEC3 val3,DEC3 val4]

·· DEBUG Val2,Val3,Val4,":"
··· PAUSE 20
GoTo Main·· nono.gif
'
Main:
· SERIN 16,$4054,PAUSEit,500,PAUSEit,[noparse][[/noparse]STR mVal\7,DEC3 val3]

·· DEBUG mVal(0),mVal(1),mVal(2),mVal(3),mVal(4),mVal(5),DEC val3":"
lol.gif·····(OK !·tongue.gif·GOOD turn.gif· GOOD )

········ val1 = (mVal(0) mVal(1) mVal(2))
········ val2 = (mVal(3) mVal(4) mVal(5))
··· DEBUG· val1,",",val2,",",val3,":" (jumpin.gif·hell no)
··· PAUSE 20
GoTo Main
'

Comments

  • steve_bsteve_b Posts: 1,563
    edited 2005-03-01 20:14
    What are you sending from?!· A PC?· what's the baud rate and protocol you're trying to get (N81..etc..).



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

    Steve
    http://members.rogers.com/steve.brady
    "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."
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-03-01 21:18
    Umm, if you are sending the 4 bytes mentioned, you should recieve them as:

    SERIN 16, $4054, [noparse][[/noparse]Val1, Val2, Val3, Val4]

    THEN, you can see them as:

    SEROUT 16, $4054, [noparse][[/noparse]Val1, DEC Val2, DEC Val3, DEC Val4]

    Where 'Val1' would be the "x" character, and the others would be converted into
    their decimal equivalents -- Byte '190' becomes 3 string bytes "190".

    This assumes you ARE sending them as bytes from your PC originally.

    The "SERIN xxx,yyy,[noparse][[/noparse]DEC MyVal] reads a 'string' with a CR after it, converts it
    to a decimal number, and puts the decimal number into MyVal.

    You had the right idea, just the wrong order of implementation.

    Oh, and what did you intend by "val1 = (x y z)"?· You've left out your operators, there.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-03-01 22:28
    Hmmm ... I've used VB to send data to the BASIC Stamp with great success. Have a look at this article:

    http://www.parallax.com/dl/docs/cols/nv/vol3/col/nv89.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
Sign In or Register to comment.