HOME

TheInfoList



OR:

In digital logic and
computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes, and development of both hardware and software. Computing has scientific, ...
, a counter is a device which stores (and sometimes displays) the number of times a particular
event Event may refer to: Gatherings of people * Ceremony, an event of ritual significance, performed on a special occasion * Convention (meeting), a gathering of individuals engaged in some common interest * Event management, the organization of ev ...
or process has occurred, often in relationship to a
clock A clock or a timepiece is a device used to measure and indicate time. The clock is one of the oldest human inventions, meeting the need to measure intervals of time shorter than the natural units such as the day, the lunar month and ...
. 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 circuit In theoretical computer science, a circuit is a model of computation in which input values proceed through a sequence of gates, each of which computes a function. Circuits of this kind provide a generalization of Boolean circuits and a mathemati ...
s, and are manufactured as separate
integrated circuit An integrated circuit or monolithic integrated circuit (also referred to as an IC, a chip, or a microchip) is a set of electronic circuits on one small flat piece (or "chip") of semiconductor material, usually silicon. Large numbers of tiny ...
s and also incorporated as parts of larger integrated circuits.


Electronic counters

An electronic counter is a
sequential logic In automata theory, sequential logic is a type of logic circuit whose output depends on the present value of its input signals and on the sequence of past inputs, the input history. This is in contrast to ''combinational logic'', whose output ...
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. Synchronous 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. * Ring counter – formed by a "circular"
shift register A shift register is a type of digital circuit using a cascade of flip-flops where the output of one flip-flop is connected to the input of the next. They share a single clock signal, which causes the data stored in the system to shift from one loc ...
. * Johnson counter – a ''twisted'' ring counter. * Gray-code counter – outputs a sequence of Gray codes. Counters are implemented in a variety of ways, including as dedicated MSI and LSI
integrated circuit An integrated circuit or monolithic integrated circuit (also referred to as an IC, a chip, or a microchip) is a set of electronic circuits on one small flat piece (or "chip") of semiconductor material, usually silicon. Large numbers of tiny ...
s, as embedded counters within
ASIC An application-specific integrated circuit (ASIC ) is an integrated circuit (IC) chip customized for a particular use, rather than intended for general-purpose use, such as a chip designed to run in a digital voice recorder or a high-efficie ...
s, as general-purpose counter and timer peripherals in
microcontroller A microcontroller (MCU for ''microcontroller unit'', often also MC, UC, or μC) is a small computer on a single VLSI integrated circuit (IC) chip. A microcontroller contains one or more CPUs ( processor cores) along with memory and programmabl ...
s, and as IP blocks in
FPGA A field-programmable gate array (FPGA) is an integrated circuit designed to be configured by a customer or a designer after manufacturinghence the term '' field-programmable''. The FPGA configuration is generally specified using a hardware d ...
s.


