rendered paste bodyconstant cmdFunctionSet : std_logic_vector (7 downto 0) := 0x28;
when function_set =>
-- Timing (in clock cycles)
-- 0 - 1 : setup time
-- 2 - 13 : command (send first nibble)
-- 14 - 64 : wait 1 us before sending second nibble
if( lcd_counter > CONV_STD_LOGIC_VECTOR(1,20) and lcd_counter < CONV_STD_LOGIC_VECTOR(14,20))
then
LCD_E <= '1';
else
LCD_E <= '0';
end if;
if (lcd_counter < CONV_STD_LOGIC_VECTOR(14,20)) then
SF_D <= cmdFunctionSet(7 downto 4);
LCD_RW <= '0';
else
SF_D <= "0000";
LCD_RW <= '0';
end if;
if (lcd_counter = CONV_STD_LOGIC_VECTOR(64,20)) then
next_state <= function_set_sendcmd;
next_lcd_counter <= CONV_STD_LOGIC_VECTOR(0,20);
end if;
when function_set_sendcmd =>
-- Timing (in clock cycles)
-- 0 - 1 : setup time
-- 2 - 13 : command (sending second nibble)
-- 14 - 2014 : wait 40 us before sending next command
if( lcd_counter > CONV_STD_LOGIC_VECTOR(1,20) and lcd_counter < CONV_STD_LOGIC_VECTOR(14,20))
then
LCD_E <= '1';
else
LCD_E <= '0';
end if;
if (lcd_counter < CONV_STD_LOGIC_VECTOR(14,20)) then
SF_D <= cmdFunctionSet(3 downto 0);
LCD_RW <= '0';
else
SF_D <= "0000";
LCD_RW <= '0';
end if;
if (lcd_counter = CONV_STD_LOGIC_VECTOR(2014,20)) then
next_state <= entry_mode_set;
next_lcd_counter <= CONV_STD_LOGIC_VECTOR(0,20);
end if;