Altera_Forum
Honored Contributor
15 years agoDesign a BCD counter with a asynchronous master reset. Display the values 0 to 9 on
Design a BCD counter with a asynchronous master reset. Display the values 0 to 9 on the 7-segment display and whenever the count is 1, 3 or 5, a Led will turn on.
HI,i have a problem with the program with regards to the led_on.Can any kind soul provides some advice on this? This is so far what i've done, -- a BCD coubter with asynchronous reset library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity bcd_counter is port ( clk, reset_bar,led_on: in std_logic; q : out std_logic_vector (9 downto 0)); end bcd_counter; architecture flow of bcd_counter is signal count_sig: unsigned (9 downto 0); begin process (clk, reset_bar,led_on) begin if (reset_bar = '1' and led_on = '1') then count_sig <= "0000000000"; elsif falling_edge (clk) then if (count_sig = 9) then count_sig <= "0000000000"; else count_sig <= count_sig +1; if(led_on = '1') then count_sig <="0000000000"; else count_sig<= count_sig +1; end if; end if; end if; end process; q <= std_logic_vector (count_sig); end flow;