UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Newbie ddevrie3
Newbie
121 Views
Registered: ‎02-10-2019

Using 7 segment display

All I want to do is display decimal numbers on a 7 segment display instead of hex. The problem is whenever I get over 9 I have to set two of the 7 segment display portions. When I  set one portion of the 7 segment display to "1", then the next to "0", the display just erases the 1 and just displays the 0. How do I set a "1" to one portion then a "0" to the next portion without overriding the 1?

 


process(LED_BCD)
begin
    case LED_BCD is
    when "0000" => LED_out <= "0000001"; --"0"
    anode_activate <= "1110";   
    when "0001" => LED_out <= "1001111"; -- "1"
    when "0010" => LED_out <= "0010010"; -- "2"
    when "0011" => LED_out <= "0000110"; -- "3"
    when "0100" => LED_out <= "1001100"; -- "4"
    when "0101" => LED_out <= "0100100"; -- "5"
    when "0110" => LED_out <= "0100000"; -- "6"
    when "0111" => LED_out <= "0001111"; -- "7"
    when "1000" => LED_out <= "0000000"; -- "8"    
    when "1001" => LED_out <= "0000100"; -- "9"
    when "1010" =>   --"10"

anode_activate <= "1101";     

LED_OUT <= "1101111"; 

anode_activate <= "1110" ;

LED_OUT <= "0000001";

end process;

0 Kudos
1 Reply
Explorer
Explorer
35 Views
Registered: ‎07-18-2018

Re: Using 7 segment display

Hi @ddevrie3,

I think we need a little more context. I am assuming you have a set of 7 segment displays that contains atleast 2 displays connected as Common Anode?

This means you have 7 (+1 for the dp) pins that you are connecting up to your LED_OUT (BLUE PINS)

7seg.PNG

So whenever you put the value on those pins. Your number shows up on all the Displays that have their anode connected to VCC (Or whatever On is)

You have the general idea down in your process but the mistake looks like here:

anode_activate <= "1101";     
LED_OUT <= "1101111";
anode_activate <= "1110" ;
LED_OUT <= "0000001";

LED out will just be 1 on the 1110 because it's the last value within the process.

You need to write it such that you save all the digits in their own vector or array. And then for each anode value (00,01,10,11) it writes out the anode value and the stored LED values at the digit location.

 

It might roughly look something like this:

signal anode : std_logic_vector( 1 downo 0) := "00";
signal digit_1 : std_logic_vector( 7 downo 0);
signal digit_2 : std_logic_vector( 7 downo 0);
signal digit_3 : std_logic_vector( 7 downo 0);
signal digit_4 : std_logic_vector( 7 downo 0);


SEL_ANODE_PROC: process(CLK) begin
    if(rising_edge(CLK)) then
        anode <= anode + 1;
    end if;
end process;

process(anode)
begin
    case anode is
        when "00" => 
            LED_out <= digit_1; --"0" 
            anode_activate <= "1110";  
        when "01" => 
            LED_out <= digit_2; --"0" 
            anode_activate <= "1101";  
        when "10" => 
            LED_out <= digit_3; --"0" 
            anode_activate <= "1011";  
        when "11" => 
            LED_out <= digit_4; -- "3"
            anode_activate <= "0111";  
end process;

And you can then make your BCD process take a number and translate it into what the stored LED digits should have in them.

 

 

0 Kudos