|
求大神帮看看程序
void TIM2_Config()
{
TIM_InitStructure.TIM_ClockDivision=TIM_CKD_DIV1;
TIM_InitStructure.TIM_CounterMode=TIM_CounterMode_Up;
TIM_InitStructure.TIM_Period=36000;
TIM_InitStructure.TIM_Prescaler=0;
TIM_InitStructure.TIM_RepetitionCounter=0;
TIM_TimeBaseInit(TIM2,&TIM_InitStructure);
TIM_OCInitStructure.TIM_OCMode=TIM_OCMode_PWM1;
TIM_OCInitStructure.TIM_OCPolarity=TIM_OCPolarity_High;
TIM_OCInitStructure.TIM_Pulse=18000;
TIM_OCInitStructure.TIM_OutputState=TIM_OutputState_Enable;
TIM_OC4Init(TIM2,&TIM_OCInitStructure);
TIM_OC4PreloadConfig(TIM2, TIM_OCPreload_Enable);
TIM_ARRPreloadConfig(TIM2, ENABLE);
TIM_Cmd(TIM2,ENABLE);
}
用TIM2的CH4输出PWM 可是没反应。。。
|
|