|
#include <STC15F2K60S2.H>
//包含頭文件,一般情況不需要改動,頭文件包含特殊功能寄存器的定義
#include<stdio.h>
#include "Init_Time0.h"
#include "SMG_Display.h"
#include "KeyScan.h"
#define BEEP_ON 0
#define BEEP_OFF 1
sbit Beep = P3^5;//蜂鳴器輸出
#define LED_ON 1
#define LED_OFF 0
#define RELAY_OPEN 0
#define RELAY_CLOSE 1
bit BeepState = 0;
unsigned char Second;
unsigned char Minute;
unsigned char Hour;
/*------------------------------------------------
主函數
------------------------------------------------*/
void main (void)
{
unsigned char i;
Init_Timer0();
Hour = 12; //初始化時鐘為 12-00-00
Minute = 00;
Second = 0;
Beep = BEEP_OFF;
i = 1;
while (1) //主循環
{
KeyScan(); //鍵盤掃描
if(Minute ==30) //半點蜂鳴器短響一聲
{
if(BeepState==0)
BeepShort();
}
else if(Minute==0)//整點蜂鳴器長響一聲
{
if(BeepState==1)
BeepLong();
}
}
}
|
評分
-
查看全部評分
|