Altera_Forum
Honored Contributor
10 years agoError (10822) a code that dosent work
i will be thankful if somebody will can help me..my aim is to make a block that get 3 inputs:a clc that change every 0.1 seca input that get '1' every time i press key0and reset button that reset my countthe aim is to count the number of time i press and when there is 3 secs that i dont press i get the count of the time i pressedi tried to it with this code:
library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; use ieee.std_logic_arith.all; entity CLAPNUM is port( resetN, clk : in std_logic; key0 : in std_logic ; sinus : out std_logic_vector(4 downto 0)); end CLAPNUM ; architecture arc_CLAPNUM of CLAPNUM is signal countera : std_logic_vector(4 downto 0) :="00000" ; signal counterb : std_logic_vector(4 downto 0) :="00000" ; signal cinout : std_logic := '0' ; signal moda : std_logic := '0' ; begin process ( resetN key0, clk) begin if resetN = '0' then countera<="00000" ; counterb<="11110"; elsif (key0 ='1') and moda='0' then countera<= countera+"00001" ; counterb<="11110"; elsif (rising_edge(clk)) then if counterb/="00000" and (key0 ='0') then counterb <= counterb-"00001"; else moda <= '1'; end if; elsif moda='1' then sinus<= countera; end if; end process; end arc_CLAPNUM; but clearly it dosent work...can someone help me plz?