I'm trying to test the GPIO functionality of Altera (DE1, Cyclone II) with this simple program.
If the GPIO_0[0] gets a high (1) signal, LEDG[0] will light up. If it receives a low (0) signal, LEDG[0] will turn off.
For the input signal, I am asserting 5 and 0 VDC.
Here's my code:
module gpio_test (CLOCK_50, GPIO_0, LEDG);
input CLOCK_50;
input [35:0] GPIO_0;
output [7:0] LEDG;
reg [7:0] LED;
assign LEDG = LED;
always @ (posedge CLOCK_50)
if (GPIO_0[0] == 1) // if GPIO received a high signal
LED <= 1; // turn LED on
else if (GPIO_0[0] == 0) // if GPIO received a low signal
LED <= 0; // turn LED off
endmodule
The problem is, it seems that GPIO_0[0] is always receiving a high signal (even though I assert a high or low signal) because the LED is always on. Assuming that my pin assignments are correct, what went wrong?
CLOCK_50
does that automatically \$\endgroup\$