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; } }