On 9/09/2011 1:04 PM, Josh Koffman wrote: > On Thu, Sep 8, 2011 at 9:54 PM, David Duffy (AVD) > wrote: >> Josh, the basic idea is: >> >> Set up a free running 20ms timer on tmr0. >> >> When tmr0 fires, set the first servo output high and set tmr1 to the >> pulse width you want for servo 1. >> >> When tmr1 fires, turn servo output 1 off, turn servo 2 output on and set >> tmr1 to the pulse width you want for servo 2. >> >> Repeat unitl all servos are serviced, then wait for the 20ms timer to >> fire again. >> >> This round robin works for up to 8 servos as 8 x 2ms =3D 16ms so you can >> service them all within the 20ms. The pulse positions move about >> somewhat within each 20ms event, but the servos don't seem to mind. > Ok, that's what I figured. Is there a clever way to save a timer and > integrate it all into one? That's where I was headed with my comments > before. I don't know if this is possible, but could you have say TMR3 > generating the 20mS interrupt, then use the CCP module on TMR3 to > generate the pulse width? I haven't had the time to do the math to see > if that would work, but I have no idea if it's even within the realm > of possibility. > > Thanks! > > Josh I guess you could subtract the sum of the 8 servo on-times from 20ms and=20 use that for a 9th time period. David... --=20 ___________________________________________ David Duffy Audio Visual Devices P/L Unit 8, 10 Hook St, Capalaba 4157 Australia Ph: +61 7 38235717 Fax: +61 7 38234717 Our Web Site: www.audiovisualdevices.com.au ___________________________________________ --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .