Go Down

Topic: Support more timers - ATMega328PB or ARM (Read 346 times) previous topic - next topic

prairiemystic

I find the ATMega328P doesn't have enough timers.

Moving to an ARM MCU or ATMega328PB, with their extra timers, looks so good but not supported in the Arduino library.

I always need timer ticks for multi-threading. It would be great to support this with a library routine.

How about a library routine for measuring freq/RPM?

Is there a summary anywhere on what routines using the timers? milli, delay etc.



pert

Here's are two 3rd party hardware packages to add support for ATmega328PB to the Arduino IDE:

I haven't tried either.

westfw

What libraries are you talking about?  AFAIK, there aren't any official Arduino Libraries for using Timers.
Usually multitasking uses fewer timers (everything operated off of a system tick), rather than more...

In the AVR Arduinos, pretty much ALL of the timers are used to (potentially) generate PWM outputs via "analogWrite()"
(Each timer has two "compare" outputs, which become the PWM signals.)   Timer 0 also generates an interrupt on overflow (ever 1024 microseconds) that is used as the system tick, which is in turn used by millis(), delay(), and micros())
I'd expect 328PB "support" to add additional PWM outputs, but no additional "timer" libraries.

The ARMs get more complicated.  Due has a Systick timer (part of the core), a PWM controller, AND some general purpose timers.  Zero has Systick and TWO kinds of timer, but no PWM controller (it uses (some of?) the timers to generate PWM.)

westfw

Quote
Timer0 millis(), delay(), micro()
Timer1 servo library
Timer2 tone()

PWM seems to use two timers.
Timer0 millis(), delay(), micro(), PWM5, PWM6
Timer1 servo library, PWM9, PWM10
Timer2 tone(), PWM3,  PWM11

Go Up