您好,欢迎来电子发烧友网! ,新用户?[免费注册]

您的位置:电子发烧友网>源码下载>单片机编程>

C51闹铃程序

大小:4.61 KB 人气: 2011-06-03 需要积分:0

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;

 

非常好我支持^.^

(2) 100%

不好我反对

(0) 0%

      发表评论

      用户评论
      评价:好评中评差评

      发表评论,获取积分! 请遵守相关规定!