library IEEE; use IEEE.STD_LOGIC_1164.ALL; entity LCD_Ansteuerung is Port ( Clk : in STD_LOGIC; reset : in STD_LOGIC; lcd_db : out STD_LOGIC_VECTOR (3 downto 0); lcd_e : out STD_LOGIC; lcd_rw : out STD_LOGIC; lcd_rs : out STD_LOGIC); end LCD_Ansteuerung; ------------------------------------------------------------------------------------------------------------------------- architecture Behavioral of LCD_Ansteuerung is component power_on_init Port ( init_start : in STD_LOGIC; init_done : out STD_LOGIC; clk : in STD_LOGIC; reset : in STD_LOGIC; lcd_db_i : out STD_LOGIC_VECTOR (3 downto 0); lcd_e_i : out STD_LOGIC); end component; component write_c Port ( clk : in STD_LOGIC; reset : in STD_LOGIC; write_start : in STD_LOGIC; db : in STD_LOGIC_VECTOR (7 downto 0); write_done : out STD_LOGIC; lcd_db_w : out STD_LOGIC_VECTOR (3 downto 0); lcd_e_w : out STD_LOGIC; lcd_rw : out std_logic); end component; component Mux1 Port ( lcd_e_i : in STD_LOGIC; lcd_e_w : in STD_LOGIC; MuxS : in STD_LOGIC; lcd_e : out STD_LOGIC); end component; component Mux4 Port ( lcd_db_i : in STD_LOGIC_VECTOR(3 downto 0); lcd_db_w : in STD_LOGIC_VECTOR(3 downto 0); MuxS : in STD_LOGIC; lcd_db : out STD_LOGIC_VECTOR(3 downto 0)); end component; type state_lcd_type is (lcd1, lcd2, lcd3, lcd4, lcd5, lcd6, lcd7, lcd8, lcd9, lcd10, lcd11, lcd12,lcd13,lcd14,lcd15,lcd16,lcd17,lcd18,lcd19,lcd20,lcd21,lcd22,lcd23,lcd24,lcd25,lcd26,lcd27,lcd28,lcd29,lcd30,lcd31,lcd32,lcd33,lcd34,lcd35,lcd36); signal state_lcd : state_lcd_type := lcd1; signal init_start : std_logic; signal init_done : std_logic; signal lcd_db_i : std_logic_VECTOR (3 downto 0); signal lcd_e_i : std_logic; signal write_start : std_logic; signal write_done : std_logic; signal db : std_logic_vector(7 downto 0); signal lcd_db_w : std_logic_VECTOR (3 downto 0); signal lcd_e_w : std_logic; signal MuxS : std_logic; begin M1: power_on_init port map(init_start,init_done,clk,reset,lcd_db_i,lcd_e_i); M2: write_c port map(clk,reset,write_start,db,write_done,lcd_db_w,lcd_e_w,lcd_rw); M3: Mux1 port map(lcd_e_i,lcd_e_w,MuxS,lcd_e); M4: Mux4 port map(lcd_db_i,lcd_db_w,MuxS,lcd_db); Free4All: process(clk,reset) begin if (reset='0') then if(clk'event and clk='1')then if(init_start='0') then init_start<='1'; elsif init_done='1' then init_start <= '0'; case state_lcd is when lcd1 => write_start<='1'; if write_done ='1' then --db <= x"28"; state_lcd <= lcd2; end if; when lcd2 => write_start<='1'; if write_done ='1' then --db <= x"16"; state_lcd <= lcd3; end if; when lcd3 => write_start<='1'; if write_done ='1' then --db <= x"0C"; state_lcd <= lcd4; end if; when lcd4 => write_start<='1'; if write_done ='1' then --db <= x"01"; state_lcd <= lcd5; end if; when lcd5 => write_start<='1'; if write_done ='1' then --db <= x"80"; state_lcd <= lcd6; end if; when lcd6 => write_start<='1'; if write_done ='1' then --db <= x"45"; state_lcd <= lcd7; end if; when lcd7 => write_start<='1'; if write_done ='1' then --db <= x"81"; state_lcd <= lcd8; end if; when lcd8 => write_start<='1'; if write_done ='1' then --db <= x"4D"; state_lcd <= lcd9; end if; when lcd9 => write_start<='1'; if write_done ='1' then --db <= x"82"; state_lcd <= lcd10; end if; when lcd10 => write_start<='1'; if write_done ='1' then --db <= x"43"; state_lcd <= lcd11; end if; when lcd11 => write_start<='1'; if write_done ='1' then --db <= x"83"; state_lcd <= lcd12; end if; when lcd12 => write_start<='1'; if write_done ='1' then --db <= x"45"; state_lcd <= lcd13; end if; when lcd13 => write_start<='1'; if write_done ='1' then --db <= x"84"; state_lcd <= lcd14; end if; when lcd14 => write_start<='1'; if write_done ='1' then --db <= x"44"; state_lcd <= lcd15; end if; when lcd15 => write_start<='1'; if write_done ='1' then --db <= x"85"; state_lcd <= lcd16; end if; when lcd16 => write_start<='1'; if write_done ='1' then --db <= x"44"; state_lcd <= lcd17; end if; when lcd17 => write_start<='1'; if write_done ='1' then --db <= x"86"; state_lcd <= lcd18; end if; when lcd18 => write_start<='1'; if write_done ='1' then --db <= x"45"; state_lcd <= lcd19; end if; when lcd19 => write_start<='1'; if write_done ='1' then --db <= x"87"; state_lcd <= lcd20; end if; when lcd20 => write_start<='1'; if write_done ='1' then --db <= x"44"; state_lcd <= lcd21; end if; when lcd21 => write_start<='1'; if write_done ='1' then --db <= x"88"; state_lcd <= lcd22; end if; when lcd22 => write_start<='1'; if write_done ='1' then --db <= x"00"; state_lcd <= lcd23; end if; when lcd23 => write_start<='1'; if write_done ='1' then --db <= x"89"; state_lcd <= lcd24; end if; when lcd24 => write_start<='1'; if write_done ='1' then --db <= x"53"; state_lcd <= lcd25; end if; when lcd25 => write_start<='1'; if write_done ='1' then --db <= x"8A"; state_lcd <= lcd26; end if; when lcd26 => write_start<='1'; if write_done ='1' then --db <= x"59"; state_lcd <= lcd27; end if; when lcd27 => write_start<='1'; if write_done ='1' then --db <= x"8B"; state_lcd <= lcd28; end if; when lcd28 => write_start<='1'; if write_done ='1' then --db <= x"53"; state_lcd <= lcd29; end if; when lcd29 => write_start<='1'; if write_done ='1' then --db <= x"8C"; state_lcd <= lcd30; end if; when lcd30 => write_start<='1'; if write_done ='1' then --db <= x"54"; state_lcd <= lcd31; end if; when lcd31 => write_start<='1'; if write_done ='1' then --db <= x"8D"; state_lcd <= lcd32; end if; when lcd32 => write_start<='1'; if write_done ='1' then --db <= x"45"; state_lcd <= lcd33; end if; when lcd33 => write_start<='1'; if write_done ='1' then --db <= x"8E"; state_lcd <= lcd34; end if; when lcd34 => write_start<='1'; if write_done ='1' then --db <= x"4D"; state_lcd <= lcd35; end if; when lcd35 => write_start<='1'; if write_done ='1' then --db <= x"8F"; state_lcd <= lcd36; end if; when lcd36 => write_start<='1'; if write_done ='1' then --db <= x"53"; end if; end case; end if; end if; elsif (reset='1') then init_start<='0'; end if; end process; with state_lcd select lcd_rs<='1' when lcd6|lcd8|lcd10|lcd12|lcd14|lcd16|lcd18|lcd20|lcd22|lcd24|lcd26|lcd28|lcd30|lcd32|lcd34|lcd36, '0' when others; with init_start select MuxS<='0' when '1', '1' when others; with state_lcd select db<= x"28" when lcd1, x"16" when lcd2, x"0C" when lcd3, x"01" when lcd4, x"80" when lcd5, x"45" when lcd6, x"81" when lcd7, x"4D" when lcd8, x"82" when lcd9, x"43" when lcd10, x"83" when lcd11, x"45" when lcd12, x"84" when lcd13, x"44" when lcd14, x"85" when lcd15, x"44" when lcd16, x"86" when lcd17, x"45" when lcd18, x"87" when lcd19, x"44" when lcd20, x"88" when lcd21, x"00" when lcd22, x"89" when lcd23, x"53" when lcd24, x"8A" when lcd25, x"59" when lcd26, x"8B" when lcd27, x"53" when lcd28, x"8C" when lcd29, x"54" when lcd30, x"8D" when lcd31, x"45" when lcd32, x"8E" when lcd33, x"4D" when lcd34, x"8F" when lcd35, x"53" when others; end Behavioral;