On Thursday, September 8, 2011, Bob Blick wrote: > I usually use a CCP peripheral in Compare mode to generate the pulse. > Use a general purpose timer to let you know when to repeat. > > If you need to drive more than one servo you should hit them all > round-robin style, and you can use the same CCP output pin to do it as > an enable for diode/CMOS/TTL logic to "AND" it with a set of general > purpose output pins. Or you can use a 3-to-8 demultiplexer, etc. > > But basically use the CCP compare output pin. Sorry I have only done it > in a 16F in C. Hi Bob, Let me make sure I understand the method you're talking about. You're suggesting using a regular timer set to interrup roughly every 20mS. At that point I'd set the output pin to positive. I'd also then read my current desired servo position and use it to trigger the CCP module in compare mode which when triggered would drop the pin back low. Does that sound right? Now on to my more specific questions. If I'm doing this on a PIC running at 8MHz (internal osc) is there a clever way to use the same timer peripheral for both the 20mS trigger _and_ the CCP source that triggers the end of the pulse? What do you have the CCP interrupt do? I could conceivably have it automatically set the output pin low, but that limits which pins I can use this routine on. Any reason why I can't use it in interrupt only mode and trigger the pin state change in the ISR? I'm not sure I entirely follow your multiple outputs ideas. I think that what you're saying is that I should have the CCP trigger on the differences, the use some other port outputs to trigger which servo gets the signal. Are you suggesting that I use the same timer to start the pulse for all servos or to alternate between servos. At 20mS between each pulse per servo, I could easily squeeze in 8 separate servos. I hope my questions make sense! Josh -- A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. =A0 =A0 =A0 =A0 -Douglas Adams --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .