module led_jingtai(clk,seg_reg);
output [6:0] seg_reg;
input clk;
reg [6:0] seg_reg;
reg [6:0] disp_dat;
reg [26:0] count;
always @(posedge clk)
begin
count=count+1;
end
always
begin
disp_dat=count[26:23]; //xian shi shu zhi
if(disp_dat>15)
begin
disp_dat=4'b0000;
end
end
always @(disp_dat)
begin
case(disp_dat)
4'h0:seg_reg=7'b1000000;//0
4'h1:seg_reg=7'b1111001;//1
4'h2:seg_reg=7'b0100100;//2
4'h3:seg_reg=7'b0110000;//3
4'h4:seg_reg=7'b0011001;//4
4'h5:seg_reg=7'b0010010;//5
 |
文件: |
led_jingtai.rar |
大小: |
264KB |
下载: |
下载 | |
4'h6:seg_reg=7'b0000010;//6
4'h7:seg_reg=7'b1111000;//7
4'h8:seg_reg=7'b0000000;//8
4'h9:seg_reg=7'b0010000;//9
4'ha:seg_reg=7'b0001000;//a
4'hb:seg_reg=7'b0000011;//b
4'hc:seg_reg=7'b1000110;//c
4'hd:seg_reg=7'b0100001;//d
4'he:seg_reg=7'b0000110;//e
endcase
end
endmodule
阅读(1162) | 评论(0) | 转发(0) |