Exemplo n.º 1
0
/******************************************************************************
 * Function:        void putcUSART(char c)
 *
 * PreCondition:    None
 *
 * Input:           None
 *
 * Output:          unsigned char c - character to received on the UART
 *
 * Side Effects:    None
 *
 * Overview:        Print the input character to the UART
 *
 * Note:            
 *
 *****************************************************************************/
unsigned char getcUSART ()
{
	char  c;

    #if defined(__18CXX)

	if (RCSTAbits.OERR)  // in case of overrun error
	{                    // we should never see an overrun error, but if we do, 
		RCSTAbits.CREN = 0;  // reset the port
		c = RCREG;
		RCSTAbits.CREN = 1;  // and keep going.
	}
	else
		c = RCREG;
// not necessary.  EUSART auto clears the flag when RCREG is cleared
//	PIR1bits.RCIF = 0;    // clear Flag

    #endif

    #if defined(__C30__) || defined(__C32__) || defined __XC16__
        c = UART2GetChar();
    #endif

	return c;
}
Exemplo n.º 2
0
/******************************************************************************
 * Function:        void putcUSART(char c)
 * Output:          unsigned char c - character to received on the UART
 *
 * Overview:        Print the input character to the UART
 *****************************************************************************/
unsigned char getcUSART ()
{
	char  c;

    #if defined(__C30__) || defined(__C32__) || defined __XC16__
        c = UART2GetChar();
    #endif

	return c;
}