基于FPGA控制的LED汉字滚动显示器设计.docx

上传人:b****1 文档编号:10302602 上传时间:2023-05-24 格式:DOCX 页数:18 大小:130.50KB
下载 相关 举报
基于FPGA控制的LED汉字滚动显示器设计.docx_第1页
第1页 / 共18页
基于FPGA控制的LED汉字滚动显示器设计.docx_第2页
第2页 / 共18页
基于FPGA控制的LED汉字滚动显示器设计.docx_第3页
第3页 / 共18页
基于FPGA控制的LED汉字滚动显示器设计.docx_第4页
第4页 / 共18页
基于FPGA控制的LED汉字滚动显示器设计.docx_第5页
第5页 / 共18页
基于FPGA控制的LED汉字滚动显示器设计.docx_第6页
第6页 / 共18页
基于FPGA控制的LED汉字滚动显示器设计.docx_第7页
第7页 / 共18页
基于FPGA控制的LED汉字滚动显示器设计.docx_第8页
第8页 / 共18页
基于FPGA控制的LED汉字滚动显示器设计.docx_第9页
第9页 / 共18页
基于FPGA控制的LED汉字滚动显示器设计.docx_第10页
第10页 / 共18页
基于FPGA控制的LED汉字滚动显示器设计.docx_第11页
第11页 / 共18页
基于FPGA控制的LED汉字滚动显示器设计.docx_第12页
第12页 / 共18页
基于FPGA控制的LED汉字滚动显示器设计.docx_第13页
第13页 / 共18页
基于FPGA控制的LED汉字滚动显示器设计.docx_第14页
第14页 / 共18页
基于FPGA控制的LED汉字滚动显示器设计.docx_第15页
第15页 / 共18页
基于FPGA控制的LED汉字滚动显示器设计.docx_第16页
第16页 / 共18页
基于FPGA控制的LED汉字滚动显示器设计.docx_第17页
第17页 / 共18页
基于FPGA控制的LED汉字滚动显示器设计.docx_第18页
第18页 / 共18页
亲,该文档总共18页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

基于FPGA控制的LED汉字滚动显示器设计.docx

《基于FPGA控制的LED汉字滚动显示器设计.docx》由会员分享,可在线阅读,更多相关《基于FPGA控制的LED汉字滚动显示器设计.docx(18页珍藏版)》请在冰点文库上搜索。

基于FPGA控制的LED汉字滚动显示器设计.docx

基于FPGA控制的LED汉字滚动显示器设计

基于FPGA控制的LED汉字滚动显示器设计

  2硬件原理图

  整个电路由五大部分组成:

时钟计数模块GEL_CLK,存储汉字字模的ROM模块ROMZI,数据分配器模块MUX,移位模块YW及显示模块XIANSH-I。

时钟计数模块用于产生整个电路所需要的时钟及其对时钟的计数值,例如:

移位时钟CLKYW,移位计数器CNTYW,字计数器CNTWORD,显示扫描计数器CNTSM。

ROMZI模块是由QualtusⅡ中的LPM1PORTROM定制成,用来存储8个待显示的汉字。

MUX模块用于在扫描时钟及扫描计数器的作用下,从ROM中读出一个汉字的8个行字模信息,送给移位模块YW,YW模块在移位时钟及移位计数器作用下,根据SELECT信号选择对读出的字模信息,进行相应的移位(左移、右移、上移、下移)后,最后送显示模块DISP驱动LED点阵显示汉字。

原理图如图2所示。

  3.2ROMZI模块

  利用LPM参数化模块库中单口ROM,利用QualtusⅡ中的MegaWizardPlug-InManager定制而成,定制前首先要制作LPMROM初始化文件,其中存储待显示汉字的字模数据,然后按照LPMMegaWizardPlug-InManager的向导提示,结合设计要求进行定制。

  图3为所定制ROM中的初始化汉字“元旦生日开心快乐”的字型码。

数据分配模块MUX要求能在8个时钟作用下,从ROM中读出一行(一个汉字的8个字型码)分别送到数据分配器中的WLl~WL8输出端。

图4为数据分配模块在扫描时钟作用下读取的字模数据,比较图3和图4可知,仿真结果正确,能满足题目要求。

3.3移位模块YW

  移位模块YW是整个设计的核心,行扫描实现左移,是通过每来一个移位时钟,将每一行的字模按位左移一位,扫描时钟到来时送出移位后的新字模。

通过8次移位,可将一个汉字移出点阵平面,按类似的道理,也可以将一个汉字经8次移位后移进点阵平面。

本例(图2)中,CNTYW为移位时钟的计数值,以WLl~WL8为欲显示汉字的原始字模,L10~L80为移位后从列上送出的8行显示字模信息,LLl~LL8为8个原始字模信息未送出位的暂存信号。

设计中需要16个移位时钟,通过前8个时钟将WLl~WL8字模移进LED点阵平面,再经后8个时钟,将汉字又一位一位地移出。

