Forum Discussion

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

Using internal Clock of DE2 in Quartus-Verilog

Hi there, I'm very new to verilog and quartus, but I'm trying to build a digital clock.

I've set up the counters (I think) for seconds minutes and hours.

But what I am unsure about is how to use the internal clock to count seconds.

Here are some questions that I have:

1.How do I access the clock in Quartus? From what I have been reading it's an input Port I have to use called CLOCK_50 if I want to use the 50 mHz clock?

2.I used a clock divider to try to increment the seconds counter every 50,000 posedge changes of the clock so that I can achieve a 1 Khz clock, would that be slow enough to emulate seconds? (I assumed the clock is 50 mhz)

3. Do I have to do anything special to use the clock, like "import" anything or use any special modules?

Thank you for your time.

4 Replies

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

    I'm by no mean an expert, but I think I can help with some things...

    1. To access the clock, just declare a input pin named CLOCK_50.

    i.e.: CLOCK_50: IN STD_LOGIC;

    2. If you want to increment a variable every second, you need a 1hz clock, not 1KHz. A simple but not efficient way to do that is to count every clock until 50.000.000. At this you will have one second. Don't forget to zero your counter.

    3. You must set the FPGA pins attached to the oscilator. You can just import the DE2_pin_assignments.csv, available on the DE2 disc. To do so, go on "Assignments - Import Assignments" .

    If I said something wrong, please someone correct me.

    Hope I can help.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    does this mean the de2 has an internal clock so no external clock will be needed

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

    The DE2 has an on-board clock source connected to an FPGA pin.

    This thread has an example top-level design for the DE2-70 board;

    http://www.alteraforum.com/forum/showthread.php?t=33462

    Take a look at Post#5. It has instructions on how to build the design.

    The design does not have a hours-minutes-seconds clock, but it does control the LEDs and hex-displays, so it will give you a good starting point.

    Cheers,

    Dave