用stm32固件库3.4编写Systick

2019-12-11 18:18发布

大伙们,我最近在学习stm32,想用固件库3.4编写一个systick,查了好多资料还是没有搞清楚,特意向大家请教。
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
15条回答
cihu
2019-12-11 20:52
在3.4库里面,只需要调用SysTick_Config函数就可以初始化systick了,下面的例子是产生10ms中断,中断函数在stm32f10x_it.c里的SysTick_Handler。想产生1ms就把100改成1000

int main(void)
{
          /*!< At this stage the microcontroller clock setting is already configured,
       this is done through SystemInit() function which is called from startup
       file (startup_stm32f10x_xx.s) before to branch to application main.
       To reconfigure the default setting of SystemInit() function, refer to
       system_stm32f10x.c file
     */
          if(SysTick_Config(SystemCoreClock / 100))   
          {
                while(1);
          }
      while(1);
}

一周热门 更多>