16x16点阵显示汉字并移动原理图程序
合集下载
相关主题
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
0x08,0x20,0x08,0xC0,0x0B,0x00,0xFF,0xFF,0x09,0x00,0x08,0xC1,0x00,0x06,0x7F,0xF8,0x40,0x00,0x40,0x00,0x40,0x00,0x7F,0xFC,0x00,0x02,0x00,0x02,0x00,0x1E,0x00,0x00,/*"机",8*/
temp2=hang[zuo+(num*2+1)]; /*num*2+1表示第二个74ls164只去第奇数个字节,最左第一列16个不控制先发送第一个74ls164字节在发送第二个的字节*/
shuru_2();
num++;
if(num==16)
{
num=0;
}
timecount++;
if(timecount==100)
源程序:
#include <reg52.h>
unsigned char i;
sbit DATA1=P3^7;
sbit DATA2=P3^5;
sbit CLCK1=P3^6;
sbit CLCK2=P3^4;
#define uchar unsigned char
#define uint unsigned int
0x00,0x80,0x01,0x00,0x06,0x00,0x1F,0xFF,0xE0,0x00,0x00,0x20,0x00,0x40,0x00,0x80,0xFF,0xFC,0x02,0x02,0x04,0x02,0x08,0x02,0x10,0x02,0x20,0x02,0x00,0x1E,0x00,0x00,/*"化",5*/
{num=0;
timecount=0;
zuo=zuo+2; /*向后扫描加一列实现移动这里每次加二是因为要跳过第二个74ls164的代码前面已经说了取模方式是最左一列16个从上到下取得*/
if(zuo==272)
{
zuo=0;
}
}
}
14年8月
0x00,0x00,0x00,0x01,0x00,0x06,0x7F,0xF8,0x04,0x40,0x04,0x40,0x04,0x40,0x04,0x40,0x04,0x40,0xFC,0x40,0x04,0x7F,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,/*"片",7*/
0x02,0x08,0x22,0x3C,0x23,0xC8,0x22,0x08,0x22,0x28,0x22,0x1D,0x02,0x02,0x08,0x0C,0x08,0x70,0xFF,0x80,0x08,0x02,0x08,0x01,0x08,0x02,0x0F,0xFC,0x00,0x00,0x00,0x00,/*"动",4*/
0x00,0x00,0x00,0x42,0x44,0x44,0x4C,0xC8,0x54,0xD0,0x65,0x42,0x45,0x41,0x46,0x7E,0x84,0x40,0x88,0x40,0x90,0x50,0x81,0x48,0x80,0xC4,0x00,0x62,0x00,0x00,0x00,0x00,/*"系",2*/
0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0x11,0x22,0x31,0x22,0x51,0x22,0x91,0x22,0x11,0x22,0x11,0x22,0x11,0x22,0x1F,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"自",3*/
CLCK2=1;
CLCK2=0;
}
}
void main(void)
{
TMOD=0x01;
TH0=(65536-2000)/256;
TL0=(65536-2000)%256;
TR0=百度文库;
ET0=1;
EA=1;
while(1);
}
void serve_led()interrupt 1 using 0 /*定时中断显示*/
16x16
周渴望南阳理工学院QQ418084696
本次设计中首先在做了8x8点阵汉子显示基础之上做的,其实点阵原理很简单,就像数码管动态显示一样简单,只要你分清楚行控制,与列控制,某段时间某列可以点亮,哪几行亮,动态扫描一个循环自然组成不同的图像。
这里取模方式是先最左边的一列选通,然后控制控制两个74ls164分别点亮16行中的几行,然后是从左向右第二列依次下去,形成动态扫描。本文程序非常简单,虽然没注释,认真看几十分钟就全明白了,说白了,数码管动态显示一回事(呵呵其实我自己做的时候下了不少功夫建议先做8x8)。
{k=2;
TH0=(65536-2000)/256;
TL0=(65536-2000)%256;
P2=0xff;
P2 = lie[num];
temp1=hang[num*2+zuo]; /*num*2表示第一个74ls164只去第偶数个字节,跟我的取模方式有关*/
shuru_1();
P2 = lie[num];
0x01,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x02,0x41,0x01,0x47,0xFE,0x45,0x00,0x49,0x00,0x51,0x00,0x61,0x00,0x41,0x00,0x01,0x00,0x01,0x00,0x00,0x00,/*"子",1*/
0x00,0x08,0x00,0x08,0x1F,0xC8,0x92,0x48,0x52,0x48,0x32,0x48,0x12,0x48,0x1F,0xFF,0x12,0x48,0x32,0x48,0x52,0x48,0x92,0x48,0x1F,0xC8,0x00,0x08,0x00,0x08,0x00,0x00,/*"单",6*/
unsigned char code hang[288]={0x00,0x00,0x00,0x00,0x1F,0xF8,0x11,0x10,0x11,0x10,0x11,0x10,0x11,0x10,0xFF,0xFE,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x1F,0xF9,0x00,0x01,0x00,0x0F,0x00,0x00,/*"电",0*/
void shuru_1();
void shuru_2();
unsigned char num,k,temp1,temp2,zuo=0;
unsigned int timecount;
unsigned char code lie[16]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,};/*74hc154显示代码从左到右16列依次选通*/
};
void shuru_1() /*74ls164进行输入数据*/
{
uchar t;
for(t=0;t<8;t++)
{
temp1<<=1;
DATA1=CY;
CLCK1=1;
CLCK1=0;
}
}
void shuru_2()
{
uchar t;
for(t=0;t<8;t++)
{
temp2<<=1;
DATA2=CY;
temp2=hang[zuo+(num*2+1)]; /*num*2+1表示第二个74ls164只去第奇数个字节,最左第一列16个不控制先发送第一个74ls164字节在发送第二个的字节*/
shuru_2();
num++;
if(num==16)
{
num=0;
}
timecount++;
if(timecount==100)
源程序:
#include <reg52.h>
unsigned char i;
sbit DATA1=P3^7;
sbit DATA2=P3^5;
sbit CLCK1=P3^6;
sbit CLCK2=P3^4;
#define uchar unsigned char
#define uint unsigned int
0x00,0x80,0x01,0x00,0x06,0x00,0x1F,0xFF,0xE0,0x00,0x00,0x20,0x00,0x40,0x00,0x80,0xFF,0xFC,0x02,0x02,0x04,0x02,0x08,0x02,0x10,0x02,0x20,0x02,0x00,0x1E,0x00,0x00,/*"化",5*/
{num=0;
timecount=0;
zuo=zuo+2; /*向后扫描加一列实现移动这里每次加二是因为要跳过第二个74ls164的代码前面已经说了取模方式是最左一列16个从上到下取得*/
if(zuo==272)
{
zuo=0;
}
}
}
14年8月
0x00,0x00,0x00,0x01,0x00,0x06,0x7F,0xF8,0x04,0x40,0x04,0x40,0x04,0x40,0x04,0x40,0x04,0x40,0xFC,0x40,0x04,0x7F,0x04,0x00,0x04,0x00,0x04,0x00,0x00,0x00,0x00,0x00,/*"片",7*/
0x02,0x08,0x22,0x3C,0x23,0xC8,0x22,0x08,0x22,0x28,0x22,0x1D,0x02,0x02,0x08,0x0C,0x08,0x70,0xFF,0x80,0x08,0x02,0x08,0x01,0x08,0x02,0x0F,0xFC,0x00,0x00,0x00,0x00,/*"动",4*/
0x00,0x00,0x00,0x42,0x44,0x44,0x4C,0xC8,0x54,0xD0,0x65,0x42,0x45,0x41,0x46,0x7E,0x84,0x40,0x88,0x40,0x90,0x50,0x81,0x48,0x80,0xC4,0x00,0x62,0x00,0x00,0x00,0x00,/*"系",2*/
0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0x11,0x22,0x31,0x22,0x51,0x22,0x91,0x22,0x11,0x22,0x11,0x22,0x11,0x22,0x1F,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,/*"自",3*/
CLCK2=1;
CLCK2=0;
}
}
void main(void)
{
TMOD=0x01;
TH0=(65536-2000)/256;
TL0=(65536-2000)%256;
TR0=百度文库;
ET0=1;
EA=1;
while(1);
}
void serve_led()interrupt 1 using 0 /*定时中断显示*/
16x16
周渴望南阳理工学院QQ418084696
本次设计中首先在做了8x8点阵汉子显示基础之上做的,其实点阵原理很简单,就像数码管动态显示一样简单,只要你分清楚行控制,与列控制,某段时间某列可以点亮,哪几行亮,动态扫描一个循环自然组成不同的图像。
这里取模方式是先最左边的一列选通,然后控制控制两个74ls164分别点亮16行中的几行,然后是从左向右第二列依次下去,形成动态扫描。本文程序非常简单,虽然没注释,认真看几十分钟就全明白了,说白了,数码管动态显示一回事(呵呵其实我自己做的时候下了不少功夫建议先做8x8)。
{k=2;
TH0=(65536-2000)/256;
TL0=(65536-2000)%256;
P2=0xff;
P2 = lie[num];
temp1=hang[num*2+zuo]; /*num*2表示第一个74ls164只去第偶数个字节,跟我的取模方式有关*/
shuru_1();
P2 = lie[num];
0x01,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x00,0x41,0x02,0x41,0x01,0x47,0xFE,0x45,0x00,0x49,0x00,0x51,0x00,0x61,0x00,0x41,0x00,0x01,0x00,0x01,0x00,0x00,0x00,/*"子",1*/
0x00,0x08,0x00,0x08,0x1F,0xC8,0x92,0x48,0x52,0x48,0x32,0x48,0x12,0x48,0x1F,0xFF,0x12,0x48,0x32,0x48,0x52,0x48,0x92,0x48,0x1F,0xC8,0x00,0x08,0x00,0x08,0x00,0x00,/*"单",6*/
unsigned char code hang[288]={0x00,0x00,0x00,0x00,0x1F,0xF8,0x11,0x10,0x11,0x10,0x11,0x10,0x11,0x10,0xFF,0xFE,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x1F,0xF9,0x00,0x01,0x00,0x0F,0x00,0x00,/*"电",0*/
void shuru_1();
void shuru_2();
unsigned char num,k,temp1,temp2,zuo=0;
unsigned int timecount;
unsigned char code lie[16]={0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f,};/*74hc154显示代码从左到右16列依次选通*/
};
void shuru_1() /*74ls164进行输入数据*/
{
uchar t;
for(t=0;t<8;t++)
{
temp1<<=1;
DATA1=CY;
CLCK1=1;
CLCK1=0;
}
}
void shuru_2()
{
uchar t;
for(t=0;t<8;t++)
{
temp2<<=1;
DATA2=CY;