Ahmed.Soliman
Junior Member level 1

Hello guys,
I need some help configuring USART module for Asynchronous reception 9600 bps in a PIC18F4431 running at 4Mhz .
I use XC8 compiler and I read the Peripherals support document included with the compiler.
Here is my current configuring code :
I need to receive 13 bytes so I use :
getsUSART(buff,BUFFER_SIZE);
where buff is declared as a char buff [13]
I really don't know where I'm wrong ! but I'm about to give it up ! so please help me
Thanks in advance
I need some help configuring USART module for Asynchronous reception 9600 bps in a PIC18F4431 running at 4Mhz .
I use XC8 compiler and I read the Peripherals support document included with the compiler.
Here is my current configuring code :
Code:
void USART_Init()
{
unsigned char config,baudconfig;
TRISCbits.RC6 = 1;
TRISCbits.RC7 = 1;
CloseUSART();
config = USART_TX_INT_OFF | USART_RX_INT_OFF | USART_ASYNCH_MODE | USART_EIGHT_BIT | USART_CONT_RX |
USART_BRGH_HIGH;
baudconfig = BAUD_IDLE_RX_PIN_STATE_HIGH | BAUD_8_BIT_RATE |BAUD_AUTO_OFF | BAUD_WAKEUP_OFF;
baudUSART(baudconfig);
OpenUSART(config,25);
}
I need to receive 13 bytes so I use :
getsUSART(buff,BUFFER_SIZE);
where buff is declared as a char buff [13]
I really don't know where I'm wrong ! but I'm about to give it up ! so please help me
Thanks in advance