Misplaced Pages

Counter (digital): Difference between revisions

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
Browse history interactively← Previous editContent deleted Content addedVisualWikitext
Revision as of 06:30, 23 March 2010 editCircuit dreamer (talk | contribs)Extended confirmed users7,660 editsm Asynchronous (ripple) counter← Previous edit Latest revision as of 09:32, 14 October 2023 edit undoEEye (talk | contribs)Extended confirmed users704 edits Electronic counters: Correction, additions 
(375 intermediate revisions by more than 100 users not shown)
Line 1: Line 1:
{{Short description|Device storing number of times an event or process occurred}}
{{About|the term counter used in electronics and computing}}
{{About|the term counter used in electronics, computing, and mechanical counting devices||Counter (disambiguation)}}
]
In ] and ], a '''counter''' is a device which stores (and sometimes displays) the number of times a particular ] or ] has occurred, often in relationship to a ]. The most common type is a ] ] circuit with an input line called the ''clock'' and multiple output lines. The values on the output lines represent a number in the ] or ] number system. Each pulse applied to the clock input ]s or ]s the number in the counter.


A counter circuit is usually constructed of several ] connected in a cascade. Counters are a very widely used component in ]s, and are manufactured as separate ]s and also incorporated as parts of larger integrated circuits.
In ] and ], a '''counter''' is a device which stores (and sometimes displays) the number of times a particular ] or ] has occurred, often in relationship to a ]. In practice, there are two types of counters:


==Electronic counters==
* Up counters, which increase (]) in value
An ] counter is a ] circuit that has a clock input signal and a group of output signals that represent an integer "counts" value. Upon each qualified clock edge, the circuit will increment (or decrement, depending on circuit design) the counts. When the counts have reached the end of the counting sequence (maximum counts when incrementing; zero counts when decrementing), the next clock will cause the counts to overflow or underflow, and the counting sequence will start over. Internally, counters use flip-flops to represent the current counts and to retain the counts between clocks. Depending on the type of counter, the output may be a direct representation of the counts (a binary number), or it may be encoded. Examples of the latter include ring counters and counters that output Gray codes.
* Down counters, which decrease (]) in value


Many counters provide additional input signals to facilitate dynamic control of the counting sequence, such as:
== In electronics ==
* Reset – sets counts to zero. Some IC manufacturers name it "clear" or "master reset (MR)".
In ], counters can be implemented quite easily using register-type circuits such as the ], and a wide variety of designs exist, e.g:
* Enable – allows or inhibits counting.
* Direction – determines whether counts will increment or decrement.
* Data – parallel input data which represents a particular counts value.
* Load – copies parallel input data to the counts.


Some counters provide a Terminal Count output which indicates that the next clock will cause overflow or underflow. This is commonly used to implement counter cascading (combining two or more counters to create a single, larger counter) by connecting the Terminal Count output of one counter to the Enable input of the next counter.
* 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


The modulus of a counter is the number of states in its count sequence. The maximum possible modulus is determined by the number of flip-flops. For example, a four-bit counter can have a modulus of up to 16 (2^4).
Each is useful for different applications. Usually, counter circuits are ] in nature, and count in ]. Many types of counter circuit are available as digital building blocks, for example a number of chips in the ] implement different counters.


Counters are generally classified as either synchronous or asynchronous. In synchronous counters, all flip-flops share a common clock and change state at the same time. In asynchronous counters, each flip-flop has a unique clock, and the flip-flop states change at different times.
Occasionally there are advantages to using a counting sequence other than the natural binary sequence -- such as the ] counter, a ] counter, or a ] counter.


Counters are categorized in various ways. For example:
Counters are useful for digital clocks and timers, and in oven timers, VCR clocks, etc.<ref>http://www.play-hookey.com/digital/synchronous_counter.html</ref>
* Modulus counter – counts through a particular number of states.
* Decade counter – modulus ten counter (counts through ten states).
* '''{{vanchor|Up/down counter|text=Up/down counter}}''' – counts up and down, as directed by a control input, or by the use of separate "up" and "down" clocks.
* ] – formed by a "circular" ].
* Johnson counter – a ''twisted'' ring counter.
* Gray-code counter – outputs a sequence of Gray codes.
* Shift register generator counter – based on a ].


Counters are implemented in a variety of ways, including as dedicated ] and ] ]s, as embedded counters within ]s, as general-purpose counter and timer peripherals in ]s, and as ] in ]s.
=== Asynchronous (ripple) counter ===

]
===Asynchronous (ripple) counter===
The most elementary asynchronous (ripple) counter is a single ], with its D (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% ] 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:
]s]]

