首页 LCD控制VHDL程序与仿真

LCD控制VHDL程序与仿真

举报
开通vip

LCD控制VHDL程序与仿真8.3 LCD控制VHDL程序与仿真 1. FPGA驱动LCD显示中文字符“年”程序 --文件名:lcd_driver.vhd。 --功能:FGAD驱动LCD显示中文字符“年”。 --最后修改日期:2004.3.24。 library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity lcd_driver is Port ( clk...

LCD控制VHDL程序与仿真
8.3 LCD控制VHDL程序与仿真 1. FPGA驱动LCD显示中文字符“年”程序 --文件名:lcd_driver.vhd。 --功能:FGAD驱动LCD显示中文字符“年”。 --最后修改日期:2004.3.24。 library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity lcd_driver is Port ( clk : in std_logic; --状态机时钟信号,同时也是液晶时钟信号,其周期应该满足液晶数据的建立时间 reset:in std_logic; lcdda : out std_logic; --寄存器选择信号 lcdrw : out std_logic; --液晶读写信号 lcden : out std_logic; --液晶时钟信号 data : out std_logic_vector(7 downto 0)); --液晶数据信号 end lcd_driver; architecture Behavioral of lcd_driver is type state is (set_dlnf,set_cursor,set_dcb,set _cgram,write _cgram,set_ddram,write_data); signal current_state:state; type ram2 is array(0 to 7) of std_logic_vector(7 downto 0); constant cgram:ram2:=(("00001000"),("00001111"),("00010010"), ("00001111"),("00001010"),("00011111"),("00000010"),("00000010"));--年字符数据存储器 signal clkk : std_logic; begin lcden <= clk ; --液晶时钟信号 lcdrw <= '0' ; --写数据 control:process(clk,reset,current_state) --液晶驱动控制器 variable cnt1: std_logic_vector(2 downto 0); begin if reset='0'then current_state<=set_dlnf; cnt1:=(others => '1'); lcdda<='0'; elsif rising_edge(clk)then current_state <= current_state ; lcdda <= '0'; case current_state is when set_dlnf=> data<="00111100";--3cH current_state<=set_cursor; when set_cursor=> data<="00000110";--06H current_state<=set_dcb; when set_dcb=> data<="00001111";--0fH current_state<=set_ cgram; when set_ cgram=> data<="01000000";--40H current_state<=write_ cgram; when write_ cgram=> --向CGRAM中写入“年” lcdda<='1'; cnt1:=cnt1+1; data<=cgram(conv_integer(cnt1)); if cnt1 = "111" then current_state<=set_ddram; end if; when set_ddram=> --从第一行的起始地址开始显示 data<="10000000";--80H current_state<=write_data; when write_data=> lcdda<='1'; data<="00000000"; --写入字符“年” when others => null; end case; end if; end process; end Behavioral; PAGE
本文档为【LCD控制VHDL程序与仿真】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_803824
暂无简介~
格式:doc
大小:26KB
软件:Word
页数:2
分类:互联网
上传时间:2013-10-10
浏览量:20