Page 1 of 1

Clock speed constant

Posted: 12 Feb 2009 20:40
by Daniel Wee
I have noticed that while you can define the clock speed down to the last Hz, the internal variable doesn't seem to make use of this extra resolution - for example in the calculation of baudrates.

Right now declaring 80.000010MHz and 80.000000MHz will have absolutely no difference in the computations.

Is it possible to store the full resolution that is defined so that our own timing routines can refer to it with better accuracy?

Daniel

Re: Clock speed constant

Posted: 16 Feb 2009 10:20
by milan
Hi,
Daniel Wee wrote:for example in the calculation of baudrates.
Right now declaring 80.000010MHz and 80.000000MHz will have absolutely no difference in the computations.
Baudrate calculation ends with rounding, result must be written in register so it has to be an integer.
It is possible that you can't see the difference because of rounding, give us the calculation example ...

Posted: 16 Feb 2009 17:10
by Daniel Wee
I remember once when I wanted to reference clock constant, and found that it did not preserve the full resolution so in the end I had to define my own constant. If you really need it, I can try to find an example.

Daniel

Posted: 17 Feb 2009 10:03
by milan
Hi,

please try to find an example so we can examine the problem