From: Tan Lao <tanlao@ya...> - 2006-03-29 17:53:20
When using the code found at
I can see the way to change frequency, but is it
possible to have a frequency at say 71 Hz and a duty
cycle that varies from 7.3% to 14.6%? If so, how
would I change these settings then?
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
From: Dave Hylands <dhylands@gm...> - 2006-03-29 18:12:25
On 3/29/06, Tan Lao <tanlao@...> wrote:
> When using the code found at
> I can see the way to change frequency, but is it
> possible to have a frequency at say 71 Hz and a duty
> cycle that varies from 7.3% to 14.6%? If so, how
> would I change these settings then?
That looks like pulses for driving an RC servo. This page:
has a link to some C code.
There is also a shell script called servo which can be found over here:
In either case, the ICR register controls how frequently things
repeat. The samples show a value of 40,000 which is units of 0.5 usec.
71Hz =3D 0.0140845 =3D 14084.5 usec =3D 28169 1/2 usec ticks
So change the 40000 to 28169 and you'll get 71 Hz. The OCRxA/B/C
registers control the duty cycle. With the example, there are the
number of 1/2 usec ticks you want the pulse to be on, so you can get
all values from 0% to 100%.
2000 would give you a 1msec pulse, and 4000 would give a 2msec pulse.
Vancouver, BC, Canada