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;
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
全部1条评论
快来发表一下你的评论吧 !