BASIC Stamp II Manual 0.94 • Parallax, Inc. • (916) 624-8333 • Page 55
BASIC Stamp II
SERIN rpin{\fpin},baudmode,{plabel,}{timeout,tlabel,}[inputdata]
Input data serially.
example:
SERIN 4,32+$4000,60000,nothingcame,[WAIT (“,”),STR bytearray\16\”,”]
Accept serial data on pin 4. Reception mode is 19,200 baud, 8 data bits,
no parity, inverted data. If no data is received after 60 seconds (60,000
milliseconds), execution will jump to
nothingcame.
If data is received,
SERIN will wait for a comma (“,”) before accepting bytes. After the
comma is received, up to 16 bytes will be received and placed into
bytearray;
if another comma is received before 16 bytes of data, then the
remaining bytes in the array will be filled with 0’s.
Rpin
is 0-15 for an I/O pin, or 16 for the internal serial port (pin 2, RX).
If a regular I/O pin is used, then the input will be on a TTL-level pin. If
the RX pin is used, then the input will be on a pseudo-RS232 pin. The
difference is this:
On a TTL-level pin (0-15), the signals received are 0 to 5 volts. Serial
communication with TTL signals should work well for most
applications (certainly if the communicating devices are all TTL-
level). If a TTL pin is used to receive RS232-level signals, then the signal
should pass through a 22K resistor before reaching the pin (otherwise, the
TTL pin may be damaged).
On the RS232-level pin (16), the signals received are -10 to 10 volts.
Serial communication with RS232 signals is standard on most serial
devices, such as printers, modems, etc. This pin is designed to
accept RS232 signals, so no in-line resistor is necessary.
In either case, the low/high threshold is at 1.4 volts (anything below
reads as 0, anything above reads as 1).
Summary of Contents for BASIC Stamp II
Page 2: ...BLANK PAGE...