You are on page 1of 16

HIGHER TECHNOLOGICAL INSTITUTE

CMOS Digital Clock


Advanced Electronics Lab.
AbdelRahman Yahia El-Feky Mohammed Morsy Hussien Ihab Nasr AbdelHamid
20061048 20060753 20060280

Submitted to
Dr. AbdAllah Mouselhy
Eng. Françoua

The clock consists of three sections seconds, minutes and hours. After reading the time
23 hours 59 minutes 59 seconds it resets back to 00.00.00, better referred to as the 0th
hour.
Keywords
A) Using IC 4026 & 7-segments (5001).
B) Designing Sequential Circuit (counter and display driver designing with IC 4026,
AND gates and inverters).

Introduction
We know that all clocks (regardless of technology) have a few required components:
• A source of power to run the clock
In a pendulum clock, the weights or the springs handle this role.
• An accurate time base that acts as the clock's heartbeat
In a pendulum clock, the pendulum and escapement handle this role.
• A way to gear down the time base to extract different components of time (hours,
minutes, seconds)
In a pendulum clock, gears serve this role.
• A way to display the time
In a pendulum clock, the hands and face serve this role.

A digital clock is no different. It simply handles these functions electronically rather than
mechanically. So in a digital clock, there is an electrical power supply (either a battery or
120-volt AC power from the wall). There is an electronic time base that "ticks" at some
known and accurate rate. There is an electronic "gearing mechanism" of some sort --
generally a digital clock handles gearing with a component called a "counter." And there
is a display, usually either LEDs (light emitting diodes) or an LCD (liquid crystal
display).
Illustration
Introduction
We know that 60 seconds equal to 1 minute and 60 minutes equal to 1 hour. Hence the
minute section is drived by second section and hour section by the minute section. Each
of the minute and second section has been designed to give a count from 00 to 59 after
which it resets to 00 and the hour section to give a count from 00 to 23 hours after which
it resets to 00. For each cycle of 00 to 59 in second section the minute section increases
its count by 1. Similarly for each cycle of 00 to 59 in minutes section the hour section
increases its count by 1. In this way when the clock reaches 23 hrs. 59mins. 59secs. each
of the section resets to 00 giving us a display 00.00.00 popularly known as the 0th hour.

Now, without wasting any time we straightaway move into the discussion with our
project with emphasis on different sections considering the modules.

High-Level View (for illustration only)


Here is a quick overview of the components of a digital clock at a high level.

At the heart of the clock there is a piece that can generate an accurate 60-hertz (Hz,
oscillations per second) signal. There are two ways to generate this signal:

The signal can be extracted from the 60-Hz oscillations in a normal power line. Many
clocks that get their power from a wall socket use this technique because it is cheap and
easy. The 60-Hz signal on the power line is reasonably accurate for this purpose.

The signal can be generated using a crystal oscillator. Obviously, any battery-operated
clock or wristwatch will use this technique instead. It takes more parts, but is generally
much more accurate.

The 60-Hz signal is divided down using a counter. When building your own clock, a
typical TTL part to use is a 7490 decade counter. This part can be configured to divide by
any number between 2 and 10, and generates a binary number as output. So you take your
60-Hz time base, divide it by 10, divide it by 6 and now you have a 1-Hz (1 oscillation
per second) signal. This 1-Hz signal is perfect for driving the "second hand" portion of
the display. So far, the clock looks like this in a block diagram:
To actually see the seconds, then the output of the counters needs to drive a display. The
two counters produce binary numbers. The divide-by-10 counter is producing a 0-1-2-3-
4-5-6-7-8-9 sequence on its outputs, while the divide-by-6 counter is producing a 0-1-2-
3-4-5 sequence on its outputs. We want to display these binary numbers on something
called a 7-segment display. A 7-segment display has seven bars on it, and by turning on
different bars you can display different numbers:

To convert a binary number between 0 and 9 to the appropriate signals to drive a 7-


segment display, you use a (appropriately named) "binary number to 7-segment display
converter." This chip looks at the binary number coming in and turns on the appropriate
bars in the 7-segment LED to display that number. If we are displaying the seconds, then
the seconds part of our clock looks like this:

The output from this stage oscillates at a frequency of one-cycle-per-minute. You can
imagine that the minutes section of the clock looks exactly the same. Finally, the hours
section looks almost the same except that the divide-by-6 counter is replaced by a divide-
by-2 counter.
Now there are two details left to figure out if you are building a real clock:
• The clock as designed here does not understand that at 12:59:59 it is supposed to cycle
back to 1:00. That is a messy little problem, and there are a couple of ways to solve it.
One technique involves creating a little bit of logic that can detect the number 13 and
reset the hour section back to 1 (not zero). Another technique involves using an adder.
For our purposes, it is easier to deal in military time, because military time includes a
zero hour.
• We need a way to set the clock. Typically this is handled by gating higher-than-normal
frequencies into the minutes section. For example, most clocks have "fast" and "slow" set
buttons. When you press the "fast" button, the 60-Hz signal is driven straight into the
minutes counter. When you press the "slow" button, a 1-Hz signal is driven into the
minutes section. There are other possible techniques, but this one is the most common.

