Moderadores: andre_luis, 51, guest2003, Renie
void SetupUsart1(unsigned int regSPBRG)
{
//Startup Serial Port 1 (RS-232)
///////////////////////////////////////////////////
Open1USART( USART_TX_INT_OFF & //Transmit interrupt OFF
USART_RX_INT_ON & //Receive interrupt ON
USART_ASYNCH_MODE & //Asynchronous mode
USART_EIGHT_BIT & //8-bit transmit and receive
USART_CONT_RX & //Continuous reception
USART_BRGH_HIGH, //High baudrate
regSPBRG ); //SPBRG register
}
The precompiled versions of these functions use default pin assignments that can be
changed by redefining the equate (equ) statements in the files writuart.asm,
readuart.asm and openuart.asm, found in the src/traditional/pmc/sw_uart or
scr/extended/pmc/sw_uart subdirectory of the compiler installation:
DelayTXBitUART ((((2*FOSC) / (4*baud)) + 1) / 2) - 12 cycles
DelayRXHalfBitUART ((((2*FOSC) / (8*baud)) + 1) / 2) - 9 cycles
DelayRXBitUART ((((2*FOSC) / (4*baud)) + 1) / 2) - 14 cycles
Usuários navegando neste fórum: Nenhum usuário registrado e 1 visitante