void Init_pwm()
{
TIM1_DeInit();
TIM1_TimeBaseInit(0, TIM1_COUNTERMODE_UP, 800, 0x00);//250
TIM1_OC4Init(TIM1_OCMODE_PWM1, TIM1_OUTPUTSTATE_ENABLE, 400, TIM1_OCPOLARITY_LOW, TIM1_OCIDLESTATE_RESET);//50%占空比
TIM1_CCxCmd(TIM1_CHANNEL_4, ENABLE);
TIM1_OC4PreloadConfig(ENABLE);
TIM1_CtrlPWMOutputs(ENABLE);
TIM1_Cmd(ENABLE);
}