我写了关于STM8S207的互补输出代码,是按照例程写的,选项字在STVD中已经设置,可就是互补输出还是出不来,但主输出是有的,下面附上代码,大家帮忙看看什么问题,
TIM1_DeInit();
TIM1_TimeBaseInit(0, TIM1_COUNTERMODE_UP, 800, 0);
TIM1_OC1Init(TIM1_OCMODE_PWM1, TIM1_OUTPUTSTATE_ENABLE,TIM1_OUTPUTNSTATE_ENABLE, 400,TIM1_OCPOLARITY_LOW, TIM1_OCNPOLARITY_HIGH,TIM1_OCIDLESTATE_SET, TIM1_OCNIDLESTATE_RESET);
TIM1_OC2Init(TIM1_OCMODE_PWM1, TIM1_OUTPUTSTATE_ENABLE,TIM1_OUTPUTNSTATE_ENABLE, 300,TIM1_OCPOLARITY_LOW, TIM1_OCNPOLARITY_HIGH,TIM1_OCIDLESTATE_SET, TIM1_OCNIDLESTATE_RESET);
TIM1_OC3Init(TIM1_OCMODE_PWM1, TIM1_OUTPUTSTATE_ENABLE,TIM1_OUTPUTNSTATE_ENABLE, 500,TIM1_OCPOLARITY_LOW, TIM1_OCNPOLARITY_HIGH,TIM1_OCIDLESTATE_SET, TIM1_OCNIDLESTATE_RESET);
TIM1_CtrlPWMOutputs(ENABLE);
TIM1_BDTRConfig(TIM1_OSSISTATE_ENABLE, TIM1_LOCKLEVEL_1, 11, TIM1_BREAK_ENABLE, TIM1_BREAKPOLARITY_HIGH, TIM1_AUTOMATICOUTPUT_ENABLE);
TIM1_Cmd(ENABLE);
此帖出自
小平头技术问答
顺便问下,为什么论坛没有帖子搜索功能
一周热门 更多>