Skip to main content

CONCEPT - 4017 DECADE COUNTER

4017 DECADE COUNTER
4017 is an integrated circuit which has been designed to count pulses.
 It has 16 pins and looks like any other 16 pin integrated circuit.


To understand well let look into the pin connections of 4017 decade counter.
1.Pin connections:


                             
  • The 4017 decade counter has ten outputs which go HIGH in sequence when a source of pulses is connected to the CLOCK input and when suitable logic levels are applied to the RESET and ENABLE inputs.
  • There are 10 output pins present in this decade counter.
  • Vss for 3 - 15 volts is given at pin 8.
  • Ground is connected at pin 16.
  • Clock pulses are provided to pin 14.
  • RESET is connected on pin 15.
2.Now what is a decade counter and how does it work?

The counting action of decade counter can be well understood from the graph below. 


Just one of the individual outputs is HIGH at a time. This is quite different from the behavior of a BCD counter like the 4510 in which it is the combination of 0's and 1's which represents the count.

The 4017 is an extremely useful device for project work and is used in the Games Timer and in various  kits including the Light Chaser.
 Internally,  4017 contains five bistable subunits. These are interconnected in a pattern known as a Johnson counter. The outputs of the bistable are decoded to give the ten individual outputs.

4017 Test circuit:

    
  • The 4017 is designed to drive higher current loads, so it is OK to connect LEDs with series resistors directly to its outputs.
  • You should assemble the prototype board version of the circuit in stages, checking that each stage is working properly before proceeding to the next stage.
  • To see the 4017 in action, you need to build an astable. The easiest way to do this is using a 4093 Schmitt trigger NAND gate integrated circuit. Start by building the astable section on your prototype board as shown in the image:


  • Its a good practice with CMOS circuits to insert a decoupling capacitor,47 µF  or 100 µF, across the supply .
  • Next, add the 4017. The pulse output from the astable is connected to the CLOCK input. For normal operation, the RESET and ENABLE inputs must be connected to 0 V as shown in the image:
  • Connect a single LED with a 680  series resistor to output 0 of the 4017.
  • Count the pulses. The output 0 LED should flash once for every 10 flashes of the LED connected to the astable.
  • Continue, adding new resistor/LED stages for outputs 1 and 2. Don't disconnect the power supply. It helps to see that the new connections make the LEDs illuminate in the correct sequence.
  •  Connect a second prototype board and keep on adding new LEDs until all 10 outputs are used:
          

This version of the 4017 gives you a free-running light chaser. This can be useful, but usually you will want to control the 4017, as outlined in the next section.

4. RESET and ENABLE inputs:

  • Modify your circuit so that the RESET and ENABLE inputs are each connected to 0 V through a 10 kW pull down resistor. Initially, the behavior of the circuit will be unchanged. Add 'flying leads' as indicated below:
  • What happens when you connect the flying lead from the RESET input temporarily to +9 V? This returns the counter to 0 and the LED for output 0 is illuminated. Although pulses are still arriving at the CLOCK input, counting has stopped.
  • Try connecting the RESET input instead to output 5, pin 1, of the 4017. Counting will start again but not all of the outputs are active. The LEDs for outputs 0, 1, 2, 3 and 4 light up as before. You won't see anything happen at output 5 because the instant that this output goes HIGH, the counter is reset and counting starts again from 0.
  • In this way, you can shorten the count for any particular application.
  • Disconnect the RESET flying lead so that the 4017 is free-running once more. What happens when you connect the free end of the ENABLE lead to +9 V? Counting stops but this time the last LED illuminated stays lit. The count stops wherever it happens to be when ENABLE goes HIGH.
  • Try connecting ENABLE to output 7, pin 6, of the 4017. Counting may start briefly but stops as soon as the count reaches 7. Now try touching the RESET lead briefly to +9 V. The 4017 resets to 0 and then counts up, stopping again when it reaches 7. This is the effect required for a count down timer such as an egg timer, or the Games Timer, described in detail in Design Electronics.

5. Sequencing:
You can use the 4017 to control a sequence of events, for example, to generate a traffic light sequence:




red + amber  illuminated for shorter periods.
This pattern shows the lights green or red for a suitably long time, with amber and
Here is the circuit.


The 1N4148 diodes are used to make OR gates which control the LEDs. Outputs 0-3 illuminate the green LED, outputs 4 and 9 illuminate the amber LED and outputs 5-9 illuminate the red LED.
The prototype board version of the circuit looks like this:
           

6. Inside the 4017
     Johnson counter
OK, so what is a Johnson counter?
A Johnson counter is one type of walking ring counter using a shift register circuit in which the NOT-Q, or inverse output of the final stage is connected to the serial input of the first stage. You need a diagram to help you to understand this:
Essentially, the logic state at the D, or data input is transferred to the Q output on the rising edge of the clock signal.
For a shift register, the clock inputs of all the D-type stages are joined together so that all the flip-flops are clocked simultaneously. This results in logic states being passed along from one flip-flop to the next in sequence.
Suppose the flip-flops have all been RESET, so that the A, B, C outputs are all logic 0. The D input to the first input will be at logic 1, as indicated in the
first line of the table:

The rising edge of the first clock pulse transfers the '1' from D to A, while B and C remain '0'.The D input is the inverse of output C, that is, D remains at '1'. Work through the rest of thetable thinking about what happens at the inputs and outputs of each of the flip-flops.Now follow the sequence of changes which will result as clock pulses are delivered to the counter.
As you can see, the counter has 6 distinct output states. When the sequence has been completed, counting starts again from the beginning.
Johnson counters have 2n output states, where n is the number of flip-flops in the chain. Here n=3, giving 6 different output states. How many flip-flops will be needed inside the 4017?

As you can see, the output is 1, only when both inputs are 0.
Look again at the 3-stage counter sequence:
6.2 Decoder stage
A decoder stage is also needed. This uses 2-input NOR gates to uniquely identify each of the 6 states in the counting sequence.
Recall the truth table of a NOR gate:

NOR gate truth table:


  • The first line in the table can be uniquely decoded by connecting A and C to the inputs of a NOR gate. This is the only state in the sequence for which A=0 and C=0. As the counter is clocked, the logic state at the D input is transferred along from one flip-flop to the next.
  •  The second line shows the only state in the sequence for which A=1 and B=0, as indicated by the shading. This line can be uniquely decoded by connecting NOT-A and B to the inputs of a NOR gate.
  • The third line is the only state in the sequence for which B=1 and C=0, as indicated by the shading. This line can be uniquely decoded by connecting NOT-B and C to the inputs of a NOR gate.
  • The remaining lines can be decoded in a similar way by detecting the pairs of values shaded in the table. Note that the D input is the same as NOT-C.
  • The diagram shows how the Johnson counter outputs can be decoded to give a 1 of 6 output:
  • You can find out about the circuit inside the 4017 from the   4017B data sheet. This has 5 D-type flip-flops (10 output states) and additional circuitry to prevent the count from becoming 'stuck' in a logic state which is not part of the Johnson counter sequence. This problem might arise when the power supply is first connected, since the logic states of the individual flip-flops cannot be predicted.
  • Look carefully at the data sheet circuit if you want to understand how the decoder circuit works. The result is to give 10 individual outputs which go HIGH in sequence. This is what the 4017 is supposed to do!