7490 Pinout (for illustration only)


Let's look at the 7490 briefly to see how it works. Here is the pinout:

The 7490 is a decade counter, meaning it is able to count from 0 to 9 cyclically, and that
is its natural mode. That is, QA, QB, QC and QD are 4 bits in a binary number, and these
pins cycle through 0 to 9, like this:
QD QC QB QA
0 0 0 0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
0 1 0 1
0 1 1 0
0 1 1 1
1 0 0 0
1 0 0 1
You can also set the chip up to count up to other maximum numbers and then return to
zero. You "set it up" by changing the wiring of the R01, R02, R91 and R92 lines. If both
R01 and R02 are 1 (5 volts) and either R91 or R92 are 0 (ground), then the chip will reset
QA, QB, QC and QD to 0. If both R91 and R92 are 1 (5 volts), then the count on QA,
QB, QC and QD goes to 1001 (5). So:

• To create a divide-by-10 counter, you first connect pin 5 to +5 volts and pin 10 to
ground to power the chip. Then you connect pin 12 to pin 1 and ground pins 2, 3,
6, and 7. You run the input clock signal (from the timebase or a previous counter)
in on pin 14. The output appears on QA, QB, QC and QD. Use the output on pin
11 to connect to the next stage.
• To create a divide-by-6 counter, you first connect pin 5 to +5 volts and pin 10 to
ground to power the chip. Then you connect pin 12 to pin 1 and ground pins 6 and
7. Connect pin 2 to pin 9 and pin 3 to pin 8. Run the input clock signal (from the
timebase or a previous counter) in on pin 14. The output appears on QA, QB and
QC. Use pin 8 to connect to the next stage.

Creating the Second Hand (for illustration only)


Knowing all of this, you can easily create the "second hand" of a digital clock. It looks
like this:

In this diagram, the top two 7490s divide the 60-Hz signal from the power supply down
by a factor of 60. The third 7490 takes a 1-hertz signal as input and divides it by 10. Its
four outputs drive normal LEDs in this diagram. The fourth 7490 divides the output of
the third by 6, and its three outputs drive normal LEDs as well. What you have at this
point is a "second hand" for your clock, with the output of the second hand appearing in
binary. If you would like to create a clock that displays the time in binary, then you are
set!

Displaying the Time as Numerals (for illustration only)


If you want to display the time as numerals, you need to use the 7447s. Here is the pinout
of a 7447, as well as the segment labeling for a 7-segment LED:

You connect a 7447 to a 7490 like this:

• Provide +5 volts on pin 16 and ground on pin 8 to power the 7447 chip.
• Connect QA, QB, QC and QD from a 7490 to pins 7, 1, 2 and 6 of the 7447,
respectively.
• Connect 330-ohm resistors to pins 13, 12, 11, 10, 9, 15 and 14 of the 7447, and
connect those resistors to the a, b, c, d, e, f, and g segments of the 7-segment
LED.
• Connect the common anode of the 7-segment LED to +5 volts.
You will need to have the pinout for the specific LED display that you use so that you
know how to wire the outputs of the 7447 to the LEDs in the 7-segment device. (Also,
note that the 7448 is equivalent to the 7447 except that it drives common-cathode
displays. Ground the common cathode of the LED in that case.)

You can see that by extending the circuit, we can easily create a complete clock. To
create the "minute hand" section of the clock, all that you need to do is duplicate the
"second hand" portion. To create the "hour hand" portion, you are going to want to be
creative. Probably the easiest solution is to create a clock that displays military time.
Then you will want to use an AND gate (or the R inputs of the 7490) to recognize the
binary number 24 and use the output of the recognizer to reset the hour counters to zero.

The final piece you need to create is a setting mechanism. On a breadboard, it is easy to
set the clock -- just move the input wires to drive higher-frequency signals into the
minute-hand section of the clock. In a real clock, you would use pushbuttons or switches
and gates to do the same thing.

If you happen to take your bedside clock or watch apart, one thing you will notice is that
there are probably not 15 TTL ICs inside. In fact, you may not be able to find a chip at
all. In most modern clocks and watches, all of the functions of the clock (including the
alarm and any other features) are all integrated into one low-power chip (in a watch, the
chip and display together consume only about a millionth of a watt). That chip is
probably embedded directly into the circuit board. You might be able to see a blob of
black plastic protecting this chip. That one tiny chip contains all of the components we
have discussed here.
Design and Operation
Module structure
The entire project has been divided into four modules. They are as follows:

