RXD(x)
 
Syntax

FUNCTION RXD(channel) as INTEGER
Description


RXD(x) 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.  

RXD(x) will return 0-255 if there was data present. or -1 (&HFFFFFFFF) if there is no serial stream available on SIN.  The hardware UARTx is used, so the CPU is not tied up, and bytes are buffered up to 256 bytes being received by an interrupt routine

SuperPRO or PROplus--

These devices support 4 UARTs, pin assignments in the Hardware Info

BASICchip or ARMmite--

Pin labeled RXD0 on the schematic, UART0 of the LPC2103.  Data is always positive true.

Baudrates can be up to 115.2 Kbaud.  

The compiler is also backward compatible with the syntax -- x = RXD0  ,  x= RXD , or  x= RXD1

Example

BAUD(2)=9600     ' enable UART2 -- not all boards have UART2
 

' Wait for serial input on pin UART2
DO
    MyByte = RXD(2)
UNTIL MyByte >= 0

 

Differences from other BASICs

See also