An asynchronous (ripple) counter is a "chain" of toggle (T) flip-flops wherein the least-significant flip-flop (bit 0) is clocked by an external signal (the counter input clock), and all other flip-flops are clocked by the output of the nearest, less significant flip-flop (e.g., bit 0 clocks the bit 1 flip-flop, bit 1 clocks the bit 2 flip-flop, etc.). The first flip-flop is clocked by rising edges; all other flip-flops in the chain are clocked by falling clock edges. Each flip-flop introduces a delay from clock edge to output toggle, thus causing the counter bits to change at different times and producing a ripple effect as the input clock propagates through the chain. When implemented with discrete flip-flops, ripple counters are commonly implemented with ], with each flip-flop configured to toggle when clocked (i.e., J and K are both connected to logic high).

In the simplest case, a one-bit counter consists of a single flip-flop. This counter will increment (by toggling its output) once per clock cycle and will count from zero to one before overflowing (starting over at zero). Each output state corresponds to two clock cycles; consequently, the flip-flop output frequency is exactly half the frequency of the input clock. If this output is then used as the clock signal for a second flip-flop, the pair of flip-flops will form a two-bit ripple counter with the following state sequence:


{| class="wikitable" style="text-align:center" {| class="wikitable" style="text-align:center"
|- |-
! Cycle !! Q1 !! Q0 !! (Q1:Q0)dec ! Clock cycle !! Q1 !! Q0 !! (Q1:Q0) decimal
|- |-
| 0 || 0 || 0 || 0 | 0 || 0 || 0 || 0
Line 42: Line 55:
|} |}


Additional flip-flops may be added to the chain to form counters of any arbitrary word size, with the output frequency of each bit equal to exactly half the frequency of the nearest, less significant bit.
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 2<sup>n</sup>-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 ] 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).


Ripple counters exhibit unstable output states while the input clock propagates through the circuit. The duration of this instability (the output settling time) is proportional to the number of flip-flops. This makes ripple counters unsuitable for use in ]s that require the counter to have a fast output settling time. Also, it is often impractical to use ripple counter output bits as clocks for external circuits because the ripple effect causes timing skew between the bits. Ripple counters are commonly used as general-purpose counters and clock frequency dividers in applications where the instantaneous count and timing skew is unimportant.
The use of flip-flop outputs as clocks leads to timing skew between the count data bits, making this ripple technique incompatible with normal ] design styles.


=== Synchronous counter === ===Synchronous counter===
] ]


In a synchronous counter, the clock inputs of the flip-flops are connected, and the common clock simultaneously triggers all flip-flops. Consequently, all of the flip-flops change state at the same time (in parallel).
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.


For example, the circuit shown to the right is an ascending (up-counting) four-bit synchronous counter implemented with JK flip-flops. Each bit of this counter is allowed to toggle when all of the less significant bits are at a logic high state. Upon clock rising edge, bit 1 toggles if bit 0 is logic high; bit 2 toggles if bits 0 and 1 are both high; bit 3 toggles if bits 2, 1, and 0 are all high.
Synchronous counters can also be implemented with hardware ]s, which are more complex but allow for smoother, more stable transitions.


====Decade counter====
Wdware-based counters are of this type.
]
A decade counter counts in decimal digits, rather than binary. A decade counter may have each (that is, it may count in ], as the ] integrated circuit did) or other binary encodings. A decade counter is a binary counter designed to count to 1001 (decimal 9). An ordinary four-stage counter can be easily modified to a decade counter by adding a NAND gate as in the schematic to the right. Notice that FF2 and FF4 provide the inputs to the NAND gate. The NAND gate outputs are connected to the CLR input of each of the FFs.".<ref>{{Cite web|url=http://www.tpub.com/neets/book13/55h.htm|title=Decade Counter|website=Integrated Publishing|access-date=19 Mar 2020}}</ref> It counts from 0 to 9 and then resets to zero. The counter output can be set to zero by pulsing the reset line low. The count then increments on each clock pulse until it reaches 1001 (decimal 9). When it increments to 1010 (decimal 10), both inputs of the NAND gate go high. The result is that the NAND output goes low, and resets the counter to zero. D going low can be a CARRY OUT signal, indicating that there has been a count of ten.


====Ring counter====
Please note that the counter shown will have an error once it reaches 1110.
{{main article|Ring counter}}
A ring counter is a circular shift register that is initiated such that only one of its flip-flops is the state one while others are in their zero states.


