Shop OBEX P1 Docs P2 Docs Learn Events
Serout / serin — Parallax Forums

Serout / serin

ArchiverArchiver Posts: 46,084
edited 2003-06-13 17:24 in General Discussion
I've been using Serout and Serin in my projects successfully.
But I would like to gain a deeper understanding of these 2 commands.

Does anyone know where I can find some pseudo-code on how
serin/serout works at a particular baudmode setting such as 84?

This must be the most important command for communication.

Much thanks in advance.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-06-13 17:24
    Hi,

    Here is a code snippet that I use to read in either a fixed length of
    serial data or until I receive a specific character. I then parse
    through the array and act on the data received. Hope this helps.

    Ed

    '*******************************************************************
    ' serin Rpin, Baudmode, [noparse][[/noparse]STR amuletMsg\L\E]
    ' serin = receive asynchronous serial data
    ' Rpin = Rx (instruct BASIC Stamp to use dedicated serial-input pin)
    ' Baudmode = 84 (9600 baud, 8-bit data, no-parity, true polarity)
    ' [noparse][[/noparse]STR amuletMsg\L\E] = receive serial data of length L or until end
    ' character E is received into amuletMsg array
    '
    ' The command serin Rx, 84, [noparse][[/noparse]STR amuletMsg\L\E]
    ' will poll the serial line looking for serial data up to length L or
    ' until end character E is encountered.
    ' Incoming data will be stored in the amuletMsg array.
    '*******************************************************************
    serial_in:
    SERIN Rx, 84, [noparse][[/noparse]STR amuletMsg\6\0]


    --- In basicstamps@yahoogroups.com, "basicstampede"
    <basicstampede@y...> wrote:
    > I've been using Serout and Serin in my projects successfully.
    > But I would like to gain a deeper understanding of these 2 commands.
    >
    > Does anyone know where I can find some pseudo-code on how
    > serin/serout works at a particular baudmode setting such as 84?
    >
    > This must be the most important command for communication.
    >
    > Much thanks in advance.
Sign In or Register to comment.