View Single Post
  #8   Spotlight this post!  
Unread 29-01-2004, 00:19
Larry Barello Larry Barello is offline
http://www.barello.net
#0492 (Titan Robotics Club)
Team Role: Mentor
 
Join Date: Jan 2002
Location: Bellevue, WA
Posts: 85
Larry Barello has a spectacular aura aboutLarry Barello has a spectacular aura about
Re: PID control loop/Encoder question

Quote:
Originally Posted by Rickertsen2
Yes, but what else are you doing in the background?
What do you mean?

I use the change of state interrupt for my encoders and Timer2 to increment a counter at 1khz. That is all that is done in the background. Everything else is done in the user code. Mostly in the high speed loop, running my gyro integration stuff at 100hz and a menu interface task at 10hz. All direct robot control stuff occurs in the 26ms main loop.

Even at 10k interrupts/sec (two encoders going full tilt), that is 1000 machine instructions per interrupt. It only takes a couple dozen to service the interrupt and decode the inputs. Lets say 100 to be generous. That is only 10% load. That leaves 9mips for the rest of the system.