A ring counter is a ] (a cascade connection of ]) 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.
=== Ring counter ===
{{main|Ring counter}}


====Johnson counter====
A ring counter is a ] (a cascade connection of ]s) 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 1 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.
{{main article|Johnson counter}}
A ] (or ], ], ], or ]) is a modified ring counter, where the output from the last stage is inverted and fed back as input to the first stage.<ref>{{cite book | title = Digital Principles Foundation of Circuit Design and Application | first = Arun Kumar | last = Singh | publisher = New Age Publishers | year = 2006 | isbn = 81-224-1759-0 | url = https://books.google.com/books?id=13Wi37h2A-oC&q=switchtail+ring+counter+johnson&pg=PA113}}</ref><ref>{{cite book | title = The Art of Electronics | first1 = Paul | last1 = Horowitz | first2 = Winfield | last2 = Hill | publisher = Cambridge University Press | year = 1989 | isbn = 0-521-37095-7 | url = https://books.google.com/books?id=bkOMDgwFA28C&q=ring+counter+walking&pg=PA667}}</ref><ref>{{cite book | title = Modern Dictionary of Electronics | first = Rudolf F | last = Graf | publisher = Newnes | year = 1999 | isbn = 0-7506-9866-7 | url = https://books.google.com/books?id=uah1PkxWeKYC&q=moebius+ring+counter+johnson&pg=PA401}}</ref> 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 similar to the decade counter (note: the ] decade counter ''is'' a Johnson counter), digital-to-analog conversion, etc. They can be implemented easily using D- or JK-type flip-flops.


=== Johnson counter === == Computer science counters ==
{{main article|Register machine}}

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.<ref>{{cite book | title = Digital Principles Foundation of Circuit Design and Application | author = Arun Kumar Singh | publisher = New Age Publishers | yearasdasd = 2006 | isbn = 8122417590 | url = http://books.google.com/books?id=13Wi37h2A-oC&pg=PA113&dq=switchtail+ring+counter+johnson&as_brr=3&ei=umTxSPXeKZH2sQP6muHZBg&sig=ACfU3U29vJPSflqg7sngLSbt5OxDp6fMvQ }}</ref><ref>{{cite book | title = The Art of Electronics | author = Paul Horowitz and Winfield Hill | publisher = Cambridge University Press | year = 1989 | isbn = 0521370957 | url = http://books.google.com/books?id=bkOMDgwFA28C&pg=PA667&dq=ring+counter+walking&as_brr=3&ei=NGbxSLrfIIuoswP_oqmdBw&sig=ACfU3U0nWT1AwZt_wgUnAedWxa8X6iDktw }}</ref><ref>{{cite book | title = Modern Dictionary of Electronics | author = Rudolf F. Graf | publisher = Newnes | year = 1999 | isbn = 0750698667 | url = http://books.google.com/books?id=uah1PkxWeKYC&pg=PA401&dq=moebius+ring+counter+johnson&as_brr=3&ei=z2bxSO3hN4XWsgOa243rBg&sig=ACfU3U38T_bIIfEQqOjEIxVzFKp8_oyd6w }}</ref> A pattern of bits equal in length to twice the length of the shift register thus circulates indefinitely. These counters find specialist applications, including those similar to the decade counter, digital to analog conversion, etc.

=== Decade counter ===

A decade counter is one that counts in decimal digits, rather than binary. A decimal counter may have each digit binary encoded (that is, it may count in ], as the ] integrated circuit did) or other binary encodings (such as the bi-quinary encoding of the ] integrated circuit). Alternatively, it may have a "fully decoded" or ] output code in which each output goes high in turn; the ] was such a circuit. The latter type of circuit finds applications in ]s 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.

=== Up–down counter ===

A counter that can change state in either direction, under control 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.

== In computer science ==
{{main|Register machine}}

In ], a '''counter''' is considered a type of memory. A counter stores a single ] (initially ]) and can be arbitrarily many digits long. A counter is usually considered in conjunction with a ] (FSM), which can perform the following operations on the counter:


In ], a '''counter''' is considered a type of memory. A counter stores a single ] (initially ]) and can be arbitrarily long. A counter is usually considered in conjunction with a ] (FSM), which can perform the following operations on the counter:
* Check whether the counter is zero * Check whether the counter is zero
* Increment the counter by one * Increment the counter by one.
* Decrement the counter by one (if it's already zero, this leaves it unchanged). * Decrement the counter by one (if it's already zero, this leaves it unchanged).


