**Button and Digital Tube Display**
LED digital display (LEDSegmentDisplays) is a device that consists of multiple light-emitting diodes (LEDs) arranged in an "8" shape. These LEDs are internally connected, and only the respective segments and common terminals need to be controlled. The most commonly used LED digital tubes have 7 segments plus a decimal point, while others may resemble a "1+1" type. They come in various forms such as half digits, 1, 2, 3, 4, 5, 6, 8, 10, and more. Based on the internal connection method, LED digital tubes are divided into two types: common cathode and common anode. Understanding these characteristics is crucial because different types of digital tubes require different hardware circuits and programming approaches. Figure 2 shows the internal circuit diagrams of both common cathode and common anode digital tubes. Their illumination principles are similar, but their power supply polarities differ. LED displays are available in various colors such as red, green, blue, and yellow.
Figure 1: This is a 10-pin 7-segment LED digital tube with a decimal point.
Figure 2: Pin definition.
The following describes the implementation of an FPGA-based button-controlled digital tube display program: ```verilog module key_led(clk_50M, key, duan_ma, wei_ma); input clk_50M; input [3:0] key; // Input key code output [3:0] wei_ma; output [7:0] duan_ma; wire [3:0] key; reg [7:0] duan_ma; reg [3:0] wei_ma; reg [3:0] key_temp; always @(posedge clk_50M) begin key_temp <= key; // Store the key value case (key_temp) 4'b0111: duan_ma <= 8'b11000000; // Display '0' 4'b1011: duan_ma <= 8'b10010000; // Display '9' 4'b1101: duan_ma <= 8'b10000010; // Display '6' 4'b1110: duan_ma <= 8'b10110000; // Display '3' endcase end always @(posedge clk_50M) begin case (key_temp) 4'b0111: wei_ma <= 4'b0111; // Select the corresponding digit 4'b1011: wei_ma <= 4'b1011; 4'b1101: wei_ma <= 4'b1101; 4'b1110: wei_ma <= 4'b1110; endcase end endmodule ``` This module controls the digital tube based on the pressed key. Each key corresponds to a specific segment code and selects the appropriate digit position. For static display of numbers 0 through 7, another module can be used: ```verilog module led_0_7(clk, rst, dataout, en); input clk, rst; output [7:0] dataout; // Segment code output output [7:0] en; // Digit selection enable reg [7:0] dataout; reg [7:0] en; reg [15:0] cnt_scan; reg [4:0] dataout_buf; always @(posedge clk or negedge rst) begin if (!rst) begin cnt_scan <= 0; end else begin cnt_scan <= cnt_scan + 1; end end endmodule ``` This module enables the static display of numbers 0 to 7 by controlling the segment codes and selecting the appropriate digit positions. It is often used in simple digital display applications where only a few digits need to be shown at a time.Welding Cable,Welding Earth Cable,Flexible Welding Cable,Copper Welding Cable
HENAN QIFAN ELECTRIC CO., LTD. , https://www.hnqifancable.com