Search code examples
constraintsvhdlseven-segment-display

How can I use seperate digits in seven segment display in basys 3 in vhdl


I am working on a Project about making a stop watch. In order to do that I must use seperate digits on the 7-segment display. However, when I try it, all the digits act the same. I used the following code for the constraint.

set_property PACKAGE_PIN W7 [get_ports {clk_out[6]}] 
set_property IOSTANDARD LVCMOS33 [get_ports {clk_out[6]}] 
set_property PACKAGE_PIN W6 [get_ports {clk_out[5]}]  
set_property IOSTANDARD LVCMOS33 [get_ports {clk_out[5]}] 
set_property PACKAGE_PIN U8 [get_ports {clk_out[4]}] 
set_property IOSTANDARD LVCMOS33 [get_ports {clk_out[4]}] 
set_property PACKAGE_PIN V8 [get_ports {clk_out[3]}]  
set_property IOSTANDARD LVCMOS33 [get_ports {clk_out[3]}] 
set_property PACKAGE_PIN U5 [get_ports {clk_out[2]}] 
set_property IOSTANDARD LVCMOS33 [get_ports {clk_out[2]}] 
set_property PACKAGE_PIN V5 [get_ports {clk_out[1]}] 
set_property IOSTANDARD LVCMOS33 [get_ports {clk_out[1]}]  
set_property PACKAGE_PIN U7 [get_ports {clk_out[0]}] 
set_property IOSTANDARD LVCMOS33 [get_ports {clk_out[0]}] 

How can I use seperate digits? It would be really helpful if you explain it to me by an example. Thanks in advance.


Solution

  • @Brian Drummond and @user1155120 have really answered your question. The display is time multiplexed. You need to repeat this sequence over and over again so fast that the human eye cannot perceive that you are only driving one digit at once:

    • enable U2 and drive the 7-segment outputs for the units column;
    • then enable U4 and drive the 7-segment outputs for the tens column;
    • then enable V4 and drive the 7-segment outputs for the hundreds column;
    • then enable W4 and drive the 7-segment outputs for the thousands column.

    So, you'll need some VHDL code that drives U2 then U4 then V4 then W4 then U2 etc and some other VHDL code that drives the 7-segment outputs appropriately for each digit.