收藏 分销(赏)

毕业设计-课程设计--基于fpga的液晶显示控制器设计.doc

上传人:精*** 文档编号:2180017 上传时间:2024-05-22 格式:DOC 页数:22 大小:542.50KB
下载 相关 举报
毕业设计-课程设计--基于fpga的液晶显示控制器设计.doc_第1页
第1页 / 共22页
毕业设计-课程设计--基于fpga的液晶显示控制器设计.doc_第2页
第2页 / 共22页
毕业设计-课程设计--基于fpga的液晶显示控制器设计.doc_第3页
第3页 / 共22页
毕业设计-课程设计--基于fpga的液晶显示控制器设计.doc_第4页
第4页 / 共22页
毕业设计-课程设计--基于fpga的液晶显示控制器设计.doc_第5页
第5页 / 共22页
点击查看更多>>
资源描述

1、电子信息工程专业 专业综合课程设计 基于FPGA的液晶显示控制器设计学 院(系): 信息与通信工程 专 业: 电子信息工程 专业综合课程设计题目目 录1设计指标及要求11.1任务及要求11.2设计原理12系统硬件电路设计22.1FPGA核心板22.2液晶显示部分32.3按键控制部分53系统软件设计54系统调试64.1硬件调试64.2软件调试75结论76参考文献7附录一 系统硬件电路图(原理图,PCB)8附录二 实物照片9附录三 系统完整程序代码9- 20 -1设计指标及要求1.1任务及要求 采用FPGA技术实现液晶的显示功能,要求学生选好液晶芯片,画出电路板,做好硬件电路后调试程序,基本功能要

2、求显示字符,扩展功能是显示动画。1.2设计原理显示控制模块是通过对FPGA芯片的编程,在此同时通过调用显示ROM文件中的字库,找到相应的二进制显示代码,再一条一条地送到显示驱动电路中,最后经过放大,送到点阵中的液晶去显示。系统的整体框图如下图所示:2系统硬件电路设计2.1FPGA核心板2.2液晶显示部分12864各引脚的功能如下:引脚号 引脚名称 引脚功能描述 1 VSS 电源地2 VDD 电源电压 3 V0 LCD驱动负电压,调节LCD对比度4 RS H:DB0-DB7为显示数据 L: DB0-DB7为指令数据5 R/W R/W=H,E=H数据被读到DB0-DB7 R/W=L,E=H DB0

3、-DB7数据写到IR或DR6 E 使能信号:R/W=L,E信号下降沿锁存到DB0-DB7; R/W=H,E=H,DDRAM数据读到DB0-DB77 DB0DB7 8位三态并行数据总线8 PSB PSB=H时为并行输入方式,PSB=L时为串行输入方式9 RST 复位端,低电平有效 12864的信号功能表如下图所示: 12864的工作时序如下图所示:2.3按键控制部分 按键连接电路如下图所示: 按键分别连接着FPGA芯片的I/O口,通过拨动按键使液晶显示不同的字符。3系统软件设计 程序流程图如下图所示: 4系统调试调试分为硬件调试和软件调试。4.1硬件调试1、上电之前,用万用表测试电源与地未短路。

4、2、上电接通电路,指示灯正常点亮。3、但12864液晶屏背光灯点亮,却未出现正常阴影,将12864反插接入电路,液晶屏点亮,出现正常阴影,检查PCB及原理图发现12864引脚并未接错,于是参考已有12864的多种电路接法,更改板子上的12864电路,问题却仍得不到解决,最终发现是所用12864液晶屏自带电路已默认选择串行数据通信,而我们所采用的电路都是并行数据通信电路,将12864液晶屏自带电路改焊,液晶屏正常点亮。原先设计12864电路所加的用于调节液晶屏对比度的滑动变阻器,实际使用时,发现并未起作用,故将其去掉。4、向板子内烧录简单的显示程序,12864液晶屏正常显示出编写的内容。至此,硬

5、件调试完成。4.2软件调试1、先根据整体思路确定了软件采用状态机的方式编写。然后查阅了12864液晶屏的使用手册以及EP4CE6E22芯片使用手册,确定了基本的操作要求,并根据要求进行了12864读数据写数据的程序编写,建成工程,完成编译,烧录进芯片,上电后,正确显示成功,完成了初步调试。2、画出了程序框图,然后将各部细节补充出来。3、正确的延时对于12864液晶屏的正确显示至关重要。要想延时正确就得先解决时序的问题,我们通过借鉴以往的学习EDA时所做的实验,直接套用了一个典型分频程序,解决了该问题。4、在程序里延时的正确使用是一大难点,因为VHDL语言仿真性极强,其独有的延时语句,多数只支持

