STM32F103ZET6單片機實驗案列文件及資料
電路原理圖如下:
--------------------------------------------------------------------------------
* 實 驗 名 : 系統時鐘實驗
* 實驗說明 : 通過自定義修改系統時鐘,使SysTick時間變化,本來LED閃爍間隔0.5秒,通過
自定義后間隔1秒。
RCC_PLLConfig(RCC_PLLSource_HSE_Div2,RCC_PLLMul_9);//設置PLL時鐘源及倍頻
改變成RCC_PLLSource_HSE_Div2
* 連接方式 :
* 注 意 : 所用函數在systick.c和led.c文件內
單片機工程模板源程序如下:
- #include "public.h"
- #include "led.h"
- #include "systick.h"
- /****************************************************************************
- * Function Name : main
- * Description : Main program.
- * Input : None
- * Output : None
- * Return : None
- ****************************************************************************/
- int main()
- {
- LED_Init(); //LED端口初始化
- RCC_HSE_Configuration();// 自定義系統時間,通過修改里面的倍頻及分頻即可
- while(1)
- {
- GPIO_SetBits(GPIOC,LED);
- delay_ms(500);//精確延時為0.5s
- GPIO_ResetBits(GPIOC,LED);
- delay_ms(500);//精確延時為0.5s
- }
- }
復制代碼
所有資料51hei提供下載:
庫函數版.7z
(3.25 MB, 下載次數: 47)
|