-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 >I did a similar project on a 16F84 (no, the code isn't handy, in case anyone >was thinking of asking) that drove 2 servos for a camera pan/tilt head that >was controlled by a serial port. Since the serial port had the most >critical timing (9600 baud), I used the timer and interrupts for doing the >bit-banged serial port, and then using simple counters, coded a dual servo >drive- worked pretty good, unless you happened to send serial information to >it when the servo pulse was high- it screwed up the servo counters, and this >made the servos "twitch." I have this on an AVR8515 in a cooperative multitasker with eight servos, (and a bunch of other stuff) and buffered serial I/O You'd have to write the part that takes the chars from the serial in buffer, and tells the servos what position to go to. The rest is handled. Rep rate isn't critical, and it sounds like more or less the same approach. I have a 1mS opsys "tick" that controls the repetition rate. When it counts to zero, then it allows the servos to be loaded. For each servo, I start a servo pulse, and the timer with the width, and when the timer hits zero, the ISR turns the servo pulse off, and points to the next servo. When all eight have been done, then I reload the ram timer for the repetition rate, and it all starts over. The servo widths are stored in ram as proportional values, 0-255 and the servo routines calculate the right pulse width per servo, from defined min and max times (different brands want different widths) - -- Are you an ISP? Tired of spam? www.spamwhack.com A pre-emptive strike against spam! Where's Dave? http://www.findu.com/cgi-bin/find.cgi?kc6ete-9 -----BEGIN PGP SIGNATURE----- Version: PGPfreeware 6.5.2 for non-commercial use iQA/AwUBOSHPtIFlGDz1l6VWEQJrdgCfQgZ7ifaPU0YMG8wu+LTZMMIbM/IAoJPs mymTI1dzP/bR1WoXkQXQ6r7k =TBic -----END PGP SIGNATURE-----