一、程序
#include <REGX51.H>
#define uchar unsigned char
#define uint unsigned int
void delay(uint ms);
void main(void)
{
int k=0;
while(1)
{
for(k=0;k<15;k++)
{
P1=0xfe;
delay(500);
P1=0xfc;
delay(500);
P1=0xf8;
delay(500);
}
for(k=0;k<10;k++)
{
P1=0xf0;
delay(500);
P1=0xe0;
delay(500);
P1=0xc0;
delay(500);
}
for(k=0;k<13;k++)
{
P1=0x80;
delay(500);
P1=0x00;
delay(500);
}
}
}
void delay(uint ms)
{
uchar i;
uint j;
for(j=0;j<ms;j++)
for(i=0;i<125;i++)
;
}