G'day Steve. That's a good start but the main drama is i would like to avoid a look-up-table if at all possible for loading PR. Feeding PR sequential values will not give a corresponding linear relationship between stepper speed and PR2. I would love to know a way to use a single number to derive the PR value without resorting to really complex maths. But maybe there is no alternative? Rgds, Kresho Sprem > -----Original Message----- > [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of stesquib@MINES.EDU > Sent: Saturday, 29 November 2003 5:40 PM > Check out the timer 2 module. Just set the prescaller and > postscaller then load > the desired period (some scaled value) into the PR2 register. > > EG: 8 MHz clock: 500ns per cycle. > 1/(1000 * 500E-9) (1000 is the max number of interrupts per second) > = 2000 (we need and interrupt every 2000 cycles) > 2000 / 256 ~ 7.8 (atleast 7.8 is needed to obtain > interrupts at 1kHz) > So round up to 8. > set some combination of prescale and postscale who's product > equals 8. > The period between interrupts is 500ns * 8 * PR2. > T = 0 to 1.024 ms > > I'm a big fan of the timer 2 module. All timers should have a > period register :) > > Hope this helps, > Steve > -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.