void Init_TM1(void)
{
CLK_PeripheralClockConfig (CLK_Peripheral_TIM1,ENABLE);
//TIM1_SetCounter(0);
TIM1_TimeBaseInit(128,TIM1_CounterMode_Up,12500,0);//100ms
TIM1_GenerateEvent(TIM1_EventSource_Update);
TIM1_ARRPreloadConfig(ENABLE);
TIM1_ClearFlag(TIM1_FLAG_Update);
TIM1_ITConfig(TIM1_IT_Update, ENABLE);
TIM1_Cmd(ENABLE);
} |