#include <reg52.h>
#define ui unsigned int
#define uc unsigned char
sbit cs2=P1^0;
sbit cs1=P1^1;
sbit e=P1^2;
sbit rw=P1^3;
sbit rs=P1^5;
sbit adcs=P3^0;
sbit adrd=P3^1;
sbit adwr=P3^2;
sbit eoc=P3^3;
sbit ada=P3^4;
ui tt,miao,shi,fen,shig,shis,feng,fens,miaos,miaog;
uc bclie,bcye,gew,shiw,baiw,gew1,shiw1,baiw1;
uc code hz[][32]=
{
/*-- 文字: 北 --*/
/*-- 楷体_GB231212; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x00,0x40,0x40,0x40,0xFC,0x00,0x00,0xFE,0x80,0x40,0x60,0x20,0x00,0x00,0x00,
0x00,0x08,0x08,0x04,0x02,0x1F,0x00,0x00,0x0F,0x10,0x10,0x10,0x10,0x0E,0x00,0x00,
/*-- 文字: 京 --*/
/*-- 楷体_GB231212; 此字体下对应的点阵为:宽x高=16x16 --*/
0x08,0x08,0x08,0x08,0xC8,0x48,0x49,0x2A,0x24,0xA4,0x64,0x04,0x04,0x04,0x00,0x00,
0x00,0x00,0x10,0x0C,0x00,0x01,0x21,0x7F,0x01,0x00,0x04,0x08,0x18,0x00,0x00,0x00,
/*-- 文字: 时 --*/
/*-- 楷体_GB231212; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0xF8,0x48,0x44,0xFC,0x00,0xA0,0x20,0x20,0x20,0xFE,0x10,0x10,0x10,0x00,0x00,
0x00,0x0F,0x04,0x04,0x0F,0x00,0x00,0x01,0x10,0x20,0x3F,0x00,0x00,0x00,0x00,0x00,
/*-- 文字: 间 --*/
/*-- 楷体_GB231212; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x00,0xF8,0x02,0x04,0xE0,0xA4,0x14,0xF4,0x02,0x02,0x02,0xFE,0x00,0x00,0x00,
0x00,0x00,0x1F,0x00,0x00,0x07,0x02,0x02,0x07,0x00,0x10,0x20,0x1F,0x00,0x00,0x00,
};
uc code sz[][16]=
{
/*-- 文字: 0 --*/
/*-- 楷体_GB231212; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0xF0,0x08,0x08,0x18,0xE0,0x00,0x00,0x00,0x0F,0x10,0x20,0x10,0x0F,0x00,
/*-- 文字: 1 --*/
/*-- 楷体_GB231212; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x10,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0x10,0x00,0x00,0x00,
/*-- 文字: 2 --*/
/*-- 楷体_GB231212; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x30,0x08,0x08,0x08,0xF8,0x00,0x00,0x00,0x00,0x18,0x14,0x13,0x10,0x08,0x00,
/*-- 文字: 3 --*/
/*-- 楷体_GB231212; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x10,0x08,0x88,0x78,0x00,0x00,0x00,0x00,0x10,0x20,0x20,0x11,0x0E,0x00,
/*-- 文字: 4 --*/
/*-- 楷体_GB231212; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0xC0,0x20,0x10,0xF8,0x00,0x00,0x00,0x03,0x02,0x02,0x02,0x1F,0x02,0x00,
/*-- 文字: 5 --*/
/*-- 楷体_GB231212; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x70,0x48,0xC8,0x88,0x00,0x00,0x00,0x10,0x10,0x20,0x10,0x0F,0x00,0x00,
/*-- 文字: 6 --*/
/*-- 楷体_GB231212; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0xE0,0x90,0x88,0x80,0x00,0x00,0x00,0x07,0x18,0x20,0x20,0x19,0x06,0x00,
/*-- 文字: 7 --*/
/*-- 楷体_GB231212; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x10,0x08,0x08,0x88,0x78,0x00,0x00,0x00,0x00,0x00,0x18,0x07,0x00,0x00,0x00,
/*-- 文字: 8 --*/
/*-- 楷体_GB231212; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x00,0x78,0x88,0x88,0x78,0x00,0x00,0x00,0x0C,0x12,0x21,0x21,0x1E,0x00,0x00,
/*-- 文字: 9 --*/
/*-- 楷体_GB231212; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0x60,0x98,0x08,0x08,0xF8,0xC0,0x00,0x00,0x00,0x21,0x12,0x09,0x07,0x00,0x00,
/*-- 文字: : --*/
/*-- 楷体_GB231212; 此字体下对应的点阵为:宽x高=8x16 --*/
0x00,0xC0,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x30,0x10,0x00,0x00,0x00,0x00,0x00,
};
void xml(uc ml)
{
rs=0;
rw=0;e=1;e=1;
P2=ml;
e=1;e=1;e=1;e=1;
e=0;
}
void xsj(uc sj)
{
rs=1;
rw=0;e=1;e=1;
P2=sj;
e=1;e=1;e=1;e=1;
e=0;
}
void qingp()
{
uc i,j;
cs1=cs2=1;
for(i=0;i<8;i++)
{
xml(0xb8+i);
xml(0x40);
for(j=0;j<64;j++)
{
xsj(0x00);
}
}
cs1=cs2=0;
}
void csh()
{
xml(0x3f);
xml(0xc0);
qingp();
}
void xhz(uc ye,lie,zi)
{
uc i;
bcye=ye;bclie=lie;
if(lie<64)cs1=1,cs2=0;
else cs1=0,cs2=1,lie=lie-64;
xml(0xb8+ye);
xml(0x40+lie);
for(i=0;i<16;i++)
{
if(lie+i<64)xsj(hz[zi][i]);
else
{
cs1=0;cs2=1;
xml(0xb8+ye);
xml(0x40+lie+i-64);
xsj(hz[zi][i]);
}
}
ye=bcye;lie=bclie;
if(lie<64)cs1=1,cs2=0;
else cs1=0,cs2=1,lie=lie-64;
xml(0xb8+ye+1);
xml(0x40+lie);
for(i=0;i<16;i++)
{
if(lie+i<64)xsj(hz[zi][i+16]);
else
{
cs1=0;cs2=1;
xml(0xb8+ye+1);
xml(0x40+lie+i-64);
xsj(hz[zi][i+16]);
}
}
P2=0xff;
}
void xsz(uc ye,lie,zi)
{
uc i;
bcye=ye;bclie=lie;
if(lie<64)cs1=1,cs2=0;
else cs1=0,cs2=1,lie=lie-64;
xml(0xb8+ye);
xml(0x40+lie);
for(i=0;i<8;i++)
{
if(lie+i<64)xsj(sz[zi][i]);
else
{
cs1=0;cs2=1;
xml(0xb8+ye);
xml(0x40+lie+i-64);
xsj(sz[zi][i]);
}
}
ye=bcye;lie=bclie;
if(lie<64)cs1=1,cs2=0;
else cs1=0,cs2=1,lie=lie-64;
xml(0xb8+ye+1);
xml(0x40+lie);
for(i=0;i<8;i++)
{
if(lie+i<64)xsj(sz[zi][i+8]);
else
{
cs1=0;cs2=1;
xml(0xb8+ye+1);
xml(0x40+lie+i-64);
xsj(sz[zi][i+8]);
}
}
P2=0xff;
}
void main()
{
csh();
while(1)
{
miaog=miao/1%10;
miaos=miao/10%10;
feng=fen/1%10;
fens=fen/10%10;
shig=shi/1%10;
shis=shi/10%10;
TMOD=0x11;
TH0=(-5000)/256;
TL0=(-5000)%256;
TR0=1;ET0=1;EA=1;
xhz(2,32,0);
xhz(2,48,1);
xhz(2,64,2);
xhz(2,80,3);
xsz(4,32,shis);
xsz(4,40,shig);
xsz(4,48,10);//
xsz(4,56,fens);
xsz(4,64,feng);
xsz(4,72,10);//
xsz(4,80,miaos);
xsz(4,88,miaog);
}
}
void time0() interrupt 1
{
TH0=(-5000)/256;
TL0=(-5000)%256;
tt++;
if(tt==200)
{
tt=0;
miao++;
if(miao==60)
{
miao=0;
fen++;
if(fen==60)
{
fen=0;
shi++;
if(shi==24)shi=0;
}
}
}
}
|