Skip to main content

RXD

Syntax

RXD ( pin )

Description

RXD (pin) will receive a single byte of data that is shifted as an asynchronous serial stream.  This function is similar to SERIN, but is a more efficient implementation.  The baudrate for the pin should be set before using RXD, that is done using the BAUD(pin) function.

RXD will return 0-255 if there was data present. RXD will timeout after 0.5 seconds and return -1 ($FFFFFFFF) if there is no serial stream detected on pin.

If pin is 16 then data is received on the SIN pin.

Example

BAUD(1) = 9600 ' set the
baud rate for serial I/O on pin 1

' Wait for serial input on pin 1

DO
MyByte =
RXD(1)

UNTIL MyByte >= 0

Differences from other BASICs

  • no equivalent in Visual BASIC
  • preferred alternate to SERIN of PBASIC

See also