标题:
如何用keil和proteus点亮流水灯 求帮助
[打印本页]
作者:
哈哈HH
时间:
2018-1-22 14:48
标题:
如何用keil和proteus点亮流水灯 求帮助
代码:
#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
uchar temp[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f,0xff};
void delay(uint z)
{
uint x,y;
for(x=100;x>0;x--)
for(y=z;y>0;y--);
}
void main()
{
uchar i;
while(1)
{
for(i=0;i<9;i++)
{
P0=temp[i];
delay(400);
}
for(i=0;i<9;i++)
{
P1=temp[i];
delay(400);
}
}
}
复制代码
proteus中电路图
[img][/img]
点亮流水灯有4种方法
1、最基础的方法,分条列举出来
2、先左移,后或
3、调用左移函数_crol_()
4、使用数组{0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1