RXD
 
Syntax


int RXD (int pin );

int RXD0();                  // for UART0 access

int RXD1();                  // for UART1 access

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 by setting the SERbauds[] array.

RXD will timeout after 0.5 seconds and return -1. These routines are "bit-banged" by the processor, so the processor is consumed during these operations.  Interupts are also disabled during each byte for these operations. 

The 0.5 second timeout can be changed by SERINtimeout.

Baudrate can be upto 115.2Kb.

UART0 UART1 support-

For RXD0 data is received on the SIN pin. SIN and SOUT are always negative true. UART0 of the LPC21xx, RXD1 for UART1.

For ARMexpress modules baudrates for RXD0 can be upto 19.2 Kbaud as it is limited by the level translators. No limit for ARMmite/ARMweb  Use setbaud() routine to set this baud.

Example

    while (1) {
       ch = RXD(4);
       if (ch != -1) printCh( ch );
       if (ch == 'Q') break;
    }  // receive and echo characters from testjig

See also