From 1a4ea70147216f586f1341d4f1981733ed2c203c Mon Sep 17 00:00:00 2001 From: tao_z <tzj0429@163.com> Date: Sat, 03 Jul 2021 21:41:30 +0800 Subject: [PATCH] 采用三个外部中断触发 --- USR/INC/pwm.h | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/USR/INC/pwm.h b/USR/INC/pwm.h index 770bbaa..da32571 100644 --- a/USR/INC/pwm.h +++ b/USR/INC/pwm.h @@ -1,11 +1,11 @@ #ifndef _PWM_H_ #define _PWM_H_ #include "gd32e23x_timer.h" -//100us * 300 = 30ms -#define PERIOD_CAP (300U) +//100us * 30000 = 3s +#define PERIOD_CAP (30000U) -//64Mzhz / 4000 = 16Khz = 62.5us -#define PERIOD_CMP (4000u) +//48Mzhz / 3000 = 16Khz = 62.5us +#define PERIOD_CMP (3000u) void TimerInit(void); void SetPwmDuty(uint16_t ch, uint32_t duty); @@ -14,4 +14,6 @@ extern void StartSpeedTime(void); extern void StopSpeedTime(void); extern void stop_pwm_output(void); +extern void TIMER2_IRQHandler_CallBack(void); +extern uint32_t GetSpeedTimerOutcnt(void); #endif -- Gitblit v1.8.0