Counter

Counter

In digital logic and computing, a counter is a device which stores (and sometimes displays) the number of times a particular event or process has occurred, often in relationship to a clock signal.

Contents

Electronic counters

In electronics, counters can be implemented quite easily using register-type circuits such as the flip-flop, and a wide variety of classifications exist:

  • Asynchronous (ripple) counter – changing state bits are used as clocks to subsequent state flip-flops
  • Synchronous counter – all state bits change under control of a single clock
  • Decade counter – counts through ten states per stage
  • Up/down counter – counts both up and down, under command of a control input
  • Ring counter – formed by a shift register with feedback connection in a ring
  • Johnson counter – a twisted ring counter
  • Cascaded counter

Each is useful for different applications. Usually, counter circuits are digital in nature, and count in natural binary. Many types of counter circuits are available as digital building blocks, for example a number of chips in the 4000 series implement different counters.

Occasionally there are advantages to using a counting sequence other than the natural binary sequence—such as the binary coded decimal counter, a linear feedback shift register counter, or a Gray-code counter.

Counters are useful for digital clocks and timers, and in oven timers, VCR clocks, etc.[1]

Asynchronous (ripple) counter

Asynchronous counter created from two JK flip-flops

An asynchronous (ripple) counter is a single JK-type flip-flop, with its J (data) input fed from its own inverted output. This circuit can store one bit, and hence can count from zero to one before it overflows (starts over from 0). This counter will increment once for every clock cycle and takes two clock cycles to overflow, so every cycle it will alternate between a transition from 0 to 1 and a transition from 1 to 0. Notice that this creates a new clock with a 50% duty cycle at exactly half the frequency of the input clock. If this output is then used as the clock signal for a similarly arranged D flip-flop (remembering to invert the output to the input), you will get another 1 bit counter that counts half as fast. Putting them together yields a two-bit counter:

Cycle Q1 Q0 (Q1:Q0)dec
0 0 0 0
1 0 1 1
2 1 0 2
3 1 1 3
4 0 0 0

You can continue to add additional flip-flops, always inverting the output to its own input, and using the output from the previous flip-flop as the clock signal. The result is called a ripple counter, which can count to 2n − 1 where n is the number of bits (flip-flop stages) in the counter. Ripple counters suffer from unstable outputs as the overflows "ripple" from stage to stage, but they do find frequent application as dividers for clock signals, where the instantaneous count is unimportant, but the division ratio overall is (to clarify this, a 1-bit counter is exactly equivalent to a divide by two circuit; the output frequency is exactly half that of the input when fed with a regular train of clock pulses).

The use of flip-flop outputs as clocks leads to timing skew between the count data bits, making this ripple technique incompatible with normal synchronous circuit design styles.

Synchronous counter

A 4-bit synchronous counter using JK flip-flops

A simple way of implementing the logic for each bit of an ascending counter (which is what is depicted in the image to the right) is for each bit to toggle when all of the less significant bits are at a logic high state. For example, bit 1 toggles when bit 0 is logic high; bit 2 toggles when both bit 1 and bit 0 are logic high; bit 3 toggles when bit 2, bit 1 and bit 0 are all high; and so on.

Synchronous counters can also be implemented with hardware finite state machines, which are more complex but allow for smoother, more stable transitions.

Hardware-based counters are of this type.

Decade counter

A circuit diagram of decade counter using JK FlipFlops(74LS112D)

A decade counter is one that counts in decimal digits, rather than binary. A decade counter may have each digit binary encoded (that is, it may count in binary-coded decimal, as the 7490 integrated circuit did) or other binary encodings (such as the bi-quinary encoding of the 7490 integrated circuit). Alternatively, it may have a "fully decoded" or one-hot output code in which each output goes high in turn (the 4017 is such a circuit). The latter type of circuit finds applications in multiplexers and demultiplexers, or wherever a scanning type of behavior is useful. Similar counters with different numbers of outputs are also common.

The decade counter is also known as a mod-counter when it counts to ten (0, 1, 2, 3, 4, 5, 6, 7, 8, 9). A Mod Counter that counts to 64 stops at 63 because 0 counts as a valid digit.

Up/down counter

A counter that can change state in either direction, under the control of an up/down selector input, is known as an up/down counter. When the selector is in the up state, the counter increments its value. When the selector is in the down state, the counter decrements the count.

Ring counter

A ring counter is a Shift Register (a cascade connection of flip-flops) with the output of the last one connected to the input of the first, that is, in a ring. Typically, a pattern consisting of a single bit is circulated so the state repeats every n clock cycles if n flip-flops are used.It can be used as a cycle counter of n states.

Johnson counter

A Johnson counter (or switchtail ring counter, twisted-ring counter, walking-ring counter, or Moebius counter) is a modified ring counter, where the output from the last stage is inverted and fed back as input to the first stage.[2][3][4] The register cycles through a sequence of bit-patterns, whose length is equal to twice the length of the shift register, continuing indefinitely. These counters find specialist applications, including those similar to the decade counter, digital-to-analog conversion, etc. They can be implemented easily using D- or JK-type flip-flops.

Computer science counters

