oldmanB
oldmanB

Reputation: 1

Quartus 12 Hours Clock (Synchronous)

I'm trying to build a 12 hour clock in Quartus using multiple LPM counters, with the requirement that it be run synchronously, with all lpm counters being driving by a single clock source.

I put together a BDF with two counters to test out the seconds, with one mod-10 counter handling the 'ones' digit, and another mod-6 counter handling the 'tens' digit. A carry out from the mod-10 drives a clock enable pin on the mod-6 counter. Everything work as expected in simulation.

I tried to duplicate this module to work as the minutes counter, except that I'm getting very strange results with the minutes 'ones' mod-10 counter. Whenever the seconds 'tens' counter hits 5, the minutes 'ones' starts counting on every clock pulse, until the previous counter rolls over to zero again.

Here's a picture of my BDF, along with a waveform simulation:

Here's a picture of my BDF, along with a waveform simulation

I'm not sure what's causing the issue, because as I understand it, the cout from the second tens should only be asserted when it rolls over to 0, and only long enough so that the minute ones increments a single time.

Just for curiosities sake, I swapped around two middle counters, to see if the issue was related to how the mod6 cout was driving the mod10, but arrive at the same results, (except the mod ten hits 9, then triggers the mod6 to count on every clk pulse until the mod10 rolls over to 0)

Any help would be appreciated, thanks.

Upvotes: 0

Views: 684

Answers (1)

user149341
user149341

Reputation:

Your condition for incrementing the ones digit in the minute is effectively:

Is the ten digits of the seconds equal to 5?

Thus, you'll increment the minute every second from :50 to :59.

You need to make the state of the ones digit in the seconds a factor as well -- the simplest way to do this will be to AND the carry out with the carry in from the previous stage.

Upvotes: 0

Related Questions