Swordfish + PWM + Servo

Discuss PIC and electronic related things

Moderators: David Barker, Jerry Messina

Post Reply
grant
Posts: 1
Joined: Fri Oct 29, 2010 10:56 pm
Location: Texas

Swordfish + PWM + Servo

Post by grant » Fri Oct 29, 2010 11:34 pm

I currently have a PIC18F4539 listening for button presses from a 12 key keypad. It is set up so that after you put in the right code and push the unlock button a green LED turns on.

Now I want to add a servo. Everything has gone good so far, but the servo is giving me lots of trouble. I think that the best way to implement the servo would be to use the built in PWM, correct? From what I understand the PWM can run in the background after it is set so that it does not interrupt the rest of the program?

I don't need any advanced servo control. I just want to be able to put it in 2 states. All the way right, and all the way left.

Can someone help me set up the PWM to put the servo in one of those states? Setting up the PWM is still very confusing for me despite the numerous example codes I have looked at.

Any help is much appreciated.

AndyO
Registered User
Registered User
Posts: 48
Joined: Sat Oct 27, 2007 7:08 pm
Location: Beijing, China

Post by AndyO » Sat Oct 30, 2010 12:27 am

I put together a Swordfish module for controlling hobby-type servos which might do what you need. Module, description and sample code are at Digital-DIY

Post Reply