In main() configure Timer1 as PWM and PB6 as output.

This commit is contained in:
Marco 2022-05-29 16:56:20 +02:00
parent e6fe8a9503
commit e595fcc78f

View File

@ -14,45 +14,16 @@ int main()
printf("Starting up!\r\n");
DDRB |= (1<< DDB5);
/*
* We are using Timer 1 Compare Match Unit B.
* OC1B is on Pin PB6. Let's make it an output.
*/
DDRB |= (1 << DDB6);
DDRC |= (1 << DDC6);
DDRD |= (1 << DDD0);
DDRD |= (1 << DDD1);
DDRD |= (1 << DDD7);
unsetPin(&PORTC, PC6);
unsetPin(&PORTD, PD0);
unsetPin(&PORTD, PD1);
unsetPin(&PORTD, PD7);
// initCtcTimer0();
// sei();
initPwmTimer1();
while (1) {
_delay_ms(10);
unsetPin(&PORTD, PD0);
unsetPin(&PORTD, PD1);
_delay_us(1);
setPin(&PORTC, PC6);
setPin(&PORTD, PC7);
setPin(&PORTB, PB5);
_delay_ms(10);
unsetPin(&PORTC, PC6);
unsetPin(&PORTD, PC7);
unsetPin(&PORTB, PB5);
_delay_us(1);
setPin(&PORTD, PD0);
setPin(&PORTD, PD1);
}
return 0;