# Problem changing system clock frequency

I have an ATtiny85 and I'm trying to set the clock to 8 MHz. I have read the data sheet and some discussions on how to do this but am not having any luck getting it to work. I have included my code and any help will be greatly appreciated.

#include <avr/io.h>
#include <avr/interrupt.h>

int main(void)
{
cli();
CLKPR |= 1<<CLKPCE;
CLKPR |= 0;
sei();

DDRB |= 1<<PINB1 | 1<<PINB0;

TCCR0A |= 1<<WGM00 | 1<<WGM01 | 1<<COM0B0 | 1<<COM0B1;
TCCR0B |= 1<<CS00;
OCR0B = 240;

TCCR1 |= 1<<PWM1A | 1<<COM1A0 | 1<<CS13 | 1<<CS12 | 1<<CS11 | 1<<CS10;
OCR1C = 255;
OCR1A = 127;

while (1)
{
}
}


I do not have a scope, so I'm not able to determine what the frequency of Timer0 is but I know that Timer1 is running at around 61 Hz (prescaler = CK/16384) because I timed the blinking of a led. That would mean that the CK is still at 1 MHz. Not sure what I'm doing wrong here.

CLKPR = 0b10000000;

• #include <avr/power.h> clock_prescale_set(clock_div_1); Oct 11 '13 at 7:31