I have a analogue to digital converter that after conversion stores its results in two 14 bit registers. I have to display this value onto a 2 digit 7 segment display.
Here is the simulation showing the 14 bit result:
As can be seen the values are quite large for a 2 digit display. I can display these values to a one tenth of a volt. Here is the display multiplexing circuit:
module muxer(
input clock,
input reset,
input [3:0] second,
input [3:0] first,
output a_m,
output b_m,
output c_m,
output d_m,
output e_m,
output f_m,
output g_m,
output [1:0] cat_m
);
//The Circuit for 7 Segment Multiplexing -
localparam N = 18;
reg [N-1:0]count; //the 18 bit counter which allows us to multiplex at 1000Hz
always @ (posedge clock)
begin
if (reset)
count <= 0;
else
count <= count + 1;
end
reg [3:0]sseg; //the 4 bit register to hold the data that is to be output
reg [1:0]cat_temp; //register for the 2 bit enable
always @ (*)
begin
case(count[N-1:N-2]) //MSB and MSB-1 for multiplexing
2'b00 :
begin
sseg = first;
cat_temp = 2'b01;
end
2'b01:
begin
sseg = second;
cat_temp = 2'b10;
end
endcase
end
assign cat_m = cat_temp;
reg [6:0] sseg_temp;
always @ (*)
begin
case(sseg)
4'd0 : sseg_temp = 7'b1000000; //display 0
4'd1 : sseg_temp = 7'b1111001; //display 1
4'd2 : sseg_temp = 7'b0100100; //display 2
4'd3 : sseg_temp = 7'b0110000; //display 3
4'd4 : sseg_temp = 7'b0011001; //display 4
4'd5 : sseg_temp = 7'b0010010; //display 5
4'd6 : sseg_temp = 7'b0000010; //display 6
4'd7 : sseg_temp = 7'b1111000; //display 7
4'd8 : sseg_temp = 7'b0000000; //display 8
4'd9 : sseg_temp = 7'b0010000; //display 9
default : sseg_temp = 7'b0111111; //dash
endcase
end
assign {g_m, f_m, e_m, d_m, c_m, b_m, a_m} = sseg_temp;
endmodule
I have made it so that I can display the digits by passing the values to the first
and second
register. but dont know how to accomplish this with the values of DataA
and DataB
shown in simulation.
Thanks