Altera_Forum
Honored Contributor
14 years agoVery simple Verilog code, but not working on DE2
I am running this simple code, pushing KEY[3] works fine (decrement), but when I push KEY[1] the 7-seg changes with both pushing and releasing and display some random number on the 7-seg.
hex_7seg is just a module to display count on the 7-seg. It works fine for other projects. Looks like the problem is with the if statement. Since when I test KEY[3] instead of KEY[1], the problem will be when I push KEY[3] Any help is appreciated module d1_7seg(KEY, HEX0); input [3:0] KEY; output [6:0] HEX0; reg [3:0] count; always @ ( negedge KEY[3] or negedge KEY[1]) begin if(KEY[1] == 0) begin count <= count + 1; end else begin count <= count - 1; end end hex_7seg (count, HEX0); endmodule