Alright I'm pretty new to MCU's but I'm working on my first project. Anyways, in my project I need a clock that can count for 15 minutes, now I've got a book and I've already figured out all the necessary things such as prescale factor and other variables needed to count for 15 minutes. That is not the problem though. I'm planning on using timer 0.
My problem is that I am not sure how to start and stop the timer. I don't want the timer ISR always running, so what line of code do I use to start and stop it?
Referencing my book it says that:
TIMSK=0x01;
unmasks the interupt
and
#asm("sei")
activates interrupts.
So if I want in a certain place within the loop the timer to start do I unmask it using TIMSK on that certain line (I assume #asm("sei") would still be in the main function)? And how do I stop and reset it also?
Probably gonna be using a small avr like the ATTINY2313.