我现在
tim1输出互补的pwm,要检测其上升沿,我用其CH2进行输入捕获(互补的pwm输出是CH1)结果示波器看见连输出的pwm都没了,附上代码:
void TIM1_Init(void)
{
TIM1_PSCRH=0X00;
TIM1_PSCRL=0X00;
TIM1_ARRH=0XFF;
TIM1_ARRL=0XFF;
TIM1_CNTRH=0X00;
TIM1_CNTRL=0X00;
TIM1_CCER1&=0XEE;
TIM1_CCMR2=0X02;
TIM1_CCER1=0X15;
//TIM1_SMCR|=0X54; //这个如果我单纯判断边沿极性还需要吗?
TIM1_IER=0X02;
TIM1_CR1=0X85;
}
#pragma vector=0x0E
__interrupt void TIM1_CAP_COM_IRQHandler(void)
{
if(TIM1_SR1&0X04) //代表上升沿到来?
{
TIM1_SR1=0X00;
}
有人帮忙看看嘛
一周热门 更多>