# 12 Hour Digital Clock AM/PM LED Indicator

#### nephelem

Joined Jan 24, 2016
20
I have built this schematic and now it's working. How can I add 2 LEDs to indicate AM/PM since this is a 12-hour digital clock? Please help me

#### DickCappels

Joined Aug 21, 2008
10,246
This is only an idea but you could makeba circuit that puts out a pulse when the two digits in the hours part of the circuit changes to "12" and use that toggle a flip-flop that drives the AM/PM LED.

#### crutschow

Joined Mar 14, 2008
34,844
Unless it's an alarm clock, why do you want an AM/PM indication?

#### nephelem

Joined Jan 24, 2016
20
This is only an idea but you could makeba circuit that puts out a pulse when the two digits in the hours part of the circuit changes to "12" and use that toggle a flip-flop that drives the AM/PM LED.
Yep, that's exactly what's on my mind but I don't know how to build a circuit for that. Tried to search on google but there's no exact or simply closer idea for that circuit.

#### nephelem

Joined Jan 24, 2016
20
Unless it's an alarm clock, why do you want an AM/PM indication?
Our professor told us to build a 12 hour clock with 2 LEDs for AM/PM indication. We will actually connect some pins on circuit to the corresponding GPIO pins on Altera DE1 Board (Quartus - Cyclone II Device) and program the logic gates used to make it run as how it should be.

#### DickCappels

Joined Aug 21, 2008
10,246
Yep, that's exactly what's on my mind but I don't know how to build a circuit for that. Tried to search on google but there's no exact or simply closer idea for that circuit.
It should not be difficult logic to come up with. Do you know what the BCD patterns corresponding to 1 and 2? It should be an easy circuit, the "2" is only displayed in the hours digit two times. A binary-to-decimal decoder and some AND gates driving a flip-flop could do it.

Last edited:

#### AnalogKid

Joined Aug 1, 2013
11,202
You already have gating to detect certain numbers and reset some counters when they occur. Add more gating to detect the hour 11. That signal goes negative when the clock changes from 11:59 to 12:00, and that edge can clock a toggle flipflop, and the Q and -Q oututs can drive the two LEDs.

ak

#### GopherT

Joined Nov 23, 2012
8,009
It should not be difficult logic to come up with. Do you know what the BCD patterns corresponding to 1 and 2? It should be an easy circuit, the "2" is only displayed in the hours digit two times. A binary-to-decimal decoder and some AND gates driving a flip-flop could do it.
He is using the CD4026 chip (counter to 7-seg driver). There is no accessible BCD. He will need to grab the evidence of a 1 and 2 on the hour display from the 7-segment inputs into glue logic and output that to his flip/flop toggle.

#### Art

Joined Sep 10, 2007
806
If the hour MSD can only be 0 or 1 or have lead zero blanking,
It looks like you only have to look at one segment of the hour MSD with the flip flop input.

#### GopherT

Joined Nov 23, 2012
8,009
If the hour MSD can only be 0 or 1 or have lead zero blanking,
It looks like you only have to look at one segment of the hour MSD with the flip flop input.
Wouldn't that change the am/PM toggle as the clock clicks from 12:59 to 01:00? Am/PM toggles from 11:59 to 12:00.

Or am I misunderstanding?

#### marcf

Joined Dec 29, 2014
295
If our ancestors had not harbored a pathological fear of the number zero, this programming challenge would not be an issue.

#### crutschow

Joined Mar 14, 2008
34,844
If our ancestors had not harbored a pathological fear of the number zero, this programming challenge would not be an issue.
What??

#### marcf

Joined Dec 29, 2014
295
There is a great book you should read. ZERO "The biography of a dangerous idea" by Charles Seife.

#### GopherT

Joined Nov 23, 2012
8,009
There is a great book you should read. ZERO "The biography of a dangerous idea" by Charles Seife.
You might want to read beyond the title as well. It is not about leading zeros or the numeral "0" or the second digit of the number 10. It is about the concept of nothingness or beginning and similar mathematical starting points necessary to use math to solve problems and the representation thereof.

#### marcf

Joined Dec 29, 2014
295
I agree, but it is not to logical to count up to 12 and then go to 1. It makes much more sense to start at 0 and count to 23.

#### DickCappels

Joined Aug 21, 2008
10,246
bump

#### GopherT

Joined Nov 23, 2012
8,009
!?!?

What? The OP fell off of the face of the interwebs. Why does this one deserve a bump? Or did you just finish the book (post 13)

#### DickCappels

Joined Aug 21, 2008
10,246
To serve a technical purpose. Now let it drift into the past.