strange thing when write pulseWidths array
This commit is contained in:
@ -14,6 +14,33 @@
|
|||||||
|
|
||||||
#include "inverter.h"
|
#include "inverter.h"
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
#define NUM_OF_SINE_VALUES 21
|
||||||
|
|
||||||
|
float sineValues[NUM_OF_SINE_VALUES] = {
|
||||||
|
0.1490,
|
||||||
|
0.2948,
|
||||||
|
0.4339,
|
||||||
|
0.5633,
|
||||||
|
0.6802,
|
||||||
|
0.7818,
|
||||||
|
0.8660,
|
||||||
|
0.9309,
|
||||||
|
0.9749,
|
||||||
|
0.9972,
|
||||||
|
0.9972,
|
||||||
|
0.9749,
|
||||||
|
0.9309,
|
||||||
|
0.8660,
|
||||||
|
0.7818,
|
||||||
|
0.6802,
|
||||||
|
0.5633,
|
||||||
|
0.4339,
|
||||||
|
0.2948,
|
||||||
|
0.1490,
|
||||||
|
0.0000
|
||||||
|
};
|
||||||
|
#else
|
||||||
#define NUM_OF_SINE_VALUES 20
|
#define NUM_OF_SINE_VALUES 20
|
||||||
|
|
||||||
float sineValues[NUM_OF_SINE_VALUES] = {
|
float sineValues[NUM_OF_SINE_VALUES] = {
|
||||||
@ -38,6 +65,7 @@ float sineValues[NUM_OF_SINE_VALUES] = {
|
|||||||
0.1564,
|
0.1564,
|
||||||
0.0000
|
0.0000
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
volatile uint16_t pulseWidths[NUM_OF_SINE_VALUES * 2];
|
volatile uint16_t pulseWidths[NUM_OF_SINE_VALUES * 2];
|
||||||
volatile uint8_t pulseWidthIdx = 0;
|
volatile uint8_t pulseWidthIdx = 0;
|
||||||
@ -50,7 +78,7 @@ ISR(TIMER0_A0, TA0_ISR_Ovrfl) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint16_t pw = pulseWidths[pulseWidthIdx + activeOffset];
|
uint16_t pw = pulseWidths[pulseWidthIdx + activeOffset];
|
||||||
if (pw != 0) {
|
if (pulseWidthIdx != (NUM_OF_SINE_VALUES - 1)) {
|
||||||
TA0CCR1 = pw;
|
TA0CCR1 = pw;
|
||||||
P2OUT |= BIT1;
|
P2OUT |= BIT1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user