1
\$\begingroup\$

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

\$\endgroup\$
  • 2
    \$\begingroup\$ 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? \$\endgroup\$ – The Photon Nov 4 '15 at 1:25
  • 1
    \$\begingroup\$ 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. \$\endgroup\$ – Julien Vivenot Nov 4 '15 at 1:49
  • 1
    \$\begingroup\$ Another thing to note: I am still prototyping on a breadboard. Could it cause any issue ? \$\endgroup\$ – Julien Vivenot Nov 4 '15 at 1:51
  • 2
    \$\begingroup\$ On a prototype board, the bypass capacitor is even more important. \$\endgroup\$ – The Photon Nov 4 '15 at 2:19
  • 1
    \$\begingroup\$ 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). \$\endgroup\$ – The Photon Nov 4 '15 at 2:20
0
\$\begingroup\$

Thanks @ThePhoton and @Icy for your comments, which helped me fix the issue.

As suspected by @ThePhoton, the issue was the lack of bypass capacitors across the counter's power supply. The issue was especially occurring when several register bits were switching as the same time.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.