Lothar M. wrote:
> Show what you have
Why not implementing the 4 bit counter simplay as a counter from 0 to 9
in the flashing_LIGHTS entity?
1 | library ieee;
|
2 | use ieee.std_logic_1164.all;
|
3 |
|
4 | entity flashing_LIGHTS is
|
5 | port ( CLOCK_50, KEY0 : in std_logic;
|
6 | HEX0 : out std_logic_vector(0 to 6));
|
7 | end flashing_LIGHTS;
|
8 |
|
9 | architecture semi_behavioral of flashing_LIGHTS is
|
10 |
|
11 | signal count : integer range 0 to 9 := 0;
|
12 | signal countsec : integer range 0 to 49999999 := 0;
|
13 |
|
14 | begin
|
15 |
|
16 | clock<=CLOCK_50;
|
17 | reset <= KEY0;
|
18 |
|
19 | clock_counter: process (CLOCK_50, reset)
|
20 | begin
|
21 | if reset = '1' then
|
22 | count_enable<='0';
|
23 | elsif clock'event and clock='1' then
|
24 | if countsec = 49999999 then -- one second is gone
|
25 | countsec <= 0;
|
26 | if count<9 then -- each second: increment the digit counter
|
27 | count <= count+1;
|
28 | else
|
29 | count <= 0;
|
30 | end if;
|
31 | else
|
32 | countsec <= count+1;
|
33 | end if;
|
34 | end if;
|
35 | end process;
|
36 |
|
37 | HEX0 <= "1111110" when count=0 else
|
38 | "0110000" when count=1 else
|
39 | ...
|
40 | "1111111" when count=8 else
|
41 | "1110011"; -- count=9
|
42 |
|
43 | end semi_behavioral;
|
If you must use those 2 components counter_4bit and segment_7_decoder,
then you will have to rip out the corresponding lines of code and put
them in their own entities...
BTW:
Have a look at the few lines above the reply edit box:
1 | Reply
|
2 | Rules — please read before posting
|
3 | Post long source code as attachment, not in the text
|
4 | ...
|
5 | Formatting options
|
6 | ...
|
7 | [vhdl]VHDL code[/vhdl]
|
8 | ...
|
So pls attach VHDL code as *.vhdl file or use the [vhdl] tokens further
on.