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

    You are using the push button for clk ?

    Is the led hanging on the most significant BCD (counts 10 , 20 , 30 , ...)

    or the least significant BCD (counts 1 , 2 , 3 , ... , 9) ?

    in this case (every 31 counts) u need to hang it on the least significnat BCD (in your image the lower one). In the other one LED will be left open.

    What happens is : The lower one counts every time u push the button.

    When it reaches 9 the uppen one goes one up. So the upper one counts every 10 times. If u place "if (count_counter=2) then ... " in the upper one, it will remain high for 10 times or from 20 to 29.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Isn't it easyer to put the 2 BCD counters in one process? Or in one VHDL file.

    your code seems right to me except u don't reset count_counter

    it will count to 255 in stead of 31. Or u can make

    signal count_counter: unsigned(4 downto 0);

    If count is 31 next will be 0

    Why it remains high for 31 till 39? Don't know the code seems right. No time to test it on a testbench srry
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    This code is loop from 0 - 99.

    --- Quote End ---

    Can't be seen from the code.

    --- Quote Start ---

    The led will turn on from 30 - 39

    --- Quote End ---

    Not true for the shown code.