单片机C语言程序设计实训100例——基于8051+Proteus仿真-程序.docx
《单片机C语言程序设计实训100例一基于8051+Proieus仿克》案例
第01篇基础程序设讣
01闪烁的LED
#include<reg5 Lh>
#define uchar unsigned char
^define uint unsigned int sbit LED=P1^: 〃延时
void DelayMS(uint x) uchar i; while(x-) for(i=0;i<120;i++);
〃主程序 void mainO while(l)
LEDsLED; DelayMS(150):
02从左到右的流水灯
#include<reg51 .h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
〃延时
void DelayMS(uinl x) uchar i; while(x-) for(i=0:i<l20:i++);
〃主程序 void mainO
PO=Oxfc: while(l)
PO=_croUPOJ);//PO的值向左循环移动 DelayMSdSO);
03 8只LED左右来回点亮
#include<reg51 ?h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int 〃延时
void DelayMS(uint x) uchar i: while(x-) for(i=0;i<120;i++);
〃主程序
void mainO uchar i; P2=OxO 1: while( 1) for(i=0:i<7:i++)
P2=_croUP2J);//P2的值向左循环移动 DelayMS(150);
for(i=0;i<7:i++)
P2=_crorjP2a);//P2的值向右循环移动 DelayMS(150);
04花样流水灯
#include<rcg51?h>
#define uchar unsigned char
#define uint unsigned int uchar code Pattern_PO[]=
Oxfc?Oxf9?Oxf3?Oxe7?Oxcf?Ox9f?Ox3f?Ox7fQxff?Oxff?Oxff?Oxff?OxffOxfT?OxCf?Oxff? 0xc7?0xdb?0xbd?0x7e?0xbd?0xdb?0xc7?0xff?0xe7excM0x81.0x00.0x81,0xc3.0xe7,0xff. Oxaa?Ox55?Ox 1 &Oxff?OxfO?OxOf?Ox(XXOxff?Oxf8?Oxfl ?Oxc30xc7.Ox8fOxlf.Ox3f.Ox7f. 0x7f?0x3f?0x 1 t0x8f.0xc7,0xe3.0xfl .OxfS.OxffQxOO.OxOCXOxftOxfLOxOf.OxfO.Oxff, 0xfe,0xfd,0xfb.0xf7.0xef0xdt0xbt0x7f,0xff.0xft0xff.0xff,0xff0xff,0xft0xff.
0xff,0x0xft0xff.0xff.0xff,0xff,0xff,0x7f0xbt0xdt0xef0xf7.0xfb.0xfd,0xfe, 0xfe,0xfc,0xf8.0xf0.0xe0,0xc0.0x80,0x00.0x00,0x00.0x00.0x(X).0x00.0x00,0x00,0x00, 0x00.0x00.0x00.0x00.0x00,0x00.0x00,0x00.0x00,Ox8O.OxcO.OxeO.OxfO,Oxf8,Oxfc,Oxfe. OxOO.Oxff.OxOO.Oxff.OxOO.OxftOxOO.Oxff
uchar code Pattem_P2[]= 0xff.0xff.0xft0xff.0xff.0xff,0xff,0xfe,0xfc,0xf9,0xf3,0xe7.0xcf.0x9tf)x3f,0xff.
Oxc7?Oxdb,Oxbd?Ox7e,Oxbd0xdb』xc7?Oxff?Oxc7』xcMOx81.0x00.0x81,0xc3.0xe7.0xff, Oxaa,Ox55,Oxl&Oxff?OxfO?OxOf?OxOOQxff?Oxf8?Oxfl ,Oxe3.Oxc7,Ox8fOxltOx3tOx7f. 0x7t0x3t0x 1 L0x8f?0xc7、0xc3?0xf 1 .OxfS.Oxff.OxOO.OxOCXOxfT.Oxff.OxOf.OxfO.Oxft 0xfL0xft0xff?0xff?0xff?0xff?0xff?0xff,0xfc,0xfd?0xfb?0xf7?
2024最新激活全家桶教程,稳定运行到2099年,请移步至置顶文章:https://sigusoft.com/99576.html
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。 文章由激活谷谷主-小谷整理,转载请注明出处:https://sigusoft.com/94966.html