|
基于STM8系列單片機(jī)的程控?cái)?shù)字時(shí)鐘設(shè)計(jì),包括秒表、計(jì)時(shí)、鬧鐘等功能。
單片機(jī)源程序(主程序)如下:
- /* Includes ------------------------------------------------------------------*/
- #include "include.h"
- #include "Time.h"
- //#include "stdio.h"
- /* Private defines -----------------------------------------------------------*/
- u16 i = 0;
- u8 Second = 0;
- u8 Minute = 0;
- u8 Hour = 0;
- u8 SendBuf[30] = " ";
- /* Private function prototypes -----------------------------------------------*/
- /*******************************************************************************
- ****函數(shù)名稱:
- ****函數(shù)功能:延時(shí)函數(shù)
- ****版本:V1.0
- ****日期:14-2-2014
- ****入口參數(shù):需要延時(shí)的數(shù)目
- ****出口參數(shù):無
- ****說明:
- ********************************************************************************/
- void Delay(uint16_t nCount)
- {
- while (nCount != 0)
- {
- nCount--;
- }
- }
- /* Private functions ---------------------------------------------------------*/
- void main(void)
- {
- /* Infinite loop */
- LED_Init(LED1|LED2|LED3);
- LED_Off(7);
-
- UART_Init();
- Send_Str("STM8S 時(shí)鐘實(shí)驗(yàn)\r\n");//發(fā)送字符串
-
- Timer4_Init(0x35);
-
- __enable_interrupt();
-
- while (1)
- {
- //Time_Count();
- sprintf(SendBuf, "現(xiàn)在時(shí)間:%02d:%02d:%02d\r\n", Hour, Minute, Second);
- ……………………
- …………限于本文篇幅 余下代碼請(qǐng)從51黑下載附件…………
復(fù)制代碼
所有資料51hei提供下載:
Project_數(shù)字時(shí)鐘(庫).7z
(800.75 KB, 下載次數(shù): 34)
2022-12-13 04:16 上傳
點(diǎn)擊文件名下載附件
程控?cái)?shù)字時(shí)鐘 下載積分: 黑幣 -5
|
評(píng)分
-
查看全部評(píng)分
|