<font size="2">// test_uart0.c
//  test for UART0 mode 0
//
// command line to build this file
//      c51 test_uart0.c db oe code small moddp2
//      bl51 test_uart0.obj TO test_uart0 RAMSIZE(256) XDATA(1900h)
//      oh51 test_uart0 HEXFILE(test_uart0.hex)

#define ALLOCATE_EXTERN
#include "fx2.h"
#include "fx2regs.h"

void main(void)
{
    // set the CPU clock to 48MHz
    CPUCS = ((CPUCS & ~bmCLKSPD) | bmCLKSPD1) ;

    PORTECFG  =  0x08;  // enable RXD0OUT
    SCON0     =  0x13;  // mode 0, receive enabled, baud CLKOUT/12, TI = 1, RI = 1

    while(1){
        if ( TI ){
            TI = 0;
            SBUF0 = 0x55;
        }
    }
}</font>