Specifications
BASIC Stamp II
Parallax, Inc. • BASIC Stamp Programming Manual 1.8 • Page 307
2
Serin
SERIN
rpin{\fpin},baudmode,{plabel,}{timeout,tlabel,}[inputData]
Receive asynchronous (e.g., RS-232) data.
•
Rpin
is a variable/constant (0–16) that specifies the I/O pin
through which the serial data will be received. This pin will
switch to input mode and remain in that state after the instruction
is completed. If Rpin is set to 16, the Stamp uses the dedicated
serial-input pin (SIN), which is normally used by the STAMP2
host program.
•
Fpin
is an optional variable/constant (0–15) that specifies the
I/O pin to be used for flow control (byte-by-byte handshaking).
This pin will switch to output mode and remain in that state after
the end of the instruction.
•
Baudmode
is a 16-bit variable/constant that specifies serial
timing and configuration. The lower 13 bits are interpreted as the
bit period minus 20µs. Bit 13 ($2000 hex) is a flag that controls the
number of data bits and parity (0=8 bits and no parity, 1=7
bits and even parity). Bit 14 ($4000 hex) controls polarity
(0=noninverted, 1=inverted). Bit 15 ($8000 hex) is not used by
Serin.
•
Plabel
is an optional label indicating where the program should
go in the event of a parity error. This argument may only be
provided if baudmode indicates 7 bits, and even parity.
•
Timeout
is an optional variable/constant (0–65535) that tells
Serin how long in milliseconds to wait for incoming data. If data
does not arrive in time, the program will jump to the address
specified by tlable.
•
Tlabel
is an optional label which must be provided along with
timeout, indicating where the program should go in the event
that data does not arrive within the period specified by timeout.
•
InputData
is a list of variables and modifiers that tells Serin what
to do with incoming data. Serin can store data in a variable or
array; interpret numeric text (decimal, binary, or hex) and store
the corresponding value in a variable; wait for a fixed or variable










