[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-chat] PWM, to fast!
From: |
Jeff Epler |
Subject: |
Re: [avr-chat] PWM, to fast! |
Date: |
Mon, 6 Jun 2005 11:42:14 -0500 |
User-agent: |
Mutt/1.4.1i |
I'm not sure your math is right. I figure that 8MHz / 128 is 62.5kHz,
not 62500kHz.
As far as I understand PWM on AVR, the counter is incremented
every PRESCALER clocks. On the 8535, the timer/counter 1 says it is
"true 16-bit design", so the full period is 65536 increments. That is
actually right around 1Hz when using the biggest prescaler.
If you use Fclk_io=8MHz, TOP=33332, N=8, you will get 30.0003Hz as the PWM
frequency. See page 102 of the datasheet (revision 2502E-12/03 here) I
believe you then set the OCR1H and OCR1L to values from 0..TOP to change
the "on" time.
Jeff
pgpLhCeQFEK7W.pgp
Description: PGP signature