|
#include
#define uchar unsigned char
#define uint unsigned int
sbit shp=P1^0;
sbit stp=P1^1;
sbit ds=P1^2;
uchar i,j,k;
uchar code table[][32]={
{0x00,0x80,0x00,0x80,0xFC,0x80,0x04,0xFC,0x45,0x04,0x46,0x48,0x28,0x40,0x28,0x40,
0x10,0x40,0x28,0x40,0x24,0xA0,0x44,0xA0,0x81,0x10,0x01,0x08,0x02,0x0E,0x0C,0x04},
{
0x00,0x00,0x41,0x84,0x26,0x7E,0x14,0x44,0x04,0x44,0x04,0x44,0xF4,0x44,0x14,0xC4,
0x15,0x44,0x16,0x54,0x14,0x48,0x10,0x40,0x10,0x40,0x28,0x46,0x47,0xFC,0x00,0x00
},
{
0x01,0x00,0x21,0x08,0x11,0x0C,0x09,0x10,0x09,0x20,0x01,0x04,0xFF,0xFE,0x04,0x40,
0x04,0x40,0x04,0x40,0x04,0x40,0x08,0x40,0x08,0x42,0x10,0x42,0x20,0x3E,0x40,0x00
},
{
0x10,0x80,0x10,0x80,0x51,0x04,0x51,0xFE,0x52,0x00,0x54,0x80,0x58,0x60,0x50,0x24,
0x57,0xFE,0x54,0x44,0x54,0x44,0x54,0x44,0x54,0x44,0x14,0x44,0x17,0xFC,0x14,0x04
}
};
void delay(uint t)
{
uchar m,k;
for(m=0;m
for(k=0;k<20;k++);
}
void sendled(uchar kk)
{
uchar q,temp;
temp=kk;
for(q=0;q<8;q++)
{ shp=0;
ds=temp&0x80;
shp=1;
temp=temp<<1;
}
}
void display(uchar *data1,uchar *data2,uchar *data3,uchar *data4)
{
for(i=0;i<16;i++)
{ sendled(data4[2*i]);sendled(data4[2*i+1]);
sendled(data3[2*i]);sendled(data3[2*i+1]);
sendled(data2[2*i]);sendled(data2[2*i+1]);
sendled(data1[2*i]);sendled(data1[2*i+1]);
stp=0;
delay(1);
P2=i;
stp=1;
delay(20);
}
}
void main()
{
while(1)
{
display(table[0],table[1],table[2],table[3]);
}
}
|