TIM1_DeInit();
TIM1_TimeBaseInit(16,TIM1_COUNTERMODE_UP,9999,0);
TIM1_OC1Init(TIM1_OCMODE_PWM1, TIM1_OUTPUTSTATE_ENABLE,
TIM1_OUTPUTNSTATE_DISABLE, 1000, TIM1_OCPOLARITY_HIGH,
TIM1_OCNPOLARITY_LOW, TIM1_OCIDLESTATE_RESET, TIM1_OCNIDLESTATE_SET);
TIM1_OC2Init(TIM1_OCMODE_PWM1, TIM1_OUTPUTSTATE_ENABLE,
TIM1_OUTPUTNSTATE_DISABLE, 1000, TIM1_OCPOLARITY_HIGH,
TIM1_OCNPOLARITY_LOW, TIM1_OCIDLESTATE_SET, TIM1_OCNIDLESTATE_SET);
TIM1_CCxCmd(TIM1_CHANNEL_1, ENABLE);
TIM1_CCxCmd(TIM1_CHANNEL_2, ENABLE);
TIM1_OC1PreloadConfig(ENABLE);
TIM1_OC2PreloadConfig(ENABLE);
TIM1_CtrlPWMOutputs(ENABLE);
TIM1_Cmd(ENABLE);
一周热门 更多>