Thanks for that idea, I did get the other code running but the clock wasn't set right so I wasn't seeing any pulses. I might try that idea in the future.
David VanHorn <microbrix@gmail.com> wrote: On Sun, Feb 24, 2008 at 5:52 PM, J C <stereotyperjack@yahoo.com> wrote:
> I am trying to control 2 servos with an ATMEGA16 running off of an 8MHz crystal. I have tried to figure it out with various code examples on the internet but don't seem to be getting it. Here is my code, any ideas?
What I do, is to set up an array of bytes in memory, each holding a
0-255 value for pulse width.
I add this to a minimum pulse width, and create timer values.
I start all the servo pulses at once, then turn them off at the
appropriate time using a single timer interrupt.
So the output looks like
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
and so on.
Then the framing pulse (15mS or so) is just a do-nothing time.
---------------------------------
Looking for last minute shopping deals? Find them fast with Yahoo! Search.
[Non-text portions of this message have been removed]Message
Re: [AVR-Chat] Mega16 PWM
2008-02-28 by J C
Attachments
- No local attachments were found for this message.