16X64点阵显示屏文档格式.docx

上传人:b****7 文档编号:22587517 上传时间:2023-02-04 格式:DOCX 页数:14 大小:2.10MB
下载 相关 举报
16X64点阵显示屏文档格式.docx_第1页
第1页 / 共14页
16X64点阵显示屏文档格式.docx_第2页
第2页 / 共14页
16X64点阵显示屏文档格式.docx_第3页
第3页 / 共14页
16X64点阵显示屏文档格式.docx_第4页
第4页 / 共14页
16X64点阵显示屏文档格式.docx_第5页
第5页 / 共14页
点击查看更多>>
下载资源
资源描述

16X64点阵显示屏文档格式.docx

《16X64点阵显示屏文档格式.docx》由会员分享,可在线阅读,更多相关《16X64点阵显示屏文档格式.docx(14页珍藏版)》请在冰豆网上搜索。

16X64点阵显示屏文档格式.docx

⒈原理图

列驱动模块及4路独立按键

2.源程序代码:

#include<

reg52.h>

//头文件

#include"

hanzi.h"

#defineucharunsignedchar

#defineuintunsignedint

//*****************************************************************//

sbitR=P2^2;

//定义数据输入端口P2^0

sbitCLK=P2^0;

//时钟信号

sbitSTB=P2^1;

//595锁存信号

sbitkey1=P1^0;

sbitkey2=P1^1;

sbitkey3=P1^2;

sbitkey4=P1^3;

uchark1_flag=0,k2_flag=0,k3_flag=0,n;

ucharyd,h;

//m为移动计数器,h为行段计数器;

longzimo;

//字模计数器

ucharBUFF[10];

//缓存;

floatd=40;

voidkey();

//按键处理函数

voidtiaozheng_data(void);

//调整数据函数

voidfasong_data(void);

//发送数据函数

voidsaomiao(void);

//行扫描函数

voidwritebyte(chardat);

//595写一字节函数

//************595写入数据函数***************//

voidwritebyte(unsignedchardat)

{

chari;

for(i=0;

i<

8;

i++)//循环8次,把编码传给锁存器

{

dat=dat>

>

1;

//右移一位,取出该字节的最低位

R=CY;

//将该字节的最低位传给R

CLK=0;

//上升沿将数据移入595

CLK=1;

}

}

//************************************//

voiddelayms(uintz)//误差0us

unsignedchara,b,c;

for(c=z;

c>

0;

c--)

for(b=38;

b>

b--)

for(a=130;

a>

a--);

/*******************************************/

voidsaomiao()//16行扫描

for(h=0;

h<

16;

h++)

tiaozheng_data();

//调整数据

fasong_data();

//串口发送数据

P0=1;

//关闭显示

STB=1;

//595锁存信号。

锁存为高

P0=h;

//送行选

STB=0;

//****************按键检测程序*****************//

voidkey()

if(key1==0)

delayms(200);

//按键去抖

if(key1==0)

{

while(!

key1);

k1_flag+=1;

n++;

if(k1_flag==5)

k1_flag=0;

}

if(key2==0)

if(key2==0&

d<

=25)

d+=0.5;

//速度变慢;

if(key3==0)

if(key3==0&

d>

=3)

d-=0.2;

//速度加快;

/***************************************/

voidtiaozheng_data(void)//装载点阵数据

chars;

if(k1_flag==0|k1_flag==1|k1_flag==2)//"

左移"

for(s=4;

s>

=0;

s--)

{

if(k1_flag==0)

{

BUFF[2*s]=table1[zimo+32*s+2*h];

BUFF[2*s+1]=table1[zimo+1+32*s+2*h];

}

if(k1_flag==1)

BUFF[2*s]=table2[zimo+32*s+2*h];

BUFF[2*s+1]=table2[zimo+1+32*s+2*h];

if(k1_flag==2)

BUFF[2*s]=table3[zimo+32*s+2*h];

BUFF[2*s+1]=table3[zimo+1+32*s+2*h];

}

if(k1_flag==3|k1_flag==4)//"

右移"

if(k1_flag==3)

BUFF[2*s+1]=table2[zimo+32*s+2*h];

BUFF[2*s]=table2[zimo+1+32*s+2*h];

if(k1_flag==4)

BUFF[2*s+1]=table3[zimo+32*s+2*h];

BUFF[2*s]=table3[zimo+1+32*s+2*h];

/********************************/

voidfasong_data()//串行发送数据

chars;

ucharinc,tempyid,temp;

if(yd<

8)

inc=0;

//inc决定从第一个还是第二个字模开始读取

else

inc=1;

if(k1_flag==0|k1_flag==1|k1_flag==2)//如果是"

for(s=0+inc;

s<

8+inc;

s++)//发送2字节数据

if(yd<

8)//如果移动少于8位

tempyid=yd;

else

tempyid=yd-8;

temp=(BUFF[s]>

tempyid)|(BUFF[s+1]<

<

(8-tempyid));

//h1左移tempyid位后和h2右移8-tempyid相或,取出移位后的数据

writebyte(temp);

if(k1_flag==3|k1_flag==4)//如果是"

for(s=8+inc;

=0+inc;

s--)//发送2字节数据

temp=(BUFF[s]<

tempyid)|(BUFF[s+1]>

//**************************************************************************************//

voidmain()

uchari;

//d的大小决定移动速度

yd=0;

//移动计数器,记录移动字节数

zimo=0;

//字模计数器,记录字数

while

(1)

while(yd<

16)

{

for(i=0;

d;

i++)

{

key();

//按键扫描函数

saomiao();

//调用扫描函数

yd++;

//移动一位

yd=0;

zimo=zimo+32;

//向后移动一个字

if(k1_flag==0)

if(zimo>

=32*65)//取决于字数默认table1[]

zimo=0;

if(k1_flag==1)//取决于字数table2[]

=32*24)//取决于字数

if(k1_flag==2)//取决于字数table3[]

=32*141)//取决于字数

if(k1_flag==3)//取决于字数table2[]

if(k1_flag==4)

=32*141)//取决于字数table3[]

3.实物图

按键功能说明

五、使用说明

1、自锁开关为电源开关;

2、第二个按键为复位开关

3、第三个按键为功能转换开关(在不同的文字之间选择,选择左移和右移);

4、第四个按键为减速;

5、第五个按键为加速;

六、制作过程遇到的问题

16X64点阵过长,导致PCB画的不好,由于技术不过硬,走了很多跳线。

Led灯在焊接的时候经常会被焊坏掉,排列不紧凑等,对数据的处理不熟悉。

七、制作心得

通过点阵的制作能够了解到点阵显示的大致原理以及一些芯片的用法和数据的处理,在检查每个led灯的好坏时要有耐心,1024个led灯每个都要顾及到,制作pcb时要考虑周到对于电子知识的学习一定要花时间和精力。

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 党团工作 > 入党转正申请

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1