Good morning,
looking at the datasheet of the attiny, it's possible to set the cpu to a more precise clock speed (from 10% accuracy of the factory, to 1% accuracy using calibration with OSCCAL register);
I would like to use 8 MHz clock speed at obviously 1% accuracy using calibration, and reading the datasheed it says that you can adjust the values of the register and calibrate it.
But I noticed that if I change the numbers, also the delay() and delayMicroseconds() functions creates absolutely wrong timing values and I have to find the right number to get a precise value.
If you look at the graph that plots the clock speed vs the number you give to the OSCCAL register, you can see that around 0b0111111 (which is 128) you get a very steep curve, it means it's not easy to get a precise value to set the 8 MHz with accuracy
How can I find the right number to get a precise 8 Mhz clock, or at least a clock speed that is coordinated with the delay() and delayMicroseconds() functions?
(now, if I set OSCCAL to a certain value, using delay(100), I get a 130 ms pulse instead of 100 ms, and that is not what I want).
Thank you in advance.
looking at the datasheet of the attiny, it's possible to set the cpu to a more precise clock speed (from 10% accuracy of the factory, to 1% accuracy using calibration with OSCCAL register);
I would like to use 8 MHz clock speed at obviously 1% accuracy using calibration, and reading the datasheed it says that you can adjust the values of the register and calibrate it.
But I noticed that if I change the numbers, also the delay() and delayMicroseconds() functions creates absolutely wrong timing values and I have to find the right number to get a precise value.
If you look at the graph that plots the clock speed vs the number you give to the OSCCAL register, you can see that around 0b0111111 (which is 128) you get a very steep curve, it means it's not easy to get a precise value to set the 8 MHz with accuracy
How can I find the right number to get a precise 8 Mhz clock, or at least a clock speed that is coordinated with the delay() and delayMicroseconds() functions?
(now, if I set OSCCAL to a certain value, using delay(100), I get a 130 ms pulse instead of 100 ms, and that is not what I want).
Thank you in advance.
Attachments
-
167.1 KB Views: 19
-
128.3 KB Views: 20