普中PZ6806L用定时器TIM2完成一秒LED闪烁一次

(82) 2024-03-11 18:01:02

本次试验用到的东西有:
1)TIM2通用定时器
2)普中PZ6806L开发板,LED1

硬件连接:
1)TIM2挂载在APB1下面
2)LED1-PC0,低电平有效

步骤:
1)先打开系统时钟
2)配置中NVIC
3)配置GPIO

关于TIM定时器的配置

typedef struct
{ 
   
  uint16_t TIM_Prescaler;         /*!< Specifies the prescaler value used to divide the TIM clock. This parameter can be a number between 0x0000 and 0xFFFF */

  uint16_t TIM_CounterMode;       /*!< Specifies the counter mode. This parameter can be a value of @ref TIM_Counter_Mode */

  uint16_t TIM_Period<
THE END

发表回复