## CD4040BE – 12-Stage Ripple-Carry Binary Counter/Divider

- The 4040 chip is able to count in binary numbers from 0 to 4095 (4096 values).
- Pin 10 is the clock pin. When the signal on this pin goes from HIGH to LOW, the counter counts one step forward.
- Pin 11 is a reset pin, you can use it to jump back to 0.
- Each output pin represents one bit in a binary number. If you use all 12 bits, you can get a number up to 4095.
- You can also think of it as a divider of the input frequency.
- Output Q1 (sometimes labeled as
**/2**) divides the input frequency in two - Output Q2 (or
**/4**) divides the previous frequency from Q1 in half, or the original clock frequency by 4. - Output Q3 (or
**/8**) divides the previous frequency from Q2 in half, or the original clock frequency by 8. - and so on… Until you come to the last output Q12 (or
**/4096**), which has divided the original frequency by 4096.

- Output Q1 (sometimes labeled as

### Counting in Binary

In order to understand how the chip counts, you need to understand a little bit about binary numbers. The table below shows you how to count from 0 to 7 (8 values) in binary. Even if you don’t get binary completely, note the pattern you can see with the values:

- The last number toggles between 0 and 1
**after every value** - The middle number toggles between 0 and 1
**after every two values** - The first number toggles between 0 and 1
**after every****four values**

Decimal Number | Binary Number |
---|---|

0 | 000 |

1 | 001 |

2 | 010 |

3 | 011 |

4 | 100 |

5 | 101 |

6 | 110 |

7 | 111 |

*Note that normally you wouldn’t add leading zeros on the binary numbers like I’ve done here (000, 001 etc.) to make them all have three digits, but it will make sense when we try to use this together with the 4051 chip for making a step sequencer.*

You would need to use 3 individual outputs from the 4040 chip to be able to count from 0 to 7.

### Examples

#### Basic Counting

Click the image to see the interactive simulation. From the simulation, you can observe the counting in binary.

#### 4040 Controlling a 4051 Multiplexer to Create a Step Sequencer

We can send this binary output to some other ICs. One good candidate would be the 4051. See the page for the 4051 Multiplexer for more information.

#### Combining the 4040 with Oscillators

The 4040 requires some kind of an input that switches from a HIGH state to LOW state. A great source would be an oscillator that we can create with the 40106 or 555 chips. For our experimental sound devices, the 4040 is a great addition. One way to use it would be to combine multiple outputs from the counter into your sound output. Q0 would be one octave lower than the original frequency coming to the input, Q1 would be one octave lower than Q0, Q2 one octave lower than Q1and so on.

### More Information and Useful Links

- Decimal to Binary Converter from RapidTables
- Hackaday tutorial for oscillators