Line 90: Line 93:
# Non-deterministic FSM plus one counter # Non-deterministic FSM plus one counter
# Deterministic FSM plus one counter # Deterministic FSM plus one counter
# Deterministic or non-deterministic FSM # Deterministic or non-deterministic FSM.


For the first and last, it doesn't matter whether the FSM is a ] or a ]. They have equivalent power. The first two and the last one are levels of the ]. For the first and last, it doesn't matter whether the FSM is a ] or a ]. They have the same power. The first two and the last one are levels of the ].


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


== Mechanical counters == === Web counter ===
<!-- Deleted image removed: ] -->
]
{{Main article|Web counter}}
]
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 ]s for bicycles and cars and in ]s. One of the largest manufacturers was the ] company, and their name was often used for this type of counter.<ref>http://www.veeder.com/page/vr_history</ref>


A '''web counter''' or '''hit counter''' is a computer program that indicates the number of visitors or hits a particular ] has received. Once set up, these counters will be incremented by one every time the web page is accessed in a ].


The number is usually displayed as an inline ] or in ] or on a physical counter such as a ]. Images may be presented in a variety of ]s, or styles; the classic example is the wheels of an ].
{{commonscat|mechanical counters}}


''Web counter'' was popular in the mid to late 1990s and early 2000s, later replaced by more detailed and complete ] measures.
== References ==


=== Computer based counters ===
<references/>

Many automation systems use PC and laptops to monitor different parameters of machines and production data. Counters may count parameters such as the number of pieces produced, the production batch number, and measurements of the amounts of material used.

== Mechanical counters ==
{{main article|Mechanical counter}}
Long before electronics became common, mechanical devices were used to count events. These are known as ]s. They typically consist of a series of disks mounted on an axle, with the digits zero through nine marked on their edge. The right-most disk moves one increment with each event. Each disk except the left-most has a protrusion that moves the next disk to the left one increment after the completion of one revolution. Such counters were used as ]s for bicycles and cars and in ]s, ]s, in production machinery as well as in other machinery. One of the largest manufacturers was the Veeder-Root company, and their name was often used for this type of counter.<ref>{{Citation | url = http://www.veeder.com/page/vr_history | title = VR History | publisher = Veeder}}.</ref>

Handheld ]s are used mainly for stocktaking and counting people attending events.

] counters were used to accumulate totals in ]s that pioneered the data processing industry.

<gallery widths="220px" heights="165px">
File:Teller (3).jpg|Mechanical counter wheels showing both sides. The bump on the wheel displayed at the top engages the ratchet on the wheel below every turn.
File:CountersMechanical.agr.jpg|Several mechanical counters.
File:Early SSA accounting operations.jpg|Early IBM tabulating machine using mechanical counters.
</gallery>


== See also == == See also ==
* ]
* ]
* ]
* ]
* ]
* ]


== References ==
*]
{{Reflist}}


==External links==
]
* {{Commons category-inline|Counter circuits }}
]
* {{Cite report |url=https://www.techrxiv.org/articles/preprint/Design_and_Synthesis_of_a_MOD_13_Binary_Down_Counter/16810198/1 |title=Design and Synthesis of a MOD 13 Binary Down Counter |last=Assim |first=Ara Abdulsatar Assim |date=2021-10-19 |doi=10.36227/techrxiv.16810198.v1}}


{{Authority control}}
]

]
]
]
]
]
]<!-- e.g., counter.up(), counter.value() -->
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]
]

Latest revision as of 09:32, 14 October 2023

Device storing number of times an event or process occurred This article is about the term counter used in electronics, computing, and mechanical counting devices. For other uses, see Counter (disambiguation).
Voltage changes on the five outputs of the binary counter counting from 00000, left to 11111 (or 31), right (vertically).

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. The most common type is a sequential digital logic circuit with an input line called the clock and multiple output lines. The values on the output lines represent a number in the binary or BCD number system. Each pulse applied to the clock input increments or decrements the number in the counter.

A counter circuit is usually constructed of several flip-flops connected in a cascade. Counters are a very widely used component in digital circuits, and are manufactured as separate integrated circuits and also incorporated as parts of larger integrated circuits.

Electronic counters

