问一个问题,关于pwm波产生的,要使led小灯进行亮暗变化 TIM_SetCompare2(TIM3,TIM_GetCapture2(TIM3)+1); if(TIM_GetCapture2(TIM3)==300) TIM_SetCompare2(TIM3,0); 库函数: void TIM_SetCompare2(TIM_TypeDef* TIMx, uint16_t Compare2) { /* Check the parameters */ assert_param(IS_TIM_LIST6_PERIPH(TIMx)); /* Set the Capture Compare2 Register value */ TIMx->CCR2 = Compare2; } uint16_t TIM_GetCapture2(TIM_TypeDef* TIMx) { /* Check the parameters */ assert_param(IS_TIM_LIST6_PERIPH(TIMx)); /* Get the Capture 2 Register value */ return TIMx->CCR2; } 貌似只说CRR2=TIM_GetCapture2(TIM3)+1,没看出自加啊。。。 |
RE:关于STM32pwm波形输出的疑问