移位设计参考文献中有关移位寄存器的设计,分计数值为“0000"和非"0000"两部分处理,对第一行字模的处理为:

 

  其他行可按相同方法处理,具体参见如下的程序:

libraryIEEE;

useIEEE.std_logic_1164.all;

useieee.std_logic_arith.all;

useieee.std_logic_unsigned.all;

entitymemtestis

port(

rst:

instd_logic;

clk:

instd_logic;

den:

instd_logic;--serialinputenable

rxd:

instd_logic;--serialinputdata

outen:

instd_logic;--outputdatarequest

rdmem:

outstd_logic;--readmemory

wrmem:

outstd_logic;--writememory

csmem:

outstd_logic;--chipenablememory

memdata:

inoutstd_logic_vector(7downto0);--memorydatainterface

memaddr:

outstd_logic_vector(2downto0);--memoryaddress

dataout:

outstd_logic_vector(7downto0);--dataoutput

dataclkout:

outstd_logic--dataoutputsyncclk

);

endmemtest;

architecturebehavofmemtestis

constants0:

std_logic_vector(2downto0):

="001";

constants1:

std_logic_vector(2downto0):

="010";

constants2:

std_logic_vector(2downto0):

="100";

signalss:

std_logic_vector(2downto0);

signalrdmemaddr,wrmemaddr:

std_logic_vector(2downto0);

signalrxdcnt:

std_logic_vector(3downto0);

signalrdmemdata,wrmemdata:

std_logic_vector(7downto0);

signalwrmem_s,wrrdy,dataclkout_s:

std_logic;

begin

process(rst,clk)

begin

ifrst='0'then

wrmemdata<=(others=>'0');

elsifclk'eventandclk='1'then

ifden='1'then

wrmemdata(7)<=wrmemdata(6);

wrmemdata(6)<=wrmemdata(5);

wrmemdata(5)<=wrmemdata(4);

wrmemdata(4)<=wrmemdata(3);

wrmemdata(3)<=wrmemdata

(2);

wrmemdata

(2)<=wrmemdata

(1);

wrmemdata

(1)<=wrmemdata(0);

wrmemdata(0)<=rxd;

endif;

endif;

endprocess;

process(rst,clk)

begin

ifrst='0'then

rxdcnt<=(others=>'0');

elsifclk'eventandclk='1'then

ifden='1'then

ifrxdcnt=9then

rxdcnt<=rxdcnt;

else

rxdcnt<=rxdcnt+1;

endif;

else

rxdcnt<=(others=>'0');

endif;

endif;

endprocess;

process(rst,clk)

begin

ifrst='0'then

ss<=s0;

elsifclk'eventandclk='1'then

casessis

whens0=>

ifwrrdy='1'then

ss<=s1;

elsifouten='1'then

ss<=s2;

endif;

whens1=>

ss<=s0;

whens2=>

ss<=s0;

whenothers=>

ss<=s0;

endcase;

endif;

endprocess;

process(rst,clk)

begin

ifrst='0'then

wrrdy<='0';

elsifclk'eventandclk='1'then

ifss=s1then

wrrdy<='0';

else

ifrxdcnt=8then

wrrdy<='1';

else

wrrdy<='0';

endif;

endif;

endif;

endprocess;

wrmem_s<='0'whenss=s1else'1';

rdmem<='0'whenss=s2else'1';

csmem<='1'whenss=s1orss=s2else'0';

process(rst,clk)

begin

ifrst='0'then

dataclkout_s<='0';

elsifclk'eventandclk='1'then

ifss=s2then

dataclkout_s<='1';

else

dataclkout_s<='0';

endif;

endif;

endprocess;

process(clk)

begin

ifclk'eventandclk='1'then

dataclkout<=dataclkout_s;

endif;

endprocess;

process(rst,clk)

begin

ifrst='0'then

dataout<=(others=>'0');

elsifclk'eventandclk='1'then

ifss=s2then

dataout<=rdmemdata;

endif;

endif;

endprocess;

process(rst,clk)

begin

ifrst='0'then

wrmemaddr<=(others=>'0');

elsifclk'eventandclk='1'then

ifss=s1then

wrmemaddr<=wrmemaddr+1;

endif;

endif;

endprocess;

process(rst,clk)

begin

ifrst='0'then

rdmemaddr<=(others=>'0');

elsifclk'eventandclk='1'then

ifss=s2then

rdmemaddr<=rdmemaddr+1;

endif;

endif;

endprocess;

memaddr<=wrmemaddrwhenwrmem_s='0'elserdmemaddr;

memdata<=wrmemdatawhenwrmem_s='0'else"ZZZZZZZZ";

rdmemdata<=memdata;

wrmem<=wrmem_s;

endbehav;

 

libraryIEEE;

useIEEE.std_logic_1164.all;

useieee.std_logic_arith.all;

useieee.std_logic_unsigned.all;

entitystatesis

