View Single Post
  #7   Spotlight this post!  
Unread 24-03-2007, 00:24
dragoonex's Avatar
dragoonex dragoonex is offline
Registered User
FRC #1325 (Inverse Paradox)
Team Role: Programmer
 
Join Date: Jan 2007
Rookie Year: 2006
Location: Canada
Posts: 9
dragoonex is on a distinguished road
Re: Anyone actually using hardware timers?

We implemented Timers into our code this year, and they are great. We set ours to fire off every millisecond. Unfortunately, we didn't have the time, but we plan to write a wrapper around one timer so we can schedule "events" to happen at certain time intervals. But so far, the timers have been proven to be extremely useful and you should definitely implement them.

Some tips, your interrupt routine should be fast. In fact, you should really only be really incrementing a number in it. Remember that since your timer is firing every X milliseconds, your number is being increased very rapidly. So use a big type like a long, or a long short. These will last your for days.

Also, always, always, always, disable your timer interrupts before trying to access your "tick" variable. Bad things will happen if you don't.