I have an ATtiny85 and I'm trying to set the clock to 8Mhz. 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 61hz (prescaler = CK/16384) because I timed the blinking of a led. That would meet that the CK is still at 1Mhz. Not sure what i'm doing wrong here.