Thread: Timer Function
View Single Post
  #7   Spotlight this post!  
Unread 28-01-2008, 15:23
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: Timer Function

Team 1425 has as schedular function which allows a routine to be run in some amount of time in the future, or set a routine to run every so often, or some amount of time since it last ran.

We do this by having timer 1 keep a time base for us, and a scheduler routine which keeps track of function pointers for routines that are to be run at the specific times.

Getting the function pointers to work was an interesting exercise for the students, but the system works well. It is not as generic as we would have liked due to the limits imposed by the available memory (used to store the info relating to the scheduled events).

A side benefit of this code is a general set of clock routines that allow any part of our code to tell how much time has elapsed. We return ms since the robot started as a long integer.

The timer setup is all based on the timer white paper available at the ifi site.