Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
15 years ago

[URGENT HELP] Add addition single Counter BIT HELP!

---------- Code Removed ----------

19 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    I tested out on circuit board. hmm, if there any way i can add a if statement on the pushbutton(clk) once i pressed 1 time, i able to automatic count_counter<=count_counter+1??

    If
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Is it possible that your signal clk remains high or low ?

    Measure on the clk plz. (Hang an output on it)

    Its confusing if u use clk for an input pin cauze clk refers to clock.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Without the schematic top entity, the intention of the design actually can't be understood.

    In my understanding, you have two, loosely related objectives:

    - Design a two-digit BCD counter

    - make it switch a led on count 31

    You have tried to solve it by separate counters, and curiously placed an additional binary counter into a BCD digit counter. That's really arbitrary, but not impossible of course. I don't want to support this crude coding style however and would suggest to connect the compare to the BCD counter output, so you have only one counter.

    The BCD counter upper digit is wired incorrectly. You are operating it as a ripple carry counter, if so, the upper digit must be clocked on the falling edge. But a ripple carry counter is bad coding style anyway. To make it a synchronous counter, you have to add carry in- and outputs. You can consult the LPM_COUNTER MegaFunction as a reference.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hey FVM,

    Ok, I understand, The block diagram is work as ripple carry counter. That caused i can't capture the value of double digits. I now have 2 separate 7 segment display. If i'm using single LPM_Counter to do the counter, also able to project 2 separate 7 segment display together?

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    As far as I remember, LPM_COUNTER doesn't offer a BCD counter option. So you would use to modulus 10 counters, carryout of the lower digit connected to carry in of the higher digit, clk parallel to both. Of course, you can implement the carry in and out also in a VHDL counter of your own.

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hmm, FvM,

    let say if i using

    Digit1,Digit2 : in std_logic_vector (3 downto 0);

    process(digit1,digit2)

    is there any way to count 0 - 99 for digit1 and digit2 for output
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Yes, as said by setting up a two digit BCD counter, using two decimal (modulus 10) counters. Each decimal counter drives one digit. That has been basically correct in your schematic, just the overflow respectively carry wasn't.