Disabled cursor blinking, added cursor repositioning hack. Display works now.

This commit is contained in:
T-moe
2016-06-10 11:21:43 +02:00
parent cbda71ae40
commit 2cd5d550ae
2 changed files with 20 additions and 28 deletions

View File

@@ -191,7 +191,7 @@ begin
lcd_newchar_next <= '1'; lcd_newchar_next <= '1';
else else
charcnt_next <= (others => '0'); charcnt_next <= (others => '0');
lcd_data_next <= x"C0"; lcd_data_next <= x"40"; --Start adress for line 2
lcd_newpos_next <= '1'; lcd_newpos_next <= '1';
ret_state_next <= S_FREQ_PREF; ret_state_next <= S_FREQ_PREF;
end if; end if;
@@ -213,14 +213,14 @@ begin
ret_state_next <= S_FORM_CONT; ret_state_next <= S_FORM_CONT;
charcnt_next <= charcnt_reg + 1; charcnt_next <= charcnt_reg + 1;
if(charcnt_reg < 1 ) then if(charcnt_reg < 1 ) then
lcd_data_next <= x"86"; lcd_data_next <= x"06"; --adress character 7 on line 1
lcd_newpos_next <= '1'; lcd_newpos_next <= '1';
elsif(charcnt_reg < 9) then elsif(charcnt_reg < 9) then
lcd_data_next <= to_unsigned(character'pos(str_form(to_integer(form),to_integer(resize(charcnt_reg-1,3)))),8); lcd_data_next <= to_unsigned(character'pos(str_form(to_integer(form),to_integer(resize(charcnt_reg-1,3)))),8);
lcd_newchar_next <= '1'; lcd_newchar_next <= '1';
else else
charcnt_next <= (others => '0'); charcnt_next <= (others => '0');
lcd_data_next <= x"4A" - digpos_reg; lcd_data_next <= x"4A" - digpos_reg; -- adress character 11 on line 2 - digit position
lcd_newpos_next <= '1'; lcd_newpos_next <= '1';
ret_state_next <= S_IDLE; ret_state_next <= S_IDLE;
end if; end if;
@@ -229,13 +229,18 @@ begin
if(charcnt_reg < 1 ) then if(charcnt_reg < 1 ) then
charcnt_next <= charcnt_reg + 1; charcnt_next <= charcnt_reg + 1;
ret_state_next <= S_FREQ_CONT; ret_state_next <= S_FREQ_CONT;
lcd_data_next <= x"4A" - digpos_reg; lcd_data_next <= x"4A" - digpos_reg; -- adress character 11 on line 2 - digit position
lcd_newpos_next <= '1'; lcd_newpos_next <= '1';
elsif(charcnt_reg = 1) then
charcnt_next <= charcnt_reg + 1;
ret_state_next <= S_FREQ_CONT;
lcd_data_next <= to_unsigned(character'pos('0'),8) + digit_reg(to_integer(digpos_reg));
lcd_newchar_next <= '1';
else else
ret_state_next <= S_IDLE; ret_state_next <= S_IDLE;
charcnt_next <= (others => '0'); charcnt_next <= (others => '0');
lcd_data_next <= to_unsigned(character'pos('0'),8) + digit_reg(to_integer(digpos_reg)); lcd_data_next <= x"4A" - digpos_reg; -- adress character 11 on line 2 - digit position
lcd_newchar_next <= '1'; lcd_newpos_next <= '1';
end if; end if;
when S_IDLE => when S_IDLE =>
btn_old_next <= enc_btn; btn_old_next <= enc_btn;

View File

@@ -69,7 +69,6 @@ architecture Behavioral of lcd_driver is
SEND_SD, -- send the display ON/OFF control SEND_SD, -- send the display ON/OFF control
SEND_CD, -- send a clear SEND_CD, -- send a clear
SEND_ES, -- send entry mode set SEND_ES, -- send entry mode set
SEND_ADRESS, -- send a new adress
WAITING1, -- wait and toggle lcd_en WAITING1, -- wait and toggle lcd_en
WAITING2, -- wait and toggle lcd_en WAITING2, -- wait and toggle lcd_en
WAITING3, -- wait and toggle lcd_en WAITING3, -- wait and toggle lcd_en
@@ -178,7 +177,7 @@ begin
when SEND_SD => -- display ON/OFF setting when SEND_SD => -- display ON/OFF setting
next_lcd_db <= "00001111"; next_lcd_db <= "00001110";
next_lcd_en <= '1'; next_lcd_en <= '1';
next_lcd_rs <= '0'; next_lcd_rs <= '0';
@@ -209,17 +208,6 @@ begin
next_ret_counter <= to_unsigned(PAUSE_COUNT,NBITS); next_ret_counter <= to_unsigned(PAUSE_COUNT,NBITS);
next_state <= WAITING1; next_state <= WAITING1;
when SEND_ADRESS => -- entry set mode
next_lcd_db <= '1' & data(6 downto 0);
next_lcd_en <= '1';
next_lcd_rs <= '0';
next_counter <= (others => '0');
next_ret_state <= DONE;
next_ret_counter <= to_unsigned(PAUSE_COUNT,NBITS);
next_state <= WAITING1;
when DONE => -- initialization done when DONE => -- initialization done
next_lcd_db <= "00000000"; next_lcd_db <= "00000000";
@@ -227,19 +215,18 @@ begin
next_lcd_rs <= '0'; next_lcd_rs <= '0';
if(new_character = '1') then -- send data if(new_character = '1') then -- send data
next_ret_state <= DONE;
next_state <= WAITING1;
next_lcd_rs <= '1'; next_lcd_rs <= '1';
next_counter <= (others => '0'); next_counter <= (others => '0');
next_ret_state <= DONE;
next_ret_counter <= to_unsigned(PAUSE_COUNT,NBITS); next_ret_counter <= to_unsigned(PAUSE_COUNT,NBITS);
next_state <= WAITING1;
next_lcd_db <= data; next_lcd_db <= data;
elsif(new_pos = '1') then -- new address elsif(new_pos = '1') then -- new address
next_lcd_rs <= '0'; next_state <= WAITING1;
next_ret_state <= DONE;
next_lcd_db <= '1' & data(6 downto 0);
next_counter <= (others => '0'); next_counter <= (others => '0');
next_ret_state <= SEND_ADRESS;
next_ret_counter <= to_unsigned(PAUSE_COUNT,NBITS); next_ret_counter <= to_unsigned(PAUSE_COUNT,NBITS);
next_state <= WAITING1;
next_lcd_db <= "000001" & data(7) & '0';
end if; end if;
when WAITING1 => -- wait with jump when WAITING1 => -- wait with jump