Serial Communications


Demonstrates the serial communications with an 8051.

Toolkit:SDCC 8051 Development System

Location:/bipom/devtools/SDCC/examples/serial/

Code Example


main()
{
    unsigned i;
   

    /* Set the serial port to 19200 Baud */
    serinit(19200);

startTest:

	/* Write a message to the serial port. Micro C routes all console input/output
	 * to the serial port by default.
	 */	 
    printf( "\rPress a key to start tests" );

    /* Loop forever until user presses a key */
    getchar();

    /*************** TEST RS232 SERIAL PORT ********************/

    printf( "\rTesting RS232 Transmit...\r\r" );

    /* Send all printable ASCII characters */
    for( i=32; i<128; i++ )
    {        
	    putchar( i );
	    
	    if( chkch() != 0 )   break;	    
    }

	goto startTest;
}