Ejemplo n.º 1
0
Archivo: Uart.c Proyecto: sdajani/sdp
int main(void)
{

    Board_init();
    UART_init(UART2_ID,9600);
    printf("\r\nUno Serial Test Harness\r\nAfter this Message the terminal should mirror anything you type.\r\n");
    unsigned char ch = 0;
    int x;
    while (1) {
        if (UART_isTransmitEmpty(UART1_ID) == TRUE){
            if (UART_isReceiveEmpty(UART1_ID) == FALSE){
                ch = UART_getChar(UART1_ID);
                UART_putChar(UART1_ID, ch);
                printf("  Through UART2: ");
                UART_putChar(UART2_ID, ch);
                x = 1024;
                while(--x){
                    if(UART_isReceiveEmpty(UART2_ID) ==FALSE)
                        break;
                }
                if(UART_isReceiveEmpty(UART2_ID) == FALSE){
                    printf("%c\n", UART_getChar(UART2_ID));
                } else{
                    printf("FAILED\n");
                }
                //DELAY(1000)
            }
        }
    }
    return 0;
}
Ejemplo n.º 2
0
/****************************************************************************
 Function
    Serial_isTransmitEmpty

 Parameters
     None.

 Returns
    TRUE or FALSE

 Description
    returns the state of the transmit buffer
 Notes


 Author
 Max Dunne, 2011.12.15
 ****************************************************************************/
char Serial_isTransmitEmpty(void)
{
    return UART_isTransmitEmpty(SERIAL_UART_ID);
}