Changing PWM frequency on ATTINY84

Hey guys

I am having a lot of trouble finding any information about changing the PWM frequency on the ATTINY84. I have found many resources about changing in the frequency on the ATMEGA328. From what I can deduce from information about the ATMEGA328, the ATTINY84 has two timers; timer0 and timer1.

I can see that using the ATMEGA328 you could use a line of code like this:
TCCR0B = TCCR0B & B11111000 | B00000001; // set timer 0 divisor to 1 for PWM frequency of 62500.00 Hz

I want to achieve a PWM frequency of around 32kHz on the ATTINY84. Can someone help me out and tell me if the line of code above would work at setting the PWM frequency at 62.5kHz?

I know by changing timer0 that the functions such as delay() and millis() might not work properly but i can deal with that. I am using a 16Mhz external clock on the ATTINY84 if that helps.

Thanks!

Hello Everyone!

I found a solution to the problem i had about changing the PWM frequency on the ATTINY84.

To change the frequency you need to manipulate the timers, there are two timers on the ATTINY84, TIMER0 and TIMER1. Each timer controls two PWM pins.

To change the frequency on TIMER0, in the setup() of your program write:

TCCR0B = TCCR0B & B11111000 | B00000001; //this changes the PWM frequency to 62.5kHz

To change the frequency on TIMER1, in the setup() of your program write:

TCCR1B = TCCR1B & B11111000 | B00000001; //this changes the PWM frequency to 32kHz

I hope this information will help you in your projects!