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

Coeficient Baud Rate RS232 Question??????????????

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



Joined: 18 Oct 2003
Posts: 145

View user's profile Send private message

Coeficient Baud Rate RS232 Question??????????????
PostPosted: Fri Feb 11, 2005 4:11 pm     Reply with quote

Hi,

I have a question about the coeficient of error for the baud rate. If I have a PIC 10Mhz the Microchip formula say that for 115200bps my CBR is 156250, My question is if I configure the USE RS232 with this value (156250), then I have not %ERROR in the comunication?

Other people search the special OSC for have 0% ERROR in the comunication , is possible that other solution is change the baud rate for have the same result?.

I wait for you answer,

Thank you very much!!
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

PostPosted: Mon Feb 14, 2005 5:20 pm     Reply with quote

You are correct. That baud rate would be produced without problems relating to bit time. If you wish to comunicate between two PIC's running at that baud rate you should have no problems relating to framing errors. On the other hand you will be hard pressed finding a PC or any other standard device that can support an odd baud rate such as that.
cfernandez



Joined: 18 Oct 2003
Posts: 145

View user's profile Send private message

PostPosted: Mon Feb 14, 2005 10:31 pm     Reply with quote

Neutone,

You say that if I want to connect a PIC 10Mhz to 115k (156250) with a PC I have to set the serial in the PC to 156250???

Or the formula say that for comunicate to 115200 my PIC 10Mhz transmit to 156250?

For example:

115200 156250
X CBR Error X CBR Error
0 156250 35,63 0 156250 -

I not understand exactly the Coeficient Baud Rate & Error and how is work?

Thanks,
Ttelmah
Guest







PostPosted: Tue Feb 15, 2005 3:25 am     Reply with quote

As Neutone very carefully pointed out, you _can_ use the rate to talk to another device at the same rate, but not for another device at a different rate.
Basically, think of the baud rate as a 'clock'. For the two devices to work with a good chance of reliability, the 'clock' at both ends, has to be within 4%, and preferably closer. Now a PC, itself cannot always develop clock rates reliably. On the original PC, the oscillator, that feeds it's internal BRG, is 3.57954MHz, and so the values it develops for a particular rate, may not be exactly what is expected, especially at high rates. In the case of 115200, if this is selected on an old PC, the actual baud clock, is 3.57945E6/32 = 111857Hz. If your system develops exactly 115200Hz, there will be a 2.9% error. Latter PC's (those that support baud rates above 230400), use a higher speed clock, and can give better accuracies on their rates. However don't necessarily rely on it!...
At the PIC end, the frequencies available to you, will also be limited by your choice of clock rate. With a 10MHz crystal, th actual frequencies that can be developed are:
625000
312500
208333
156250
125000
104167
89285
78125...

Now you will see that 115200, is _not_ there. No amount of fiddling with the timings, will give this frequency. The 'closest' value, is still over 7% away from the requirement. The get a 'good' 115200, you need to select a clock rate for the crystal, that is a multiple, of 16times the required rate. In this case, 9.216MHz, or 11.059MHz, will be the 'closest' crystals to 10Mz, which give accurate 115200 transmission.
Now, _if_ your PC, allows a rate of 156250 to be selcted, this rate can be developed by the PIC at 10MHz, and a link at this rate can be used. However doing this, makes your code at the PC end, 'non standard', and can be asking for problems...

Best Wishes
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