Kreeker
Newbie level 1
- Joined
- Apr 28, 2011
- Messages
- 1
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,292
Hey Guys,
I'm designing a combinational lock using a 4x4 keypad input. I'm sure you guys are familiar with this type of keypad; 4 bits for input to the keypad, and 4 bits for output of the keypad.
Here is my code so far for my Keypad module:
I think I have the right idea, but what is missing is some type of debouncing... and I'm having trouble figuring this out.
Thanks for your help in advance
I'm designing a combinational lock using a 4x4 keypad input. I'm sure you guys are familiar with this type of keypad; 4 bits for input to the keypad, and 4 bits for output of the keypad.
Here is my code so far for my Keypad module:
Code:
begin
input : process (clk)
begin
if reset = '1' then
row_out <= "0001";
current_Input <= "00000";
previous_Input <= "00000";
elsif clk'event and clk = '1' then
previous_Input <= current_Input;
if columns = "1000" then
if row_out = "1000" then
current_Input <= "00001";
elsif row_out = "0100" then
current_Input <= "00010";
elsif row_out = "0010" then
current_Input <= "00011";
elsif row_out = "0001" then
current_Input <= "00100";
end if;
elsif columns = "0100" then
if row_out = "1000" then
current_Input <= "00101";
elsif row_out = "0100" then
current_Input <= "00110";
elsif row_out = "0010" then
current_Input <= "00111";
elsif row_out = "0001" then
current_Input <= "01000";
end if;
elsif columns = "0010" then
if row_out = "1000" then
current_Input <= "01001";
elsif row_out = "0100" then
current_Input <= "01010";
elsif row_out = "0010" then
current_Input <= "01011";
elsif row_out = "0001" then
current_Input <= "01100";
end if;
elsif columns = "0001" then
if row_out = "1000" then
current_Input <= "01101";
elsif row_out = "0100" then
current_Input <= "01110";
elsif row_out = "0010" then
current_Input <= "01111";
elsif row_out = "0001" then
current_Input <= "10000";
end if;
else
current_Input <= "00000";
end if;
if row_out = "1000" then
row_out <= "0100";
elsif row_out = "0100" then
row_out <= "0010";
elsif row_out = "0010" then
row_out <= "0001";
else
row_out <= "1000";
end if;
if previous_Input = current_Input then
LedTest <= "00000";
else
LedTest <= current_Input;
end if;
previous_Input <= current_Input;
end if;
end process;
rows <= row_out;
end Behavioral;
I think I have the right idea, but what is missing is some type of debouncing... and I'm having trouble figuring this out.
Thanks for your help in advance