|
1234567891011121314151617181920212223 |
- #include "tim.h"
-
- //------------------------------------------------------------------
- void TIM3_Int_Init(u16 arr,u16 psc)
- {
- TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
- // NVIC_InitTypeDef NVIC_InitStructure;
-
- RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE); //ʱʹ
-
- //ʱTIM3ʼ
- TIM_TimeBaseStructure.TIM_Period = arr; //һ¼װԶװؼĴڵֵ
- TIM_TimeBaseStructure.TIM_Prescaler =psc; //ΪTIMxʱƵʳԤƵֵ
- TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1; //ʱӷָ:TDTS = Tck_tim
- TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; //TIMϼģʽ
- TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure); //ָIJʼTIMxʱλ
-
- TIM_ITConfig(TIM3,TIM_IT_Update,ENABLE ); //ʹָTIM3ж,ж
-
- TIM_Cmd(TIM3, ENABLE); //ʹTIMx
- }
-
-
|