|
![](static/image/common/ico_lz.png)
楼主 |
发表于 2012-4-16 22:43:15
|
显示全部楼层
simonlee0311 发表于 2012-4-16 21:52 ![](static/image/common/back.gif)
用陣列啊。換個方式吧?用左右移的方式吧。
用陣列太浪費空間了。
为什么右移不行啊。。左移为什么可以a
#include<reg52.h>
char a;
unsigned int b,c,flag;
sbit F1 = P2^6;
void main()
{
a = 0xff;
while(1)
{
// b = 50000;
//c = 50000;
a = a<<1;
P1 = a;
//while(b--);
if(a == 0x00)
{
a = 0xfe;
flag = 1;
while(c--);
}
while( flag == 1)
{
a = 0xaa;
b = 1;
c = 1;
a = a>>1;
P1 = a;
while(b--);
if(a == 0x00)
{
P1 = 0xfe;
flag = 0;
while(c--);
}
}
}
} |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|