日本黄色一级经典视频|伊人久久精品视频|亚洲黄色色周成人视频九九九|av免费网址黄色小短片|黄色Av无码亚洲成年人|亚洲1区2区3区无码|真人黄片免费观看|无码一级小说欧美日免费三级|日韩中文字幕91在线看|精品久久久无码中文字幕边打电话

當前位置:首頁 > 嵌入式 > 嵌入式教程
[導讀]基于FPGA的中文字符顯示的VHDL程序

--文件名:lcd_driver.vhd。

  --功能:FGAD驅(qū)動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; --狀態(tài)機時鐘信號,同時也是液晶時鐘信號,其周期應該滿足液晶數(shù)據(jù)的建立時間

  reset:in std_logic;

  lcdda : out std_logic; --寄存器選擇信號

  lcdrw : out std_logic; --液晶讀寫信號

  lcden : out std_logic; --液晶時鐘信號

  data : out std_logic_vector(7 downto 0)); --液晶數(shù)據(jù)信號

  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"));--年字符數(shù)據(jù)存儲器

  signal clkk : std_logic;

  begin

  lcden <= clk ; --液晶時鐘信號

  lcdrw <= '0' ; --寫數(shù)據(jù)

  control:process(clk,reset,current_state) --液晶驅(qū)動控制器

  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;

本站聲明: 本文章由作者或相關機構(gòu)授權(quán)發(fā)布,目的在于傳遞更多信息,并不代表本站贊同其觀點,本站亦不保證或承諾內(nèi)容真實性等。需要轉(zhuǎn)載請聯(lián)系該專欄作者,如若文章內(nèi)容侵犯您的權(quán)益,請及時聯(lián)系本站刪除( 郵箱:macysun@21ic.com )。
換一批
延伸閱讀
關閉