#include<reg52.h>
#include<intrins.h>
#define ui unsigned int
#define uc unsigned char
ui qishilie;
sbit ST_CP=P1^6;
sbit G=P1^7;
uc code zimo[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x7F,0xFF,0x40,0x02,0x50,0x12,
0x51,0x12,0x51,0x12,0x51,0x12,0x5F,0xF2,
0x51,0x12,0x51,0x92,0x51,0x72,0x50,0x12,
0x40,0x02,0x7F,0xFF,0x00,0x00,0x00,0x00,
0x04,0x20,0x44,0x24,0x54,0x44,0x54,0x88,
0x55,0x48,0x56,0x32,0xFC,0x21,0x55,0xFE,
0x54,0x10,0x56,0x30,0x55,0x48,0x54,0x84,
0x54,0xC4,0x44,0x60,0x04,0x40,0x00,0x00,
0x00,0x00,0x00,0x00,0x7F,0xFF,0x49,0x02,
0x49,0x04,0x49,0x08,0x49,0x00,0x4F,0x00,
0x49,0xC0,0x49,0x30,0x49,0x08,0x79,0x04,
0x01,0x02,0x01,0x0F,0x00,0x00,0x00,0x00,
0x01,0x01,0x09,0x01,0x31,0x01,0x21,0x02,
0x21,0xE2,0x2F,0x14,0xA5,0x14,0x61,0x08,
0x21,0x14,0x21,0x24,0x21,0xC2,0x21,0x03,
0x29,0x02,0x31,0x00,0x21,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
void delay(ui m)
{
ui i,j;
for(i=0;i<m;i++)
for(j=0;j<122;j++);
}
/*
void fazijie(unsigned char shuju)
{
SBUF=shuju;
while(TI==0);
TI=0;
}*/
sbit ds=P3^0;
sbit sh_cp=P3^1;
void fazijie(unsigned char shuju)
{ //xxxx xxxx
uc i,j;
j=0x01;
for(i=0;i<8;i++)
{
ds=shuju&j;//第i位
sh_cp=0;
sh_cp=1;
j<<=1;
}
}
void dzxianshi(void)
{
ui yingji=0x7fff;ui k=0x00;
uc i;
for(i=0;i<16;i+=2)
{
fazijie(yingji%0x100);//1111 1111
fazijie(yingji/0x100);//0111 1111
fazijie(zimo[i+1+qishilie]);
fazijie(zimo[i+qishilie]);
P1=k++&0X0f; //屏蔽高四位
ST_CP=1;G=1;
ST_CP=0;
delay(1);
yingji=_iror_(yingji,1);
}
}
void init_T0(void)
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
TMOD=0X01;
PT0=0;
EA=1;ET0=1;
TR0=1;
}
uc chi;
void t0_ser(void)interrupt 1
{
TH0=(65536-50000)/256;
TL0=(65536-50000)%256;
chi++;
if(chi==2)
{
chi=0;
qishilie+=2;
if(qishilie==32*5)qishilie=0;
}
}
void main(void)
{
SCON=0X00;
init_T0();
while(1)
{
dzxianshi();
}
}
这是左移的 怎么改成隔一段时间显示汉字的呢 |