TIM1_OCInitStructure.TIM_OutputState = TIM_OutputState_Enable;
TIM1_OCInitStructure.TIM_OutputNState =TIM_OutputNState_Enable;
TIM1_OCInitStructure.TIM_Pulse = PWM_PERIOD >> 1;
TIM1_OCInitStructure.TIM_OCPolarity = TIM_OCPolarity_High;
//上桥臂高电平有效
TIM1_OCInitStructure.TIM_OCNPolarity = TIM_OCNPolarity_Low;
//下桥臂低电平有效
TIM1_OCInitStructure.TIM_OCIdleState = TIM_OCIdleState_Reset;
//空闲状态上桥输出0
TIM1_OCInitStructure.TIM_OCNIdleState =TIM_OCNIdleState_Set;
//空闲状态下桥输出1
通过修改CR2的值来实现 上桥输出0,下桥输出0(下桥低有效)电子刹车。但是现在的问题是为什么下桥的状态修改不了呢?始终都是1,没办法改为0
TIM1的LOCK位已经关掉了。 |