6、仿真状态,综合设计时并不能通过编译,无法实现,我们尝试了诸如for、loop、wait until、wait on等语句都未能正常编译通过,最后采用if语句,计数延时才得以正确延时。5、最终,我们经过多次删改,基本完成了预期要实现的设计目标。5结论本设计硬件电路的使用比较简单,所用元器件较少,电路中使用了FPGA芯片和LCD12864液晶显示器等主要芯片,实现了预计的功能。在对芯片的管脚功能和用法有了充分的了解后,根据原先的选择好的设计要求设计硬件电路,包括FPGA控制电路、按键接口电路、显示电路。然后通过软件编程,实现了用按键进行控制,用液晶模块进行显示,基本完成了预期要实现的目标。6参考文

7、献1 潘松, 黄继业. EDA技术实用教程VHDL版M. 第四版. 北京:科学出版社, 2010.2 赵俊超等. 集成电路设计VHDL教程M. 北京:北京希望电子出版社, 2009.3 李维是, 郭强. 液晶显示应用技术M. 北京:电子工业出版社, 2011.附录一 系统硬件电路图(原理图,PCB)附录二 实物照片附录三 系统完整程序代码-12864液晶的显示- -时钟:50MHZ library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity lcd12864 is generic( div

8、ide_500k:integer:=100;-100分频后:500KHZ:2us cnt1_value:integer:=50 ); port( clk,reset:in std_logic;key:in std_logic_vector(1 downto 0); rs,rw,en:out std_logic; data:out std_logic_vector(7 downto 0) ); end entity; architecture behavior of lcd12864 is type word is array(0 to 15) of std_logic_vector(7 dow

9、nto 0);-数组中的左起第1个数为数组中的最低位对应的数,所以设置为array(0 to 3),而不是array(3 downto 0)。 type state is( set_dlnf,set_cursor,set_dcb,set_shift, set_ddram1,set_ddram2,set_ddram3,set_ddram4, write_xuexiao,write_zhuanye,write_mc,write_fh, over ); constant name1:word:=(10100001,11101111,10110100,11110011,11000001,1010110

10、0,11000011,11110001,11010111,11100101,11010001,10100111,11010100,10111010,10100001,11101111);-大连民族大学 constant name2:word:=(10100001,11101111,10110101,11100111,11010111,11010011,11010000,11000101,11001111,10100010,10111001,10100100,10110011,11001100,10100001,11101111);-电子信息工程 constant name3:word:=(11

11、001101,11110101,10111010,10110001,10100001,11101111,10100001,11101111,10100001,11101111,11001101,11110100,11010101,11010111,10111001,11111010);-李瑞constant name4:word:=(11010111,10100011,11000000,11001111,11001010,10100110,10111101,11011010,11001000,11010101,10111111,11101100,11000000,11010110,101000

12、11,10100001);-祝老师节日快乐constant name5:word:=(11010111,10100011,11000000,11001111,11001010,10100110,11001001,11101101,11001100,11100101,10111101,10100001,10111111,10110101,10100011,10100001);-祝老师身体健康constant name6:word:=(11010111,10100011,11000000,11001111,11001010,10100110,11001101,11110010,11001010,1

13、1000010,11001000,11100111,11010010,11100010,10100011,10100001);-祝老师万事如意constant name7:word:=(11010111,10100011,11000000,11001111,11001010,10100110,10111010,11001111,10111100,11010010,11010000,11010010,10111000,10100011,10100011,10100001);-祝老师阖家幸福signal pr_state:state; signal newclk:std_logic; begin

14、process(clk) is variable num:integer range 0 to divide_500k; begin if(clkevent and clk=1)then num:=num+1; if(num=divide_500k) then num:=0; end if; if(numdivide_500k/2) then-设置占空比 newclk=0; else newclk=1; end if; end if; end process; process(newclk,reset,pr_state,key) is variable cnt1:integer range 0

15、 to 100*cnt1_value:=0; variable cnt2:integer range 0 to 100:=0; begin if reset=0 then pr_state=set_dlnf;-把状态set_dlnf赋于pr_state cnt1:=0; cnt2:=0; en=0; rs=0; rw=0; data=00000001;-清屏 en cnt1:=cnt1+1; if(cnt1cnt1_value) then en=0; rs=0; -命令 rw=0; -写 elsif(cnt12*cnt1_value) then data=00110000; -选择8位数据基本

16、指令集:0x30 elsif(cnt120*cnt1_value) then en=1; elsif(cnt1=20*cnt1_value) then en=0; cnt1:=0; pr_state cnt1:=cnt1+1; if(cnt1cnt1_value) then en=0; elsif(cnt12*cnt1_value) then data=00001100; -整体显示设置:光标OFF 反光0FF:0x0c elsif(cnt120*cnt1_value) then en=1; elsif(cnt1=20*cnt1_value) then en=0; cnt1:=0; pr_st

17、ate cnt1:=cnt1+1; if(cnt1cnt1_value) then en=0; elsif(cnt12*cnt1_value) then data=00000001; -清除显示,并且认定地址指针为00h:0x01 elsif(cnt120*cnt1_value) then en=1; elsif(cnt1=20*cnt1_value) then en=0; cnt1:=0; pr_state cnt1:=cnt1+1; if(cnt1cnt1_value) then en=0; elsif(cnt12*cnt1_value) then data=00000110; -指定游标

18、的移动方向及指定显示的移位:0x06 elsif(cnt120*cnt1_value) then en=1; elsif(cnt1=20*cnt1_value) then en=0; cnt1:=0; pr_state cnt1:=cnt1+1; if(cnt1cnt1_value) then en=0; elsif(cnt12*cnt1_value) then data=10000000; -从第一行的第一个字开始显示:0x80 elsif(cnt120*cnt1_value) then en=1; elsif(cnt1=20*cnt1_value) then en=0; cnt1:=0;

19、pr_state cnt1:=cnt1+1; if cnt11*cnt1_value then en=0; rs=1; -选择数据 rw=0; elsif cnt12*cnt1_value thenif key=00 then data=name1(cnt2) ; -送数据 elsif key=01 then data=name1(cnt2); elsif key=10 then data=name3(cnt2);elsif key=11 then data=name4(cnt2);end if; elsif cnt120*cnt1_value then en=1; -在上升沿时,数据才能写入

20、液晶,所以要先送数据,再让使能端变高 elsif cnt1=20*cnt1_value then en=0; -通过液晶的时序图知:使能端先低,送数据,使能端升高,再变低。 cnt1:=0; cnt2:=cnt2+1; if cnt2=16 then pr_state cnt1:=cnt1+1; en=0; rw=0; rs=0; if(cnt1cnt1_value) then en=0; elsif(cnt12*cnt1_value) then data=10010000; -从第二行的第一个字开始显示:0x80 elsif(cnt120*cnt1_value) then en=1; els

21、if(cnt1=20*cnt1_value) then en=0; cnt1:=0; pr_state cnt1:=cnt1+1; if cnt11*cnt1_value then en=0; rs=1; -选择数据 rw=0; elsif cnt12*cnt1_value then if key=00 then data=name2(cnt2); -送数据elsif key=01 then data=name1(cnt2);elsif key=10 then data=name3(cnt2);elsif key=11 then data=name5(cnt2);end if; elsif c

22、nt120*cnt1_value then en=1; -在上升沿时,数据才能写入液晶,所以要先送数据,再让使能端变高 elsif cnt1=20*cnt1_value then en=0; -通过液晶的时序图知:使能端先低,送数据,使能端升高,再变低。 cnt1:=0; cnt2:=cnt2+1; if cnt2=16 then pr_state cnt1:=cnt1+1; en=0; rw=0; rs=0; if(cnt1cnt1_value) then en=0; elsif(cnt12*cnt1_value) then data=10001000; -从第三行的第一个字开始显示:0x8

23、0 elsif(cnt120*cnt1_value) then en=1; elsif(cnt1=20*cnt1_value) then en=0; cnt1:=0; pr_state cnt1:=cnt1+1; if cnt11*cnt1_value then en=0; rs=1; -选择数据 rw=0; elsif cnt12*cnt1_value then if key=00 then data=name3(cnt2); -送数据elsif key=01 then data=name1(cnt2);elsif key=10 then data=name3(cnt2);elsif key

24、=11 then data=name6(cnt2); end if; elsif cnt120*cnt1_value then en=1; -在上升沿时,数据才能写入液晶,所以要先送数据,再让使能端变高 elsif cnt1=20*cnt1_value then en=0; -通过液晶的时序图知:使能端先低,送数据,使能端升高,再变低。 cnt1:=0; cnt2:=cnt2+1; if cnt2=16 then pr_state cnt1:=cnt1+1; en=0; rw=0; rs=0; if(cnt1cnt1_value) then en=0; elsif(cnt12*cnt1_val

25、ue) then data=10011000; -从第四行的第一个字开始显示:0x80 elsif(cnt120*cnt1_value) then en=1; elsif(cnt1=20*cnt1_value) then en=0; cnt1:=0; pr_state cnt1:=cnt1+1; if cnt11*cnt1_value then en=0; rs=1; -选择数据 rw=0; elsif cnt12*cnt1_value then if key=00 then data=name4(cnt2); -送数据elsif key=01 then data=name1(cnt2);el

26、sif key=10 then data=name3(cnt2);elsif key=11 then data=name7(cnt2);end if; elsif cnt120*cnt1_value then en=1; -在上升沿时,数据才能写入液晶,所以要先送数据,再让使能端变高 elsif cnt1=20*cnt1_value then en=0; -通过液晶的时序图知:使能端先低,送数据,使能端升高,再变低。 cnt1:=0; cnt2:=cnt2+1; if cnt2=16 then pr_state null; when others= en=Z; rs=Z; rw=Z; dataZ); cnt1:=0; cnt2:=0; end case; end if;end process; end architecture;

展开阅读全文
相似文档                                   自信AI助手自信AI助手
猜你喜欢                                   自信AI导航自信AI导航
搜索标签

当前位置:首页 > 学术论文 > 毕业论文/毕业设计

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        获赠5币

©2010-2024 宁波自信网络信息技术有限公司  版权所有

客服电话:4008-655-100  投诉/维权电话:4009-655-100

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :gzh.png    weibo.png    LOFTER.png 

客服