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 support@ccsinfo.com

Can't achieve 115200 baud on PIC16C74B at 20MHz

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



Joined: 30 Sep 2004
Posts: 14

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

Can't achieve 115200 baud on PIC16C74B at 20MHz
PostPosted: Tue May 03, 2005 5:42 am     Reply with quote

When I try to compile my program using the line...

#use rs232(baud=115200,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)

the compiler shows an error saying...

"Baud rate out of range"

Is the PIC16C74B capable of using a baud rate of 115200 ?

If so, how do I calculate the required clock speed to give a baud rate of 115200 ?
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Tue May 03, 2005 6:55 am     Reply with quote

At 20MHz 115200 baud should be possible.

You didn't mention your compiler version, so I tried it in v3.216 and got the same result ! The program compiles fine for a PIC18F458.

Checking the device options in chipedit.exe I noticed an option being set saying "BRGH can not be 1", disabling this option makes the program compile .

If you don't have chipedit.exe you can set the registers manually:
SPBRG = 0x0A
TXSTA = 0x26
RCSTA = 0x90

Does anyone know why BRGH is disabled? According to the datasheets it is a valid bitsetting and it isn't mentioned in the errata sheets as well.
Charlie U



Joined: 09 Sep 2003
Posts: 183
Location: Somewhere under water in the Great Lakes

View user's profile Send private message

PostPosted: Tue May 03, 2005 8:00 am     Reply with quote

Take a look at the errata sheet for the PIC16C74. There is a high error rate when the BRGH is set, and they recommend that it be set low. In the early days, this was included in the errata for the rev A version at least and possibly the Rev B, I don't recall now. There is a parameter that can be included in the #use RS232 pre-processor command that allows the BRGH to be set which is BRGH1OK. The second to last character is the letter O not the number 0.

So just add it to the command like so:

#use rs232(baud=115200,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8, BRGH1OK)

and it should work.

You can also go into the device editor, if you are using PCW, and modify the part definition by removing the check in the box for this errata. This will allow the bit to be set high.
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