Em 9/9/2011 15:06, Bob Blick escreveu: > On Friday, September 09, 2011 2:25 PM, "Isaac Marino Bavaresco" wrote: >> The OP could also do the following: >> >> Using a single timer, in the main loop set it for the first servo pulse >> width and set the corresponding pin high. >> When the timer interrupt occurs, inside the ISR clear the first servo >> pin, set the next servo pin to one and program this servo's pulse width, >> and so on for the remaining servos. Turn off the pin of servo 'n', turn >> on the pin of servo 'n+1' and set the timer to interrupt after the pulse >> width of servo 'n+1'. >> After the last servo is served set the timer to interrupt after the >> remaining time to complete the 20ms frame, and then start over, but this >> time the first servo pin is set by the ISR. > Won't you get some jitter this way? > > When I use CCP Compare for the pulse, and freerunning a timer interrupt > for the repeat, it is very stable. > > Friendly regards, > > Bob Yes, some. But standard servos aren't that precise, and a few micro-seconds of jitter perhaps will not show on the output. Old R/C transmitters (analog AM ones and even some analog FM ones) had lots of jitter and everything worked OK. Newer no-brand china servos show a "ladder" response curve, they turn in "steps" (we could call them digital servos :D ) after a certain amount of change in the signal. If the OP never disables the interrupts and he codes very carefully, he can reduce the jitter to one or two clock cycles, which would be imperceptible. Isaac --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .