电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

FPGA的数码管显示(Verilog)

FPGA的数码管显示(Verilog)_第1页
1/7
FPGA的数码管显示(Verilog)_第2页
2/7
FPGA的数码管显示(Verilog)_第3页
3/7
FPGA 的数码管显示(Verilog) 按键与数码管显示 module key_led(clk_50M,key,duan_ma,wei_ma); input clk_50M; input [3:0] key; //key为输入的键码的值 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; //把键码的值赋给寄存器 case ( key_temp ) 4'b0111:duan_ma<=8'b1100_0000; //段码,按键后,数码管显示0 4'b1011:duan_ma<=8'b1001_0000; //段码,数码管显示9 4'b1101:duan_ma<=8'b1000_0010; //段码,数码管显示6 4'b1110:duan_ma<=8'b1011_0000; //段码,数码管显示3 endcase end always @ ( posedge clk_50M ) begin case( key_temp ) 4'b0111:wei_ma<=4'b0111; //位选信号 4'b1011:wei_ma<=4'b1011; 4'b1101:wei_ma<=4'b1101; 4'b1110:wei_ma<=4'b1110; endcase end endmodule 数码管静态显示0-7 module led_0_7 (clk,rst,dataout,en); input clk,rst; output[7:0] dataout; //数码管的段码输出 output[7:0] en; //数码管的位选使能输出 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 always @(cnt_scan) begin case(cnt_scan[15:13]) 3'b000 : en = 8'b1111_1110; 3'b001 : en = 8'b1111_1101; 3'b010 : en = 8'b1111_1011; 3'b011 : en = 8'b1111_0111; 3'b100 : en = 8'b1110_1111; 3'b101 : en = 8'b1101_1111; 3'b110 : en = 8'b1011_1111; 3'b111 : en = 8'b0111_1111; default : en = 8'b1111_1110; endcase end always@(en) //对应COM 信号给出各段数据 begin case(en) 8'b1111_1110: dataou t_bu f=0; 8'b1111_1101: dataou t_bu f=1; 8'b1111_1011: dataou t_bu f=2; 8'b1111_0111: dataou t_bu f=3; 8'b1110_1111: dataou t_bu f=4; 8'b1101_1111: dataou t_bu f=5; 8'b1011_1111: dataou t_bu f=6; 8'b0111_1111: dataou t_bu f=7; defau lt: dataou t_bu f=8; endcase end always@(dataout_buf) begin case(dataout_buf) 4'b0000: dataout=8'b1100_0000; 4'b0001: dataout=8'b1111_1001; 4'b0010: dataout=8'b1010_0100; 4'b0011: dataout=8'b1011_0000; 4'b0100: dataout=8'b1001_1001; 4'b0101: dataout=8'b1001_0010; 4'b0110: dataout=8'b1000_0010; 4'b0111: dataout=8'b1111_1000; 4'b1000: dataout=8'b1000_0000; 4'b1001: dataou t=8'b1001_1000; 4'b1010: dataou t=8'b1000_1000; 4'b1011: dataou t=8'b1000_0011; 4'b1100: dataou t=8'b1100_0110; 4'b1101: dataou t=8'b1010_0001; 4'b1110: dataou t=8'b1000_0110; 4'b1111: dataou t=8'b1000_1110; endcase end endmodu le

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

FPGA的数码管显示(Verilog)

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部