#include<reg52.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit key=P3^0;
delay_ms(uint ms)
{ uint i,j; for(i=ms;i>0;i--);
for(j=114;j>0;j--);
return 0; }
void main() {
uint a,count=0; a=0xfe;
while(1)
{ P1=a; { if(key==1) {a=_crol_(a,1);
delay_ms(500); count++;}
else
{ for(;count>0;count--)
{ a=_cror_(a,1); P1=a; delay_ms(500); }
break; } } } } |