Servos and PWM
Jan-Erik Soderholm email (remove spam text)
Konstantin K. wrote :
> I have a tank-like bot where each thread is controlled by a servor (2
> servos in total). This makes a single pic not suitable for driving
> both at the same time without extensive multitasking.
If you look at the problem as a *single* task controling *two* (or more)
servos, you'll see that you don't need any "multitasking" at all.
> The servos are modified for continuous motion.
What is "continuous" here ?
> I only need to be able
> to go forward and backward. Speed control is not needed.
As far as I know, you never directly control the "speed" of a RC servo,
only the position (using the pulse width).
> So to drive
> the servo forward and backward I only need two different pulse widths.
> One of my options is to get a 12F685 for each servo...
> My other idea was to have a 555 timer for each servo...
Both those solutions seems as a major overkill and far to complicated.
> Does anyone have any suggestions on what would be the best way to go
> about it? Or any other ideas on how to drive 2 or 3 servos from the
> same pic.
Set up a timer as a basic "time base" (interrupt driven).
Create a number of counters and flags to hold the "status"
of each servo output.
At each timer interrupt, check each servo counter and, if needed,
change the output to the servos.
This is normal RC servos (20 ms period 1.5 +- 0.5 ms pulse), right ?
That is a very long time for a PIC... :-)
See also: www.piclist.com/techref/microchip/ios.htm?key=servo
You must be a member of the
piclist mailing list
(not only a www.piclist.com member) to post to the