how can i make this 24-hour clock into a 12-hour clock

Wendy

Joined Mar 24, 2008
23,429
Basically start from scratch and design a two digit counter that counts from 1 to 12. You will use gates to look at the logic conditions to do the appropriate resets (presets actually, since it needs to reset to 1).

There is a TTL chip out there that will do this, the 74192 (datasheet attached).

Interesting thing about the 74192, you can preload the registers to any number you want (they call this presetting). This feature is useful to make something similar to a reset that goes to 1 instead of zero.

We have had a lot of homework assignments for using clocks and this IC.

You seem to have focused on the TTL stuff, which is positively ancient. The CMOS series (4000 and 4500 families) have very close equivalents if you need to use a more modern chip, though those are considered obsolete nowdays too.

Like I said in the other post, some reading required. The good news is, while not being extremely advanced, it is extremely useful knowledge, something you will need forever if you keep working with digital logic.
 

Attachments

Georacer

Joined Nov 25, 2009
5,182
You could try the following:
Your outputs for the hour digits are 4-bit numbers, right? The difference between 12 hour and 24 hour system is that numbers past 11 don't show up in the 12 hour system. So, recognise numbers past 11 and substract 12 from them.
The logic test is this: Let H4,H3,H2,H1 be the decades number and L4,L3,L2,L1 be the units number. Numbers past 11 (12,13,14...) satisfy the function F=(H2+H1)*(L4*L3*L2)'. Feed this signal on the enable pin of 2 4-bit adders (or 1 of 8-bits), and substract 0001 0010 from them. This will be done by actually adding their complement of 2, 1110 1110. You don't need to compensate for a possible result of above 1010, as no half bit number is larger than 1100 to yield an invalid BCD result.
This might sound a little complicated, so feel free to ask about anything you don't understand.

PS: BCD represantation can be a bit tricky, but it's worth the trouble!
 

Thread Starter

pr1111

Joined Jul 8, 2010
35
You could try the following:
Your outputs for the hour digits are 4-bit numbers, right? The difference between 12 hour and 24 hour system is that numbers past 11 don't show up in the 12 hour system. So, recognise numbers past 11 and substract 12 from them.
The logic test is this: Let H4,H3,H2,H1 be the decades number and L4,L3,L2,L1 be the units number. Numbers past 11 (12,13,14...) satisfy the function F=(H2+H1)*(L4*L3*L2)'. Feed this signal on the enable pin of 2 4-bit adders (or 1 of 8-bits), and substract 0001 0010 from them. This will be done by actually adding their complement of 2, 1110 1110. You don't need to compensate for a possible result of above 1010, as no half bit number is larger than 1100 to yield an invalid BCD result.
This might sound a little complicated, so feel free to ask about anything you don't understand.

PS: BCD represantation can be a bit tricky, but it's worth the trouble!
it's complicated,,, i'm just starting at digital circuits
 

Thread Starter

pr1111

Joined Jul 8, 2010
35
Basically start from scratch and design a two digit counter that counts from 1 to 12. You will use gates to look at the logic conditions to do the appropriate resets (presets actually, since it needs to reset to 1).

There is a TTL chip out there that will do this, the 74192 (datasheet attached).

Interesting thing about the 74192, you can preload the registers to any number you want (they call this presetting). This feature is useful to make something similar to a reset that goes to 1 instead of zero.

We have had a lot of homework assignments for using clocks and this IC.

You seem to have focused on the TTL stuff, which is positively ancient. The CMOS series (4000 and 4500 families) have very close equivalents if you need to use a more modern chip, though those are considered obsolete nowdays too.

Like I said in the other post, some reading required. The good news is, while not being extremely advanced, it is extremely useful knowledge, something you will need forever if you keep working with digital logic.
if i use this ic will the 10 be gone... isn't it going to be 01 02 03 04 05 06 07 08 09 11 12???
 

beenthere

Joined Apr 20, 2004
15,819
if i use this ic will the 10 be gone... isn't it going to be 01 02 03 04 05 06 07 08 09 11 12???
A binary counter counts from 0 to F; a BCD counter (BCD is worthwhile to learn about) counts 0 to 9.

One thing that is always worth some time is using the IC number as a search term to obtain a data sheet. That document will give you the information you need to use the IC successfully.

That '393 obviously counts to 12 (C) in the lower stage. By decoding its outputs properly, you can change the clock to 12 hours and simply not use the upper section. That is a pain, IMHO. It is always simpler to use BCD counters for BCD applications. Look at the data sheet for a '390, for instance.

Bill's suggestion to use a '192 is very good. When a count gets to the end - say 12 - the logic can do a load function so the count goes back to 1 instead of 0. A '162 would also work.
 

