ImageVerifierCode 换一换
格式:DOCX , 页数:24 ,大小:17.91KB ,
资源ID:6060686      下载积分:1 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bingdoc.com/d-6060686.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(爆闪灯C51程序Word文档下载推荐.docx)为本站会员(b****2)主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(发送邮件至service@bingdoc.com或直接QQ联系客服),我们立即给予删除!

爆闪灯C51程序Word文档下载推荐.docx

1、sfr IAP_ADDRH=0XC3;sfr IAP_ADDRL=0XC4;sfr IAP_CMD=0xc5;sfr IAP_TRIG=0XC6;sfr IAP_CONTR=0XC7;unsigned char liang_temp=1;unsigned char an_temp=1;unsigned char R_to_B_temp=1;unsigned char stop_temp=1;unsigned char mode=1;unsigned char time_key=0;unsigned char time_temp=0;unsigned char mode1_temp=0;ucha

2、r ajs,ljs;uchar rtobjs,stopjs,js3c=1;uchar rba=0;bit la=1;ksj=0;unsigned char code zhifu016=0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F,0x77,0x7C,0x39,0x5E,0x79,0x71;unsigned char code zhifu216=0xFC,0x60,0xDA,0xF2,0x66,0xB6,0xBE,0xE0,0XFe,0Xf6,0Xee,0X3e,0X9c,0X7a,0X9e,0X8e;/*void delay20(void)

3、 /误差 -0.000000000002us unsigned char a,b,c; for(c=2;c0;c-) for(b=95;bb-) for(a=209;aa-);void delay500(void) /误差 0us 500ms for(c=23; for(b=152; for(a=70;void eeprom_erase(unsigned char a) unsigned int add=512; unsigned int add1=0; add1=add*a; IAP_ADDRH=add1/255; IAP_ADDRL=add1%255; IAP_CONTR=0X8C; IA

4、P_CMD=0X03; IAP_TRIG=0X5A; IAP_TRIG=0XA5; _nop_();void eeprom_writer(unsigned int add,unsigned char date) IAP_DATA=date; IAP_ADDRH=add/255; IAP_ADDRL=add%255; IAP_CMD=2;/*unsigned char eeprom_read(unsigned int add) unsigned char date=0;/ IAP_CMD=0X01; date=IAP_DATA; return(date);void show(unsigned c

5、har a) unsigned char shi; unsigned char ge; unsigned char *p; unsigned char *p1; p=zhifu0; p1=zhifu2; shi=a/10; shi=*(p+shi);/得到编码值 ge=a%10; ge=*(p1+ge); P0=shi; P2=ge;/*void liang_key() if(!P1_0) delay20(); liang_temp+; if(liang_temp99) liang_temp=1; show(liang_temp); while(! while(ksj)liang_temp+;

6、delay20();if(liang_temp99)liang_temp=1;show(liang_temp); void an_key() if(P1_0=0) if(P1_0=0) an_temp+; if(an_temp an_temp=1; show(an_temp); while(ksj)an_temp+;if(an_temp99)an_temp=1;show(an_temp); /*void R_to_B_key() R_to_B_temp+; if(R_to_B_temp R_to_B_temp=1; show(R_to_B_temp); while(ksj)R_to_B_tem

7、p+;if(R_to_B_temp99)R_to_B_temp=1;show(R_to_B_temp); void stop_key() stop_temp+; if(stop_temp stop_temp=1; show(stop_temp); while(! while(ksj)stop_temp+;if(stop_temp99)stop_temp=1;show(stop_temp); /*void show_mode(unsigned char a) unsigned char ge=0; ge=*(p1+a);/ P0=0x00; P2=ge;void set_mode() TR1=1

8、;/开定时器 show_mode(mode); while(time_key=0) if(! delay20(); mode+; if(mode5) mode=1; time_temp=0; show_mode(mode); TR1=0;/关定时器 time_key=0; time_temp=0; TH1 = 0x3C; TL1 = 0xB0; eeprom_erase(1); eeprom_writer(0,mode); P0=0; P2=0; rtobjs= R_to_B_temp; stopjs=stop_temp; ajs=an_temp; ljs=liang_temp; rba=0;

9、void set_fun()/设置时间的顺序是从亮,暗,红到蓝,停,4个步骤 第一个模式 unsigned char panduan=0;P1_1) P0=zhifu015; P2=zhifu21; delay500(); panduan=1; while(panduan) liang_key(); show(liang_temp); delay20(); panduan=0; ljs=liang_temp; delay20(); P0=zhifu015; P2=zhifu22; while(panduan) an_key(); show(an_temp); if(! panduan=0; a

10、js=an_temp; P2=zhifu23; R_to_B_key(); rtobjs=R_to_B_temp; panduan=1; P2=zhifu24; while(panduan) stop_key(); show(stop_temp); if(! panduan=0; stopjs=stop_temp; eeprom_erase(0); eeprom_writer(0,liang_temp); eeprom_writer(1,an_temp); eeprom_writer(2,R_to_B_temp); eeprom_writer(3,stop_temp); P0=0X0; P2=

11、0X0;/ red=1;/ blue=0;/ yq=yq2=0; rtobjs = R_to_B_temp; stopjs = stop_temp; ajs = an_temp; ljs = liang_temp; void mode_out(bit a1,bit a2,bit a3,bit a4)/a为停留时间,各位为输出值 P1_4=a1; P1_5=a2; P1_6=a3; P1_7=a4;void redfun(void) if(js3c4) if(la) mode_out(1,0,1,0); else mode_out(0,0,0,0); else mode_out(0,0,0,0)

12、;void bluefun(void) if(la) mode_out(0,1,0,1); else mode_out(0,0,0,0);void allfun(void) if(js3c30) time_key=1;void Timer0Interrupt(void) interrupt 1/ TR0=0; static uchar i=0; static uchar kj=0; /10 ms if(la) /如果在亮计时 ljs-; /亮计数自减 if(ljs=0) /亮的时间到 la=0; /置0亮暗计数 /还原暗计数值 else /如果在暗计时 ajs-; /晚计数自减 if(ajs=

13、0) /保持暗的时间到 la=1; /点亮 /还原亮计数初值 js3c+; /else P1&=0x0f; if(rba=0 & js3c=3) i+; if(i i=0;rtobjs-; /红到蓝时间自减 if(rtobjs=0) /时间到进入到蓝亮 js3c=1;rba=1;rtobjs=R_to_B_temp; if(rba=1 & /红到蓝时间自减rba=2; if(rba=2 & i+; stopjs-; if(stopjs=0) /时间到进入到蓝亮rba=0; rtobjs=R_to_B_temp; P1_0) /ksj为长按标记。如果长按,ksj置1,否则置0 kj+;if(kj70)kj=0;ksj=1; else kj=0; ks

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2