注册 登录
电子工程世界-论坛 返回首页 EEWORLD首页 频道 EE大学堂 下载中心 Datasheet 专题
小贾的个人空间 https://home.eeworld.com.cn/space-uid-410563.html [收藏] [复制] [分享] [RSS]
日志

求教 有错误 求修改

已有 609 次阅读2012-4-26 14:49 |

这是基于FPGA的LCD控制器的设计与实现  要求实现英文字符和汉字  字符没问题  汉字也知道

中文部分的实现原理与英文部分大体相同,但是由于VHDL中无法识别中文,因此在使用上不可能做到和英文一样方便。使用时需要参照中文字符表,将需要的字符所对应的数据输入RAM,然后通和英文模块不重复的符号来实现对其的调用。如 “这个中文字符,所对应的数据为16#BCD6,因此在函数部分应为:

    when '@' => result := 16#BC#;

    when '#' => result := 16#D6#;

调用时的只需将@#这两个符号来代替中文字符即可

when "000000" =>data<=conv_std_logic_vector (char_to_integer ('@'),8);

when "000001" =>data<=conv_std_logic_vector (char_to_integer ('#'),8)

 

但是还是遇到问题了,求指教:

附汉字显示的VHDL程序(有问题提示  怎么修改?)

 

新手急求!

附汉字程序有问题,求分析!

 library ieee;
 use ieee.std_logic_1164.all;
 use ieee.std_logic_unsigned.all;
 use ieee.std_logic_arith.all;
  package packexp is
      function char_to_integer(indata : character) return integer ;
   end;
   package BODY packexp is
     function char_to_integer(indata : character) return integer is
        variable result : integer range 0 to 16#FF#;
       begin
     case indata is
                when '@' => result := 16#D7#;
                when '#' => result := 16#F6#;
                when '@@' => result := 16#D7#;
                when '##' => result := 16#FE#;
                when '@@@' => result := 16#BA#;
                when '###' => result := 16#C3#;
                when '@@@@' => result := 16#B5#;
                when '####' => result := 16#C4#;
                when '@@@@@' => result := 16#D7#;
                when '#####' => result := 16#D4#;
                when '@@@@@' => result := 16#BC#;
                when '#####' => result := 16#BA#;
                when '@@@@@@@' => result := 16#A3#;
                when '#######' => result := 16#AC#;
                when '$' => result := 16#C8#;
                when '%' => result := 16#CA#;
                when '$$' => result := 16#B4#;
                when '%%' => result := 16#C8#;
                when '$$$' => result := 16#B5#;
                when '%%%' => result := 16#C4#;
                when '$$$$' => result := 16#CA#;
                when '%%%%' => result := 16#A8#;
                when '$$$$$' => result := 16#D7#;
                when '%%%%%' => result := 16#D3#;
                when '$$$$$$' => result := 16#A3#;
                when '%%%%%%' => result := 16#A1#;
                when others => result := 16#20#;
     end case;
     return result;
    end function;  
  end;
  library ieee;
  use ieee.std_logic_1164.all;
  use ieee.std_logic_arith.all;
  use work.packexp.all;
  entity HZXS is
     port ( clk : in std_logic;
  address : in std_logic_vector(5 downto 0);
  data: out std_logic_vector(7 downto 0) );
    end YWZF;
  architecture D of HZXS is
     begin
      process(clk,address)
         begin
  if clk'event and clk='1' then
       case address is
     when "000000" =>data<=conv_std_logic_vector (char_to_integer ('@'),8);
     when "000001" =>data<=conv_std_logic_vector (char_to_integer ('#'),8);
     when "000010" =>data<=conv_std_logic_vector (char_to_integer ('@@'),8);
     when "000011" =>data<=conv_std_logic_vector (char_to_integer ('##'),8);
     when "000100" =>data<=conv_std_logic_vector (char_to_integer ('@@@'),8);
     when "000101" =>data<=conv_std_logic_vector (char_to_integer ('###'),8);
     when "000110" =>data<=conv_std_logic_vector (char_to_integer ('@@@@'),8);
     when "000111" =>data<=conv_std_logic_vector (char_to_integer ('####'),8);
     when "001000" =>data<=conv_std_logic_vector (char_to_integer ('@@@@@'),8);
     when "001001" =>data<=conv_std_logic_vector (char_to_integer ('#####'),8);
     when "001010" =>data<=conv_std_logic_vector (char_to_integer ('@@@@@@'),8);
     when "001011" =>data<=conv_std_logic_vector (char_to_integer ('######'),8);
     when "001100" =>data<=conv_std_logic_vector (char_to_integer ('@@@@@@@'),8);
     when "001101" =>data<=conv_std_logic_vector (char_to_integer ('#######'),8);
     when "001110" =>data<=conv_std_logic_vector (char_to_integer ('$'),8);
     when "001111" =>data<=conv_std_logic_vector (char_to_integer ('%'),8);
     when "010000" =>data<=conv_std_logic_vector (char_to_integer ('$$'),8);
     when "010001" =>data<=conv_std_logic_vector (char_to_integer ('%%'),8);
     when "010010" =>data<=conv_std_logic_vector (char_to_integer ('$$$'),8);
     when "010011" =>data<=conv_std_logic_vector (char_to_integer ('%%%'),8);
     when "010100" =>data<=conv_std_logic_vector (char_to_integer ('$$$$'),8);
            when "010101" =>data<=conv_std_logic_vector (char_to_integer ('%%%%'),8);
            when "010110" =>data<=conv_std_logic_vector (char_to_integer ('$$$$$'),8);
            when "010111" =>data<=conv_std_logic_vector (char_to_integer ('%%%%%'),8);
            when "011000" =>data<=conv_std_logic_vector (char_to_integer ('$$$$$$'),8);
            when "011001" =>data<=conv_std_logic_vector (char_to_integer ('%%%%%%'),8);
            when others =>data<=conv_std_logic_vector (char_to_integer (' '),8);

     end case;  
 end if;
 end process; 
  end D;

 

 预期汉字显示为:    做最好的自己,

                  仁慈的狮子!

评论 (0 个评论)

facelist doodle 涂鸦板

您需要登录后才可以评论 登录 | 注册

热门文章