Electronic – Software timers using hardware interrupt

timer

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?

Best Answer

Initialize a variable in the global scope, and then have your timer interrupt increment it and check the value. Its literally four lines of code.