# millis() 8MHz

**URL:** <https://forum.arduino.cc/t/millis-8mhz/447459>\
**Category:** 3rd Party Boards\
**Created:** [March 25, 2017, 11:12pm UTC](https://forum.arduino.cc/t/millis-8mhz/447459 "2017-03-25T23:12:33Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![zwakrim](https://avatars.discourse-cdn.com/v4/letter/z/c68b51/32.png) [@zwakrim](https://forum.arduino.cc/u/zwakrim)\
**Post date:** [March 25, 2017, 11:12pm UTC](https://forum.arduino.cc/t/millis-8mhz/447459/1 "2017-03-25T23:12:33Z")

</div>

hello,

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

thanks

---

<div class="post-metadata">

**Author:** ![DrAzzy](https://avatars.discourse-cdn.com/v4/letter/d/eb9ed0/32.png) [@DrAzzy](https://forum.arduino.cc/u/DrAzzy)\
**Post date:** [March 26, 2017, 12:31am UTC](https://forum.arduino.cc/t/millis-8mhz/447459/2 "2017-03-26T00:31:53Z")

</div>

Yeah. Shouldn't be an issue.

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

---

<div class="post-metadata">

**Author:** ![ty\_ger07](https://avatars.discourse-cdn.com/v4/letter/t/4da419/32.png) [@ty\_ger07](https://forum.arduino.cc/u/ty_ger07)\
**Post date:** [March 26, 2017, 3:27am UTC](https://forum.arduino.cc/t/millis-8mhz/447459/3 "2017-03-26T03:27:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![zwakrim](https://avatars.discourse-cdn.com/v4/letter/z/c68b51/32.png) [@zwakrim](https://forum.arduino.cc/u/zwakrim)\
**Post date:** [March 26, 2017, 11:18am UTC](https://forum.arduino.cc/t/millis-8mhz/447459/4 "2017-03-26T11:18:12Z")

</div>

I wanted to say 8MHz

---

<div class="post-metadata">

**Author:** ![Smajdalf](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/smajdalf/32/1102076_2.png) [@Smajdalf](https://forum.arduino.cc/u/Smajdalf)\
**Post date:** [March 26, 2017, 1:26pm UTC](https://forum.arduino.cc/t/millis-8mhz/447459/5 "2017-03-26T13:26:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![GolamMostafa](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/golammostafa/32/239011_2.png) [@GolamMostafa](https://forum.arduino.cc/u/GolamMostafa)\
**Post date:** [March 26, 2017, 1:57pm UTC](https://forum.arduino.cc/t/millis-8mhz/447459/6 "2017-03-26T13:57:24Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![zwakrim](https://avatars.discourse-cdn.com/v4/letter/z/c68b51/32.png) [@zwakrim](https://forum.arduino.cc/u/zwakrim)\
**Post date:** [March 26, 2017, 8:44pm UTC](https://forum.arduino.cc/t/millis-8mhz/447459/7 "2017-03-26T20:44:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Martin-X](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/martin-x/32/1126438_2.png) [@Martin-X](https://forum.arduino.cc/u/Martin-X)\
**Post date:** [March 26, 2017, 10:39pm UTC](https://forum.arduino.cc/t/millis-8mhz/447459/8 "2017-03-26T22:39:02Z")

</div>

> 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.

---

<div class="post-metadata">

**Author:** ![awt98523](https://avatars.discourse-cdn.com/v4/letter/a/ea666f/32.png) [@awt98523](https://forum.arduino.cc/u/awt98523)\
**Post date:** [March 28, 2017, 5:30am UTC](https://forum.arduino.cc/t/millis-8mhz/447459/9 "2017-03-28T05:30:19Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![Martin-X](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/martin-x/32/1126438_2.png) [@Martin-X](https://forum.arduino.cc/u/Martin-X)\
**Post date:** [March 28, 2017, 10:15pm UTC](https://forum.arduino.cc/t/millis-8mhz/447459/10 "2017-03-28T22:15:59Z")

</div>

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: [Arduino Playground - Prescaler](http://playground.arduino.cc/Code/Prescaler)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 6, 2021, 5:08pm UTC](https://forum.arduino.cc/t/millis-8mhz/447459/11 "2021-05-06T17:08:53Z")

</div>

Closed on May 6, 2021, 5:08pm UTC


