Skip to main content

SERIN

Syntax

SERIN pin, baudrate, { posTrue,} [data-list ]

Description

SERIN receives [data-list] bytes as asynchronous serial data on pin at a baudratePosTrue is an optional parameter, and if set to 0 then the data is inverted.

[data-list] can contain a list of  variables, or   stringame$ \ len.   The latter will receive out len bytes starting from stringname$(0). SERIN will timeout after 0.5 seconds and return -1 ($FFFFFFFF) in the next item in the InputList before the timeout.

ARMstamp

If pin is 16 then data is received on the SIN pin. SIN and SOUT are always negative true.

Baudrates can be upto 115.2 Kbaud for pins 0-15 or 19.2 Kbaud for pin 16 (SIN and SOUT).  SIN and SOUT are limited by the level translators.

ARMmite--

If pin is 16 then data is received on the SIN pin. SIN and SOUT are always positive true.

Baudrates can be upto 115.2 Kbaud for all pins.

Example

' Read serial stream from pin 1 saving to MyByte

SERIN 1, 19200, [MyByte]

PRINT HEX(MyByte)

Differences from other BASICs

  • no equivalent in Visual BASIC
  • simplified from PBASIC

See also