An electronic counter is a sequential logic circuit that has a clock input signal and a group of output signals that represent an integer "counts" value. Upon each qualified clock edge, the circuit will increment (or decrement, depending on circuit design) the counts. When the counts have reached the end of the counting sequence (maximum counts when incrementing; zero counts when decrementing), the next clock will cause the counts to overflow or underflow, and the counting sequence will start over. Internally, counters use flip-flops to represent the current counts and to retain the counts between clocks. Depending on the type of counter, the output may be a direct representation of the counts (a binary number), or it may be encoded. Examples of the latter include ring counters and counters that output Gray codes.

Many counters provide additional input signals to facilitate dynamic control of the counting sequence, such as:

  • Reset – sets counts to zero. Some IC manufacturers name it "clear" or "master reset (MR)".
  • Enable – allows or inhibits counting.
  • Direction – determines whether counts will increment or decrement.
  • Data – parallel input data which represents a particular counts value.
  • Load – copies parallel input data to the counts.

Some counters provide a Terminal Count output which indicates that the next clock will cause overflow or underflow. This is commonly used to implement counter cascading (combining two or more counters to create a single, larger counter) by connecting the Terminal Count output of one counter to the Enable input of the next counter.

The modulus of a counter is the number of states in its count sequence. The maximum possible modulus is determined by the number of flip-flops. For example, a four-bit counter can have a modulus of up to 16 (2^4).

Counters are generally classified as either synchronous or asynchronous. In synchronous counters, all flip-flops share a common clock and change state at the same time. In asynchronous counters, each flip-flop has a unique clock, and the flip-flop states change at different times.

Counters are categorized in various ways. For example:

  • Modulus counter – counts through a particular number of states.
  • Decade counter – modulus ten counter (counts through ten states).
  • Up/down counter – counts up and down, as directed by a control input, or by the use of separate "up" and "down" clocks.
  • Ring counter – formed by a "circular" shift register.
  • Johnson counter – a twisted ring counter.
  • Gray-code counter – outputs a sequence of Gray codes.
  • Shift register generator counter – based on a shift register with feedback.

Counters are implemented in a variety of ways, including as dedicated MSI and LSI integrated circuits, as embedded counters within ASICs, as general-purpose counter and timer peripherals in microcontrollers, and as IP blocks in FPGAs.

Asynchronous (ripple) counter

Asynchronous counter created from two JK flip-flops

An asynchronous (ripple) counter is a "chain" of toggle (T) flip-flops wherein the least-significant flip-flop (bit 0) is clocked by an external signal (the counter input clock), and all other flip-flops are clocked by the output of the nearest, less significant flip-flop (e.g., bit 0 clocks the bit 1 flip-flop, bit 1 clocks the bit 2 flip-flop, etc.). The first flip-flop is clocked by rising edges; all other flip-flops in the chain are clocked by falling clock edges. Each flip-flop introduces a delay from clock edge to output toggle, thus causing the counter bits to change at different times and producing a ripple effect as the input clock propagates through the chain. When implemented with discrete flip-flops, ripple counters are commonly implemented with JK flip-flops, with each flip-flop configured to toggle when clocked (i.e., J and K are both connected to logic high).

In the simplest case, a one-bit counter consists of a single flip-flop. This counter will increment (by toggling its output) once per clock cycle and will count from zero to one before overflowing (starting over at zero). Each output state corresponds to two clock cycles; consequently, the flip-flop output frequency is exactly half the frequency of the input clock. If this output is then used as the clock signal for a second flip-flop, the pair of flip-flops will form a two-bit ripple counter with the following state sequence:

Clock cycle Q1 Q0 (Q1:Q0) decimal
0 0 0 0
1 0 1 1
2 1 0 2
3 1 1 3
4 0 0 0

Additional flip-flops may be added to the chain to form counters of any arbitrary word size, with the output frequency of each bit equal to exactly half the frequency of the nearest, less significant bit.

Ripple counters exhibit unstable output states while the input clock propagates through the circuit. The duration of this instability (the output settling time) is proportional to the number of flip-flops. This makes ripple counters unsuitable for use in synchronous circuits that require the counter to have a fast output settling time. Also, it is often impractical to use ripple counter output bits as clocks for external circuits because the ripple effect causes timing skew between the bits. Ripple counters are commonly used as general-purpose counters and clock frequency dividers in applications where the instantaneous count and timing skew is unimportant.

Synchronous counter

A 4-bit synchronous counter using JK flip-flops

In a synchronous counter, the clock inputs of the flip-flops are connected, and the common clock simultaneously triggers all flip-flops. Consequently, all of the flip-flops change state at the same time (in parallel).

