0
\$\begingroup\$

Let us say we want to configure a 16-bit timer to generate an interrupt every 1 second with a clock running at 8 MHz.

We can use several pair of values for the period and prescaler. Let us take the two extremes:

  • prescaler = 125 and period = 64000,
  • prescaler = 64000 and period = 125.

Is it better to take one of the two pair of values regarding the MCU load and power consumption?

\$\endgroup\$
  • \$\begingroup\$ I would not think of a measurable difference, but it would be an interesting experiment which is easy to perform. \$\endgroup\$ – Eugene Sh. May 30 at 16:18
  • \$\begingroup\$ When each FF toggles, you'll have about 1mA of shoot-thru current for about 100 picoseconds (your mileage will vary, based on VDD, circuit, technology, etc) \$\endgroup\$ – analogsystemsrf May 30 at 17:11
  • \$\begingroup\$ The biggest win would be not clocking your entire chip at 8 MHz when not necessary. \$\endgroup\$ – Chris Stratton May 30 at 17:16
0
\$\begingroup\$

Probably no difference at all, since the same flip-flop design is likely used in both places. Whichever way you configure it, you have the same number of flip-flops toggling at the same rates.

\$\endgroup\$
  • \$\begingroup\$ What is confusing me is that, for one period, the counter register will be written N times, N being the period value. As a consequence there will be less register writings than if we took a higher value for the period. \$\endgroup\$ – Mat.R May 30 at 17:08
  • \$\begingroup\$ @Mat.R the prescalars are effectively counter registers too. There may be a tiny difference, but it's really unlikely to be of consequenece. \$\endgroup\$ – Chris Stratton May 30 at 17:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.