VHDL写的1602,第二行只显示点阵,求解
时间:10-02
整理:3721RD
点击:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity LCD1602_1 is
Port ( CLK : in std_logic;
Reset : in std_logic;
LCD_RS : out std_logic; --寄存器选择信号
LCD_RW : out std_logic; --液晶读写信号
LCD_EN : out std_logic; --液晶时钟信号
LCD_Data : out std_logic_vector(7 downto 0)); --液晶数据信号
end LCD1602_1;
architecture Behavioral of LCD1602_1 is
type state is (set_dlnf,set_cursor,set_dcb,set_cgram,write_cgram,set_ddram,write_LCD_Data);
signal Current_State:state;
signal Clk_Out : std_logic;
signal LCD_Clk : std_logic;
begin
process(CLK)--分频进程,CLK输入,CLK_Out输出,50MHz输入,125Hz输出,8ms
variable n1:integer range 0 to 19999;
begin
if rising_edge(CLK) then
if n1 LCD_RS LCD_RS LCD_RS LCD_RS LCD_RS LCD_RS LCD_RS null;
end case;
end if;
end process;
end Behavioral;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity LCD1602_1 is
Port ( CLK : in std_logic;
Reset : in std_logic;
LCD_RS : out std_logic; --寄存器选择信号
LCD_RW : out std_logic; --液晶读写信号
LCD_EN : out std_logic; --液晶时钟信号
LCD_Data : out std_logic_vector(7 downto 0)); --液晶数据信号
end LCD1602_1;
architecture Behavioral of LCD1602_1 is
type state is (set_dlnf,set_cursor,set_dcb,set_cgram,write_cgram,set_ddram,write_LCD_Data);
signal Current_State:state;
signal Clk_Out : std_logic;
signal LCD_Clk : std_logic;
begin
process(CLK)--分频进程,CLK输入,CLK_Out输出,50MHz输入,125Hz输出,8ms
variable n1:integer range 0 to 19999;
begin
if rising_edge(CLK) then
if n1 LCD_RS LCD_RS LCD_RS LCD_RS LCD_RS LCD_RS LCD_RS null;
end case;
end if;
end process;
end Behavioral;
when set_ddram=> LCD_RS<='0';
IF CNT1<"01111" THEN CNT1:=CNT1+1; --主体显示,写显示地址DDRam(RS='0')
ELSE CNT1:="00000";
END IF;
IF CNT1<="01111" THEN LCD_Data <="11000000"+cnt1; ---写第二行地址
END IF;
Current_State<=write_cgram;
写地址为0xc0第二行,不管怎么改地址第二行都只显示点阵,是什么问题啊