《单片机C语言程序设计实训100例—基于8051Proteus仿真》案例.docx

《单片机C语言程序设计实训100例—基于8051Proteus仿真》案例.docx

  1. 1、本文档共60页,可阅读全部内容。
  2. 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
《单片机C语言程序设计实训100例—基于8051Proteus仿真》案例

《单片机C语言程序设计实训 100 例—基于 8051+Proteus仿真》案例??第 01? 篇基础程序设计??01?? 闪烁的 LED??#includereg51.h#define uchar unsigned char#define uint unsigned int sbit LED=P1^0;//延时void DelayMS(uint x){uchar i;while(x--){for(i=0;i120;i++);}}//主程序void main(){while(1){LED=~LED; DelayMS(150);}???} ???02?? 从左到右的流水灯???#includereg51.h#includeintrins.h#define uchar unsigned char#define uint unsigned int//延时void DelayMS(uint x){uchar i;while(x--){for(i=0;i120;i++);}}//主程序void main(){P0=0xfe;while(1){P0=_crol_(P0,1); //P0 的值向左循环移动DelayMS(150);}}??03?? 8 只 LED 左右来回点亮???#includereg51.h#includeintrins.h#define uchar unsigned char#define uint unsigned int//延时void DelayMS(uint x){uchar i;while(x--){???for(i=0;i120;i++); ?}}//主程序void main(){uchar i; P2=0x01; while(1){?for(i=0;i7;i++){P2=_crol_(P2,1); //P2 的值向左循环移动DelayMS(150);}for(i=0;i7;i++){P2=_cror_(P2,1); //P2 的值向右循环移动DelayMS(150);}}}?????04?? 花样流水灯????#includereg51.h#define uchar unsigned char#define uint unsigned int uchar code Pattern_P0[]={??0xfc,0xf9,0xf3,0xe7,0xcf,0x9f,0x3f,0x7f,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,0xfd,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,0xe0,0xf0,0xf8,0xfc,0xfe,0x00,0xff,0x00,0xff,0x00,0xff,0x00,0xff};uchar code Pattern_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,0xf1,0xe3,0xc7,0x8f,0x1f,0x3f,0x7f,0x7f,0x3f,0x1f,0x8f,0xc7,0xe3,0xf1,0xf8,0xff,0x00,0x00,0xff,0xff,0x0f,0xf0,0xf

文档评论(0)

haihang2017 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档