1. Seconds section
A) Using two counters and drivers ICs (IC 4026) in such a way that this portion
produces output from 00 to 59 continuously with a frequency of 1 Hz (1pps).
B) Using seven-segment display (IC 5001) to display the counts. Both the ICs are
of common cathode type.
C) Checking the output of the circuit.
2. Minutes section
A) Repeating the same circuit as that of the second section, but here the output
should count from 00 to 59 with a frequency of 1 Hz for 1 ppm.
B) Checking the output.
3. Hours section
A) Designing the circuit in such a way so that the output resets to 00
automatically displaying 23.59.59.
B) Here the counting proceeds with a frequency of one pulse per hour.
C) Checking the output.
4. Assembling
A) Assembling the three sections together.
B) Checking the output of the final circuit.

4026 counter and display decoder


The 4026 IC is a 16-pin CMOS seven-segment counter from the 4000 series. It counts
clock pulses and returns the output in a form which can be displayed on a seven-segment
display. This avoids using a binary-coded decimal to seven-segment decoder, but it can
only be used to display the (decimal) digits 0-9.
Pinout
Pin
Name Purpose
number
1 CLK Clock in
2 CI Clock inhibit - when low, clock pulses increment the seven-segment
Display enable - the chip outputs to the seven-segment when this is
3 DE high (i.e. when it's low, the seven-segment is off) - useful to
conserve battery life, for instance
4 DEO Display enable out - for chaining 4026s
Carry out output - Is high when changing from 9 to 0. It provides an
5 CO output at 1/10 of the clock frequency, to drive the clock input of
another 4026 to provide multi-digit counting.
6 F Output for the seven-segment's F input
7 G Output for the seven-segment's G input
8 VDD The connection to the 0V rail
9 D Output for the seven-segment's D input
10 A Output for the seven-segment's A input
11 E Output for the seven-segment's E input
12 B Output for the seven-segment's B input
13 C Output for the seven-segment's C input
Ungated C-segment - an output for the seven-segment's C input
14 UCS which isn't affected by the DE input. This output is high unless the
count is 2, when it goes low.
15 RST Reset - resets all outputs to low when taken high
16 VSS The connection to the +9V rail
555 timer IC Astable mode
In astable mode, the '555 timer' puts out a continuous stream of rectangular pulses having
a specified frequency. A resistor (call it R1) is connected between Vcc and the discharge
pin (pin 7) and another (R2) is connected between the discharge pin (pin 7), and the
trigger (pin 2) and threshold (pin 6) pins that share a common node. Hence the capacitor
is charged through R1 and R2, and discharged only through R2, since pin 7 has low
impedance to ground during output low intervals of the cycle, therefore discharging the
capacitor. The use of R2 is mandatory, since without it the high current spikes from the
capacitor may damage the internal discharge transistor.
In the astable mode, the frequency of the pulse stream depends on the values of R1, R2
and C:

The high time from each pulse is given by

And the low time from each pulse is given by

Where R1 and R2 are the values of the resistors in ohms and C is the value of the
capacitor in farads. These specifications apply to the NE555. Other 555 timers can have
better specifications depending on the grade (military, medical, etc).

Supply voltage (VCC) 4.5 to 15 V

Supply current (VCC = +5


3 to 6 mA
V)

Supply current (VCC = +15


10 to 15 mA
V)

Output current (maximum) 200 mA

Power dissipation 600 mW

Operating temperature 0 to 70 °C
Block Diagram

Timer

6-input 6-input 6-input 6-input


AND gate AND gate AND gate AND gate

Counter Counter Counter Counter Counter Counter


& Driver & Driver & Driver & Driver & Driver & Driver

Display Display Display Display Display Display

Basic Concept
It is evident from the block diagram that for each of second and minute section we
require a Decade Counter for the unit’s place and a MOD-6 counter for the ten’s place.
For the second and minute sections the situation is identical with the unit’s place counting
from 0-9-0 and repeats whereas the ten’s place count’s from 0-5-0 and repeats. For the
hour section we require the counter for the unit’s place to count 0-3-0 and for the ten’s
place it counts 0-2-0 and repeats. This circuit is designed with an IC 4026 i.e. a dual J-K
Flip-Flop.
Circuit

Components used
Parts Quantity Price
7- segments (CC) 6 3.5x6
IC-4026 6 6x5.75 LE
IC-555 1 1.25 LE
IC-7430 4 4x4 LE
IC-7404 2 2x2.5 LE
Push button Switch 6 6x0.75 LE
Resistance 10 KΩ 7 7x10 piasters
Resistance 100 KΩ 1 10 piasters
Resistance 22 KΩ 1 10 piasters
Capacitor 100 nF 1 50 piasters
Capacitor 0.01 µF 1 35 piasters
Capacitor 10 µF 1 35 piasters
Total 84.35 LE
References
A) http://electronics.howstuffworks.com/gadgets/clocks-watches/digital-
clock.htm
B) http://en.wikipedia.org/wiki/555_timer_IC

You might also like