From 66ca2c80046285d64bdf58d6cc506654ac99df70 Mon Sep 17 00:00:00 2001 From: cui635 Date: Tue, 16 Sep 2025 11:22:16 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E6=94=B9PWM=E9=A2=91?= =?UTF-8?q?=E7=8E=87=EF=BC=8C=E8=A7=A3=E5=86=B3=E7=94=B5=E6=9C=BA=E4=BD=8E?= =?UTF-8?q?=E9=80=9F=E5=90=AF=E5=81=9C=E6=97=B6=E7=9A=84=E9=AB=98=E9=A2=91?= =?UTF-8?q?=E5=99=AA=E9=9F=B3=E9=97=AE=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Project/HC32F460/source/Module/dc_motor/dc_motor.c | 2 +- Project/HC32F460/source/Module/dc_motor/dc_motor.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Project/HC32F460/source/Module/dc_motor/dc_motor.c b/Project/HC32F460/source/Module/dc_motor/dc_motor.c index 442cf72..cd67c6a 100644 --- a/Project/HC32F460/source/Module/dc_motor/dc_motor.c +++ b/Project/HC32F460/source/Module/dc_motor/dc_motor.c @@ -34,7 +34,7 @@ void DCMOTORDBGOnOff(uint8_t OnOff) /* Timer4 CNT */ #define TIMER4_UNIT (M4_TMR41) -#define TIMER4_CNT_CYCLE_VAL (10000u) /* Timer4 counter cycle value */ +#define TIMER4_CNT_CYCLE_VAL (500u) /* Timer4 counter cycle value */ /* Timer4 OCO */ #define TIMER4_OCO_HIGH_CH (Timer4OcoOuh) /* only Timer4OcoOuh Timer4OcoOvh Timer4OcoOwh */ diff --git a/Project/HC32F460/source/Module/dc_motor/dc_motor.h b/Project/HC32F460/source/Module/dc_motor/dc_motor.h index 9543ddb..d7e319c 100644 --- a/Project/HC32F460/source/Module/dc_motor/dc_motor.h +++ b/Project/HC32F460/source/Module/dc_motor/dc_motor.h @@ -11,10 +11,10 @@ #define TIMER TIMER4 // 电机控制参数 #define PWM_PERIOD TIM_PERIOD // PWM周期值 (ARR) -#define MAX_SPEED 9900 // 最大速度(PWM占空比) -#define ACCEL_STEP 100 // 加速步进值 -#define DECEL_STEP 100 // 减速步进值 -#define ACCEL_INTERVAL 2 // 加减速间隔(ms) +#define MAX_SPEED 480 // 最大速度(PWM占空比) +#define ACCEL_STEP 10 // 加速步进值 +#define DECEL_STEP 10 // 减速步进值 +#define ACCEL_INTERVAL 10 // 加减速间隔(ms)