|
使用定時器的查詢方式。具體功能描述如下:使用定時器控制一個發(fā)光二極管亮ns,再滅ns,如此重復(fù)。n為學(xué)號后一位,0的為10秒。
單片機(jī)源程序如下:
- /*******************************************************************************************************
- * @file main.c
- * @author oya
- * @version 1.0
- * @date 09/19/2020
- * @section LICENSE
- *
- * This file is ...
- *********************************************************************************************************/
- /********************************************************************************************************
- * INCLUDE FILES *
- *********************************************************************************************************/
- #include <reg51.h>
- #include "bsp_led.h"
- #include "bsp_key.h"
- #include "bsp_displayDev.h"
- #include "bsp_systemtick.h"
- #include "KeyProc.h"
- #include "SysLedProc.h"
- #include "DisplayDevProc.h"
- /********************************************************************************************************
- *
- * Function Name: void main(void)
- *
- * Descriptions: 主函數(shù)
- *
- * Arguments: void
- *
- * Returns: void
- *
- * Author: oya
- *
- *********************************************************************************************************/
- void Bsp_Init(void)
- {
- //1. 系統(tǒng)時鐘初始化
- SysTick_Init ();
-
- //1. 按鍵初始化
- Key_Gpio_Init ();
-
- //2. LED初始化
- Led_Init ();
-
- //3. 顯示設(shè)備初始化
- DisplayDev_Init ();
- }
- /********************************************************************************************************
- *
- * Function Name: void main(void)
- *
- * Descriptions: 主函數(shù)
- *
- * Arguments: void
- *
- * Returns: void
- *
- * Author: oya
- *
- *********************************************************************************************************/
- void main (void)
- {
- //1. 硬件連接層
- Bsp_Init ();
-
- //2. 應(yīng)用層
- //None
-
- while(1)
- {
- KeyProc ();
-
- DisplayDevProc ();
-
- SysLedProc ();
-
- }
- }
復(fù)制代碼
所有資料51hei提供下載:
04.TimerCurbNixieTube.rar
(124.24 KB, 下載次數(shù): 14)
2020-10-30 23:13 上傳
點擊文件名下載附件
|
|