library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity LASchalter is Port ( CLK : in std_logic; sw: in std_logic_vector(5 downto 1); btn_cod : in std_logic_vector(4 downto 0); led : out std_logic_vector(15 downto 0); LAdataport : out std_logic_vector(4 downto 0); LAclkport : out std_logic); end LASchalter; architecture Behavioral of LASchalter is signal CLKDiv : std_logic_vector(24 downto 0); signal CLK80Hz: std_logic; signal CLKslow: std_logic; signal BCLK: std_logic; signal btn_del: std_logic_vector(1 downto 0); signal data: std_logic_vector(7 downto 0); signal counter: std_logic_vector(15 downto 8) := x"00"; begin process(CLK) begin if CLK'event and CLK ='1' then CLKDiv <= CLKDiv + '1'; end if; end process; CLK80Hz <= CLKDiv(20); process(CLK80Hz) -- Process für die Tastenentprellung begin if CLK80Hz'event and CLK80Hz='1' then if btn_cod(4) = '1' then if btn_del < "11" then btn_del <= btn_del + '1'; end if; else if btn_del > "00" then btn_del <= btn_del - '1'; end if; end if; end if; end process; BCLK <= btn_del(0) and btn_del(1); process(BCLK) -- Process zum Zählen, wie oft die Taste gedrückt ist begin if BCLK'event and BCLK='1' then data <= data(3 downto 0) & btn_cod(3 downto 0); end if; end process; CLKslow <= CLKDiv(24); LAclkport <= CLKslow; process(CLKslow) begin if CLKslow'event and CLKslow = '1' then if sw(1) = '1' then counter <= counter + '1'; else counter <= x"00"; end if; led(7 downto 0) <= data; led(15 downto 8) <= counter; LAdataport <= data(7 downto 4) & sw(1); end if; end process; end Behavioral;