millis() 8MHz

hello,

is it possible to use the function millis() with the internal 8MHz clk of the atmege328p without getting a error?

thanks

Yeah. Shouldn't be an issue.

(note - proper capitolization is "MHz" not "mHz")

8 millihertz (mHz) equals 8×10^-9 (0.000000008) megahertz (MHz) or 0.008 hertz (Hz). I hope that helps.

I wanted to say 8MHz

Define "without error". Internal 8MHz is +/- 10% unless calibrated. When calibrated it is +/- 1% (at given temperature and voltage IIRC).

Shouldn't be an issue.

  1. It should be an issue.

  2. Literature says that the internal R/C oscillator has +/- 3% error!

  3. Some one in this Forum had already reported that his servo had jitters while it was under internal
    8 MHz; but, it appeared to be fine under external 16 MHz.

actually i want to use the internal clk caus i think it used less more power than using a external clock ??

zwakrim:
is it possible to use the function millis() with the internal 8MHz clk of the atmege328p without getting a error?

I run all my projects on the internal RC oscillator at 8 MHz. I don't have any problems using millis(), and Servos, SPI and I2C also work fine. I would only envisage problems when working at the extremes of temperature, but a custom calibration of the oscillator would fix that.

Compared to running at 16 MHz / 5V, the power saving is only about 5 mA while active and you can save another couple of mA by running at 3V, real power saving is found by optimising sleep/power-down time.

In summary - millis() works fine for short / medium delays, but if you want super-accurate timing, use a crystal.

Martin-X:
I run all my projects on the internal RC oscillator at 8 MHz. I don't have any problems using millis(), and Servos, SPI and I2C also work fine. I would only envisage problems when working at the extremes of temperature, but a custom calibration of the oscillator would fix that.

I got the same. The millis() worked normal with internal RC oscillator 8MHz. But I can't put it running correctly with 1MHz (internal RC oscillator 8MHz with devider 8). Have you tried the millis() or delay() at 1Mhz?

Thanks

I’ve never tried 1 MHz on any serious project, never found the need to go there. The savings in power don’t match the extra time for each instruction cycle, which is an important consideration if you want long battery life / low power operation.

There is only one good reason for forcing a slow clock speed, and that is to permit operation at a lower supply voltage.

To get millis() to work at 1 MHz, #define F_CPU needs to be set to the right speed in the board definition and the fuses set accordingly. If you are changing the clock speed in your sketch then millis() / delay() will be out by a large amount.

This might be of interest: http://playground.arduino.cc/Code/Prescaler