I'm trying to write some code (actually, modifying Kevin's) with a defunct MPlab, so unfortunately I can't check myself with a test build this weekend. I'm using timer0 as a timer, and have it configured for 10mHz (Or 100 ns). I intend to simply, every 100ns, poll some variables. I have three questions:
1. The interrupt routine is called after the timer overflows. Does it overflow at it's frequency (10mHz)?
2. Do I have to turn off the timer, before I do anything in the interrupt? And will, when executed, the code just enter back into the timer, or do I have to somehow reset it?
3. Did I screw anything else up?
Thanks, interrupts are scary.
Code:
void Timer_0_Int_Handler(void)
{
// this function will be called when a timer 0 interrupt occurs
unsigned char tenth_micro_seconds;
unsigned int micro_seconds;
tenth_micro_seconds++;
if (tenth_micro_seconds>=10)
{
micro_seconds++;
}
}
__________________
Reading makes a full man, conference a ready man, and writing an exact man.
-Sir Francis Bacon
"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction."
-Albert Einstein