Support Complementary PWM mode

This commit is contained in:
murphy
2022-08-24 15:08:08 +08:00
parent dce9c6229e
commit 5573ead3af
36 changed files with 4251 additions and 1196 deletions
+10 -8
View File
@@ -15,9 +15,10 @@
#include "define.h"
// dead time unit = 1/72us
// ex. dead time 72 = 1us, 36 = 0.5us, 18=0.25us
#define DEAD_ZONE_01 36 // unit = 1/72us, PWM0.0 PWM0.1 Dead time
#define DEAD_ZONE_23 72 // unit = 1/72us, PWM0.2 PWM0.3 Dead time
#define DEAD_ZONE_45 18 // unit = 1/72us, PWM0.4 PWM0.5 Dead time
// ex. dead time 2 = 2/72 us, 3 = 3/72us, 4=4/72us
#define DEAD_ZONE_01 2 // unit = 1/72us, PWM0.0 PWM0.1 Dead time
#define DEAD_ZONE_23 3 // unit = 1/72us, PWM0.2 PWM0.3 Dead time
#define DEAD_ZONE_45 4 // unit = 1/72us, PWM0.4 PWM0.5 Dead time
#define MAX_FREQ 150000
#define MIN_FREQ 40000
@@ -206,12 +207,13 @@ int main(void)
UART_Func();
if(TIMER_GetIntFlag(TIMER1)) { // timer1 elapsed?
TIMER_ClearIntFlag(TIMER1); // clear timer1 flags
BUTTON_Func();
TIMER_ClearIntFlag(TIMER1); // clear timer1 flags
if(Shutdown == 0) {
BUTTON_Func();
}
int S = CHECK_SHUTDOWN();
if(S >= 0) {
if(S) {
if(SHUTDOWN_MODE_CHANGED() != 0) {
if(Shutdown == 1) {
Display('E');
/* Enable TIMER2 interrupt */
ComplementaryPWM0(0, 0); // Turn off PWM