CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

usart baudrate problems :"Baud rate out of range"

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
cian
Guest







usart baudrate problems :"Baud rate out of range"
PostPosted: Tue Aug 17, 2004 8:12 am     Reply with quote

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

View user's profile Send private message

i think the baudrate is too high for CCS compiler
PostPosted: Tue Aug 17, 2004 8:58 am     Reply with quote

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

View user's profile Send private message Send e-mail

PostPosted: Tue Aug 17, 2004 9:06 am     Reply with quote

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







PostPosted: Tue Aug 17, 2004 9:43 am     Reply with quote

You are of course right, I mixed up some of the pins Embarassed
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

View user's profile Send private message Send e-mail

PostPosted: Tue Aug 17, 2004 10:06 am     Reply with quote

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 Smile
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group