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

    Here's a guide.

    1. Use synchronous design techniques, eg., use the 50MHz clock on your board.

    2. Design a synchronizer component, eg., dual DFF for converting an asynchronous external signal to a synchronous signal

    3. Synchronize the external push button signals and then debounce them, i.e., check that the button transition from high to low or low to high is clean. You might need to use a counter to decide that button transitions are only recognized if the button state changes and is held for say 10 clocks. The button change can be converted to a single clock period wide pulse, and this can be the enable for your counter that drives the hex display.

    4. Design a hex to 7-segment display driver

    5. Wire it all together

    Don't go searching too far for source code, try and write it yourself, I'll show you examples if you cannot figure it out.

    Are you writing VHDL or SystemVerilog code?

    What board are you using?

    Cheers,

    Dave