diff --git a/lcd_driver.vhd b/lcd_driver.vhd index 4760658..2b18436 100644 --- a/lcd_driver.vhd +++ b/lcd_driver.vhd @@ -44,7 +44,7 @@ use ieee.numeric_std.all; --use UNISIM.VComponents.all; entity lcd_driver is - generic ( NBITS : natural := 16; -- counter bit size + generic ( NBITS : natural := 21; -- counter bit size clk_freq : natural := 50000000; -- frequency of clk (50MHz) in hz wait_40000us : natural := 40000; -- wait 40ms wait_37us : natural := 37; -- wait 37us @@ -84,9 +84,9 @@ architecture Behavioral of lcd_driver is signal ret_state : display_state := INIT; -- ret_state register signal next_ret_state : display_state := INIT; -- next_ret_state register - signal cur_counter : unsigned(NBITS-1 downto 0) := (others => '0'); -- 10bit counter signal + signal cur_counter : unsigned(NBITS-1 downto 0) := (others => '0'); -- n bit counter signal signal next_counter : unsigned(NBITS-1 downto 0) := (others => '0'); - signal ret_counter : unsigned(NBITS-1 downto 0) := (others => '0'); -- 10bit counter signal + signal ret_counter : unsigned(NBITS-1 downto 0) := (others => '0'); -- n bit counter signal signal next_ret_counter : unsigned(NBITS-1 downto 0) := (others => '0'); signal next_lcd_db : STD_LOGIC_VECTOR(7 downto 0) := (others => '0'); -- next lcd databus @@ -155,7 +155,7 @@ begin next_lcd_db <= "00000000"; next_lcd_en <= '0'; next_lcd_rw <= '0'; - next_lcd_rs <= '1'; + next_lcd_rs <= '0'; next_counter <= (others => '0'); next_ret_state <= SEND_FS; @@ -196,14 +196,14 @@ begin next_counter <= (others => '0'); next_ret_state <= PAUSE; next_ret_counter <= to_unsigned(PAUSE_COUNT,NBITS); - next_state <= COUNT; + next_state <= PAUSE; when PAUSE => next_lcd_db <= "00000000"; next_lcd_en <= '0'; next_lcd_rw <= '0'; - next_lcd_rs <= '1'; + next_lcd_rs <= '0'; next_counter <= (others => '0'); next_ret_state <= SEND_ES; @@ -211,7 +211,8 @@ begin next_state <= COUNT; when SEND_ES => - + + next_lcd_db <= "00000110"; next_lcd_en <= '0'; next_lcd_rw <= '0'; @@ -238,6 +239,7 @@ begin if(cur_counter >= ret_counter) then next_state <= ret_state; + next_lcd_en <= '1'; end if; when DONE => diff --git a/lcd_driver_tb.vhd b/lcd_driver_tb.vhd index db6d29e..2b8ecfc 100644 --- a/lcd_driver_tb.vhd +++ b/lcd_driver_tb.vhd @@ -103,15 +103,14 @@ BEGIN begin reset <= '1'; - - -- hold reset state for 100 ns. - wait for 100 ns; - + wait for 100 ns; -- hold reset state for 100 ns. reset <= '0'; + + -- Apply Data + --data = '' wait for clk_period*10; - -- insert stimulus here wait; diff --git a/simulate_display_init.wcfg b/simulate_display_init.wcfg new file mode 100644 index 0000000..b6d02f8 --- /dev/null +++ b/simulate_display_init.wcfg @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + clk + clk + + + reset + reset + + + data[7:0] + data[7:0] + + + new_character + new_character + + + new_pos + new_pos + + + auto_incr_cursor + auto_incr_cursor + + + lcd_db[7:0] + lcd_db[7:0] + + + lcd_en + lcd_en + + + lcd_rw + lcd_rw + + + lcd_rs + lcd_rs + + + clk_period + clk_period + + + cur_state + cur_state + + + next_state + next_state + + + ret_state + ret_state + + + next_ret_state + next_ret_state + + + init_done + init_done + + + cur_counter[20:0] + cur_counter[20:0] + UNSIGNEDDECRADIX + + + ret_counter[20:0] + ret_counter[20:0] + UNSIGNEDDECRADIX + + + cur_lcd_db[7:0] + cur_lcd_db[7:0] + + diff --git a/yasg.gise b/yasg.gise index b91ba44..c960e9d 100644 --- a/yasg.gise +++ b/yasg.gise @@ -37,8 +37,10 @@ + + - + @@ -54,21 +56,17 @@ - + - - - - - + - + @@ -76,24 +74,16 @@ - + - - - - - - + - - - @@ -102,10 +92,9 @@ - + - @@ -148,6 +137,7 @@ + @@ -157,7 +147,6 @@ -