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

Maximum USART speed possibel with 4Mhz Xtal

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



Joined: 08 Sep 2003
Posts: 492
Location: India

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

Maximum USART speed possibel with 4Mhz Xtal
PostPosted: Sat Jul 31, 2004 11:48 pm     Reply with quote

Hello,

I am using PIC 16F877 and the CCS compiler. I as wondering what would be the maximum Baud rate possible with a 4 MHz xtal.

thanks
arun
Guest








PostPosted: Sun Aug 01, 2004 2:04 am     Reply with quote

With BRGHOK it is
4000000/16=250kbaud
Normally it is
4000000/64 = 62500
Keep in mind that the baud rate is calculated as either
Fosc/16/(N+1) or
Fosc/64/(N+1) where N is the baud rate generator division factor. So you can not use most of standard baud rates @4MHz. Use a baud rate crystal instead.
arunb



Joined: 08 Sep 2003
Posts: 492
Location: India

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

RE:
PostPosted: Sun Aug 01, 2004 6:39 am     Reply with quote

Hello,

I calculated that the baud rate cannot be more than 19200. Which means if I want higher baud rates I must go in for a 20 Mhz crystal.

What is a baud rate crystal and how can I connect it to the PIC.

Just curious to know, I am using a PCB with parts that have been soldered manually ( the maximum track spacing on the PCB is 0.5 mm) , is it OK to use a 20 Mhz crystal or will it cause problems ??. 1


thanks
arun
ckielstra



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

View user's profile Send private message

PostPosted: Sun Aug 01, 2004 7:10 am     Reply with quote

Quote:
I calculated that the baud rate cannot be more than 19200. Which means if I want higher baud rates I must go in for a 20 Mhz crystal.

Your calculations must be wrong. Even without calculations you can check Table 10-3 and 10-3 of the PIC16F877 datasheet where settings for several baudrates and crystals are shown: For a 4MHz crystal it states that the maximum baudrate with BRGH=0 is 62500 baud and with BRGH=1 even 250.000 baud.

Quote:
What is a baud rate crystal and how can I connect it to the PIC.

These are normal crystals with very odd looking frequencies like 3.6864MHz. They are usefull in baudrate generators because dividing this frequency by a power of 2 will give you an exact baudrate value.

Just remember that in specifying the baudrate you are only allowed a maximum error of 3%. For example, trying to create a baudrate of 19k2 with a 4MHz crystal with BRGH=0 requires you to set SPBRG=2 (See table 10-3). The actual baudrate generated will be 20.833baud, being an error of 8.51%!!! This is to large an error. Same settings with a 3.6864MHz crystal give a 0% error.
arunb



Joined: 08 Sep 2003
Posts: 492
Location: India

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

RE:
PostPosted: Mon Aug 02, 2004 7:30 am     Reply with quote

Yes you are right my calculations are wrong !!! Silly of me

Thank you very much

cheers
arun
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