给这段程序加注释TIM15->CR2 = TIM_CR2_MMS_2|TIM_CR2_MMS_0; // TRGO trigger = oc2 TIM15->CCR1 = ADC_CHANGEOVR/4; TIM15->CCR2 = ADC_CHANGEOVR; TIM15->CCR3 = 0; TIM15->CCR4 = 0; TIM15->SMCR = 0; TIM15->CCMR1 = TIM_CCMR1_OC1M | TIM_CCMR1_OC1PE |TIM_CCMR1_OC2M ;//| TIM_CCMR1_OC2PE ; TIM15->CCMR2 = 0; TIM15->CCER = TIM_CCER_CC1E | TIM_CCER_CC1P| TIM_CCER_CC2E |TIM_CCER_CC2P; TIM15->DIER = TIM_DIER_CC1IE; TIM15->EGR = 0; TIM15->BDTR = 0;//TIM_BDTR_AOE|TIM_BDTR_MOE;
时间: 2023-06-04 12:06:20 浏览: 316
答:这段程序是给定时器TIM15进行初始化设置的,注释中的代码表示使用TIM15的定时器输出触发OC2,并且使用ADC_CHANGEOVR/4作为CC1的比较值,使用ADC_CHANGEOVR作为CC2的比较值,其他通道的比较值为0。TIM15的SMCR设置为0,CCMR1用于配置CC1和CC2的输出模式和预装载,CCMR2没有配置。CCER开启CC1和CC2的比较输出,并且设置极性为反相输出。DIER使能CC1的比较中断,EGR事件清零。BDTR没有设置任何参数。
阅读全文