# Software timers using hardware interrupt

I have to implement a counter for upto 30 minutes on my microcontroller. However the hardware interrupts maximum time is nowhere close to this. So I think I would be using the interrupt and increment a variable everytime the interrupt is called by the hardware. However I would like to know if there are already any such open source timers available which I can port and use more easily rather than writing evertything from scratch. The second question is :

interrupt timer()
{
/increment a count

}


Other than setting a flag when my required counter value is reached is there any more efficient way of doing this?

• @user43914 - Don't forget to declare the variable volatile, so checks don't get compiled out. – Connor Wolf Jun 3 '14 at 5:16