View Single Post
  #12   Spotlight this post!  
Unread 16-03-2007, 13:48
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: Anyone actually using hardware timers?

Since the interrupt handler blocks other interrupts, you want to do as little as possible in inerrupt context. Once you have incremented your timer count, the rest of the calculation should be "interruptable", so it should be done in the main code in the "fast loop" section (i.e. outside the 26ms data transfer to master processor section).

Theory aside, you probably won't notice any problem with doing what you propose. As described, you are doing a fairly quick operation, and you don't have many other interrupt sources that you could be holding off.

We have used the timers (based on the white paper) and find it very usefull to have a high (milisecond) resolution clock for various purposes. For example, if you have a routine to move an arm to a position, it could check the time when it starts and abort if it takes too long to get to position. Alternately, you can use the time to schedule activities on ticks other than the 26ms heartbeat provide by the getdata/putdata requirement.