CMOS Integrated Circuit Decade counter

The 4017 CMOS Integrated Circuit Decade counter

The 4017 is a Complementary Metal Oxide Semiconductor (CMOS) Integrated circuit with sixteen pins, implementing a divide-by-ten function with ten decoded outputs and a carry output. Reset and Count Enable inputs are provided in addition to the Clock input. The pin functions are:

  • Supply and ground - pin 8 ground and pin 16 +Vcc
  • Ten decoded outputs - pins 1 to 7 and 9 to 11
  • Carry output - pin 12
  • Clock input - pin 14
  • Count Enable input - pin 13
  • Reset input - pin 15

It will work comfortably within a supply voltage range of 3V to 15V. If you try to run it at anywhere over 18V, it might get destroyed.

It will normally count every time the voltage at pin 14 swings from low to high, provided pin 13 is low and pin 15 is not high. The flash animation below might give you a feel of how it works. Click the power switch to start the action!

Just to be complete, the chip will count if the enable input goes high while clock is low. The two inputs are complementary.

If you try to wire this in actual practice, there are a few things to be aware of:

  • The resistor can be omitted if you're using the 9V battery - the chip by itself limits current to a level safe for itself and for LEDs.
  • The clock switch, the blue guy, will in practice deliver a random number of pulses due to "switch bounce". If you are using manual switching you need a debounce circuit too, to ensure that the count advances by one, and by one only, each time the switch is operated.
  • The blue guy could stand still, holding his switch up, and the green guy could dance - and the counter will still count, but every time his switch goes down this time.
  • If you need more than ten counts here's a circuit for counts up to seventeen.

Here are a few solutions to the clock generation problem:


For the greatest speed and reliability you will need to use a double throw switch and two gates in a bistable configuration. The cross connection of the gates ensure that when the switch makes contact and then bounces, the state gets latched and that the output stays steady. From the diagram at left, that is the output A.

When the double throw switch is deemed an unnecessary luxury and a slow speed of operation is acceptable, the R-C debounce network followed by a schmitt trigger to sharpen the slow transition may be used. This is the output at B.

When you need a continuous train of pulses you can wire up the simplest possible oscillator circuit using a schmitt trigger gate and a resistor and capacitor. Increase the value of the capacitor to make it slower. Or make the resistor variable for an adjustable speed. This is the output at C

The remaining two gates show the preferred way to deal with unused CMOS inputs on a gate package: connect to ground, the supply or to an output which is at a defined level.

The CD40106 is a hex schmitt inverter. Quite


useful, and able to banish quite a few vexing problems when applied properly. The TTL equivalent is 74HC14, if you need a faster gate.