port(

rst:

instd_logic;

clk:

instd_logic;

nscar:

instd_logic;

ewcar:

instd_logic;

nsred:

outstd_logic;

nsgreen:

outstd_logic;

nsyellow:

outstd_logic;

ewred:

outstd_logic;

ewgreen:

outstd_logic;

ewyellow:

outstd_logic

);

endstates;

architecturebehavofstatesis

constants0:

std_logic_vector(1downto0):

="00";--ewgreen

constants1:

std_logic_vector(1downto0):

="01";

constants2:

std_logic_vector(1downto0):

="11";--nsgreen

constants3:

std_logic_vector(1downto0):

="10";

signalss:

std_logic_vector(1downto0);

signaltm60s,tm40s:

std_logic_vector(5downto0);

signaltm3s:

std_logic_vector(1downto0);

signalentm60s,entm40s,entm3s,tm60soc,tm40soc,tm3soc:

std_logic;

begin

process(rst,clk)

begin

ifrst='0'then

ss<=s0;

elsifclk'eventandclk='1'then

casessis

whens0=>

ifnscar='1'then

ifewcar='1'then

iftm60soc='1'then

ss<=s1;

endif;

else

ss<=s1;

endif;

endif;

whens1=>

iftm3soc='1'then

ss<=s2;

endif;

whens2=>

ifnscar='1'then

ifewcar='1'then

iftm40soc='1'then

ss<=s3;

endif;

endif;

else

ss<=s3;

endif;

whens3=>

iftm3soc='1'then

ss<=s0;

endif;

whenothers=>

ss<=s0;

endcase;

endif;

endprocess;

process(rst,clk)

begin

ifrst='0'then

entm60s<='0';

elsifclk'eventandclk='1'then

ifss=s0then

entm60s<='1';

else

entm60s<='0';

endif;

endif;

endprocess;

process(rst,clk)

begin

ifrst='0'then

entm40s<='0';

elsifclk'eventandclk='1'then

ifss=s2then

entm40s<='1';

else

entm40s<='0';

endif;

endif;

endprocess;

process(rst,clk)

begin

ifrst='0'then

entm3s<='0';

elsifclk'eventandclk='1'then

ifss=s1orss=s3then

entm3s<='1';

else

entm3s<='0';

endif;

endif;

endprocess;

process(rst,clk)

begin

ifrst='0'then

tm60s<=B"000000";

elsifclk'eventandclk='1'then

ifentm60s='1'then

iftm60s=59then

tm60s<=B"000000";

else

tm60s<=tm60s+1;

endif;

else

tm60s<=B"000000";

endif;

endif;

endprocess;

process(rst,clk)

begin

ifrst='0'then

tm40s<=B"000000";

elsifclk'eventandclk='1'then

ifentm40s='1'then

iftm40s=39then

tm40s<=B"000000";

else

tm40s<=tm40s+1;

endif;

else

tm40s<=B"000000";

endif;

endif;

endprocess;

process(rst,clk)

begin

ifrst='0'then

tm3s<=B"00";

elsifclk'eventandclk='1'then

ifentm3s='1'then

iftm3s=2then

tm3s<=B"00";

else

tm3s<=tm3s+1;

endif;

else

tm3s<=B"00";

endif;

endif;

endprocess;

process(rst,clk)

begin

ifrst='0'then

tm60soc<='0';

elsifclk'eventandclk='1'then

iftm60s=59then

tm60soc<='1';

else

tm60soc<='0';

endif;

endif;

endprocess;

process(rst,clk)

begin

ifrst='0'then

tm40soc<='0';

elsifclk'eventandclk='1'then

iftm40s=39then

tm40soc<='1';

else

tm40soc<='0';

endif;

endif;

endprocess;

process(rst,clk)

begin

ifrst='0'then

tm3soc<='0';

elsifclk'eventandclk='1'then

iftm3s=2then

tm3soc<='1';

else

tm3soc<='0';

endif;

endif;

endprocess;

process(rst,clk)

begin

ifrst='0'then

nsred<='1';

nsgreen<='0';

nsyellow<='0';

ewred<='0';

ewgreen<='1';

ewyellow<='0';

elsifclk'eventandclk='1'then

casessis

whens0=>

nsred<='1';

nsgreen<='0';

nsyellow<='0';

ewred<='0';

ewgreen<='1';

ewyellow<='0';

whens1=>

nsred<='0';

nsgreen<='0';

nsyellow<='1';

ewred<='0';

ewgreen<='0';

ewyellow<='1';

whens2=>

nsred<='0';

nsgreen<='1';

nsyellow<='0';

ewred<='1';

ewgreen<='0';

ewyellow<='0';

whens3=>

nsred<='0';

nsgreen<='0';

nsyellow<='1';

ewred<='0';

ewgreen<='0';

ewyellow<='1';

whenothers=>

endcase;

endif;

endprocess;

endbehav;

 

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

当前位置:首页 > 人文社科 > 哲学历史

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2