C51语言编程闹钟代码,C51闹铃程序

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;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值