file://E:\DSC00481.JPG程序如下,未用端口已设置为高电平,指定的是最左端的数码管,右边三个为啥会亮?而且四个数码管变化一致。
module shumaguan (out,key_in,EN);
input [2:0] key_in; //an jian shu ru
output EN;
output [7:0] out;
reg [7:0] out;
wire [2:0] key_in;
assign EN = 0; //xuan ze yi ge shu ma guan
always@(key_in)
begin
case(key_in)
3'b111: out = 8'b11000000; //0
3'b110: out = 8'b11111001; //1
3'b101: out = 8'b10100100; //2
3'b100: out = 8'b10110000; //3
3'b011: out = 8'b10011001; //4
3'b010: out = 8'b10010010; //5
3'b001: out = 8'b10000010; //6
3'b000: out = 8'b11111000; //7
endcase
end
endmodule
|