Posted on:

code for matrix button input so far. getting signals from buttons but not sending signals to 4bit led output, any help would be great.
Library IEEE; Use IEEE.STD_LOGIC_1164.ALL; Use IEEE.STD_LOGIC_ARITH.ALL; Use IEEE.STD_LOGIC_UNSIGNED.ALL; Entity keypad_input is Port( clk : in std_logic; col_line : in std_logic_vector(2 downto 0); row_line : out std_logic_vector(3 downto 0); Number : out std_logic_vector(3 downto 0)); End keypad_input; Architecture Behavior of keypad_input is signal sig_c : std_logic_vector(2 downto 0):= "000"; signal sig_r : std_logic_vector(3 downto 0):= "0001" ; signal num : std_logic_VECTOR (3 DOWNTO 0); Signal C0 : std_logic_vector (2 downto 0):= "000"; Signal C1 : std_logic_vector (2 downto 0):= "000"; Signal C2 : std_logic_vector (2 downto 0):= "000"; begin  send signal to rows of keypad  process (clk) is Begin If (clk 'event and clk = '0') then sig_r <= sig_r(0) & sig_r(3 downto 1); end if; end process; row_line <= sig_r; debounce: process (clk,sig_c,col_line) is Begin If (Clk 'event and Clk = '1') then C0 <= C0(1 downto 0) & Col_line(0); C1 <= C1(1 downto 0) & Col_line(1); C2 <= C2(1 downto 0) & Col_line(2); end if; sig_c(0) <= C0(0) and C0(1) and (not C0(2)); sig_c(1) <= C1(0) and C1(1) and (not C1(2)); sig_c(2) <= C2(0) and C2(1) and (not C2(2)); End process;  read debounces signals  input: Process (num, sig_r, sig_c) is begin if sig_r = "0001" then if sig_c(0) = '1' then num <= "1110";  e elsif sig_c(1) = '1' then num <= "0000";  0 elsif sig_c (2) = '1' then num <= "1010";  a else null; end if; elsif sig_r = "0010" then if sig_c(0) = '1' then num <= "0011";  3 elsif sig_c(1) = '1' then num <= "0010";  2 elsif sig_c (2) = '1' then num <= "0001";  1 else null; end if; elsif sig_r = "0100" then if sig_c(0) = '1' then num <= "0110";  6 elsif sig_c(1) = '1' then num <= "0101";  5 elsif sig_c (2) = '1' then num <= "0100";  4 else null; end if; elsif sig_r = "1000" then if sig_c(0) = '1' then num <= "1001";  9 elsif sig_c(1) = '1' then num <= "1000";  8 elsif sig_c (2) = '1' then num <= "0111";  7 else null; end if; end if; end process; number <= num; end Behavior; 
:
Edited by Moderator
Posted on:

ed jones wrote: > getting signals from buttons but not sending signals to 4bit led output How did you find that out? What do you expect? And what do you get instead? BTW1: your "debounce" process suffers three big design flaws. 1. sig_c and col_line are not necessary in the sensitivity list. 2. at the moment C0, C1 and C2 are missing for a correct simualation!! 3. do NOT combine synchronous and combinatorial processes into one. So finally: only clk must be in that sensitivity list. And after "end if" there must follow "end process":
process (clk) begin If (Clk 'event and Clk = '1') then  this is the synchronous process end if;  nothing here!!!!!!! end process; 
BTW2: please read that very short manual for the editbox here. Most important is that thing with those [vhdl] tags...
:
Edited by Moderator