Shop OBEX P1 Docs P2 Docs Learn Events
RF and serin/serout — Parallax Forums

RF and serin/serout

ArchiverArchiver Posts: 46,084
edited 2004-06-08 18:56 in General Discussion
In a message dated 6/8/2004 1:34:33 PM Eastern Daylight Time,
alexetouioui@h... writes:


> My programs are:
> Card 1:
> ..
> serin 1,16624,[noparse][[/noparse]DEC 100]
> ..
>
> Card 2:
> val VAR Word
> ..
> serout 2,16624,[noparse][[/noparse]DEC val]
> ...
>

If you are serouting dec val then your serin must say

serin 2, baud, [noparse][[/noparse]dec val]

You ALWAYS serin to a variable, never to a constant or decimal.

Sid


[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-06-08 16:46
    Hello,
    I work on two BS2x and RF modules, it's good for transfert letters
    like : "H" (serin 1,16624,"H"). But if I want to transfert a number,
    it won't work... help me.

    My programs are:
    Card 1:
    ..
    serin 1,16624,[noparse][[/noparse]DEC 100]
    ..

    Card 2:
    val VAR Word
    ..
    serout 2,16624,[noparse][[/noparse]DEC val]
    ...


    Thx in advance!
    Alex.
  • ArchiverArchiver Posts: 46,084
    edited 2004-06-08 18:56
    Alex,

    A single byte can hold a number up to 255. So you can do:

    SEROUT pin,baud, [noparse][[/noparse]255]

    on one unit and

    SERIN pin,baud,[noparse][[/noparse]x]

    debug dec x

    will display 255


    You can send a word sized number (up to 65,553) in two bytes.


    value var word
    value = 60000

    SEROUT pin,baud,[noparse][[/noparse]value.highbyte, value.lowbyte]


    SERIN pin, baud, [noparse][[/noparse]value.highbyte, value.lowbyte]

    debug dec value

    will display 60,000

    Numbers larger can be done, but it gets a little harder.

    HTH,

    Jonathan

    www.madlabs.info



    Original Message
    From: "alexetouioui3" <alexetouioui@h...>
    To: <basicstamps@yahoogroups.com>
    Sent: Tuesday, June 08, 2004 8:46 AM
    Subject: [noparse][[/noparse]basicstamps] RF and serin/serout


    > Hello,
    > I work on two BS2x and RF modules, it's good for transfert letters
    > like : "H" (serin 1,16624,"H"). But if I want to transfert a number,
    > it won't work... help me.
    >
    > My programs are:
    > Card 1:
    > ..
    > serin 1,16624,[noparse][[/noparse]DEC 100]
    > ..
    >
    > Card 2:
    > val VAR Word
    > ..
    > serout 2,16624,[noparse][[/noparse]DEC val]
    > ...
    >
    >
    > Thx in advance!
    > Alex.
    >
    >
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    > Yahoo! Groups Links
    >
    >
    >
    >
    >
    >
Sign In or Register to comment.