#include #include #define uchar unsigned char #define uint unsigned int sbit led1=P0^0; sbit beep=P1^0; void delay(uint); //----------主函数------------- void main() { while(1) { uchar temp; temp=0xfe; //P0=temp; //delay(500); while(1) { P2=temp; temp=_crol_(temp,1); delay(500); } } } //---------延时--------------- void delay(uint c) //1ms { unsigned int a,b; for(b=c;b>0;b--) for(a=125;a>0;a--); }