Altera_Forum
Honored Contributor
16 years agosimple question
Hi there,
I'm trying to increment a row of leds by one but pressing a pushbutton that is normally high until it is pressed. I have this code, but for some reason, the led's just light randomly. I'm using a DE2-70 board, 18 LEDs, 1 pushbutton to reset, and 1 to increment. module button_led(iKEY, oLEDR, iCLK_28); output [17:0]oLEDR; input [0:3]iKEY; input iCLK_28; reg [17:0]j; assign oLEDR = j; always @(posedge iCLK_28) begin if(!iKEY[0]) j <= 0; else if (!iKEY[1]) j <= j + 1; end endmodule Thanks!!