1 PWM 4种主要输出模式
2 PWM输出
2.1 主函数
2.2 PWM输出模式实验
- PWM2 | OCPolarity ->TIM_OCPOLARITY_HIGH
- 当比较值固定为200 时,高电平占空比 = ((arr+1) – CCR1) / (arr+1) = (500-200)/500=60%
3 互补PWM输出模式实验
- 设置输出比较值和死区时间的函数
- atim_timx_cplm_pwm_set(300, 100) 这个语句,相当于设置捕获/比较寄存器的值为300,DTG[7:0]的值为 100。通过计算可以得到 PWM 的占空比为 70%,死区时间为 2.38us。
- PWM1 | OCPolarity ->TIM_OCPOLARITY_LOW | OCNPolarity->TIM_OCPOLARITY_LOW
3.1 实验分析
- PWM1 | OCPolarity ->TIM_OCPOLARITY_LOW | OCNPolarity->TIM_OCPOLARITY_LOW
- 占空比计算
- 实验现象