单片机原理及应用实验

单片机原理及应用实验

ID:16859239

大小:104.54 KB

页数:20页

时间:2018-08-25

单片机原理及应用实验_第1页
单片机原理及应用实验_第2页
单片机原理及应用实验_第3页
单片机原理及应用实验_第4页
单片机原理及应用实验_第5页
资源描述:

《单片机原理及应用实验》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库

1、北京航空航天大学单片机实验51otherstaffoftheCentre.Duringthewar,ZhuwastransferredbacktoJiangxi,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Startingin1939servedasrecorderoftheWestNorthOrganization,SecretaryoftheSpecialCommitteeAfterthevictoryofthelongMarch,hehasbeen

2、theNorthwestOfficeoftheFederationofStateenterprisesMinister,ShenmufuguSARmissions,DirectorofNingxiaCountypartyCommitteeSecretaryandrecorderoftheCountypartyCommitteeSecretary,Ministersand19/20实验一单片机开发环境以及I/O使用实验1、#include//89S52寄存器定义头文件/*---延时子程序(有参函数),t=n*10ms

3、---*/voiddelay(unsignedcharn){unsignedchari,j,k;for(i=0;i//89S52寄存器定义头文件voidmain(){wh

4、ile(1){P0=0xff;//对端口写"1",作为高阻抗输入端用if(P0_0)//判断P0.0是否为高电平{P1_0=0;}else//如果P0.0不是高电平,则执行后面的语句{P1_0=1;}}}3、#include//89S52寄存器定义头文件/*---延时子程序(有参函数),t=n*10ms---*/#defineK1P0_0#defineK2P0_1#defineL1P1_0#defineL2P1_1#defineL3P1_2#defineL4P1_3#defineL5P1_4#defineL6P1_

5、5#defineL7P1_6#defineL8P1_7otherstaffoftheCentre.Duringthewar,ZhuwastransferredbacktoJiangxi,andDirectorofthenewOfficeinJingdezhen,JiangxiCommitteeSecretary.Startingin1939servedasrecorderoftheWestNorthOrganization,SecretaryoftheSpecialCommitteeAfterthevictoryofthelongMar

6、ch,hehasbeentheNorthwestOfficeoftheFederationofStateenterprisesMinister,ShenmufuguSARmissions,DirectorofNingxiaCountypartyCommitteeSecretaryandrecorderoftheCountypartyCommitteeSecretary,Ministersand19/20voiddelay(unsignedcharn){unsignedchari,j,k;for(i=0;i

7、<14;j++)for(k=0;k<237;k++);}/*******正循环******/voidway1(){while(K1==0&&K2==0){staticunsignedcharposition=0;P1=1<=8)position=0;delay(100);}}/*******逆循环******/voidway2(){while(K1==0&&K2==1){staticunsignedcharposition=0;P1=128>>position;if(++position>

8、=8)position=0;delay(100);}}/*******交替闪烁******/voidway3(){while(K1==1&&K2==0){P1=0X55;delay(100);P1=0xAA

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

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

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