本帖最后由 lpx280666373 于 2022-8-17 08:35 编辑
如图“预驱时序图”,假设AB相导通。 A相上桥臂导通、下桥臂截止,则TIM1_CH0输出PWM,TIM1_CH0N输出同极性PWM或长高电平;
B相上桥臂截止、下桥臂长通,则TIM1_CH1输出长低, TIM1_CH1N输出长低;
实验结果没配置出来B相想要的结果,通过尝试更改下面的配置;
timer_ocintpara.ocpolarity = TIMER_OC_POLARITY_HIGH;
timer_ocintpara.ocnpolarity = TIMER_OCN_POLARITY_LOW;
timer_ocintpara.ocidlestate = TIMER_OC_IDLE_STATE_HIGH;
timer_ocintpara.ocnidlestate = TIMER_OCN_IDLE_STATE_LOW;
timer_channel_output_mode_config(TIMER0, TIMER_CH_0, TIMER_OC_MODE_PWM0);
timer_channel_output_mode_config(TIMER0, TIMER_CH_1, TIMER_OC_MODE_PWM0);
timer_channel_output_mode_config(TIMER0, TIMER_CH_2, TIMER_OC_MODE_PWM0);
timer_channel_output_state_config(TIMER0, TIMER_CH_0, TIMER_CCX_DISABLE);
timer_channel_output_state_config(TIMER0, TIMER_CH_1, TIMER_CCX_DISABLE);
timer_channel_output_state_config(TIMER0, TIMER_CH_2, TIMER_CCX_DISABLE);
timer_channel_complementary_output_state_config(TIMER0, TIMER_CH_0, TIMER_CCXN_DISABLE);
timer_channel_complementary_output_state_config(TIMER0, TIMER_CH_1, TIMER_CCXN_DISABLE);
timer_channel_complementary_output_state_config(TIMER0, TIMER_CH_2, TIMER_CCXN_DISABLE);
|