CD4017 decade counter
The LED chaser chip: ten outputs, exactly one of them high at a time, and every clock edge moves the high one along to the next.
Put a 555 on the clock and an LED on each output and the light runs down the row. Aliases: 4017, CD4017BE, HEF4017, MC14017, decade counter, Johnson counter, one-of-ten decoder.
It is a 4000-series CMOS part, not a 74HC one, and three things about it follow from
that: its supply pins are called VDD and VSS, it runs anywhere from 3 V to 18 V,
and its outputs are weak (see below).
Pins
| Pin | Name | What it does |
|---|---|---|
| 3, 2, 4, 7, 10, 1, 5, 6, 9, 11 | Q0 to Q9 |
The ten decoded outputs. Only one is high at a time. They are not in order round the package. |
| 12 | CO |
Carry out: high for counts 0 to 4, low for 5 to 9. It rises as the count rolls from 9 back to 0, which is what clocks a second 4017. |
| 13 | INH |
Clock inhibit. Low lets the clock count; high freezes the count. |
| 14 | CLK |
Clock. The count moves on a rising edge. |
| 15 | RST |
Reset. High sends the count to 0 (Q0 high) at once and holds it there. |
| 8 | VSS |
Ground. |
| 16 | VDD |
Supply, 3 V to 18 V. |
Truth table
RST |
INH |
CLK |
What happens |
|---|---|---|---|
| 1 | x | x | Count goes to 0 |
| 0 | 0 | rising | Count moves on by one |
| 0 | falling | 1 | Count moves on by one |
| 0 | 1 | x | Count holds |
| Count | High output | CO |
|---|---|---|
| 0 to 4 | Q0 to Q4 |
1 |
| 5 to 9 | Q5 to Q9 |
0 |
Inside the chip the clock and the inhibit are one gate, CLK AND NOT INH, which is
why a falling INH while CLK is high also counts.
Properties
None.
What the model gets right
The outputs are weak. A metal-gate CMOS output is a few hundred ohms. The model
uses 2500 / VDD ohms, which is 500 ohms at 5 V and matches the MC14017B data sheet's
typical drive currents at 5, 10 and 15 V to within a few percent. An LED with a 220
ohm resistor on an output gets about 4 to 5 mA at 5 V and glows rather than blazes,
exactly as it does on a real breadboard, and the output voltage sags under that load.
It is slow, and the delay depends on the supply. From the MC14017B data sheet's
typical column at 50 pF: 500 ns from the clock to a decoded output and 400 ns to CO
at 5 V, falling to 230 and 175 ns at 10 V and 175 and 125 ns at 15 V. Supplies in
between are interpolated along those points.
Resetting from an output works. Wire Q5 to RST and the counter runs 0, 1, 2,
3, 4 and starts again, because Q5 resets the chip the moment it goes high. Q5 is
high for about half a microsecond each time, as on the real chip, which is too short
to light an LED.
What it does not model
The Johnson counter inside a real 4017 is modeled as the count 0 to 9 it decodes to, which is all its pins ever show. It powers up at 0 rather than wherever it likes. There are no minimum clock pulse widths or reset removal times: a pulse of any length counts. Below 5 V the delays are held at the 5 V figures, where a real chip is slower still. Input thresholds are half the supply, where the data sheet only promises 30% and 70%.
Common mistakes
Leaving RST or INH unconnected. A floating reset reads as unknown after power-up,
so the whole count goes unknown (shown as X). Tie both to VSS when you do not need
them. And wiring the LEDs in pin order: pin 1 is Q5, not Q0.
See it in action
Decade chaser is the classic circuit: a 555 astable clocks a 4017 and ten LEDs take turns. Open it at /templates.