0
\$\begingroup\$

I'm trying to count the frequency of an audio signal using a 393 binary counter which is read by an Arduino without using its ADC. If the reading is done once per second, should the counter be somehow stopped when the counter is READ in order to avoid additional counts before the output pins are read? Perhaps, keep the input signal high with a MOSFET? What is the canonical approach to reading binary counter outputs?

\$\endgroup\$
4
  • 1
    \$\begingroup\$ I don't understand how you can measure an analog signal with a digital input. Can you add some schematic to make some sense of the question? \$\endgroup\$
    – Eugene Sh.
    Dec 29, 2016 at 16:29
  • 3
    \$\begingroup\$ ...and why bother with 393 when you can do this directly with the arduino. \$\endgroup\$ Dec 29, 2016 at 16:31
  • \$\begingroup\$ @JImDearden Because the ADC can be too slow. \$\endgroup\$
    – John M.
    Dec 30, 2016 at 1:28
  • \$\begingroup\$ @EugeneSh. I was planning to use a Schmitt Trigger. \$\endgroup\$
    – John M.
    Dec 30, 2016 at 1:46

1 Answer 1

4
\$\begingroup\$

Am only going to address your question about reading the count output from a '393 counter. You have two problems to overcome.
This counter is asynchronous, which means that a clock input ripples through the individual flip-flops to its next count state. If you happen to read the count value on-the-fly very soon after a clock transition, you might get a really strange number, neither one less, nor one more than what you'd expect. This rippling occurs very quickly but nevertheless can cause errors.
The other problem occurs when you concatenate counter chips for extended count values. A microcontroller can read in eight bits at-a-time. To read in a count from two or more '393's, the microcontroller must read in eight bits from one chip and save that result into a register, then return and read in eight bits from the next chip. In the interval, the count value can change, leading to the possibility of a wrong result.

schematic

simulate this circuit – Schematic created using CircuitLab

One solution to both problems adds a "gate" to clock input. When the microcontroller wants to read the count value, the clock input is disabled, freezing the current count value. Then the microcontroller can read the count value, which is now frozen at some value.

A 74HC590 counter chip is more appropriate. Its counter flip-flops are arranged to make a synchronous counter, having no ripple-count problem. It also incorporates an internal gate. It also provides an internal counter latch that stores the current count value, while letting the counter flip-flops continue counting up. And it provides a tri-state output, so that a micrcontroller can read in its eight-bit value from the same port. This makes it very easy to concatenate these chips if your microcontroller has limited I/O pins.
However, most microcontrollers have versatile internal counters that can give similar results with no external chips.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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