From b479b1416f97a82de19414d7e7996293830077e0 Mon Sep 17 00:00:00 2001 From: Wolfgang Hottgenroth Date: Sat, 15 Oct 2016 08:26:43 +0200 Subject: [PATCH] introduce polarity, use 30 sine values --- src/inverterCtrl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/inverterCtrl.c b/src/inverterCtrl.c index 8327d42..9083294 100644 --- a/src/inverterCtrl.c +++ b/src/inverterCtrl.c @@ -15,7 +15,7 @@ #include -#define NUM_OF_SINE_VALUES 20 +#define NUM_OF_SINE_VALUES 30 volatile uint8_t pulseWidthIdx = 0; @@ -27,20 +27,20 @@ ISR(TIMER1_A0, TA1_ISR_Ovrfl) { if (pulseWidthIdx == 0) { P2OUT |= BIT3; } - if (pulseWidthIdx == 13) { + if (pulseWidthIdx == (NUM_OF_SINE_VALUES / 3)) { P2OUT |= BIT4; } - if (pulseWidthIdx == 26) { + if (pulseWidthIdx == (NUM_OF_SINE_VALUES / 3 * 2)) { P2OUT |= BIT5; } } else { if (pulseWidthIdx == 0) { P2OUT |= BIT4; } - if (pulseWidthIdx == 13) { + if (pulseWidthIdx == (NUM_OF_SINE_VALUES / 3)) { P2OUT |= BIT3; } - if (pulseWidthIdx == 26) { + if (pulseWidthIdx == (NUM_OF_SINE_VALUES / 3 * 2)) { P2OUT |= BIT5; } }