seconds on 7 seg display
hi all
i need help with this verilog code.
it supose to display the seconds from 1s to 60s on 7 seg displays and reset.
no errors but wrong output
please help .
module seconds (clock,counter,clock_1Hz,enable,counter_s0,Hex_s0,counter_s1,Hex_s1);
input clock;
output reg [23:0] counter;
output reg clock_1Hz;
input enable;
output reg [3:0] counter_s0;
output reg [6:0] Hex_s0;
output reg [3:0] counter_s1;
output reg [6:0] Hex_s1;
always@ (posedge clock)
begin
counter <= counter+1;
if (counter==24'hCDFE60)
begin
clock_1Hz <= !clock_1Hz;
counter <= 0;
if (enable == 0)
begin
counter_s0 <= counter_s0+1;
if (counter_s0== 4'b1001)
counter_s1 <= counter_s1+1;
case (counter_s0)
4'b0000: Hex_s0 = 7'b1000000;
4'b0001: Hex_s0 = 7'b1001111;
4'b0010: Hex_s0 = 7'b0100100;
4'b0011: Hex_s0 = 7'b0110000;
4'b0100: Hex_s0 = 7'b0011001;
4'b0101: Hex_s0 = 7'b0010010;
4'b0110: Hex_s0 = 7'b0000010;
4'b0111: Hex_s0 = 7'b1111000;
4'b1000: Hex_s0 = 7'b0000000;
4'b1001: Hex_s0 = 7'b0010000;
endcase
case (counter_s1)
4'b0000: Hex_s1 = 7'b1000000;
4'b0001: Hex_s1 = 7'b1001111;
4'b0010: Hex_s1 = 7'b0100100;
4'b0011: Hex_s1 = 7'b0110000;
4'b0100: Hex_s1 = 7'b0011001;
4'b0101: Hex_s1 = 7'b0010010;
4'b0110: Hex_s1 = 7'b0000010;
endcase
end
else begin
counter_s0 <= 0;
counter_s1 <= 0;
end
end
end
endmodule