r0nald
Newbie level 3
keyboard vhdl
I need to keep in my register playerAkeyb(7 downto 0) data about which key is down or not.
Right not I am using testled for debugging.
If I do not look which particular key was pressed, the code works well. If I check wether the key pressed was something particular(stored in playerAkeys(4)), then the behaviour is random(sometimes work, sometimes doesnt).
So the current code works, but can not differentiate between keys pressed. If I uncomment the "if scancode = playerAkeys(4) then", the thing sometimes works, sometimes doesnt.
Here is the whole code: **broken link removed**
Here is the PS2 driver code: **broken link removed**
I guess there is some simple stupid thing what I am missing and why I am smashing myself through the wall for 2 days now.
I need to keep in my register playerAkeyb(7 downto 0) data about which key is down or not.
Right not I am using testled for debugging.
If I do not look which particular key was pressed, the code works well. If I check wether the key pressed was something particular(stored in playerAkeys(4)), then the behaviour is random(sometimes work, sometimes doesnt).
Code:
process(clk25MHz)
begin
if clk25MHz'event and clk25MHz = '1' then
if ps2_rdy = '1' then
if scancode = release_key_const then
key_release <= '1';
else
--if scancode = playerAkeys(4) then
if key_release = '0' then
playerAkeyb(4) <= '1';
else
playerAkeyb(4) <= '0';
key_release <= '0';
end if;
--end if;
end if;
ps2_clr_rdy <= '1';
end if;
if ps2_clr_rdy = '1' then
ps2_clr_rdy <= '0';
end if;
end if;
end process;
testled <= playerAkeyb(4);
So the current code works, but can not differentiate between keys pressed. If I uncomment the "if scancode = playerAkeys(4) then", the thing sometimes works, sometimes doesnt.
Here is the whole code: **broken link removed**
Here is the PS2 driver code: **broken link removed**
I guess there is some simple stupid thing what I am missing and why I am smashing myself through the wall for 2 days now.