#include "REG51.H"
unsigned char led[34]={ 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0x7f,0x3f,0x1f,0x0f,0x07,0x03,0x01,0x00,
0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
unsigned char i,j;
void init(void)
{
IE=0X82;
TCON=0X10;
TMOD=0X01;
TH0=0x3c;
TL0=0xb0;
}
void timer0(void) interrupt 1
{
int k;
k++;
TH0=0x3c;
TL0=0xb0;
if(k==1)
{
k = 0;
j++;
if(j==24)
{
j = 0;
}
}
}
void main(void)
{
init();
while(1)
{
for(i = 0;i < 8;i++)
{
P0 = led[i+j];
}
}
}