Wendy

Joined Mar 24, 2008
23,429
This is where your training with gates come in. Remember, these counters are fundamentally binary. The most significant digit is a simple flip flop, unless you want to create an option for a 12 or 24 hour clock. The logic for each is totally different. However, with gates, you can make it optional (a common option for clocks).

Starting from a fresh count...

0 0001 .. 01
0 0010 .. 02
0 0011 .. 03
0 0100 .. 04
0 0101 .. 05
0 0110 .. 06
0 0111 .. 07
0 1000 .. 08
0 1001 .. 09
1 0000 .. 10 .. Note 1
1 0001 .. 11
1 0010 .. 12
1 0011 .. 13 .. Note 2

Note 1: A BCD counter will reset on 10, and sent a carry signal to the next stage. Look for this on the datasheet.

Note 2: A simple 3 input AND gate can sense the number thirteen, this is used to send a reset signal to the most significant digit (the simple flip flop) and a preset signal to the 74192, taking it back to the number 1. I have highlighted the digits used in the reset signal in red.

Side note, I regularly use diode gates in my designs. They lay out easier, and work. Just mentioning this as an option for you too.
 

Thread Starter

pr1111

Joined Jul 8, 2010
35
This is where your training with gates come in. Remember, these counters are fundamentally binary. The most significant digit is a simple flip flop, unless you want to create an option for a 12 or 24 hour clock. The logic for each is totally different. However, with gates, you can make it optional (a common option for clocks).

Starting from a fresh count...

0 0001 .. 01
0 0010 .. 02
0 0011 .. 03
0 0100 .. 04
0 0101 .. 05
0 0110 .. 06
0 0111 .. 07
0 1000 .. 08
0 1001 .. 09
1 0000 .. 10 .. Note 1
1 0001 .. 11
1 0010 .. 12
1 0011 .. 13 .. Note 2

Note 1: A BCD counter will reset on 10, and sent a carry signal to the next stage. Look for this on the datasheet.

Note 2: A simple 3 input AND gate can sense the number thirteen, this is used to send a reset signal to the most significant digit (the simple flip flop) and a preset signal to the 74192, taking it back to the number 1. I have highlighted the digits used in the reset signal in red.

Side note, I regularly use diode gates in my designs. They lay out easier, and work. Just mentioning this as an option for you too.
how can i set ' 192 to 1 2 3 4 5 6 7 8 9 0 1 2 then 1 2 3 4 5 6 7 8 9 0 1 2 again??

how can i preset it??
 
Last edited:

Wendy

Joined Mar 24, 2008
23,429
You preset it to 1 when 13 comes up, the rest follows. Have you studied the data sheet (this is a major part of learning electronics).
 

tom66

Joined May 9, 2009
2,595
Be a bit more patient. Wait more than 5 minutes.

Presetting on the 74193 chip is easy enough to explain with the datasheet:

http://www.datasheetcatalog.org/datasheets/90/248169_DS.pdf

Pull the LOAD pin high for normal operation. You load data, put the data you want on Data A, Data B, Data C and Data D, then pull LOAD low. When LOAD goes low, the data is loaded into the flip flops.

You could have learnt this from the third paragraph of the summary.

So basically, use a triple input (N)AND gate on the output, as Bill suggested, feed this to the LOAD pin with 0 0 0 0 on the data pins.
 

Thread Starter

pr1111

Joined Jul 8, 2010
35
i don't understand it... i just have this subject logic circuits 2 weeks ago and we are currently on boolean algebra.. i don't know much about anything else than logic gates
 

tom66

Joined May 9, 2009
2,595
You don't need to know anything more than what the datasheet says. Read the first page then you will have an idea. Or read my post.

I did not know how to preset the '192 before I wrote that post, the datasheet told me everything I needed to know.
 

Wendy

Joined Mar 24, 2008
23,429
Be a bit more patient. Wait more than 5 minutes.

Presetting on the 74193 chip is easy enough to explain with the datasheet:

http://www.datasheetcatalog.org/datasheets/90/248169_DS.pdf

Pull the LOAD pin high for normal operation. You load data, put the data you want on Data A, Data B, Data C and Data D, then pull LOAD low. When LOAD goes low, the data is loaded into the flip flops.

You could have learnt this from the third paragraph of the summary.

So basically, use a triple input (N)AND gate on the output, as Bill suggested, feed this to the LOAD pin with 0 0 0 0 on the data pins.
Or in his case, 0001.
 

Thread Starter

pr1111

Joined Jul 8, 2010
35
thanks everyone,,, i'm done with the clock,,,, i didn't go well in the 74ls193(i can't understand how to use it) so i just use a 74hc393 and logic gates....
 
Top