Asynchronous (ripple) counter

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: 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 circuit In digital electronics, a synchronous circuit is a digital circuit in which the changes in the state of memory elements are synchronized by a clock signal. In a sequential digital logic circuit, data are stored in memory devices called flip-f ...
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.


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). 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 decade counter counts in decimal digits, rather than binary. A decade counter may have each (that is, it may count in
binary-coded decimal In computing and electronic systems, binary-coded decimal (BCD) is a class of binary encodings of decimal numbers where each digit is represented by a fixed number of bits, usually four or eight. Sometimes, special bit patterns are used ...
, 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

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 shift register is a type of digital circuit using a cascade of flip-flops where the output of one flip-flop is connected to the input of the next. They share a single clock signal, which causes the data stored in the system to shift from one loc ...
(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

A
Johnson counter A ring counter is a type of counter composed of flip-flops connected into a shift register, with the output of the last flip-flop fed to the input of the first, making a "circular" or "ring" structure. There are two types of ring counters: * A ...
(or
switch-tail ring counter A ring counter is a type of counter composed of flip-flop (electronics), flip-flops connected into a shift register, with the output of the last flip-flop fed to the input of the first, making a "circular" or "ring" structure. There are two types ...
, 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, digital-to-analog conversion, etc. They can be implemented easily using D- or JK-type flip-flops.


Computer science counters

In
computability theory Computability theory, also known as recursion theory, is a branch of mathematical logic, computer science, and the theory of computation that originated in the 1930s with the study of computable functions and Turing degrees. The field has sinc ...
, a counter is considered a type of memory. A counter stores a single
natural number In mathematics, the natural numbers are those numbers used for counting (as in "there are ''six'' coins on the table") and ordering (as in "this is the ''third'' largest city in the country"). Numbers used for counting are called '' cardinal ...
(initially
zero 0 (zero) is a number representing an empty quantity. In place-value notation such as the Hindu–Arabic numeral system, 0 also serves as a placeholder numerical digit, which works by Multiplication, multiplying digits to the left of 0 by th ...
) and can be arbitrarily long. A counter is usually considered in conjunction with a
finite-state machine A finite-state machine (FSM) or finite-state automaton (FSA, plural: ''automata''), finite automaton, or simply a state machine, is a mathematical model of computation. It is an abstract machine that can be in exactly one of a finite number o ...
(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: # Deterministic or non-deterministic FSM plus two counters # Non-deterministic FSM plus one
stack Stack may refer to: Places * Stack Island, an island game reserve in Bass Strait, south-eastern Australia, in Tasmania’s Hunter Island Group * Blue Stack Mountains, in Co. Donegal, Ireland People * Stack (surname) (including a list of people ...
# Non-deterministic FSM plus one counter # Deterministic FSM plus one counter # 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 In automata theory, a finite-state machine is called a deterministic finite automaton (DFA), if * each of its transitions is ''uniquely'' determined by its source state and input symbol, and * reading an input symbol is required for each state ...
. 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 A Turing machine is a mathematical model of computation describing an abstract machine that manipulates symbols on a strip of tape according to a table of rules. Despite the model's simplicity, it is capable of implementing any computer alg ...
. See the article on counter machines for a proof.


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 A web browser is application software for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's screen. Browsers are used o ...
. The number is usually displayed as an inline
digital image A digital image is an image composed of picture elements, also known as ''pixels'', each with '' finite'', '' discrete quantities'' of numeric representation for its intensity or gray level that is an output from its two-dimensional functions ...
or in
plain text In computing, plain text is a loose term for data (e.g. file contents) that represent only characters of readable material but not its graphical representation nor other objects (floating-point numbers, images, etc.). It may also include a limit ...
or on a physical counter such as a
mechanical counter Mechanical counters are digital counters built using mechanical components. Long before electronics became common, mechanical devices were used to count events. They typically consist of a series of disks mounted on an axle, with the digits zero ...
. Images may be presented in a variety of
font In metal typesetting, a font is a particular size, weight and style of a typeface. Each font is a matched set of type, with a piece (a " sort") for each glyph. A typeface consists of a range of such fonts that shared an overall design. In mo ...
s, or styles; the classic example is the wheels of an
odometer An odometer or odograph is an instrument used for measuring the distance traveled by a vehicle, such as a bicycle or car. The device may be electronic, mechanical, or a combination of the two ( electromechanical). The noun derives from ancient G ...
. ''Web counter'' was popular in the mid to late 1990s and early 2000s, later replaced by more detailed and complete
web traffic Web traffic is the data sent and received by visitors to a website. Since the mid-1990s, web traffic has been the largest portion of Internet traffic. Sites monitor the incoming and outgoing traffic to see which parts or pages of their site are ...
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

Long before electronics became common, mechanical devices were used to count events. These are known as
tally counter A tally counter is a mechanical, electronic, or software device used to incrementally count something, typically fleeting. One of the most common things tally counters are used for is counting people, animals, or things that are coming and going fr ...
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
odometer An odometer or odograph is an instrument used for measuring the distance traveled by a vehicle, such as a bicycle or car. The device may be electronic, mechanical, or a combination of the two ( electromechanical). The noun derives from ancient G ...
s for bicycles and cars and in
tape recorder An audio tape recorder, also known as a tape deck, tape player or tape machine or simply a tape recorder, is a sound recording and reproduction device that records and plays back sounds usually using magnetic tape for storage. In its present ...
s, 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 counter A tally counter is a mechanical, electronic, or software device used to incrementally count something, typically fleeting. One of the most common things tally counters are used for is counting people, animals, or things that are coming and going fr ...
s are used mainly for stocktaking and counting people attending events.
Electromechanical In engineering, electromechanics combines processes and procedures drawn from electrical engineering and mechanical engineering. Electromechanics focuses on the interaction of electrical and mechanical systems as a whole and how the two systems ...
counters were used to accumulate totals in tabulating machines that pioneered the data processing industry. 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.


See also

* Time to digital converter * Geneva drive * Pace count beads *
Prayer beads Prayer beads are a form of beadwork used to count the repetitions of prayers, chants, or mantras by members of various religions such as Hinduism, Buddhism, Shinto, Umbanda, Islam, Sikhism, the Baháʼí Faith, and some Christian denom ...
*
Asynchronous circuit Asynchronous circuit (clockless or self-timed circuit) is a sequential digital logic circuit that does not use a global clock circuit or signal generator to synchronize its components. Instead, the components are driven by a handshaking circui ...
*
Synchronous circuit In digital electronics, a synchronous circuit is a digital circuit in which the changes in the state of memory elements are synchronized by a clock signal. In a sequential digital logic circuit, data are stored in memory devices called flip-f ...


References


External links

* {{Authority control Numeral systems Digital circuits Unary operations