標(biāo)題: STM32通用定時(shí)器程序 [打印本頁(yè)]

作者: wangting123    時(shí)間: 2020-5-20 12:17
標(biāo)題: STM32通用定時(shí)器程序
STM32系列的
  1. #include "led.h"
  2. #include "delay.h"
  3. #include "sys.h"
  4. #include "timer.h"

  5. int main(void)
  6. {       
  7.         Stm32_Clock_Init(9); //系統(tǒng)時(shí)鐘設(shè)置,當(dāng)前晶振頻率為8MHz,PLL的值為9,則系統(tǒng)時(shí)鐘為72MHz
  8.         delay_init(72);             //延時(shí)初始化
  9.         LED_Init();                          //初始化與LED連接的硬件接口
  10.         TIM3_Init(4999,7199);//10Khz的計(jì)數(shù)頻率,計(jì)數(shù)到5000為500ms  
  11.            while(1)
  12.         {
  13.                 LED0=!LED0;
  14.                 delay_ms(200);                  
  15.         }
  16. }
復(fù)制代碼


通用定時(shí)器.7z

191.21 KB, 下載次數(shù): 4, 下載積分: 黑幣 -5






歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1