新聞中心

EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計(jì)應(yīng)用 > 單片機(jī)電子時(shí)鐘程序

單片機(jī)電子時(shí)鐘程序

作者: 時(shí)間:2016-11-29 來源:網(wǎng)絡(luò) 收藏



本文引用地址:http://m.butianyuan.cn/article/201611/323559.htm
/********************************************************************************
品名:電子時(shí)鐘
功能:秒表,鬧鐘,日歷,計(jì)數(shù)器,頻率計(jì) 時(shí)鐘
作者:阿飛
版本:v1.4
修改:二月調(diào)整bug code unsigned char leab_day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
改成 code unsigned char leab_day[12]={31,29,31,30,31,30,31,31,30,31,30,31};
時(shí)間:2012,8,11
版權(quán)所有:http://www.51hei.com
********************************************************************************/
#include
sbit sh=P1^7;
sbit ds=P1^5;
sbit st=P1^6;
sbit led0 = P1^2;
sbit led1 = P1^3;
sbit led2 = P1^4;
sbit led3 = P1^1;
sbit button1 = P3^2;
sbit button2 = P3^3;
sbit button3 = P3^4;
sbit buzzer = P1^0;
sbit RCLK = P3^7;
typedef struct
{
unsigned char count;
unsigned char sec;
unsigned char min;
unsigned char hou;
unsigned char day;
unsigned char mon;
unsigned char year[2];
unsigned char AlarmMin;
unsigned char AlarmHou;
unsigned char stopwatch[3];
unsigned char cymometer[2];
unsigned char cymometer_count;
unsigned char flashcount;
unsigned char mode;
unsigned char delaycount;
unsigned char ditheringcount;
unsigned char February_day;
}TIME;
typedef union
{
struct
{
unsigned char bit0:1;
unsigned char bit1:1;
unsigned char bit2:1;
unsigned char bit3:1;
unsigned char bit4:1;
unsigned char bit5:1;
unsigned char bit6:1;
unsigned char bit7:1;
}BIT;
unsigned char byte;
}BETY_BIT;

extern BETY_BIT BIT_FLAG,BIT_FLAG1;
extern TIME time;
extern void isr_button1_proces(void);
extern void isr_button2_proces(void);
extern void isr_button3_proces(void);

#define menu_button1_down_1 BIT_FLAG.BIT.bit0
#define menu_button1_down BIT_FLAG.BIT.bit1
#define flash_flag BIT_FLAG.BIT.bit2
#define flash_control BIT_FLAG.BIT.bit3
#define menu_button2_down BIT_FLAG.BIT.bit4
#define button2_length_whack_flagBIT_FLAG.BIT.bit5
#define Alarm_on_offBIT_FLAG.BIT.bit6
#define start_stopwatch BIT_FLAG.BIT.bit7
#define menu_button3_down BIT_FLAG1.BIT.bit0
#define button3_length_whack_flagBIT_FLAG1.BIT.bit1
#define stopwatch_clear_flag BIT_FLAG1.BIT.bit2
//#define Alarm_on_off_display BIT_FLAG1.BIT.bit3
#define cymometer_start_flagBIT_FLAG1.BIT.bit4
#define cymometer1_start_flagBIT_FLAG1.BIT.bit5
#define leap_year_flag BIT_FLAG1.BIT.bit6
#define dithering_flag BIT_FLAG1.BIT.bit7
/*******************************************************
上一頁 1 2 3 下一頁

關(guān)鍵詞: 單片機(jī)電子時(shí)

評(píng)論


技術(shù)專區(qū)

關(guān)閉