Just a couple of comments on this, based on what is discussed.
Generally it's a bad idea to do large globs of code inside an ISR. If you want a timer, just increment a tick counter inside the ISR, and do the processing outside.
If the timer interrupt is very fast, you could make a precounter inside the ISR, to divide down the interrupt interval to a more convenient rate. It's of little use to read a button input every 100us when debouncing an input is in the range of 10-30ms, depending on the quality of the pushbutton. A normal glitch period is around 10-15ms.
Personally I use 10ms as an interval and read 3 times the same state to validate the change. Then the button input is validated to be changed. If you have more than one input, you only need to AND, OR and XOR a little bit to keep the states correct all the time.
If you need a delay to execute a change or toggle a LED, use the timer ticks and count them to get your time. You can expand the timer system to any interval you need.
If this is the only application running in your program you don't need to make the it transparent, but doing that from the beginning is wise.
That way you can put in more applications with no change in the existing ones, as long as they don't interact and use the same resources.
Rule number one here is: Never use delay loops in your programs, that is a waste of processing power.
TOK
