单片机技能大赛编程大全.doc

单片机技能大赛编程大全.doc

ID:57210233

大小:27.50 KB

页数:6页

时间:2020-08-06

单片机技能大赛编程大全.doc_第1页
单片机技能大赛编程大全.doc_第2页
单片机技能大赛编程大全.doc_第3页
单片机技能大赛编程大全.doc_第4页
单片机技能大赛编程大全.doc_第5页
资源描述:

《单片机技能大赛编程大全.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、一.开关检测器程序编写:ORG00HSTART:MOVA,P1ANLA,#0F0HRRARRARRARRAORlA,#0F0HMOVP1,ASJMPSTARTORG00HSTART:MOVA,P1ANLA,#0F0HRRARRARRARRAORlA,#0F0HMOVP1,ASJMPSTART二:节日彩灯控制器编程:#include#defineucharunsignedchar#defineuintunsignedintsbitkey=P1^2;ucharcodetable_P0[]={0xfc,0xf9,0xf3,0xe7,0xcf,0x9f,0x3f,0

2、x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xdb,0xbd,0x7e,0xbd,0xdb,0xe7,0xff,0xe7,0xc3,0x81,0x00,0x81,0xc3,0xe7,0xff,0xaa,0x55,0x18,0xff,0xf0,0x0f,0x00,0xff,0xf8,0xf1,0xe3,0xc7,0x8f,0x1f,0x3f,0x7f,0x7f,0x3f,0x1f,0x8f,0xc7,0xe3,0xf1,0xf8,0xff,0x00,0x00,0xff,0xff,0x0f,0xf0,0xff,0xfe,0x

3、fd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe,0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0xc0,0xe

4、0,0xf0,0xf8,0xfc,0xfe,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff};ucharcodetable_P2[]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xfc,0xf9,0xf3,0xe7,0xcf,0x9f,0x3f,0xff,0xe7,0xdb,0xbd,0x7e,0xbd,0xdb,0xe7,0xff,0xe7,0xc3,0x81,0x00,0x81,0xc3,0xe7,0xff,0xaa,0x55,0x18,0xff,0xf0,0x0f,0x00,0xff,0xf8,0x

5、f1,0xe3,0xc7,0x8f,0x1f,0x3f,0x7f,0x7f,0x3f,0x1f,0x8f,0xc7,0xe3,0xf1,0xf8,0xff,0x00,0x00,0xff,0xff,0x0f,0xf0,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0x7f,0xbf,0xdf,0xef,0xf7,0xfb,0xfd,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf

6、f,0xff,0xff,0xff,0xff,0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0x00,0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff};//延时voiddelay(uintxms){uinti,j;for(i=xms;i>0;i--)for(j=110;j>0;j--);}//主程序voidmain(){uchari;if(key==0){delay

7、(10);if(key==0){while(!key);while(1){//从数组中读取数据送至P0和P2口显示for(i=0;i<136;i++){P0=table_P0[i];P2=table_P2[i];delay(100);}}}}}三.简单的左右循环流水灯的制作#include#includeunsignedchartemp;//定义字符变量temp,temp左移或右移并给连接LED的P1口赋值inta;//定义延迟函数delay()voiddelay

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。