Advertisement
Vedro

LED

Mar 17th, 2019
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 2.65 KB | None | 0 0
  1. ----------------------------------------------------------------------------------
  2. -- Company:
  3. -- Engineer:
  4. --
  5. -- Create Date:    14:33:10 03/16/2019
  6. -- Design Name:
  7. -- Module Name:    LED_kod - Behavioral
  8. -- Project Name:
  9. -- Target Devices:
  10. -- Tool versions:
  11. -- Description:
  12. --
  13. -- Dependencies:
  14. --
  15. -- Revision:
  16. -- Revision 0.01 - File Created
  17. -- Additional Comments:
  18. --
  19. ----------------------------------------------------------------------------------
  20. library IEEE;
  21. use IEEE.STD_LOGIC_1164.ALL;
  22.  
  23. -- Uncomment the following library declaration if using
  24. -- arithmetic functions with Signed or Unsigned values
  25. --use IEEE.NUMERIC_STD.ALL;
  26.  
  27. -- Uncomment the following library declaration if instantiating
  28. -- any Xilinx primitives in this code.
  29. --library UNISIM;
  30. --use UNISIM.VComponents.all;
  31.  
  32. entity LED_kod is
  33.     Port ( SW_30 : in  STD_LOGIC_VECTOR (3 downto 0);                       -- liczby
  34.               SW_74 : in  STD_LOGIC_VECTOR (7 downto 4);                        -- kropki
  35.            BTN : in  STD_LOGIC_VECTOR (3 downto 0);                     -- BT3  BT2 BT1 BT0
  36.               AN : out STD_LOGIC_VECTOR (3 downto 0);                           -- AN3  AN2 AN1 AN0
  37.               SEGM : out STD_LOGIC_VECTOR (6 downto 0);                         -- 6G       5F      4E      3D      2C      1B      0A
  38.               DOT : out STD_LOGIC);                                                 -- kropka
  39. end LED_kod;
  40.  
  41. architecture Behavioral of LED_kod is
  42. begin
  43.     Aktywacja: process (BTN, SW_30)                                             -- nie wiem czy SW_30 konieczne
  44.         begin
  45.             case BTN is
  46.                 when "0001" => AN <= "1110";
  47.                 when "0010" => AN <= "1101";
  48.                 when "0100" => AN <= "1011";
  49.                 when "1000" => AN <= "0111";
  50.                 when others => AN <= "1111";
  51.             end case;
  52.            
  53.             case SW_30 is
  54.                 when "0000" => SEGM <= "1000000";
  55.                 when "0001" => SEGM <= "1111001";
  56.                 when "0010" => SEGM <= "1101000";
  57.                 when "0011" => SEGM <= "0110000";
  58.                 when "0100" => SEGM <= "0011001";
  59.                 when "0101" => SEGM <= "0010010";
  60.                 when "0110" => SEGM <= "0000010";
  61.                 when "0111" => SEGM <= "1111000";
  62.                 when "1000" => SEGM <= "0000000";
  63.                 when "1001" => SEGM <= "0010000";
  64.                 when "1010" => SEGM <= "0001000";
  65.                 when "1011" => SEGM <= "0000011";
  66.                 when "1100" => SEGM <= "1000110";
  67.                 when "1101" => SEGM <= "0100001";
  68.                 when "1110" => SEGM <= "0000110";
  69.                 when "1111" => SEGM <= "0001110";
  70.                 when others => SEGM <= "1111111";
  71.             end case;
  72.         end process;
  73.  
  74. --  Kropki : process (SW_74)
  75. --      begin
  76. --          if SW_74(4) = '1' then
  77. --              AN(0) <= '0';
  78. --              DOT <= '0';
  79. --          elsif SW_74(5) = '1' then
  80. --              AN(1) <= '0';
  81. --              DOT <= '0';
  82. --          elsif SW_74(6) = '1' then
  83. --              AN(2) <= '0';
  84. --              DOT <= '0';
  85. --          elsif SW_74(7) = '1' then
  86. --              AN(3) <= '0';
  87. --              DOT <= '0';
  88. --          end if;
  89. --      end process;
  90.                
  91. end Behavioral;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement