# Binary counter (SN74LV8154) jumps (internal bits seems to flip)

I am using a "Dual 16-bit binary counter with 3-state output registers" (SN74LV8154) to count input pulses up to 32 bits.

It is working fine most of the time, but some of the bits in the counter seem to flip randomly. The result is reflected in the register, as I see the output value sometimes jump forward and/or backward.

Jumps are persistent (not punctual misreadings) since the value does not jump the other way around right after the issue. e.g.

1. 0x12fe
2. 0x12ff
3. 0x1200 (should be 0x1300)
4. 0x1201
5. 0x1202 (0x0100 still not on)

The chip allows to read byte by byte with the help of a 4 bit word selector. This is done quite frequently, word by word, and I record a timeseries with the result. I expect the counter to go up by a few increments between reads.

The result is fine most of the time, but it looks like some internal carries are either forgotten or doubled.

Here are a few examples:

|----------------------+------------------------+-------------|
| Before               | After                  | Jump        |
|                      | (Expected)             |             |
|----------------------+------------------------+-------------|
| 0b010011000011111111 |  0b010011001000000000  | 0b100000000 |
|                      | (0b010011000100000000) |             |
| 0b110001000001111111 |  0b110001000000000000  | -0b10000000 |
|                      | (0b110001000010000000) |             |
| 0b111100101011111111 |  0b111100110000000000  | 0b100000000 |
|                      | (0b111100101100000000) |             |
|----------------------+------------------------+-------------|


I also saw jumps by +/- 16, +/- 32, +/-65536, so I guess the issue is not related to the word size.

Any help on how to investigate this would be much appreciated.

Julien

• Does your circuit have bypass capacitors across the power supply of the chip? What is the source of the input pulses? If it is an electromechanical switch, did you debounce the signal? – The Photon Nov 4 '15 at 1:25
• No bypass capacitor (I come from the software world, am a real beginner in electronics, and did not even know about these... :s I am looking into it now). As for the input, it comes from a photo interrupter. – Julien Vivenot Nov 4 '15 at 1:49
• Another thing to note: I am still prototyping on a breadboard. Could it cause any issue ? – Julien Vivenot Nov 4 '15 at 1:51
• On a prototype board, the bypass capacitor is even more important. – The Photon Nov 4 '15 at 2:19
• Given the pattern of errors (occurring when a large number of output bits change), the bypass issue is more likely the root cause than input debouncing. But they're both things that are easy to forget to do on your first few designs (until they bite you on the ass once each). – The Photon Nov 4 '15 at 2:20