單片機電子時鐘程序
/********************************************************************************
品名:電子時鐘
功能:秒表,鬧鐘,日歷,計數(shù)器,頻率計 時鐘
作者:阿飛
版本:v1.4
修改:二月調(diào)整bug code unsigned char leab_day[12]={31,28,31,30,31,30,31,31,30,31,30,31};
品名:電子時鐘
功能:秒表,鬧鐘,日歷,計數(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};
時間: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;
********************************************************************************/
#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);
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
關(guān)鍵詞:
單片機電子時
評論