#include
#include "74HC595.H"
unsigned char code tab[]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};
unsigned char code digittab[37][8]={ //字模取模方式 阴码 逆向 逐列式
{0x0C,0x12,0x12,0x12,0x12,0x12,0x0C,0x00},/*"0",0*/
{0x04,0x06,0x04,0x04,0x04,0x04,0x0E,0x00},/*"1",1*/
{0x0C,0x12,0x10,0x08,0x04,0x02,0x1E,0x00},/*"2",2*/
{0x0C,0x12,0x10,0x0C,0x10,0x12,0x0C,0x00},/*"3",3*/
{0x08,0x0C,0x0C,0x0A,0x0A,0x1E,0x08,0x00},/*"4",4*/
{0x1E,0x02,0x02,0x0E,0x10,0x10,0x0E,0x00},/*"5",5*/
{0x0C,0x12,0x02,0x0E,0x12,0x12,0x0C,0x00},/*"6",6*/
{0x1E,0x12,0x10,0x08,0x04,0x04,0x04,0x00},/*"7",7*/
{0x0C,0x12,0x12,0x0C,0x12,0x12,0x0C,0x00},/*"8",8*/
{0x0C,0x12,0x12,0x1C,0x10,0x12,0x0C,0x00},/*"9",9*/
{0x00,0x00,0x00,0x1C,0x1C,0x12,0x1C,0x00},/*"a",10*/
{0x02,0x02,0x02,0x0E,0x12,0x12,0x0E,0x00},/*"b",11*/
{0x00,0x00,0x00,0x1C,0x02,0x02,0x1C,0x00},/*"c",12*/
{0x02,0x02,0x02,0x0E,0x12,0x12,0x0E,0x00},/*"b",13*/
{0x00,0x00,0x00,0x0C,0x1E,0x02,0x0C,0x00},/*"e",14*/
{0x00,0x08,0x04,0x1E,0x04,0x04,0x04,0x00},/*"f",15*/
{0x00,0x00,0x00,0x1C,0x12,0x1C,0x10,0x0C},/*"g",16*/
{0x02,0x02,0x02,0x0E,0x0A,0x0A,0x0A,0x00},/*"h",17*/
{0x00,0x00,0x04,0x00,0x04,0x04,0x04,0x00},/*"i",18*/
{0x00,0x00,0x08,0x00,0x08,0x08,0x08,0x06},/*"j",19*/
{0x02,0x02,0x02,0x1A,0x06,0x0A,0x12,0x00},/*"k",20*/
{0x04,0x04,0x04,0x04,0x04,0x04,0x0E,0x00},/*"l",21*/
{0x00,0x00,0x00,0x1E,0x1A,0x1A,0x1A,0x00},/*"m",22*/
{0x00,0x00,0x00,0x0E,0x12,0x12,0x12,0x00},/*"n",23*/
{0x00,0x00,0x00,0x0C,0x12,0x12,0x0C,0x00},/*"o",24*/
{0x00,0x00,0x00,0x0E,0x12,0x12,0x0E,0x02},/*"p",25*/
{0x00,0x00,0x00,0x1C,0x12,0x12,0x1C,0x10},/*"q",26*/
{0x00,0x00,0x00,0x1A,0x06,0x02,0x02,0x00},/*"r",27*/
{0x00,0x00,0x00,0x1C,0x06,0x18,0x0E,0x00},/*"s",28*/
{0x00,0x00,0x04,0x0E,0x04,0x04,0x0C,0x00},/*"t",29*/
{0x00,0x00,0x00,0x12,0x12,0x12,0x1C,0x00},/*"u",30*/
{0x00,0x00,0x00,0x12,0x12,0x0C,0x0C,0x00},/*"v",31*/
{0x00,0x00,0x00,0x15,0x15,0x0E,0x0A,0x00},/*"w",32*/
{0x00,0x00,0x00,0x12,0x0C,0x0C,0x12,0x00},/*"x",33*/
{0x00,0x00,0x00,0x12,0x12,0x1C,0x10,0x0C},/*"y",34*/
{0x00,0x00,0x00,0x1E,0x08,0x04,0x1E,0x00},/*"z",35*/
};
unsigned int
timecount;
unsigned char cnta;
unsigned char cntb;
void main(void)
{
TMOD=0x01;
TH0=(65536-1000)/256;
TL0=(65536-1000)%256;
TR0=1;
ET0=1;
EA=1;
while(1);
}
void t0(void) interrupt 1 using 0
{
TH0=(65536-1000)/256;
TL0=(65536-1000)%256;
if(cntb%2==0){
Ser_IN(tab[cnta]);//8X8点阵列扫描
Ser_IN(0xff);
Ser_IN(digittab[cntb][cnta]);//8X8点阵行送扫描数据
Par_OUT();//74HC595输出显示
}
else
{
Ser_IN(0xff);
Ser_IN(tab[cnta]);//8X8点阵列扫描
Ser_IN(digittab[cntb][cnta]);//8X8点阵行送扫描数据
Par_OUT();//74HC595输出显示
}
cnta++;
if(cnta==8)
{
cnta=0;
}
timecount++;
if(timecount==1000)
{
timecount=0;
cntb++;
if(cntb==37)
{
cntb=0;
}
}
}
|