各位:
使用IAR开发环境,定时器1通道2的PWM配置如下:
CLK_PeripheralClockConfig(CLK_PERIPHERAL_TIMER1, ENABLE);
TIM1_DeInit();
TIM1_TimeBaseInit(16, TIM1_COUNTERMODE_UP, 9999, 0x00);
TIM1_OC2Init(TIM1_OCMODE_PWM2, TIM1_OUTPUTSTATE_ENABLE, TIM1_OUTPUTNSTATE_ENABLE, 4999, TIM1_OCPOLARITY_LOW, TIM1_OCNPOLARITY_HIGH, TIM1_OCIDLESTATE_SET, TIM1_OCNIDLESTATE_RESET);
TIM1_CCxCmd(TIM1_CHANNEL_2, ENABLE);
TIM1_OC2PreloadConfig(ENABLE);
TIM1_CtrlPWMOutputs(ENABLE);
TIM1_Cmd(ENABLE);
同时,也使用STVP复用了PC7的引脚功能,使其输出为tim1_ch2功能,如下图,但是,依然没有输出,大家看一下是什么问题?谢谢!
|