phase shift must be 120°
This commit is contained in:
@ -15,11 +15,11 @@
|
|||||||
#include <isr_compat.h>
|
#include <isr_compat.h>
|
||||||
|
|
||||||
|
|
||||||
#define NUM_OF_SINE_VALUES 30
|
#define NUM_OF_SINE_VALUES 21
|
||||||
|
|
||||||
|
|
||||||
volatile uint8_t pulseWidthIdx = 0;
|
volatile uint8_t pulseWidthIdx = 0;
|
||||||
volatile bool direction = true;
|
volatile bool direction = false;
|
||||||
|
|
||||||
|
|
||||||
ISR(TIMER1_A0, TA1_ISR_Ovrfl) {
|
ISR(TIMER1_A0, TA1_ISR_Ovrfl) {
|
||||||
@ -79,7 +79,7 @@ void inverterCtrlInit() {
|
|||||||
|
|
||||||
void inverterCtrlSetFrequency(uint16_t f) {
|
void inverterCtrlSetFrequency(uint16_t f) {
|
||||||
float ff = (float)f;
|
float ff = (float)f;
|
||||||
float slotLength = 2 / (ff * 400e-9 * NUM_OF_SINE_VALUES);
|
float slotLength = 4 / (ff * 400e-9 * NUM_OF_SINE_VALUES);
|
||||||
uint16_t sl = (uint16_t)slotLength;
|
uint16_t sl = (uint16_t)slotLength;
|
||||||
|
|
||||||
__disable_interrupt();
|
__disable_interrupt();
|
||||||
|
Reference in New Issue
Block a user