verilog中有关显示数码管的问题,很简单~
我要设计一个七人表决器,led灯表明是否通过,数码管显示赞成票和否定票的数量,求怎样让数码管显示票数啊!!...
我要设计一个七人表决器,led灯表明是否通过,数码管显示赞成票和否定票的数量,求怎样让数码管显示票数啊!!
展开
1个回答
展开全部
就那那种丑丑的七个HEX display来说吧,你给他一个七位长的二级制,七位对应display上的七格,0就是亮,1就是不亮。(有的是反过来的)
http://en.wikipedia.org/wiki/Seven-segment_display
拉倒下面看那个表啦
表里的abcdefg对应的是七个segment
code如下
module SevenSegmentDisplayDecoder(ssOut, nIn);
output reg [6:0] ssOut;
input [3:0] nIn;
// ssOut format {g, f, e, d, c, b, a}
always @(nIn)
case (nIn)
4'h0: ssOut = 7'b0111111;
4'h1: ssOut = 7'b0000110;
4'h2: ssOut = 7'b1011011;
4'h3: ssOut = 7'b1001111;
4'h4: ssOut = 7'b1100110;
4'h5: ssOut = 7'b1101101;
4'h6: ssOut = 7'b1111101;
4'h7: ssOut = 7'b0000111;
4'h8: ssOut = 7'b1111111;
4'h9: ssOut = 7'b1100111;
4'hA: ssOut = 7'b1110111;
4'hB: ssOut = 7'b1111100;
4'hC: ssOut = 7'b0111001;
4'hD: ssOut = 7'b1011110;
4'hE: ssOut = 7'b1111001;
4'hF: ssOut = 7'b1110001;
default: ssOut = 7'b1001001;
endcase
endmodule
http://en.wikipedia.org/wiki/Seven-segment_display
拉倒下面看那个表啦
表里的abcdefg对应的是七个segment
code如下
module SevenSegmentDisplayDecoder(ssOut, nIn);
output reg [6:0] ssOut;
input [3:0] nIn;
// ssOut format {g, f, e, d, c, b, a}
always @(nIn)
case (nIn)
4'h0: ssOut = 7'b0111111;
4'h1: ssOut = 7'b0000110;
4'h2: ssOut = 7'b1011011;
4'h3: ssOut = 7'b1001111;
4'h4: ssOut = 7'b1100110;
4'h5: ssOut = 7'b1101101;
4'h6: ssOut = 7'b1111101;
4'h7: ssOut = 7'b0000111;
4'h8: ssOut = 7'b1111111;
4'h9: ssOut = 7'b1100111;
4'hA: ssOut = 7'b1110111;
4'hB: ssOut = 7'b1111100;
4'hC: ssOut = 7'b0111001;
4'hD: ssOut = 7'b1011110;
4'hE: ssOut = 7'b1111001;
4'hF: ssOut = 7'b1110001;
default: ssOut = 7'b1001001;
endcase
endmodule
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询