#include <REG51.H> //以51为例
#include <intrins.H> //引入_crol_
void delay(unsigned char x) //延时函数
{
unsigned int i,j;
for(i=0;i<x;i++)
for(j=0;j<113;j++);
}
void main(){
P2 = 0x80; //赋值 11111110
while (1){
delay(100);
P2 = _cror_(P2,1); //改为左移只要把cror改为crol就可以
}
}