您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

1234567891011121314151617181920212223
  1. #include "tim.h"
  2. //------------------------------------------------------------------
  3. void TIM3_Int_Init(u16 arr,u16 psc)
  4. {
  5. TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
  6. // NVIC_InitTypeDef NVIC_InitStructure;
  7. RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE); //ʱʹ
  8. //ʱTIM3ʼ
  9. TIM_TimeBaseStructure.TIM_Period = arr; //һ¼װԶװؼĴڵֵ
  10. TIM_TimeBaseStructure.TIM_Prescaler =psc; //ΪTIMxʱƵʳԤƵֵ
  11. TIM_TimeBaseStructure.TIM_ClockDivision = TIM_CKD_DIV1; //ʱӷָ:TDTS = Tck_tim
  12. TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up; //TIMϼģʽ
  13. TIM_TimeBaseInit(TIM3, &TIM_TimeBaseStructure); //ָIJʼTIMxʱλ
  14. TIM_ITConfig(TIM3,TIM_IT_Update,ENABLE ); //ʹָTIM3ж,ж
  15. TIM_Cmd(TIM3, ENABLE); //ʹTIMx
  16. }