#include <reg51.h>
#include <math.h>
typedef unsigned char byte;
byte a[16]={1,22,31,4,5,6,7,8,23,3,10,30,73,40,55,93};
byte b[16]={3,14,7,13,17,19,97,1,12,128,127,124,123,122,33,21};
byte c[16]={9,15,4,13,41,49,57,18,74,3,39,59,112,100,91};
byte d[16]={33,58,68,66,21,19,97,1,14,222,56,12,3,9,15,11};
sbit switcher=P0^0;
byte i=0;
byte counter;
byte xdata display _at_ 0x8001;
void Inic(void) {
EA=1;
ET0=1;
TMOD=0x01;
TH0=0xC3;
TL0=0x50;
TR0=1;
counter=0;
i=0;
}
void timer0 (void) interrupt 1 using 2 {
TH0=0xC3;
TL0=0x50;
if((++counter==0)) { counter=20;
if(switcher) {
if(!(a[i]%3) )
display = a[i];
i++;
if(i==16) i=0;
if(!(b[i]%3) )
display = b[i];
i++;
if(i==16) i=0;
if(!(c[i]%3) )
display = c[i];
i++;
if(i==16) i=0;
if(!(d[i]%3) )
display = d[i];
i++;
if(i==16) i=0;
}}
TR0=0;
}
void main(void) {
Inic();
while(1){TR0=1;}
}