附:http://www.jh-tec.cn/archives/7543
前言
之前咱们讲了8x8点阵、8x16点阵、16x16点阵以及16x32点阵,这篇文章再讲一讲16x128点阵
硬件设计
该方案支持左右轮动,按键可以控制暂停、换方向。
仿真图:
程序设计
#include<reg51.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
sbit sclk=P1^1;
sbit rclk=P1^2;
sbit sdin=P1^0;
sbit s1=P3^6;
sbit s2=P3^7;
bit fangxiang;
uint alt,net,s3=30*25.5;
int d1,d2;
bit mode;
uchar code tab[]={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",0*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",1*/
0x00,0x80,0x01,0x02,0x06,0x02,0x78,0x82,0x08,0x82,0x08,0x82,0x08,0x82,0x08,0x82,
0xFF,0xFE,0x48,0x82,0x08,0x82,0x08,0x82,0x19,0x82,0x08,0x86,0x00,0x02,0x00,0x00,/*"生",2*/
0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFC,0x42,0x08,0x42,0x08,0x42,0x08,0x42,0x08,
0x42,0x08,0x42,0x08,0x42,0x08,0x7F,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"日",3*/
0x0E,0x00,0x00,0x00,0xFF,0xFF,0x10,0x00,0x0D,0x01,0x11,0x02,0x11,0x0C,0x11,0x70,
0xFF,0x80,0x11,0x60,0x11,0x10,0x11,0x0C,0x1F,0x06,0x01,0x03,0x01,0x02,0x00,0x00,/*"快",4*/
0x00,0x00,0x00,0x04,0x02,0x18,0x3F,0x30,0x22,0xE0,0x22,0x48,0x22,0x04,0x62,0x02,
0x5F,0xFC,0x42,0x00,0xC2,0x00,0xC2,0x40,0x42,0x30,0x02,0x1C,0x00,0x08,0x00,0x00,/*"乐",5*/
0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFA,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"!",6*/
/*-- 文字: 点 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x01,0x00,0x02,0x03,0xEC,0x02,0x20,0x02,0x20,0x02,0x28,0xFE,0x26,0x12,0x20,
0x12,0x28,0x12,0x26,0x12,0x20,0x13,0xE0,0x10,0x08,0x10,0x07,0x00,0x00,0x00,0x00,
/*-- 文字: 阵 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x00,0x7F,0xFF,0x40,0x10,0x44,0x08,0x5B,0x10,0x60,0xE0,0x10,0x10,0x13,0x10,
0x1D,0x10,0xF1,0x10,0x17,0xFF,0x11,0x10,0x11,0x10,0x11,0x10,0x10,0x10,0x00,0x00,
/*-- 文字: 显 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x02,0x00,0x42,0x00,0x22,0x7F,0x1A,0x49,0x02,0x49,0xFE,0x49,0x02,0x49,0x02,
0x49,0x02,0x49,0xFE,0x49,0x02,0x7F,0x0A,0x00,0x12,0x00,0x62,0x00,0x02,0x00,0x00,
/*-- 文字: 示 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x02,0x04,0x02,0x08,0x42,0x10,0x42,0x60,0x42,0x00,0x42,0x02,0x42,0x01,0x43,0xFE,
0x42,0x00,0x42,0x00,0x42,0x00,0x42,0x40,0x42,0x20,0x02,0x10,0x02,0x0C,0x00,0x00,
/*-- 文字: 屏 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x02,0x00,0x0C,0x7F,0xF0,0x48,0x20,0x49,0x21,0x4D,0x26,0x4B,0xF8,0x49,0x20,
0x49,0x20,0x49,0x20,0x4B,0xFF,0x4D,0x20,0x79,0x20,0x00,0x20,0x00,0x00,0x00,0x00,
/*-- 文字: 程 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x24,0x10,0x24,0x60,0x25,0x80,0x7F,0xFF,0xC4,0x80,0x44,0x60,0x00,0x02,0x7C,0x92,
0x44,0x92,0x44,0x92,0x44,0xFE,0x44,0x92,0x44,0x92,0x7C,0x92,0x00,0x82,0x00,0x00,
/*-- 文字: 序 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x02,0x00,0x0C,0x3F,0xF0,0x20,0x00,0x20,0x80,0x20,0x80,0x28,0x80,0xA8,0x82,
0x6A,0x81,0x29,0xFE,0x2A,0x80,0x2C,0x80,0x28,0x80,0x20,0xA0,0x20,0xC0,0x00,0x00,
/*-- 文字: 设 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x02,0x00,0x02,0x00,0x42,0x00,0x33,0xFC,0x00,0x09,0x02,0x11,0x05,0x02,0x79,0xC2,
0x41,0x34,0x41,0x08,0x41,0x14,0x79,0x62,0x05,0x82,0x04,0x01,0x04,0x01,0x00,0x00,
/*-- 文字: 计 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x02,0x00,0x02,0x00,0x42,0x00,0x33,0xFE,0x00,0x04,0x02,0x08,0x02,0x00,0x02,0x00,
0x02,0x00,0xFF,0xFF,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x02,0x00,0x00,0x00,
/*-- 文字: 与 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x10,0x00,0x10,0x07,0x10,0xF9,0x10,0x11,0x10,0x11,0x10,0x11,0x10,0x11,0x10,
0x11,0x10,0x11,0x12,0x11,0x01,0x11,0x02,0x11,0xFC,0x10,0x00,0x00,0x00,0x00,0x00,
/*-- 文字: 仿 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x80,0x01,0x00,0x06,0x00,0x1F,0xFF,0xE0,0x01,0x10,0x02,0x10,0x0C,0x1F,0xF0,
0x91,0x00,0x71,0x02,0x11,0x01,0x11,0x02,0x11,0xFC,0x10,0x00,0x10,0x00,0x00,0x00,
/*-- 文字: 真 --*/
/*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x08,0x20,0x08,0x20,0x09,0x2F,0xFA,0x2A,0xAC,0x2A,0xA8,0x2A,0xA8,0xFA,0xA8,
0x2A,0xA8,0x2A,0xA8,0x2A,0xAC,0x2F,0xFA,0x20,0x09,0x20,0x08,0x00,0x08,0x00,0x00,
0x10,0x04,0x1F,0xFC,0x00,0x84,0x01,0x00,0x01,0x00,0x01,0x04,0x00,0xFC,0x00,0x04,/*"h",7*/
0x00,0x00,0x00,0x98,0x01,0x24,0x01,0x44,0x01,0x44,0x01,0x44,0x00,0xFC,0x00,0x04,/*"a",8*/
0x01,0x01,0x01,0xFF,0x00,0x85,0x01,0x04,0x01,0x04,0x00,0x88,0x00,0x70,0x00,0x00,/*"p",9*/
0x01,0x01,0x01,0xFF,0x00,0x85,0x01,0x04,0x01,0x04,0x00,0x88,0x00,0x70,0x00,0x00,/*"p",10*/
0x01,0x01,0x01,0x81,0x01,0x71,0x00,0x0E,0x00,0x18,0x01,0x60,0x01,0x80,0x01,0x00,/*"y",11*/
0x00,0x00,0x00,0x0C,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*".",12*/
0x10,0x00,0x1F,0xFC,0x00,0x88,0x01,0x04,0x01,0x04,0x00,0x88,0x00,0x70,0x00,0x00,/*"b",13*/
0x00,0x00,0x01,0x04,0x19,0x04,0x19,0xFC,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,/*"i",14*/
0x01,0x04,0x01,0x04,0x01,0xFC,0x00,0x84,0x01,0x04,0x01,0x00,0x01,0x80,0x00,0x00,/*"r",15*/
0x00,0x00,0x01,0x00,0x01,0x00,0x07,0xF8,0x01,0x04,0x01,0x04,0x00,0x00,0x00,0x00,/*"t",16*/
0x10,0x04,0x1F,0xFC,0x00,0x84,0x01,0x00,0x01,0x00,0x01,0x04,0x00,0xFC,0x00,0x04,/*"h",17*/
0x00,0x00,0x00,0x70,0x00,0x88,0x01,0x04,0x01,0x04,0x11,0x08,0x1F,0xFC,0x00,0x04,/*"d",18*/
0x00,0x00,0x00,0x98,0x01,0x24,0x01,0x44,0x01,0x44,0x01,0x44,0x00,0xFC,0x00,0x04,/*"a",19*/
0x01,0x01,0x01,0x81,0x01,0x71,0x00,0x0E,0x00,0x18,0x01,0x60,0x01,0x80,0x01,0x00,/*"y",20*/
0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xCC,0x00,0x0C,0x00,0x00,0x00,0x00,0x00,0x00,/*"!",21*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",22*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*" ",23*/
};
void delay(uint z) //延时子函数
{
uchar x;
for(;z>0;z--)
for(x=110;x>0;x--);
}
void writedata(uchar dat1,uchar dat2,uchar dat3,uchar dat4,uchar dat5,uchar dat6,uchar dat7,uchar dat8,uchar dat9,uchar dat10,uchar dat11,uchar dat12,uchar dat13,uchar dat14,uchar dat15,uchar dat16) //595显示子函数
{
uchar i;
for(i=0;i<8;i++) //循环八次
{
dat1=dat1>>1; //数据左移
sdin=CY;
sclk=1;
sclk=0;
}
for(i=0;i<8;i++) //循环八次
{
dat2=dat2>>1; //数据左移
sdin=CY;
sclk=1;
sclk=0;
}
for(i=0;i<8;i++) //循环八次
{
dat3=dat3>>1; //数据左移
sdin=CY;
sclk=1;
sclk=0;
}
for(i=0;i<8;i++) //循环八次
{
dat4=dat4>>1; //数据左移
sdin=CY;
sclk=1;
sclk=0;
}
for(i=0;i<8;i++) //循环八次
{
dat5=dat5>>1; //数据左移
sdin=CY;
sclk=1;
sclk=0;
}
for(i=0;i<8;i++) //循环八次
{
dat6=dat6>>1; //数据左移
sdin=CY;
sclk=1;
sclk=0;
}
for(i=0;i<8;i++) //循环八次
{
dat7=dat7>>1; //数据左移
sdin=CY;
sclk=1;
sclk=0;
}
for(i=0;i<8;i++) //循环八次
{
dat8=dat8>>1; //数据左移
sdin=CY;
sclk=1;
sclk=0;
}
for(i=0;i<8;i++) //循环八次
{
dat9=dat9>>1; //数据左移
sdin=CY;
sclk=1;
sclk=0;
}
for(i=0;i<8;i++) //循环八次
{
dat10=dat10>>1; //数据左移
sdin=CY;
sclk=1;
sclk=0;
}
for(i=0;i<8;i++) //循环八次
{
dat11=dat11>>1; //数据左移
sdin=CY;
sclk=1;
sclk=0;
}
for(i=0;i<8;i++) //循环八次
{
dat12=dat12>>1; //数据左移
sdin=CY;
sclk=1;
sclk=0;
}
for(i=0;i<8;i++) //循环八次
{
dat13=dat13>>1; //数据左移
sdin=CY;
sclk=1;
sclk=0;
}
for(i=0;i<8;i++) //循环八次
{
dat14=dat14>>1; //数据左移
sdin=CY;
sclk=1;
sclk=0;
}
for(i=0;i<8;i++) //循环八次
{
dat15=dat15>>1; //数据左移
sdin=CY;
sclk=1;
sclk=0;
}
for(i=0;i<8;i++) //循环八次
{
dat16=dat16>>1; //数据左移
sdin=CY;
sclk=1;