Altera_Forum
Honored Contributor
13 years agoBeginner Q: How do I slow down my counter?
Hello, so I'm trying to implement a simple 4bit counter,
library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity counter is port (clk, reset : in std_logic; Q : out std_logic_vector(3 downto 0)); end; architecture behav of counter is signal temp : std_logic_vector(3 downto 0) := "0000"; begin process (clk, reset) begin if(reset = '1') then temp <= "0000"; elsif (rising_edge(clk)) then temp <= temp + "0001"; end if; end process; Q <= temp; end; I assign clk to 50MHz oscillator clock on my de2-115(pin_y2) and I get all 4 leds to light up and stay like that. I am guessing the clock period is so small that it seems like they are constantly up. I would like to slow it down so it takes say, 0.5 seconds between LEDs count. I tried using after 500000000 ns line at the end of elsif statement but that didn't do anything.:confused: Looking into altera ftp tutorials didn't turn up anything, and using search here turn up some crazy stuff that is way out of my league at the moment. Any help would be appreciated.