Question

Write a coding for Counter to count from 00 until 99 (in decimal). Display the result at 2 BCD 7- segment attached to address

Hi guys, i need the coding, please help me. (Must using KEIL uversion software). TQ

0 0
Add a comment Improve this question Transcribed image text
Answer #1
module twodigit_counter(
  input clock,
    input reset,
    output a,
    output b,
    output c,
    output d,
    output e,
    output f,
    output g,
    output dp,
    output [3:0]an
    );
  
reg [3:0]first; //register for the first digit
reg [3:0]second; //register for the second digit

reg [22:0] delay; //register to produce the 0.1 second delay
wire test;

always @ (posedge clock or posedge reset)
 begin
  if (reset)
   delay <= 0;
  else
   delay <= delay + 1;
 end
 
assign test = &delay; //AND each bit of delay with itself; test will be high only when all bits of delay are high


always @ (posedge test or posedge reset)
 begin
  if (reset) begin
   first <= 0;
   second <= 0;
  end
   else if (first==4'd9) begin  //x9 reached
    first <= 0;
     if (second == 4'd9) //99 reached
      second <= 0;
      else
       second <= second + 1;
     
   end
   else
    first <= first + 1;
  end
  


local N = 18;

reg [N-1:0]count;

always @ (posedge clock or posedge reset)
 begin
  if (reset)
   count <= 0;
  else
   count <= count + 1;
 end

reg [6:0]sseg;
reg [3:0]an_temp;
always @ (*)
 begin
  case(count[N-1:N-2])
   
   2'b00 : 
    begin
     sseg = first;
     an_temp = 4'b1110;
    end
   
   2'b01:
    begin
     sseg = second;
     an_temp = 4'b1101;
    end
   
   2'b10:
    begin
     sseg = 6'ha; //unknown sent to produce '-'
     an_temp = 4'b1011;
    end
    
   2'b11:
    begin
     sseg = 6'ha; //unknown sent to produce '-'
     an_temp = 4'b0111;
    end
  endcase
 end
assign an = an_temp;

reg [6:0] sseg_temp; 
always @ (*)
 begin
  case(sseg)
   4'd0 : sseg_temp = 7'b1000000; //0
   4'd1 : sseg_temp = 7'b1111001; //1
   4'd2 : sseg_temp = 7'b0100100; //2
   4'd3 : sseg_temp = 7'b0110000; //3
   4'd4 : sseg_temp = 7'b0011001; //4
   4'd5 : sseg_temp = 7'b0010010; //5
   4'd6 : sseg_temp = 7'b0000010; //6
   4'd7 : sseg_temp = 7'b1111000; //7
   4'd8 : sseg_temp = 7'b0000000; //8
   4'd9 : sseg_temp = 7'b0010000; //9
   default : sseg_temp = 7'b0111111; //dash
  endcase
 end
assign {g, f, e, d, c, b, a} = sseg_temp; 
assign dp = 1'b1; //we dont need the decimal here so turn all of them off



endmodule
Add a comment
Know the answer?
Add Answer to:
Hi guys, i need the coding, please help me. (Must using KEIL uversion software). TQ Write...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • hi..help me please solve this quuestion..tq so much..i realy need the answer for this question please..tq...

    hi..help me please solve this quuestion..tq so much..i realy need the answer for this question please..tq again.. I) Lt X be a random sample from the tUimifom (o, ) distribution Consider max( Xz. X) a and b are the random interval (ay,' b%) around 0, where },-max(Xi, X. . X.), a and b are constants such that 1 sasb Find the confidence level of this interval

  • hi I need help with my homework please help me with this topic I have I...

    hi I need help with my homework please help me with this topic I have I provide you with the information please help   PLEASE BE CLAER MAKE SURE NO PLAGIARISM I NEED 350 WORDS and also if you can it Must be third person Topic - Drug abuse information: (pertaining to your topic), outline one thing that would be a step in the right direction to address this, and address potential barriers to implementation. Research comparable nations’ strategies to address...

  • python Hi guys, I really need help with that please Can I get help with this...

    python Hi guys, I really need help with that please Can I get help with this python program? Please write clear Show all the steps please, the outcome and follow the directions. Volume # Purpose: This program computes the volume (in liters) of a six-pack of soda cans and the total volume of a six-pack and a two-liter bottle. Complete the following: # Liters in a 12-ounce can and a two-liter bottle. # Number of cans per pack. # Calculate...

  • Hi guys, I need some help with this physics exercise! 2) If th direction, what must...

    Hi guys, I need some help with this physics exercise! 2) If th direction, what must be its value (sign and magnitude) in terms of E and B? e charged particle does not deviate from its original Bin ㄨㄨㄨㄨㄨㄨㄨ Source Slit

  • Hi everyone, I need help In Haskell Coding. Please code in Haskell, Regards 1) Write a...

    Hi everyone, I need help In Haskell Coding. Please code in Haskell, Regards 1) Write a function that takes a list of tuples of three integers each and returns a list consisting of just the tuples that are Pythagorean triples. instead of using a list comprehension, use lambda expression and a function that tests one tuple and returns a Bool. As long as the lambda expression is correct, it is OK to make this simpler by having the lambda calls...

  • Please Solve As soon as Solve quickly I get you thumbs up directly Thank's Abdul-Rahim Taysir...

    Please Solve As soon as Solve quickly I get you thumbs up directly Thank's Abdul-Rahim Taysir Part 2: Write a VHDL code to complete the following VHDL code to implement a two-digit BCD counter. A two-digit (two-decade) BCD counter counts in decimal, a two-digit BCD counter counts from 00 decimal to 99 decimal. On the next count, it rolls over to 00 decimal. The least significant four bits of the counter represent the least significant decimal digit (0 to 9)...

  • Hi I need help with my homework please I give you all the instruction on the...

    Hi I need help with my homework please I give you all the instruction on the assignment I need help with it please it is very important please be clear and give me a good answer and very important please so important (I need no plagiarism, please) and also copy and paste it better and clear to read. Must be 300 words assignment guidelines: Must be 300 words Must be AMA format Must be third person and please give me...

  • hi I need help with my homework please help me with this topic I have I provide you with the information please help&nbs...

    hi I need help with my homework please help me with this topic I have I provide you with the information please help  PLEASE BE CLAER MAKE SURE NO PLAGIARISM I NEED 350 WORDS and also if you can it Must be third person if you can Topic - Drug abuse information: Considering the increasing problem in the U.S. (pertaining to your topic), outline one thing that would be a step in the right direction to address this, and address potential...

  • Hi guys can you please help me out with this I couldn’t do it in straight...

    Hi guys can you please help me out with this I couldn’t do it in straight lines. Please take look at the directions below the question :$ much thanks 37 m 10 m :Ξ 1,5 m 9 m Sheet pile 24 m k 10-3cm/sec Impermeable layer Figure 8.20 8.7 Draw a flow net for the weir shown in Figure 8.20. Calculate the rate of seepage under the weir.

  • Hi guys I need answer for this problem as soon as possible please help. thank you...

    Hi guys I need answer for this problem as soon as possible please help. thank you very much in advance. 3. A convex mirror of focal length 30.0 cm is placed 20.0 cm to the left of a plane mirror. An object 10.0 cm tall is placed midway between the two mirrors. Determine the location and height of the first three images formed by convex mirror

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT