Jump to content
  • 0

How to assign each digit of a number on the chosen seven segment display ? (Nexys 4DDR)


Yannick

Question

Hello !

I'm currently encoutering an issue about how to assign each digit of a number on the seven segment display. For example, if I have the number 1932, how to affect the '2' on the first digit display . The '3' on the second, the '9' on the third, etc...

Actually, I have a 4-bit BCD (which functions) and I want to display the decimal number. My output, bcd0, bcd1, bcd2, bcd3 represents the ones, the tens, the hundres and the thousands). I'm decoding each output like that :

 

 case  bcd0 is

when "0000"=> seven_seg<="0000001";  -- '0'
when "0001"=> seven_seg<="1001111";  -- '1'
when "0010"=> seven_seg<="0010010";  -- '2'
when "0011"=> seven_seg<="0000110";  -- '3'
when "0100"=> seven_seg<="1001100";  -- '4'
when "0101"=> seven_seg<="0100100";  -- '5'
when "0110"=> seven_seg<="0100000";  -- '6'
when "0111"=> seven_seg<="0001111";  -- '7'
when "1000"=> seven_seg<="0000000";  -- '8'
when "1001"=> seven_seg<="0000100";  -- '9'

when others=> seven_seg<="1111111";
end case;


case  bcd1 is
when "0000"=> seven_seg<="0000001";  -- '0'
when "0001"=> seven_seg<="1001111";  -- '1'
when "0010"=> seven_seg<="0010010";  -- '2'
when "0011"=> seven_seg<="0000110";  -- '3'
when "0100"=> seven_seg<="1001100";  -- '4'
when "0101"=> seven_seg<="0100100";  -- '5'
when "0110"=> seven_seg<="0100000";  -- '6'
when "0111"=> seven_seg<="0001111";  -- '7'
when "1000"=> seven_seg<="0000000";  -- '8'
when "1001"=> seven_seg<="0000100";  -- '9'
 
when others=> seven_seg<="1111111";
end case;


case  bcd2 is
when "0000"=> seven_seg <="0000001";  -- '0'
when "0001"=> seven_seg<="1001111";  -- '1'
when "0010"=> seven_seg<="0010010";  -- '2'
when "0011"=> seven_seg<="0000110";  -- '3'
when "0100"=> seven_seg<="1001100";  -- '4'
when "0101"=> seven_seg<="0100100";  -- '5'
when "0110"=> seven_seg<="0100000";  -- '6'
when "0111"=> seven_seg<="0001111";  -- '7'
when "1000"=> seven_seg<="0000000";  -- '8'
when "1001"=> seven_seg<="0000100";  -- '9'
 
when others=> seven_seg<="1111111";
end case;


case  bcd3 is
when "0000"=> seven_seg <="0000001";  -- '0'
when "0001"=> seven_seg<="1001111";  -- '1'
when "0010"=> seven_seg<="0010010";  -- '2'
when "0011"=> seven_seg<="0000110";  -- '3'
when "0100"=> seven_seg<="1001100";  -- '4'
when "0101"=> seven_seg<="0100100";  -- '5'
when "0110"=> seven_seg<="0100000";  -- '6'
when "0111"=> seven_seg<="0001111";  -- '7'
when "1000"=> seven_seg<="0000000";  -- '8'
when "1001"=> seven_seg<="0000100";  -- '9'
 
when others=> seven_seg<="1111111";
end case;

 

Of course, I know that I have to activate the 4 first anodes (low level). And that I have to assign each bit of "seven_seg" to the good pin on the .XCF file.

Thank you very much for help !

 

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

Thanks @artvvb !

I took a look on the design challenge and I'm not sure to have well understood. So, for my issue, this is the third part "a real seven segment display controller" that can help me, right ?

If so, if we do a comparison, the switches are my bcd0, bcd1, bcd2, bcd3 (each one is 4-bit length like switches). If I well understand, it means that if I want to visualise the number 1932 ("2" in bcd0, "3" in bcd1, "9" in bcd2 and "1" in bcd3) on four different digit display (the four first of the eight) at the same time, I have to use a MUX which will be controlled by a counter ? Which will enable the right Anode to display each number ?

 

Link to comment
Share on other sites

@Yannick

Yes, you will need to add a multiplexor either after your four bcds or before them, so that you can scan through each anode in sequence, displaying each digit for a quarter of the time. If your clock is running fast enough, the time that each digit is low will not be visible. You essentially need to display 1XXX (bcd input of 1, anode output of 0111), followed by X9XX, etc, counting through each of the different digits.

Hope this helps,

Arthur

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...