Servo controller schematic and code V1.00

Contents:

[Document Version: 1.00] [Last Updated: 4/15/95]


1. About the Author

Servo controller schematic and code

Author: Richard John Farmer
E-Mail: gt5876b@prism.gatech.edu
Date: 15 Apr 1995


Rick Farmer           gt5876b@prism.gatech.edu  `85 CB700SC  AMA# 482666
3510 Buford Hwy K-6   85k miles and 10 years of merciless abuse and it still 
Atlanta, Ga. 30329    lives, but then again a spare engine (or two) helps.

2. Introduction

I got a lot of mail on this project in comp.arch.embedded and figured the folks of sci.electronics might like it too, so follow up on there. For those of you who don't know a PIC is a $5 microcontroller (single chip computer), and the servos in question are the RC model type which go for ~$20.


3. Getting support software

Here it is, the code and schematic for a simple servo controller using a PC joystick and a PIC 16c55. The code can be complied with MPALC (obsolete) or MPASM (use this) and simulated with MPSIM. All are free from Microchip and available on ftp.ultranet.com /biz/mchip + tons of other code examples. A demo version of Circad is available on mobius.gmu.edu (limited to 2 anonymous connections!) in directory /pub/circad as file TEST__THIS. So you can play with this for free. If you're in the Atlanta area you can even come over and use my burner to make a chip if you bring a beer.


4. Servo Controller Schematic and Code


5. Now a Little on Servos

Send one a 1ms pulse every 20-30 ms and it goes all the way to the left, a 2ms pulse every 20-30ms and it goes all the way to the right, 1.5 ms and it goes to the middle, simple. This code is simple it just counts while the joystick pot charge a cap enough to be a 1, saves the time, flips the pin to an output to discharge it (with a low out), then flips it back to an input. The timing is all done in spin loops. If you want to do something else the low time of 20-30ms is not critical. I actually compensate for the variable high pulse time, but it isn't needed. The 16c5x chips don't have interrupts and only 2 level deep stack, but hey they're cheap and fast as hell. Remember, this is just something I cooked one afternoon, so it's not pretty but it works.


6. Future Project

My current project is a Xilinx SPROM programer. Anyone up on the *.MCS file format. I've got the hardware designed, but I still don't have all the info needed to parse the input file yet. The hardware is fully software configurable so it'll make a good starting point for other such project by the net.community.

Anybody want a copy of my resume too :-)


Please check attribution section for Author of this document! This article was written by filipg@repairfaq.org [mailto]. The most recent version is available on the WWW server http://www.repairfaq.org/filipg/ [Copyright] [Disclaimer]