Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] Mega16 PWM

2008-02-28 by J C

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]

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.