Forum Discussion

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

0-15 counter

Hi Guys,

Can anyone help me i am nee to altera programming.

Can anyone help me i am trying to write an up and down counter that counts from 0-15 with 2 bushbuttons and 2 7 segments display

plaease help or guide me.

11 Replies

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

    You need to start out simpler than this. What you want to do should not really be implemented the way you're attempting to do it. I'm not saying you are wrong, merely that I would like to show you a way of implementing your design that will help you in the long run.

    For example, your clk_div logic is dividing the clock, and then the divided signal is being used as a clock. This is a bad way to design a circuit in an FPGA - at least it is a bad idea to start learning this way without understanding why it is bad. Good synchronous design uses a single clock (or as few clocks as possible, with clock-domain-crossing logic between clocks). Your circuit can be implemented using a clock divider, but the divider is then used to create an enable pulse for another counter.

    Go back to my original suggestion of driving your hex display directly with the MSBs of a counter (the github repo has examples), or go back to the guide you asked for at the beginning of this post.

    Cheers,

    Dave