#include<intrins.h>
#define uint unsigned int
#define uchar unsigned char
void delayms(uint);
uchar aa;
void main()
{
aa=0xfe;
//你原来的
while(1)
{
P1=aa;
delayms(500);
aa=_crol_(aa,1);
}
//下面我写的
//右移1位
while(1)
{
P1=aa;
delayms(500);
aa=aa<<1; //右移1位
}
//左移1位
while(1)
{
P1=aa;
delayms(500);
aa=aa>>1; //左移1位
}
//右移8位
while(1)
{
unsigned char i;
for(i=0;i<8;i++)
{
P1=aa;
delayms(500);
aa=aa>>1;
}
}
}
void delayms(uint xms)
{
uint i,j;
for(i=xms;i>0;i--)
for(j=110;j>0;j--);
} |