Instructables

A Servo-based 4-legged Walker

Featured

Step 7: Program the chip

Programming can be done with as sophisticated a setup as you've got. Myself, that's just the (pictured) ghetto-programmer -- just some wires soldered to a parallel port plug.

This instructable details the programmer and software you need to get it all running.

Do Not! Do Not! Do not use this programming cable with any devices that even get near to voltages above 5v. The voltage could run up the cable and fry your computer's parallel port, ruining your computer. More elegant designs have limiting resistors and/or diodes. For this project, ghetto is fine. It's only a 3.6v battery onboard. But be careful.

The code I use is attached here. Mostly, it's overkill for just getting two motors to swing back and forth, but I was having fun.

The gist of it is that the servos need pulses every 20ms or so. The length of the pulse tells the servo where to turn the legs. 1.5ms is around the center, and the range is from 1ms to 2ms approximately.

The code uses the built-in 16-bit pulse generator for both the signal pulse and the 20ms delay, and gives microsecond resolution at the stock speed. The servo's resolution is somewhere near 5-10 microseconds, so 16-bits is plenty.

Does there need to be an microcontroller-programming instructable? I'll have to get on that. Let me know in the comments.

 
Remove these adsRemove these ads by Signing Up
Great project but is the Code in C or C++? I'm an Arduinophyte. Sorry, I'm not the most hardworking person...

Once again, Great Project
geeklord5 years ago
I need to learn how to write in C. Can I use C to programall microcontrollers??
Nope. I tried uploading C++.

C++ = busted Arduino (if you're using one.)

Try getting the Turbo C bible...worked for me.
xenomorph6 years ago
awesome!!!!!!!!!!! i have never programmed before and thanks to your instructable I can start THX:-)
knive056 years ago
can i use pic16f84a as a microcontroller