PIC servo control

Thread Starter

clichtenberg

Joined Jul 16, 2010
2
I'm working on a project that uses a PIC16F84A to control two servo motors. I'm writing the program in assembler. I'm having trouble figuring out how to interface the PIC with the motors. Does anyone have any experience controlling servos with PICs? Any good references would help a ton as well (I haven't found any yet).
 

Thread Starter

clichtenberg

Joined Jul 16, 2010
2
Thanks for the quick response!

The site helped with figuring out some of the interfacing, but I'm still not sure how I would go about writing the code in assembler. Since my project involves using the two motors to essentially open a box (I'm building a leave-me-alone box: http://www.youtube.com/watch?v=RMGJB410Ccs), I was considering having interrupt routines for when the switch is flipped. When I flip the switch, one motor should open the box, then the other should flip the switch off. So, I think the entire process would be, wait for the switch to flip; when it flips, the hatch motor should activate and open the hatch and the motor with the arm should flip off the switch, retract the arm, and the hatch motor should close the hatch; then the process would repeat. Yes, no? Am I on the right track?
 

Markd77

Joined Sep 7, 2009
2,806
Not too far off. You probably need a little (maybe 1/2 second) delay between open hatch and flip switch.
Because you can adjust the hardware you could get away with very simple code for the servos:
wait 19ms
both servo control signals high
wait 1ms
maybe turn off 1 or both servo control signals
wait 1ms
turn off both signals
repeat
 

MMcLaren

Joined Feb 14, 2010
861
I suspect if you design the "arm" correctly you could use a single servo to both open the lid and turn off the switch...
 
Top