Hexadecimal digit to seven-segment LED decoder

As shown in the figure(a), a seven-segment LED consists of seven LED bars and a single round LED decimal point. The seven-segment LED is configured as avtive low, which means that an LED segment is lit if the corresponding control signal is ‘0’.
The following code generates aprropriate LED patterns as shown in Figure (b).


library ieee;
use ieee.std_logic_1164.all;
entity hex_to_sseg is 
    port(
    hex: in std_logic_vector(3 downto 0);
    dp: in std_logic;
    sseg: out std_logic_vector(7 downto 0)
    );
end hex_to_sseg;
architecture arch of hex_to_sseg is

begin 
    with hex select
    sseg(6 downto 0) <= 
        "0000001" when "0000";
        "1001111" when "0001";
        "0010010" when "0010";
        "0000110" when "0011";
        "1001100" when "0100";
        "0100100" when "0110";
        "0100000" when "0110";
        "0001111" when "0111";
        "0000000" when "1000";
        "0000100" when "1001";
        "0001000" when "1010"; --a
        "1100000" when "1011"; --b
        "0110001" when "1100"; --c
        "1000000" when "1101"; --d
        "0110000" when "1110"; --e
        "0111000" when others; --f
    sseg(7) <= dp;
end arch;

There is a 1-bit input (dp) connecting directly to the decimal point LED. The LED control singals (a,b,c,d,e,f,g and dp) are grouped together as a single 8-bit signal(sseg).

News Reporter
Dr. Lu

发表评论

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据

跳至工具栏