Hi Josh, It is pretty easy to do, you just need to send a 1ms pulse for the lowest position, 2ms for the highest, 1.5ms for the middle etc. You have to send that pulse at every 20ms (you do not need to be very precise with this one, it can be 15ms or 25ms, it will work, the only thing you need to be tight i= s the pulse width) Almost like a PWM except the duty cycle is always in between 1% - 2%... Pretty easy to do so. There are loads of example, usually if you search for something like "servo tester PIC 18F"... For example: http://www.instructables.com/id/Use-a-PIC-Microcontroller-to-Control-a-Hobb= y-Servo/ The source is in C but it might give you some idea especially with reading the description - and then I am pretty sure you will be able to do it by yourself. Good luck, Tamas On Thu, Sep 8, 2011 at 11:07 PM, Josh Koffman wrote: > Hi all, > > I'm having some trouble deciding on the best way to drive some hobby > R/C servos. It's been many years since I've dealt with them. As usual, > when I'm in this state I look around for sample code that might exist > on the web and see if it helps steer me. Problem here is that I'm > having some trouble locating it. > > I'd love to find code that's for the 18F series as I think it'll be > more relevant to the available peripherals in the chip. Most of what > I'm finding is for 16F chips, and most include a large amount of code > dedicated to serial comms and complex command sets, neither of which > are important to me at the moment and are making the code harder to > understand. Then of course, I've found some lovely examples with zero > comments or explanations. Nice! > > At the moment I'm working through Ashley Roll's code > (http://www.digitalnemesis.com/info/projects/picservo/) but if anyone > knows of anything out there for 18F that just simply drives a servo, > I'd love to see it! > > Thanks, > > Josh > -- > A common mistake that people make when trying to design something > completely foolproof is to underestimate the ingenuity of complete > fools. > -Douglas Adams > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > --=20 int main() { char *a,*s,*q; printf(s=3D"int main() { char *a,*s,*q; printf(s=3D%s%s%s, q=3D%s%s%s%s,s,q,q,a=3D%s%s%s%s,q,q,q,a,a,q); }", q=3D"\"",s,q,q,a=3D"\\",q,q,q,a,a,q); } --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .