S
Smith
Guest
Hi all.
I've encountered problem in developing a simple BCD number display.
Hope you all can tell me what wrong that I did.
In the system, I use a 4-bits counter which supply the 4-bits inputs to
the 7-segment decoder, expecting the equivalent value of the 4-bits
binary number in BCD to be displayed in the 7-segment.
In my simulation of the system, I found that the counter works well,
counting from 0000 to 1111 perfectly. However, the simulation result in
the 7-segment display included the binary number of 0000, 0001, 0010,
and 0011 only. And then it repeats again. The rest combination of the
4-bits number are fail to be decoded. According to the simulation
result, it also shows that the decoded 0001 binary number take more
time before it changes to the decoded result of the 0010.
Is that because of the timing of the system cause this problem? Below
is the coding for my 7-segment decoder module. Hope you all can help me
to figure out the problem. Thanks.
_____________________________________________________________
module seg7 (clock, bcd, number_segments);
input clock;
input [3:0] bcd;
output [6:0]number_segments;
reg [6:0]number_segments;
reg [3:0]count;
//from previous 4-bits counter module
always @(posedge clock)
begin
count [3:0] = bcd;
end
// Create segment outputs
always @(bcd)
begin
case(bcd)
0000 : number_segments <= 7'b1110111;
0001 : number_segments <= 7'b0100100;
0010 : number_segments <= 7'b1011101;
0011 : number_segments <= 7'b1101101;
0100 : number_segments <= 7'b0101110;
0101 : number_segments <= 7'b1101011;
0110 : number_segments <= 7'b1111011;
0111 : number_segments <= 7'b0100101;
1000 : number_segments <= 7'b1111111;
1001 : number_segments <= 7'b1101111;
1010 : number_segments <= 7'b0111111;
1011 : number_segments <= 7'b1111010;
1100 : number_segments <= 7'b1010011;
1101 : number_segments <= 7'b1111100;
1110 : number_segments <= 7'b1011011;
1111 : number_segments <= 7'b0011011;
endcase
end
endmodule
I've encountered problem in developing a simple BCD number display.
Hope you all can tell me what wrong that I did.
In the system, I use a 4-bits counter which supply the 4-bits inputs to
the 7-segment decoder, expecting the equivalent value of the 4-bits
binary number in BCD to be displayed in the 7-segment.
In my simulation of the system, I found that the counter works well,
counting from 0000 to 1111 perfectly. However, the simulation result in
the 7-segment display included the binary number of 0000, 0001, 0010,
and 0011 only. And then it repeats again. The rest combination of the
4-bits number are fail to be decoded. According to the simulation
result, it also shows that the decoded 0001 binary number take more
time before it changes to the decoded result of the 0010.
Is that because of the timing of the system cause this problem? Below
is the coding for my 7-segment decoder module. Hope you all can help me
to figure out the problem. Thanks.
_____________________________________________________________
module seg7 (clock, bcd, number_segments);
input clock;
input [3:0] bcd;
output [6:0]number_segments;
reg [6:0]number_segments;
reg [3:0]count;
//from previous 4-bits counter module
always @(posedge clock)
begin
count [3:0] = bcd;
end
// Create segment outputs
always @(bcd)
begin
case(bcd)
0000 : number_segments <= 7'b1110111;
0001 : number_segments <= 7'b0100100;
0010 : number_segments <= 7'b1011101;
0011 : number_segments <= 7'b1101101;
0100 : number_segments <= 7'b0101110;
0101 : number_segments <= 7'b1101011;
0110 : number_segments <= 7'b1111011;
0111 : number_segments <= 7'b0100101;
1000 : number_segments <= 7'b1111111;
1001 : number_segments <= 7'b1101111;
1010 : number_segments <= 7'b0111111;
1011 : number_segments <= 7'b1111010;
1100 : number_segments <= 7'b1010011;
1101 : number_segments <= 7'b1111100;
1110 : number_segments <= 7'b1011011;
1111 : number_segments <= 7'b0011011;
endcase
end
endmodule