1 | library IEEE;
|
2 | use IEEE.STD_LOGIC_1164.ALL;
|
3 | use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
4 |
|
5 | entity eigener_count is
|
6 | Port ( --switches : in STD_LOGIC_VECTOR(4 downto 0);
|
7 | --LEDs : out STD_LOGIC_VECTOR(3 downto 0);
|
8 | clk : in STD_LOGIC;
|
9 | taster : in STD_LOGIC;
|
10 | --BCD_IN : inout STD_LOGIC_VECTOR(3 downto 0);
|
11 | --SSEG : out STD_LOGIC_VECTOR(6 downto 0);
|
12 | ausgang_7seg : out STD_LOGIC_VECTOR (6 downto 0);
|
13 | ausgang_anode : out STD_LOGIC_VECTOR (3 downto 0);
|
14 | reset : in STD_LOGIC
|
15 | );
|
16 | end eigener_count;
|
17 |
|
18 | architecture Behavioral of eigener_count is
|
19 | --signal counter : STD_LOGIC_VECTOR(29 downto 0) := (others => '0');
|
20 | --signal taster_deb : std_logic := '0';
|
21 | signal counter : STD_LOGIC_VECTOR(3 downto 0) := (others => '0');
|
22 | signal taster_old : std_logic := '0';
|
23 | begin
|
24 | with counter select
|
25 | ausgang_7seg <= "0000001" when "0000", -- 0
|
26 | "1001111" when "0001", -- 1
|
27 | "0010010" when "0010", -- 2
|
28 | "0000110" when "0011", -- 3
|
29 | "1001100" when "0100", -- 4
|
30 | "0100100" when "0101", -- 5
|
31 | "0100000" when "0110", -- 6
|
32 | "0001111" when "0111", -- 7
|
33 | "0000000" when "1000", -- 8
|
34 | "0000100" when "1001", -- 9
|
35 | "0001000" when "1010", -- A
|
36 | "1100000" when "1011", -- b
|
37 | "0110001" when "1100", -- C
|
38 | "1000010" when "1101", -- d
|
39 | "0110000" when "1110", -- E
|
40 | "0111000" when "1111", -- F
|
41 | "1111111" when others; -- turn off all LED
|
42 |
|
43 | ausgang_anode <= "1110";
|
44 |
|
45 |
|
46 | --clk_proc: process(clk, reset)
|
47 | clk_proc: process(clk, reset, taster)
|
48 | begin
|
49 | if reset = '0' then
|
50 | counter <= "0000";
|
51 | elsif rising_edge(clk) then
|
52 | if (taster = '0') then --and (taster_old = '1') then
|
53 | counter <= counter+1;
|
54 |
|
55 | end if;
|
56 | --taster_old <= taster;
|
57 | end if;
|
58 |
|
59 |
|
60 | end process;
|
61 |
|
62 |
|
63 |
|
64 | end Behavioral;
|