星期四, 5月 10, 2007

七段顯示器

由於實驗需要,我寫了一個不怎強的加強版七段顯示器,A~F表示成 A b C d e F
還蠻好用的


LIBRARY ieee;
USE ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

ENTITY dis47 IS
PORT(in_d: in std_logic_vector(3 downto 0);
out_d: out std_logic_vector(0 to 6));
END dis47;

ARCHITECTURE beheavor OF dis47 IS
BEGIN
process(in_d)
begin
case in_d is
when "0000" => out_d <= "1111110";
when "0001" => out_d <= "0110000";
when "0010" => out_d <= "1101101";
when "0011" => out_d <= "1111001";
when "0100" => out_d <= "0110011";
when "0101" => out_d <= "1011011";
when "0110" => out_d <= "1011111";
when "0111" => out_d <= "1110010";
when "1000" => out_d <= "1111111";
when "1001" => out_d <= "1111011";
when "1010" => out_d <= "1110111";
when "1011" => out_d <= "0011111";
when "1100" => out_d <= "1001110";
when "1101" => out_d <= "0111101";
when "1110" => out_d <= "1101111";
when "1111" => out_d <= "1000111";
when others=> out_d <="0000000";
end case;
end process;
END beheavor;

沒有留言: