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

Hardware UART baudrate Error and Crystal

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







Hardware UART baudrate Error and Crystal
PostPosted: Wed Mar 19, 2003 8:40 am     Reply with quote

Hello,
I would like to know if the frecuency of the crystal improves or not the Baudrate error that the Hardware UART is using? Which crystal do I have to use to archive the less possible error in baudrates between 1200bps and 10400bps? Now I'm using a 20MHz crystal.
Thanks
Ezequiel
___________________________
This message was ported from CCS's old forum
Original Post ID: 12835
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

Re: Hardware UART baudrate Error and Crystal
PostPosted: Wed Mar 19, 2003 9:37 am     Reply with quote

:=Hello,
:= I would like to know if the frecuency of the crystal improves or not the Baudrate error that the Hardware UART is using? Which crystal do I have to use to archive the less possible error in baudrates between 1200bps and 10400bps? Now I'm using a 20MHz crystal.
:=Thanks
:=Ezequiel

I use a 19,660,800 crystal. Works good for many baud rates.
___________________________
This message was ported from CCS's old forum
Original Post ID: 12838
R.J.Hamlett
Guest







Re: Hardware UART baudrate Error and Crystal
PostPosted: Wed Mar 19, 2003 11:58 am     Reply with quote

:=Hello,
:= I would like to know if the frecuency of the crystal improves or not the Baudrate error that the Hardware UART is using? Which crystal do I have to use to archive the less possible error in baudrates between 1200bps and 10400bps? Now I'm using a 20MHz crystal.
:=Thanks
Basically, you get the most accurate value from crystals that are nice binary multiples of the required rate. A typical example, (for 4MHzish operation), is the 4096000Hz crystal. Similar ones exist, like 16384000 for a 16MHz chip (for the 4096 crystal, MicroChip, specify the 4MHz part to work to this rate). Now in your case, the 1200 to 9600 rates are all simple multiples of one another, and it is the 10400 rate will pose relative difficulties. You need a frequency that has as two factors, 665600, and 614400. Unfortunately, nothing exists for this, but for the 9600 rate, if the high speed oscillator is instead chosen (giving division by 16), a frequency of 19968000Hz, will get close, but there is a problem with the lower frequencies.
Using the low speed divider, gives:
/(30*64) = 10400
/(65*64) = 4800
/(130*64) = 2400
While the high speed divider, gives:
/(130*16) = 9600
These are all exact. The problem is that at this frequency, 1200bps, is below the lowest frequency available (the highest frequency that will give 1200bps, is 19660800Hz). This unfortunately has significant error on the 10400 rate.
However use of the 19968000 crystal, giving 1218.75Hz as the lowest rate, still only gives an error of 1.56\%, and with all the other frequencies being perfect, may well be the best choice. This compares to using the 20MHz crystal, which gives 1.73\% on this rate, and errors between a fraction of a percent, and about 1.5\% on the other frequencies.

Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 12840
Pete Smith
Guest







Re: Hardware UART baudrate Error and Crystal
PostPosted: Thu Mar 20, 2003 8:36 am     Reply with quote

:=Hello,
:= I would like to know if the frecuency of the crystal improves or not the Baudrate error that the Hardware UART is using? Which crystal do I have to use to archive the less possible error in baudrates between 1200bps and 10400bps? Now I'm using a 20MHz crystal.

For the project I'm on at the moment, I use a 1.8432MHz crystal. This has the advantage that (IIRC) all baud rates are available with no error at all, because 1843200 is divisible by all the normal baud rates (4.8k, 56.6k, 115.2k etc).

You could try seeing if there are 14.7456MHz (1.8432 * 8) Xtals available wherever you get your normal stuff. Farnell (UK) do them for between 80p & 1ukp (around $1.50).

HTH

Pete.
___________________________
This message was ported from CCS's old forum
Original Post ID: 12874
Sherpa Doug
Guest







Re: Hardware UART baudrate Error and Crystal
PostPosted: Thu Mar 20, 2003 9:26 am     Reply with quote

:=:=Hello,
:=:= I would like to know if the frecuency of the crystal improves or not the Baudrate error that the Hardware UART is using? Which crystal do I have to use to archive the less possible error in baudrates between 1200bps and 10400bps? Now I'm using a 20MHz crystal.
:=
:=For the project I'm on at the moment, I use a 1.8432MHz crystal. This has the advantage that (IIRC) all baud rates are available with no error at all, because 1843200 is divisible by all the normal baud rates (4.8k, 56.6k, 115.2k etc).
:=
:=You could try seeing if there are 14.7456MHz (1.8432 * 8) Xtals available wherever you get your normal stuff. Farnell (UK) do them for between 80p & 1ukp (around $1.50).
:=
:=HTH
:=
:=Pete.

His problem is that he has to support an odd baudrate, 10400. I have never run across this one before. I know of some old oceanographic gear that uses 5000 & 10000 baud, but that was designed before 9600 became popular.

___________________________
This message was ported from CCS's old forum
Original Post ID: 12878
R.J.Hamlett
Guest







Re: Hardware UART baudrate Error and Crystal
PostPosted: Thu Mar 20, 2003 9:39 am     Reply with quote

:=:=:=Hello,
:=:=:= I would like to know if the frecuency of the crystal improves or not the Baudrate error that the Hardware UART is using? Which crystal do I have to use to archive the less possible error in baudrates between 1200bps and 10400bps? Now I'm using a 20MHz crystal.
:=:=
:=:=For the project I'm on at the moment, I use a 1.8432MHz crystal. This has the advantage that (IIRC) all baud rates are available with no error at all, because 1843200 is divisible by all the normal baud rates (4.8k, 56.6k, 115.2k etc).
:=:=
:=:=You could try seeing if there are 14.7456MHz (1.8432 * 8) Xtals available wherever you get your normal stuff. Farnell (UK) do them for between 80p & 1ukp (around $1.50).
:=:=
:=:=HTH
:=:=
:=:=Pete.
:=
:=His problem is that he has to support an odd baudrate, 10400. I have never run across this one before. I know of some old oceanographic gear that uses 5000 & 10000 baud, but that was designed before 9600 became popular.
:=
Isn't 10400, something like the Midi rate?.
Sounds familiar as such.

Best Wishes
___________________________
This message was ported from CCS's old forum
Original Post ID: 12880
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