For example, the circuit shown to the right is an ascending (up-counting) four-bit synchronous counter implemented with JK flip-flops. Each bit of this counter is allowed to toggle when all of the less significant bits are at a logic high state. Upon clock rising edge, bit 1 toggles if bit 0 is logic high; bit 2 toggles if bits 0 and 1 are both high; bit 3 toggles if bits 2, 1, and 0 are all high.

Decade counter

A circuit decade counter using JK Flip-flops (74LS112D)

A decade counter counts in decimal digits, rather than binary. A decade counter may have each (that is, it may count in binary-coded decimal, as the 7490 integrated circuit did) or other binary encodings. A decade counter is a binary counter designed to count to 1001 (decimal 9). An ordinary four-stage counter can be easily modified to a decade counter by adding a NAND gate as in the schematic to the right. Notice that FF2 and FF4 provide the inputs to the NAND gate. The NAND gate outputs are connected to the CLR input of each of the FFs.". It counts from 0 to 9 and then resets to zero. The counter output can be set to zero by pulsing the reset line low. The count then increments on each clock pulse until it reaches 1001 (decimal 9). When it increments to 1010 (decimal 10), both inputs of the NAND gate go high. The result is that the NAND output goes low, and resets the counter to zero. D going low can be a CARRY OUT signal, indicating that there has been a count of ten.

Ring counter

Main article: Ring counter

A ring counter is a circular shift register that is initiated such that only one of its flip-flops is the state one while others are in their zero states.

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.

Johnson counter

Main article: Johnson counter

A Johnson counter (or switch-tail ring counter, twisted ring counter, walking ring counter, or Möbius counter) is a modified ring counter, where the output from the last stage is inverted and fed back as input to the first stage. 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 similar to the decade counter (note: the 74x4017 decade counter is a Johnson counter), digital-to-analog conversion, etc. They can be implemented easily using D- or JK-type flip-flops.

Computer science counters

Main article: Register machine

In computability theory, a counter is considered a type of memory. A counter stores a single natural number (initially zero) and can be arbitrarily 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 automaton or a nondeterministic finite automaton. They have the same 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.

Web counter

Main article: Web counter

A web counter or hit counter is a computer program that indicates the number of visitors or hits a particular webpage has received. Once set up, these counters will be incremented by one every time the web page is accessed in a web browser.

The number is usually displayed as an inline digital image or in plain text or on a physical counter such as a mechanical counter. Images may be presented in a variety of fonts, or styles; the classic example is the wheels of an odometer.

Web counter was popular in the mid to late 1990s and early 2000s, later replaced by more detailed and complete web traffic measures.

Computer based counters

Many automation systems use PC and laptops to monitor different parameters of machines and production data. Counters may count parameters such as the number of pieces produced, the production batch number, and measurements of the amounts of material used.

Mechanical counters

Main article: Mechanical counter

Long before electronics became common, mechanical devices were used to count events. These are known as tally counters. They typically consist of a series of disks mounted on an axle, with the digits zero through nine marked on their edge. The right-most disk moves one increment with each event. Each disk except the left-most has a protrusion that moves the next disk to the left one increment after the completion of one revolution. Such counters were used as odometers for bicycles and cars and in tape recorders, fuel dispensers, in production machinery as well as in other machinery. One of the largest manufacturers was the Veeder-Root company, and their name was often used for this type of counter.

Handheld tally counters are used mainly for stocktaking and counting people attending events.

Electromechanical counters were used to accumulate totals in tabulating machines that pioneered the data processing industry.

  • Mechanical counter wheels showing both sides. The bump on the wheel displayed at the top engages the ratchet on the wheel below every turn. Mechanical counter wheels showing both sides. The bump on the wheel displayed at the top engages the ratchet on the wheel below every turn.
  • Several mechanical counters. Several mechanical counters.
  • Early IBM tabulating machine using mechanical counters. Early IBM tabulating machine using mechanical counters.

See also

References

  1. "Decade Counter". Integrated Publishing. Retrieved 19 Mar 2020.
  2. Singh, Arun Kumar (2006). Digital Principles Foundation of Circuit Design and Application. New Age Publishers. ISBN 81-224-1759-0.
  3. Horowitz, Paul; Hill, Winfield (1989). The Art of Electronics. Cambridge University Press. ISBN 0-521-37095-7.
  4. Graf, Rudolf F (1999). Modern Dictionary of Electronics. Newnes. ISBN 0-7506-9866-7.
  5. VR History, Veeder.

External links

Categories:
Counter (digital): Difference between revisions Add topic