From 96ac9f15073d7b10c1d282b96b797d1d63015eed Mon Sep 17 00:00:00 2001 From: Marco Date: Fri, 27 May 2022 02:21:58 +0200 Subject: [PATCH] Create simple alternating voltage by naively switching ports off and on. --- src/inverter.c | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/src/inverter.c b/src/inverter.c index 1343470..60d7dd1 100644 --- a/src/inverter.c +++ b/src/inverter.c @@ -2,9 +2,10 @@ #include #include -#include "include/uart.h" -#include "include/timer.h" -#include "include/commands.h" +#include "uart.h" +#include "timer.h" +#include "commands.h" +#include "pins.h" int main() { @@ -13,25 +14,45 @@ int main() printf("Starting up!\r\n"); - DDRB |= (1 << DDB2); - DDRB |= (1 << DDB6); + DDRB |= (1<< DDB5); - DDRC |= (1 << DDC7); + DDRC |= (1 << DDC6); DDRD |= (1 << DDD0); DDRD |= (1 << DDD1); - DDRD |= (1 << DDD6); + DDRD |= (1 << DDD7); + unsetPin(&PORTC, PC6); - initCtcTimer0(); + unsetPin(&PORTD, PD0); + unsetPin(&PORTD, PD1); + unsetPin(&PORTD, PD7); - sei(); + // initCtcTimer0(); + // sei(); while (1) { - if ((PORTB & (1<1) { - _delay_ms(5); - PORTB &= ~(1<