51study实例-C51闹铃程序
MCUBLOG 发表
#i nclude
#i nclude
#define comdir P3_2
#define wirespeaker P1_3
#define wiret0 T0
#define wiret1 T1
#define adr_delay1s 0x1086
#define adr_print10ms 0x1000
#define adr_print80ms 0x101A
#define adr_screen_black 0x10BA
#define adr_screen_clear 0x10CD
#define adr_key_search 0X10EB
#define adr_sound500hz 0x109E
#define max_timer 24*3
void (* pFunc)(void); //定义指向函数的指针
void (* Print80ms)(void);
int CodeChange(int i);
/*define a struct*/
struct time_str{
unsigned char hour;
unsigned char min;
unsigned char sec;
}today;
int depart=20;
int t0int_flag=0;
unsigned char data dispbuf[8] _at_ 0x30;
unsigned char code Sound_Date[max_timer]={
0x00,0x00,0x0a, 0x00,0x00,0x1e, 0x00,0x01,0x00, 0x00,0x02,0x00,
0x0b,0x00,0x00, 0x0b,0x00,0x00, 0x0b,0x00,0x00, 0x0b,0x00,0x00,
0x0b,0x00,0x00, 0x0b,0x00,0x00, 0x0b,0x00,0x00, 0x0b,0x00,0x00,
0x0b,0x00,0x00, 0x0b,0x00,0x00, 0x0b,0x00,0x00, 0x0b,0x00,0x00,
0x0b,0x00,0x00, 0x0b,0x00,0x00, 0x0b,0x00,0x00, 0x0b,0x00,0x00,
0x0b,0x00,0x00, 0x0b,0x00,0x00, 0x0b,0x00,0x00, 0x0b,0x00,0x00,
};
/*TIMER0 INTERRUPT*/
void timer0(void) interrupt 1{
wiret1=!wiret1;
TH0=0X3C;
TL0=0XB0;
depart-=1;