STM8 TIM1死区配置问题!!!求救!!
void PWM_1M_Init(void)
{
TIM1_DeInit();
//TIM1_CH3.TIM1_CH3N配置为互补输出设置。频率为1Mhz。现在想加一点死区。避免方波交叉时短路。但是一加上那句配置死区的语句,。就没有输出了!!求解释。。OPTION BYTE什么 都没有问题。就是死区配置加上去就不行了!!!
TIM1_TimeBaseInit(1, TIM1_COUNTERMODE_UP, 11, 0);
//1M: TIM1_TimeBaseInit(1, TIM1_COUNTERMODE_UP, 11, 0); TIM1时钟=24M/2=12M 12M/1M=12
TIM1_OC3Init(TIM1_OCMODE_PWM2, TIM1_OUTPUTSTATE_ENABLE, TIM1_OUTPUTNSTATE_ENABLE,
6, TIM1_OCPOLARITY_HIGH, TIM1_OCNPOLARITY_HIGH, TIM1_OCIDLESTATE_RESET,
TIM1_OCNIDLESTATE_RESET);
//设置死区!只要一加了这句。就没输出了!!!!这个死区配置的有问题吗!!!????
//TIM1_BDTRConfig(TIM1_OSSISTATE_ENABLE, TIM1_LOCKLEVEL_OFF, 0, TIM1_BREAK_ENABLE, TIM1_BREAKPOLARITY_LOW, TIM1_AUTOMATICOUTPUT_ENABLE);
/* TIM1 counter 使能 */
TIM1_OC3PreloadConfig(ENABLE); //通道3使能
TIM1_CtrlPWMOutputs(ENABLE); /* 使能TIM1输出 */
TIM1_Cmd(ENABLE); //TIM1启动/关闭
} |