View Single Post
  #2   Spotlight this post!  
Unread 09-03-2006, 23:24
ericand's Avatar
ericand ericand is offline
Registered User
AKA: Eric Anderson
FRC #3765 (Terrabots)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: St. Paul, MN
Posts: 148
ericand is a jewel in the roughericand is a jewel in the roughericand is a jewel in the rough
Re: Timer0 stubbornly not working

I might think you are missing the part where you enable the interrupt except
you say you are getting it but at a slower rate. Do you have any other
interrupts happening? I think your ISR will pick up the timer if the ISR gets called for something else (even if the timer has not been enabled to generate
an interrupt).

I think the bits you need to set for timer 0 are in the INTCON register.
Check the PIC data sheet for the exact bits.

This is what we do when we set up timer1. However,

IPR1bits.TMR1IP = 0;
PIE1bits.TMR1IE = 1;
INTCONbits.GIEL = 1;

We are using timer 1 to provide a clock to run a number of different functions.

We did our initial setup using the timer white paper that is published on the IFI
web site. If you follow the instructions in the paper exactly, you will get timer1
up and running.

http://www.ifirobotics.com/docs/time...004-jan-14.pdf

we generalized it so we can can set an #define to the base HZ rate we want.

We also use timer 2 via Kevin's ADC code, but that worked without modification.
You may want to check that one out for a working example as well.

Last edited by ericand : 09-03-2006 at 23:39.