Go Down

Topic: Timer 0 reset parametre (Read 115 times) previous topic - next topic

gaelperr

Hello,

I use the Timer 0 for an application, but I want at the end of this application use the function "Delay()".
The problem is : I change de registre for the timer 0 and logically, after I can't use the Delay function.

I want to find the parametres of the registre to use for delay().

Thank you.   

septillion

So why use timer0? You have 3 timers, why do you need timer0?

But in the hardware folder you can find all the files including the initialization functions :)
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

MartinL

#2
Apr 18, 2018, 01:57 pm Last Edit: Apr 18, 2018, 01:58 pm by MartinL
On AVR Arduinos timer 0 ticks every 4us, this causes the 8-bit timer to overflow every 1ms, (4us * 256).

If you require the delay() function it's not possible to change this, however it is still possible to use timer 0's COMPA and COMPB interrupt service routines, if you need to run code at a 1ms interval.

DrAzzy

You can print value of the registers before you start changing them, or even just save to a variable.


 The timers are initialized in init() in wiring.c, you can also use that as a guide.
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

Go Up