标题:
求帮忙解释一下这个单片机程序
[打印本页]
作者:
yb1314Y
时间:
2019-6-23 20:39
标题:
求帮忙解释一下这个单片机程序
#include <reg52.h>
#define uchar unsigned char
#define uint unsigned int
uchar code Pattern_P0[]=
{
0xfc,0xf9,0xf3,0xe7,0xcf,0x9f
};
uchar code Pattern_P2[]=
{
0xf5,0xf6,0xfe,0x54,0x56,0x76,0xd7,0x49,0xa9,0xe4,0xc6
};
void DelayMS(uint x)
{
uchar t;
while(x--)
{
for(t=120;t>0;t--);
}
}
void main()
{
uchar i;
while(1)
{
for(i=136;i>0;i--)
{
P0=Pattern_P0[i];
P2=Pattern_P2[i];
DelayMS(150);
}
}
}
复制代码
作者:
xianfajushi
时间:
2019-6-24 05:07
这个程序没什么特别的,就是循环送数组的数据到端口,不过单循环的值已经超过数组的量了。
作者:
charles11
时间:
2019-6-24 07:34
其实那个for语句看的不是很懂,数组里面个数显然没有136个,为什么要循环这么多次?
作者:
yb1314Y
时间:
2019-6-24 11:46
那个大神帮我全部都说一下
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1