Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17244 Discussions

Need help in realizing a simple clock

Altera_Forum
Honored Contributor II
1,248 Views

Dear all,  

 

 

I found a question in using DE2-115 board and need your help. (I attached my source file ".v" in the for your information)  

 

 

Brief intro of the files:  

 

 

Top: lab2_DE115.v  

 

 

Goal: realize a simple clock, use the HEX LEDs on the board to show Hour: Min: Sec. If the Hour: Min: Sec reaches to 23:59:59, in the next second, the clock will go back to 00:00:00.  

 

 

Implementation: I used the DE2-115 embedded clock(50MHz), by (clock_divider.v, divide_by_50.v and divide_by_10.v) divide it to obtain 1sec per period. Then I used "ninth_counter.v and fifth_counter.v" to form the minutes and sec into 0-59:0-59. Then I use hex_7seg.v to show the Hour:Min:Sec output into the LEDs.  

 

 

Issue: I could not figure out how I can reset the the clock to "00:00:00" after it reaches to "23:59:59". 

 

 

More details: I created a signal: DAYSET and a subprogram: calladay.v. When the time reaches to "23:59:59", DAYSET will changes to "~DAYSET". I would like to use the changes in DAYSET to reset all of the digits of "Hour:Min:Sec". However, I could not figure out how I can insert the DAYSET into the functions. I tried several ways but the Quartus II always says I have some syntax error.  

 

 

Could anyone take a look at my code and give me some suggestions! 

 

 

Thanks!
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
516 Views

To detect the condition you want you must specifically look for the condition when all six digits are equal to the wrap values. This will be an extension of what (I assume) you are doing for other digits. 

 

E.g. in order to increment the first minute digit (3rd digit from right) you must see both 9 on digit 1 and 5 on digit 2. Incrementing digit 4 is conditional on the values on digits 1-3 - and so on. 

 

So, the condition for the wrap you are looking for is conditional on the values on all 6 digits. So, you will have to create some logic to look for this condition. 

 

It sounds like your 'DAYSET' register is an attempt at this. So, you're heading in the right direction. 

 

Regards, 

Alex 

 

PS. Please don't open identical threads on different sections of the forum :)
0 Kudos
Altera_Forum
Honored Contributor II
516 Views

Dear Alex,  

 

Thanks for the reply.  

 

"It sounds like your 'DAYSET' register is an attempt at this. So, you're heading in the right direction.": the issue is that I could not figure out how to use "DAYSET" to reset the the clock.  

 

I created a signal: DAYSET and a subprogram: calladay.v. When the time reaches to "23:59:59", DAYSET will changes to "~DAYSET". I would like to use the changes in DAYSET to reset all of the digits of "Hour:Min:Sec". However, I could not figure out how I can insert the DAYSET into the functions. I tried several ways but the Quartus II always says I have some syntax error.  

 

Can you please give me a hand?
0 Kudos
Altera_Forum
Honored Contributor II
516 Views

If you (still) have a problem with the syntax, post the relevant code and I'll have a look...

0 Kudos
Reply