From e595fcc78f8419ca4ffe3d63fec1f83119823366 Mon Sep 17 00:00:00 2001 From: Marco Date: Sun, 29 May 2022 16:56:20 +0200 Subject: [PATCH] In main() configure Timer1 as PWM and PB6 as output. --- src/inverter.c | 41 ++++++----------------------------------- 1 file changed, 6 insertions(+), 35 deletions(-) diff --git a/src/inverter.c b/src/inverter.c index 60d7dd1..172a7ce 100644 --- a/src/inverter.c +++ b/src/inverter.c @@ -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;