#include<reg52.h>
#include<intrins.h>
typedef unsigned char u8;
typedef unsigned int u16;
sbit sck=P3^6; //输入数据时钟
sbit rck=P3^5; //输出锁存器时钟
sbit ser=P3^4; //写数据口
//点阵显示数组 相当于点阵的列扫描 先是第一个点阵右至左扫,再是第二个右至左扫
u8 code word0[] = {0x00, 0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80,
0x01, 0x00, 0x02, 0x00, 0x04, 0x00, 0x08, 0x00, 0x10, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80, 0x00};
//清屏
u8 code word15[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
// 永
u8 code word1[]={96,0,128,0,0,0,248,0,128,8,128,4,158,2,144,1,144,2,136,4,132,8,130,48,161,16,64,0,0,0,0,0};
// 远
u8 code word2[]={2,4,228,15,4,0,0,0,240,31,64,2,71,2,68,2,68,18,36,18,20,28,10,0,49,0,192,63,0,0,0,0};
// 的
u8 code word3[]={8,2,8,2,4,17,62,63,162,16,98,16,34,17,62,18,34,18,34,16,34,16,34,16,62,10,34,4,0,0,0,0};
// 黄
u8 code word4[]={32,2,32,10,254,31,32,2,255,63,128,0,248,15,136,8,248,15,136,8,248,15,32,2,24,4,6,24,0,0,0,0};
// 家
u8 code word5[]={64,0,128,0,254,31,2,16,248,7,32,8,88,4,166,2,144,3,76,5,32,9,16,49,46,17,192,0,0,0,0,0};
// 驹
u8 code word6[]={16,1,63,1,144,16,146,63,82,16,178,23,146,20,190,20,160,20,184,23,167,20,32,16,20,18,8,12,0,0,0,0};
// B
u8 code word7[]={0,0,0,0,0,0,0,0,255,0,230,0,198,0,230,0,126,0,230,0,198,1,198,1,198,1,230,1,255,0,0,0};
// E
u8 code word8[]={0,0,0,0,0,0,0,0,255,0,198,1,102,0,102,0,126,0,102,0,102,0,6,0,134,1,198,1,255,0,0,0};
// Y
u8 code word9[]={0,0,0,0,0,0,0,0,239,1,198,0,238,0,108,0,124,0,56,0,56,0,56,0,56,0,56,0,124,0,0,0};
// O
u8 code word10[]={0,0,0,0,0,0,0,0,124,0,238,0,199,1,199,1,199,1,199,1,199,1,199,1,198,1,238,0,124,0,0,0};
// N
u8 code word11[]={0,0,0,0,0,0,0,0,231,3,206,0,206,0,222,0,254,0,254,0,246,0,230,0,230,0,198,0,207,0,0,0};
// D
u8 code word12[]={0,0,0,0,0,0,0,0,127,0,230,0,198,1,198,1,198,1,198,1,198,1,198,1,198,1,230,0,127,0,0,0};
// ^_^
u8 code word13[]={0,0,24,24,36,36,66,66,0,0,0,0,0,0,0,0,24,48,32,8,64,4,128,3,0,0,0,0,0,0,0,0};
//清屏
u8 code word14[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
u8 *p[]={word15,word1,word2,word3,word4,word5,word6,word7,word8,
word9,word10,word11,word12,word13,word14};//word15和word14不能对换否则出错
void senddata(u8 dat1,u8 dat2,u8 dat3,u8 dat4)
{
u8 i;
sck=0; //sck高脉冲时数据送入寄存器
rck=0; //rck高脉冲送入寄存器存储的数据输出去
_nop_();
_nop_();
for(i=0;i<8;i++)
{
ser=dat1>>7;
dat1<<=1;
sck=1;
_nop_();
_nop_();
sck=0;
_nop_();
_nop_();
}
for(i=0;i<8;i++)
{
ser=dat2>>7;
dat2<<=1;
sck=1;
_nop_();
_nop_();
sck=0;
_nop_();
_nop_();
}
for(i=0;i<8;i++)
{
ser=dat3>>7;
dat3<<=1;
sck=1;
_nop_();
_nop_();
sck=0;
_nop_();
_nop_();
}
for(i=0;i<8;i++)
{
ser=dat4>>7;
dat4<<=1;
sck=1;
_nop_();
_nop_();
sck=0;
_nop_();
_nop_();
}
rck=1;
_nop_();
_nop_();
}
void main()
{
u8 i,k;
u16 j;
while(1)
{
for(j=0;j<10;j++)
{
for(i=0;i<16;i++)
{
senddata(~(*(p[0] + 2*(i+k) + 1)),~(*(p[0] + 2*(i+k))),word0[2*i],word0[2*i+1]);
}
//senddata(0xff,0xff,0,0);
}
k++;
if(k==15*15)k=0;
}
}
|