微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 嵌入式设计讨论 > FPGA,CPLD和ASIC > 1602液晶屏驱动问题求助

1602液晶屏驱动问题求助

时间:10-02 整理:3721RD 点击:
需要再LCD1602上的第二行显示一个字符串,应该是先设置地址,然后把字符串一个一个拷贝应该就可以了吧,但是为什么显示的时候第一行也会显示出数据呢?这是为什么?有没有人能帮帮我。

  1.                                 --set dd ram address
  2.                                 --upper-4--"C0"
  3.                                 when st_disp14 =>
  4.                                                 SF_D <= x"C";
  5.                                                 LCD_E <= '1';
  6.                                                 LCD_RS <= '0';
  7.                                         if(cnt_disp < 1) then
  8.                                                 cnt_disp := cnt_disp + 1;
  9.                                                 Cur_State <= st_disp14;
  10.                                         else
  11.                                                 cnt_disp := 0;
  12.                                                 Cur_State <= st_disp15;
  13.                                                 LCD_E <= '0';
  14.                                         end if;
  15.                                 --lower-4
  16.                                 when st_disp15 =>
  17.                                         SF_D <= x"0";
  18.                                         LCD_E <= '1';
  19.                                         if(cnt_disp < 1)then
  20.                                                 cnt_disp := cnt_disp + 1;
  21.                                                 Cur_State <= st_disp15;
  22.                                         else
  23.                                                 cnt_disp := 0;
  24.                                                 Cur_State <= st_disp16;
  25.                                                 LCD_E <= '0';
  26.                                                 cnt_rw := 0;
  27.                                         end if;
  28.                                 --Write the first Line
  29.                                 when st_disp16 =>
  30.                                         if(cnt_rw < 16)then
  31.                                                 Cur_State <= st_disp17;
  32.                                                 LCD_E <= '1';
  33.                                                 LCD_RS <= '1';
  34.                                                 SF_D <= str0(cnt_rw)(7 downto 4);
  35.                                         else
  36.                                                 Cur_State <= st_disp26;
  37.                                                 LCD_E <= '0';
  38.                                                 LCD_RS <= '0';
  39.                                                 cnt_rw := 0;
  40.                                         end if;
  41.                                 when st_disp17 =>
  42.                                         LCD_E <= '0';
  43.                                         Cur_State <= st_disp18;
  44.                                 when st_disp18 =>
  45.                                         LCD_E <= '1';
  46.                                         LCD_RS <= '1';
  47.                                         SF_D <= str0(cnt_rw)(3 downto 0);
  48.                                         Cur_State <= st_disp19;
  49.                                 when st_disp19 =>
  50.                                         LCD_E <= '0';
  51.                                         cnt_rw := cnt_rw + 1;
  52.                                         Cur_State <= st_disp16;
  53.                                 when st_disp26 =>
  54.                                         LCD_RS <= '0';
  55.                                         LCD_E <= '0';
  56.                                         Cur_State <= st_disp14;

复制代码


最终显示结果是
llo,World!
Hello,World!
其中字符串str0的值为Hello,World!

ut一下就知道了。

使用LCD1602显示之前有一个初始化的过程,也就是设置LCD1602的显示模式,这个你做过了吗?



   谢谢了,问题已解决!是我初始化的时候LCD_E信号忘了复位。

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top