Cool stuff of the day

Time-Sandglass-icon

Although very handy for basic applications, you may soon or later want to get rid of the basic timing functions from Arduino and start using advanced timing featuring better accuracy and avoid time consuming waiting loops.

There are several approaches to achieve this goal. Firstly, you may explore the web and try to find some information of interest. I you are lucky, you may find pages such as this one: Secrets of Arduino PWM or this one Les Timers. If you are patient and used to read advanced technical publications, you may just get a copy of the ATMEGA 328 microcontroller data sheet and read all about timers.

Alternatively, you may learn about timers by doing ! This on line code generator does that very well. All you need to do is to set the base frequency of your micro-controller (typically 16 MHz for UNO boards, 8 MHz for some low power boards) and the requested frequency. As a result of the calculations, the page displays the code necessary to drive any of the three timers from the ATMEGA 328.

Nota: Keep in mind that timer0 is used by Arduino for the timing functions such as millis() or micros().

And here is the link to this nice web site: Arduino Timer Interrupts Calculator

HTH

Leave a Reply

You must be logged in to post a comment.