#include<reg51.h> #include <intrins.h> char LED; void delay(unsigned int i) { unsigned char j; for(i; i > 0; i--) for(j = 255; j > 0; j--); } main() { unsigned char LED; unsigned int i; LED = 0xfe; P1 = LED; while(1) { delay(250); if (LED==0Xfe) { for (i=1;i<=7;i++) { LED = _crol_(LED,1); delay(250); P1 = LED; } } if (LED==0X7F) { for (i=1;i<=7;i++) { LED=_cror_(LED,1); delay(250); P1 = LED; } } } }