2825|1

5

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

求教 如何修改程序把英文字符显示修改为汉字显示 [复制链接]

这是基于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#20#;
     when '!' => result := 16#21#;
     when '.' => result := 16#2E#;
     when ':' => result := 16#3A#;
     when 'a' => result := 16#61#;
     when 'b' => result := 16#62#;
     when 'c' => result := 16#63#;
     when 'd' => result := 16#64#;
     when 'e' => result := 16#65#;
     when 'f' => result := 16#66#;
     when 'g' => result := 16#67#;
     when 'h' => result := 16#68#;
     when 'i' => result := 16#69#;
     when 'j' => result := 16#6A#;
     when 'k' => result := 16#6B#;
     when 'l' => result := 16#6C#;
     when 'm' => result := 16#6D#;
     when 'n' => result := 16#6E#;
     when 'o' => result := 16#6F#;
     when 'p' => result := 16#70#;
     when 'q' => result := 16#71#;
     when 'r' => result := 16#72#;
     when 's' => result := 16#73#;
     when 't' => result := 16#74#;
     when 'u' => result := 16#75#;
     when 'v' => result := 16#76#;
     when 'w' => result := 16#77#;
     when 'x' => result := 16#78#;
     when 'y' => result := 16#79#;
     when 'z' => result := 16#7A#;
     when 'A' => result := 16#41#;
     when 'B' => result := 16#42#;
     when 'C' => result := 16#43#;
     when 'D' => result := 16#44#;
     when 'E' => result := 16#45#;
     when 'F' => result := 16#46#;
     when 'G' => result := 16#47#;
     when 'H' => result := 16#48#;
     when 'I' => result := 16#49#;
     when 'J' => result := 16#4A#;
     when 'K' => result := 16#4B#;
     when 'L' => result := 16#4C#;
     when 'M' => result := 16#4D#;
     when 'N' => result := 16#4E#;
     when 'O' => result := 16#4F#;
     when 'P' => result := 16#50#;
     when 'Q' => result := 16#51#;
     when 'R' => result := 16#52#;
     when 'S' => result := 16#53#;
     when 'T' => result := 16#54#;
     when 'U' => result := 16#55#;
     when 'V' => result := 16#56#;
     when 'W' => result := 16#57#;
     when 'X' => result := 16#58#;
     when 'Y' => result := 16#59#;
     when 'Z' => result := 16#5A#;
     when '0' => result := 16#30#;
     when '1' => result := 16#31#;
     when '2' => result := 16#32#;
     when '3' => result := 16#33#;
     when '4' => result := 16#34#;
     when '5' => result := 16#35#;
     when '6' => result := 16#36#;
     when '7' => result := 16#37#; 
     when '8' => result := 16#38#;
     when '9' => result := 16#39#;
     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 YWZF 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 C of YWZF 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 ('H'),8);
     when "000001" =>data<=conv_std_logic_vector (char_to_integer ('a'),8);
     when "000010" =>data<=conv_std_logic_vector (char_to_integer ('p'),8);
     when "000011" =>data<=conv_std_logic_vector (char_to_integer ('p'),8);
     when "000100" =>data<=conv_std_logic_vector (char_to_integer ('y'),8);
     when "000101" =>data<=conv_std_logic_vector (char_to_integer (' '),8);
     when "000110" =>data<=conv_std_logic_vector (char_to_integer ('b'),8);
     when "000111" =>data<=conv_std_logic_vector (char_to_integer ('i'),8);
     when "001000" =>data<=conv_std_logic_vector (char_to_integer ('r'),8);
     when "001001" =>data<=conv_std_logic_vector (char_to_integer ('t'),8);
     when "001010" =>data<=conv_std_logic_vector (char_to_integer ('h'),8);
     when "001011" =>data<=conv_std_logic_vector (char_to_integer ('d'),8);
     when "001100" =>data<=conv_std_logic_vector (char_to_integer ('a'),8);
     when "001101" =>data<=conv_std_logic_vector (char_to_integer ('y'),8);
     when "001110" =>data<=conv_std_logic_vector (char_to_integer (' '),8);
     when "001111" =>data<=conv_std_logic_vector (char_to_integer ('t'),8);
     when "010000" =>data<=conv_std_logic_vector (char_to_integer ('o'),8);
     when "010001" =>data<=conv_std_logic_vector (char_to_integer (' '),8);
     when "010010" =>data<=conv_std_logic_vector (char_to_integer ('u'),8);
     when "010011" =>data<=conv_std_logic_vector (char_to_integer (' '),8);
     when "010100" =>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 C;

 

新手急求!

 

此帖出自FPGA/CPLD论坛

最新回复

啥问题?  详情 回复 发表于 2012-4-26 21:40
点赞 关注
 

回复
举报

6892

帖子

0

TA的资源

五彩晶圆(高级)

沙发
 

啥问题?

此帖出自FPGA/CPLD论坛
个人签名一个为理想不懈前进的人,一个永不言败人!
http://shop57496282.taobao.com/
欢迎光临网上店铺!
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/9 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表