In computability theory, a counter is considered a type of memory. A counter stores a single natural number (initially zero) and can be arbitrarily many digits long. A counter is usually considered in conjunction with a finite-state machine (FSM), which can perform the following operations on the counter:

  • Check whether the counter is zero
  • Increment the counter by one.
  • Decrement the counter by one (if it's already zero, this leaves it unchanged).

The following machines are listed in order of power, with each one being strictly more powerful than the one below it:

  1. Deterministic or non-deterministic FSM plus two counters
  2. Non-deterministic FSM plus one stack
  3. Non-deterministic FSM plus one counter
  4. Deterministic FSM plus one counter
  5. Deterministic or non-deterministic FSM

For the first and last, it doesn't matter whether the FSM is a deterministic finite-state machine or a nondeterministic finite-state machine. They have equivalent power. The first two and the last one are levels of the Chomsky hierarchy.

The first machine, an FSM plus two counters, is equivalent in power to a Turing machine. See the article on counter machines for a proof.

Mechanical counters

Mechanical counter wheels showing both sides. The bump on the wheel shown at the top engages the ratchet on the wheel below every turn.
Several mechanical counters

Long before electronics became common, mechanical devices were used to count events. These typically consist of a series of disks mounted on an axle, with the digits 0 through 9 marked on their edge. The right most disk moves one increment with each event. Each disk except the left-most has a protrusion that, after the completion of one revolution, moves the next disk to the left one increment. Such counters were originally used to control manufacturing processes, but were later used as odometers for bicycles and cars and in fuel dispensers. One of the largest manufacturers was the Veeder-Root company, and their name was often used for this type of counter.[5]

References

  1. ^ http://www.play-hookey.com/digital/synchronous_counter.html
  2. ^ Arun Kumar Singh. Digital Principles Foundation of Circuit Design and Application. New Age Publishers. ISBN 8122417590. http://books.google.com/books?id=13Wi37h2A-oC&pg=PA113&dq=switchtail+ring+counter+johnson. 
  3. ^ Paul Horowitz and Winfield Hill (1989). The Art of Electronics. Cambridge University Press. ISBN 0521370957. http://books.google.com/books?id=bkOMDgwFA28C&pg=PA667&dq=ring+counter+walking. 
  4. ^ Rudolf F. Graf (1999). Modern Dictionary of Electronics. Newnes. ISBN 0750698667. http://books.google.com/books?id=uah1PkxWeKYC&pg=PA401&dq=moebius+ring+counter+johnson. 
  5. ^ http://www.veeder.com/page/vr_history

See also


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?
Synonyms:

Look at other dictionaries:

  • Counter — Coun ter, a. Contrary; opposite; contrasted; opposed; adverse; antagonistic; as, a counter current; a counter revolution; a counter poison; a counter agent; counter fugue. Innumerable facts attesting the counter principle. I. Taylor. [1913… …   The Collaborative International Dictionary of English

  • counter — coun‧ter [ˈkaʊntə ǁ ər] noun [countable] 1. COMMERCE the place where you are served in a shop, bank etc: • Please pay at the checkout counter. ˈtrade ˌcounter COMMERCE a part of a shop, factory, or website where a business can buy goods for less… …   Financial and business terms

  • counter — Ⅰ. counter [1] ► NOUN 1) a long flat topped fitment over which goods are sold or served or across which business is conducted with customers. 2) a small disc used in board games for keeping the score or as a place marker. 3) a token representing… …   English terms dictionary

  • counter — counter1 [kount′ər] n. [ME countour: in senses 1 & 2 < OFr conteor < L computator < computare; in senses 3, 4, 5 < OFr contouer, counting room, table of a bank < ML computatorium < L computare,COMPUTE] 1. a) a person or thing… …   English World dictionary

  • Counter — Coun ter, adv. [F. contre, fr. L. contra against. Cf. {Contra }.] 1. Contrary; in opposition; in an opposite direction; contrariwise; used chiefly with run or go. [1913 Webster] Running counter to all the rules of virtue. Locks. [1913 Webster] 2 …   The Collaborative International Dictionary of English

  • counter- — coun·ter / kau̇n tər/ prefix 1 a: contrary: opposite counter letter b: opposing: retaliatory counter action 2: complementary: corresponding …   Law dictionary

  • Counter- — Coun ter (koun t[ e]r ). Note: [See {Counter}, adv. ] A prefix meaning contrary, opposite, in opposition; as, counteract, counterbalance, countercheck. See {Counter}, adv. & a. [1913 Webster] …   The Collaborative International Dictionary of English

  • Counter — Count er (koun t[ e]r), n. [OE. countere, countour, a counter (in sense 1), OF. contere, conteor, fr. conter to count. See {Count}, v. t. ] 1. One who counts, or reckons up; a calculator; a reckoner. [1913 Webster] 2. A piece of metal, ivory,… …   The Collaborative International Dictionary of English

  • Counter — Coun ter, n. [See {Counter}, adv., {Contra}.] 1. (Naut.) The after part of a vessel s body, from the water line to the stern, below and somewhat forward of the stern proper. [1913 Webster] 2. (Mus.) Same as {Contra}. Formerly used to designate… …   The Collaborative International Dictionary of English

  • counter — [adj] opposite, opposing adverse, against, antagonistic, anti, antipodal, antipodean, antithetical, conflicting, contradictory, contrary, contrasting, converse, diametric, hindering, impeding, obstructive, obverse, opposed, polar, reverse;… …   New thesaurus

  • Counter — Coun ter, n. [OE. countour, OF. contouer, comptouer, F. comptoir, LL. computatorium, prop., a computing place, place of accounts, fr. L. computare. See {Count}, v. t.] A table or board on which money is counted and over which business is… …   The Collaborative International Dictionary of English

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”