#include<reg52.h>
void delay(unsigned int t)
{while(–t);}
unsigned char i;
void main()
{
while(1)
{
P0=0xef;
P2=0x79;
}
} 这是第一个程序。
#include<reg52.h>
void delay(unsigned int t)
{while(–t);}
unsigned char i;
unsigned code a[]={0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x10};
void main()
{
while(1)
{
for(i=0;i<10;i++)
{
P0=0x7f;
P2=a[1];
delay(500);
P0=0xbf;
P2=a[2];
delay(500);
P0=0xdf;
P2=a[3];
delay(500);
P0=0xef;
P2=a[4];
delay(500);
P0=0xf7;
P2=a[5];
delay(500);
P0=0xfb;
P2=a[6];
delay(500);
P0=0xfd;
P2=a[7];
delay(500);
P0=0xfe;
P2=a[8];
delay(500);
}
}
} 这是第二个程序,我也是初学者,写的不好,请多指教!