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

  • Hey guys. I am new to coding. And I need your help in answering this problem...

    Hey guys. I am new to coding. And I need your help in answering this problem for me. You have to answer this problem using only C++ programming language. Thanks. "Write a program that asks the user for an integer value, num. The program calculates the total number of factors of num. For example, if the user enters 12, the program should print out 6 (1,2,3,4,6,12)."

  • 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 Every one, hope all is well. I need help in Using Haskell coding Please, please...

    Hi Every one, hope all is well. I need help in Using Haskell coding Please, please read the instructon very carefully to: (in Syntax Code please) NOTE: function headers (for example, for the area-of-a-rectangle function, do not need to write area :: Int-> Int-> Int at the top of your function). You may use the :{ ... :} syntax to write multi-line functions in prelude Haskell platform. Write a function that takes three numbers, a b, and c, and returns...

  • 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...

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