网站公告列表

  没有公告

加入收藏
设为首页
联系站长
您现在的位置: 61IC中国电子在线 >> EDA >> HDL >> 文章正文
  FPGA驱动LCD显示中文字符“年”程序           ★★★ 【字体:
FPGA驱动LCD显示中文字符“年”程序
作者:Free    文章来源:Free    点击数:    更新时间:2008-1-3    

--文件名: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;

               欢迎点击进入:TI德州中文网   (国内唯一针对TI应用的中文技术网站)    文章录入:admin    责任编辑:admin 
  • 上一篇文章:

  • 下一篇文章:
  • 发表评论】【加入收藏】【告诉好友】【打印此文】【关闭窗口
    最新热点 最新推荐 相关文章
    FPGA驱动LED静态显示
    多进制数字频率调制(MFSK)系…
      网友评论:(只显示最新10条。评论内容只代表网友观点,与本站立场无关!)
    站长:61IC 湘ICP备05002478号