View Single Post
  #1   Spotlight this post!  
Unread 28-01-2006, 22:50
Andrew Blair's Avatar
Andrew Blair Andrew Blair is offline
SAE Formula is FIRST with Gasoline.
FRC #0306 (CRT)
Team Role: Alumni
 
Join Date: Feb 2005
Rookie Year: 2004
Location: Corry
Posts: 1,193
Andrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond reputeAndrew Blair has a reputation beyond repute
Send a message via AIM to Andrew Blair Send a message via Yahoo to Andrew Blair
Timer0 Interrupt Behaviour

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