單片機(jī)電子時(shí)鐘程序
/********************************************************************************
品名:電子時(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};
品名:電子時(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;
********************************************************************************/
#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)鍵詞:
單片機(jī)電子時(shí)
相關(guān)推薦
技術(shù)專區(qū)
- FPGA
- DSP
- MCU
- 示波器
- 步進(jìn)電機(jī)
- Zigbee
- LabVIEW
- Arduino
- RFID
- NFC
- STM32
- Protel
- GPS
- MSP430
- Multisim
- 濾波器
- CAN總線
- 開關(guān)電源
- 單片機(jī)
- PCB
- USB
- ARM
- CPLD
- 連接器
- MEMS
- CMOS
- MIPS
- EMC
- EDA
- ROM
- 陀螺儀
- VHDL
- 比較器
- Verilog
- 穩(wěn)壓電源
- RAM
- AVR
- 傳感器
- 可控硅
- IGBT
- 嵌入式開發(fā)
- 逆變器
- Quartus
- RS-232
- Cyclone
- 電位器
- 電機(jī)控制
- 藍(lán)牙
- PLC
- PWM
- 汽車電子
- 轉(zhuǎn)換器
- 電源管理
- 信號(hào)放大器
評(píng)論