#include<reg52.h>
sbit Led0 = P1^0;
sbit Led1 = P1^1;
sbit Led2 = P1^2;
sbit Led3 = P1^3;
sbit Led4 = P1^4;
sbit Led5 = P1^5;
sbit Led6 = P1^6;
sbit Led7 = P1^7;
unsigned char code table[] = {0xE7,0XDB,0XBD,0X7E};//查询数组
void delay(unsigned int xms) //延时函数,延时X毫秒
{
unsigned char j,m;
for(j=xms; j>0; j--)
{
for(m=110; m>0; m--);
}
}
void main()
{
unsigned char j,i;
while(1)
{
for(j=0; j<4; j++)
{
P0 = table[i];
delay(1000);//延时1秒
}
}
} |