View previous topic :: View next topic |
Author |
Message |
cian Guest
|
usart baudrate problems :"Baud rate out of range" |
Posted: Tue Aug 17, 2004 8:12 am |
|
|
Hi,
I'm trying to run a PIC16LF876A from a 7,372,800Hz xtal with some rs232 code using a 115200 baudrate. Here's a snippet:
#use DELAY(clock=7372800)
<snip>
#use rs232(baud=115200, xmit=RS232_TX, rcv=RS232_RX, ERRORS)
void rs232_putc(char c){
putc(c);
}
When compiling I get the error:
"Baud rate out of range"
I've tried using the BRGH1OK option but it doesn't make any difference.
AFAIK this baudrate should be fine: 7372800/(16*4) = 115200
So does anyone know what the problem is?
Compiler version 3.188 BTW
Cheers,
Cian |
|
|
garyzheng
Joined: 22 Jul 2004 Posts: 25
|
i think the baudrate is too high for CCS compiler |
Posted: Tue Aug 17, 2004 8:58 am |
|
|
you should kow that the CCS compiler had some limitation, if it told you the baudrate is too high, you should limit your baudrate, that is all |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Aug 17, 2004 9:06 am |
|
|
Works just fine for me. Post the defines for RS232_Tx and RS232_RX. I suspect these are wrong. You should probably use the BRGH1OK option otherwise the SPBRG value will be 0. Not sure if this is valid or not. |
|
|
cian Guest
|
|
Posted: Tue Aug 17, 2004 9:43 am |
|
|
You are of course right, I mixed up some of the pins
I'm using two pins for hardware UART and two for software, I got them reversed.
Apologies and thanks for the help,
Cian |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Aug 17, 2004 10:06 am |
|
|
As it turns out, even with the BRGH1OK the compiler uses a SPBRG value of 0 so I guess it is valid plus a quick look at the datasheet shows a zero value in the table |
|
|
|