Blinking LEDs on the DE10-Lite board.
User-Defined LEDs
There are ten user-controllable LEDs connected to the FPGA on the board. Each LED is driven directly and individually by a pin on the MAX 10 FPGA. Driving its associated pin to a high logic level turns the LED on, and driving the pin low turns it off.
Pin Assignment of LEDs
Signal Name | FPGA Pin No. | Description | I/O Standard |
---|---|---|---|
LEDR0 | PIN_A8 | LED [0] | 3.3-V LVTTL |
LEDR1 | PIN_A9 | LED [1] | 3.3-V LVTTL |
LEDR2 | PIN_A10 | LED [2] | 3.3-V LVTTL |
LEDR3 | PIN_B10 | LED [3] | 3.3-V LVTTL |
LEDR4 | PIN_D13 | LED [4] | 3.3-V LVTTL |
LEDR5 | PIN_C13 | LED [5] | 3.3-V LVTTL |
LEDR6 | PIN_E14 | LED [6] | 3.3-V LVTTL |
LEDR7 | PIN_D14 | LED [7] | 3.3-V LVTTL |
LEDR8 | PIN_A11 | LED [8] | 3.3-V LVTTL |
LEDR9 | PIN_B11 | LED [9] | 3.3-V LVTTL |
Verilog HDL Code
module LED_Blinking (
input clk,
output reg [9:0] LED
);
reg [24:0] cnt; // Counter for timing LED blinking
reg [3:0] current_led = 0; // Current LED being blinked
always @ (posedge clk) begin
cnt <= cnt + 1;
// Blink each LED for 5 seconds (assuming clock frequency of 50 MHz)
if (cnt == 25000000) begin
cnt <= 0;
current_led <= current_led + 1; // Move to the next LED
if (current_led == 10) begin
current_led <= 0; // Reset to LED0 if all LEDs are blinked
end
end
end
// Assign the output of each LED based on the current_led signal
always @* begin
LED = 10'b0000000000; // Initialize all LEDs to off
LED[current_led] = cnt[24]; // Blink the current LED
end
endmodule
Pin Planner
Node Name | Direction | Location | I/O Bank | VREF Group | Fitter Location | I/O Standard |
---|---|---|---|---|---|---|
LED[9] | Output | PIN_B11 | 7 | B7_N0 | PIN_B11 | 2.5 V |
LED[8] | Output | PIN_A11 | 7 | B7_N0 | PIN_A11 | 2.5 V |
LED[7] | Output | PIN_D14 | 7 | B7_N0 | PIN_D14 | 2.5 V |
LED[6] | Output | PIN_E14 | 7 | B7_N0 | PIN_E14 | 2.5 V |
LED[5] | Output | PIN_C13 | 7 | B7_N0 | PIN_C13 | 2.5 V |
LED[4] | Output | PIN_D13 | 7 | B7_N0 | PIN_D13 | 2.5 V |
LED[3] | Output | PIN_B10 | 7 | B7_N0 | PIN_B10 | 2.5 V |
LED[2] | Output | PIN_A10 | 7 | B7_N0 | PIN_A10 | 2.5 V |
LED[1] | Output | PIN_A9 | 7 | B7_N0 | PIN_A9 | 2.5 V |
LED[0] | Output | PIN_A8 | 7 | B7_N0 | PIN_A8 | 2.5 V |
clk | Input | PIN_P11 | 3 | B3_N0 | PIN_P11 | 2.5 V |