Hello everyone!
I would like to ask a question about programming an Attiny45 via Arduino as ISP.
I attempted to write a simple software to create a PWM signal on pin 5 via manipulating the timer0 registers. The code looks the following:
void setup()
{
DDRB = (1<<PB0);
TCCR0A |= (1 << COM0A1) | (1 << WGM01) | (1 << WGM00);
OCR0A = 150;
//Set timer0 prescaler:
TCCR0B |= (1 << CS00);
}
void loop()
{
}
No matter if I change the board to another attiny45 or an attiny85, I cannot manupulate the prescaler when I try to set those bits which can divide the internal counter clock. With 16MHz internal clock setting, burning the bootloader to the chip, then uploading this sketch, I can measure a 1kHz signal with variable duty cycle on the mentioned leg (by changing OCR0A between 0 and 255). What did I miss?
Thank you for the help in advance!
:Niz