单片机C51 8位流水灯-LMLPHP

#include<reg51.h>
sbit P1_0=0X90;
sbit P1_1=0x91;
sbit P1_2=0x92;
sbit P1_3=0x93;
sbit P1_4=0x94;
sbit P1_5=0x95;
sbit P1_6=0x96;
sbit P1_7=0x97; void stop(void);
void delay(unsigned int xms); int main(void)
{
int i=2;
P1=~0;
for(i;i>0;i--)
{
P1_0=0;
delay(500);
P1_0=1;
delay(100);
P1_1=0;
delay(500);
P1_1=1;
delay(100);
P1_2=0;
delay(500);
P1_2=1;
delay(100);
P1_3=0;
delay(500);
P1_3=1;
delay(100);
P1_4=0;
delay(500);
P1_4=1;
delay(100);
P1_5=0;
delay(500);
P1_5=1;
delay(100);
P1_6=0;
delay(500);
P1_6=1;
delay(100);
P1_7=0;
delay(500);
P1_7=1;
delay(100);
}
stop();
return 0;
}
void stop(void)
{
while(1)
{;}
}
void delay(unsigned int xms)
{
unsigned int x,y;
for(x=xms;x>0;x--)
for(y=110;y>0;y--);
}
05-22 18:56