Windmill Software Ltd Follow us on Google+ Follow us on Twitter
Data Acquisition Intelligence

Windmill Software
February 1999

Monitor Newsletter Archive


Issue 7: Timing and Counting


Windmill News | Counting and Timing | Glossary S


You can now download the latest versions of the on-line Help for Windmill programs. How do you know if you have an older version? Well, if your Help has a white rather than pale yellow background then there may be an updated Help file available.

Thank you to all who filled in our survey. Your comments were very helpful and we plan to include some of them in a FAQ (list of frequently asked questions) for future users of the software. If you haven't yet filled in the survey you can still do so.

If you haven't yet tried Windmill software as a special offer to our subscribers we're offering our standard logging, charting and control programs absolutely free! Use the subscribe form at the bottom of this page.


Counters are used in many processes. For example, you could:

  • Calibrate the position of printing on packaging by counting pulses emitted from the print-head.
  • Count people entering and leaving a store using door open and proximity sensors.
  • Calculate 24-hour rainfall by counting how often a "bucket" fills, tips over and empties.
  • Measure speed by counting revolutions of a rotating shaft per unit of time, using optical or magnetic markers.
  • Interface to a flow meter which generates pulses at a rate depending on flow. Similarly you could measure power output from an electricity meter

Methods of Counting

There are several methods, or modes, of counting. Some counters support several modes and you can choose which mode to use with software like Windmill.

Totalise or Event Counting

Each counter starts at zero and counts pulses either up to its maximum count or until you reset it. When it reaches its maximum it may reset itself to zero or store its value in an output latch. You can set a scale and offset factor to the count with software. For example, if the pulses come from a flow meter which produces one pulse for every 50 millilitres, a scale factor of 0.05 gives a reading in litres.

Up/Down Counting

Similar to a totalise counter but you set a starting value and specify whether you want to count up or down. This is useful, for example, in batch counting.

Frequency Counting

A count is measured over a defined time: the gate time. By dividing the count by the gate time, you can work out the counts per second value, giving a frequency in cycles per second (Hertz). Useful when measuring speed or the immediate rate of power consumpution.

Period Counting

Measures the time for a number of cycles to occur. At the end of each measurement the counter resets to zero. Used, for example, to calculate the speed of a conveyor belt by measuring the time between consecutive pulses.


Measures the time that a signal is true, or the time between a start and a stop pulse. Useful for recording, for instance, the time a machine is running.

What the Hardware Specifications Mean

Gate Input

It is sometimes helpful to count only when a certain condition occurs. For example, if timing pulses are counted when a machine is running (ie the On signal is true) you can calculate the percentage of time the machine is in use just by comparing the total count with the elapsed time. This calculation is simple even though the machine may start and stop many times during the monitoring period, and many machines might be monitored.

The counter must have a hardware gate input, as well as its normal count input. You connect the machine's On signal to the gate and a source of clock pulses to the normal count input, making the measurements within the hardware of the counter.

If you need to enable and disable counting, make sure your hardware has a gate input.

Input Source

The input to a counter is a train of voltage pulses. Different counters will advance on different voltage levels. For example, some counters expect TTL voltages. These will count when the voltage level is above 2.4 V. Or, for timers, a signal will switch to true above 2.4 V and false below 0.8 V. Other counters are designed for 24 V, or 5 V CMOS levels. If your pulse level is outside that required by your counter you may be able to condition the signal - amplify it for example - to the correct level. Conditioning the signal may lead to loss of speed.

Output Latch

Provides a storage in hardware for the count. On a command from software the contents of all counters are simultaneously transferred to their output latches. This means that you can take a snapshot of counter contents at an instant in time, without disturbing the on-going count. This is especially important with cascaded counters.


Resolution expresses the highest count achievable with a counter. It is shown as a number of bits. The count starts at 0, so the calculation to translate n bits to the highest count is (2n)-1. A 16-bit counter, for example, can count up to 65535. If you can cascade (link) two or more counters you can achieve higher counts.


Some counters produce a voltage pulse when they go from their maximum count back to zero. You can use this as an input to another counter - thereby continuing the count. In this way you could use two 16-bit counters as a 32-bit counter (counting to 2^32-1 or 4294967295).

Maximum Input Frequency

This shows the minimum time separation between two successive pulses to which the counter can respond. An input frequency might be 10 MHz, or, in the case of the Microlink 551 card for sale in our shop, 3 MHz ( A frequency of 10 MHz would give a minimum time separation of 0.1 microseconds.

Considerations When Choosing Counters

For simple counting applications the major concern arises over whether counts can be missed. When the count is read regularly for long periods it is sensible to reset the counter to 0 after reading, clearly no counts should be lost during this process. Also consider whether the count will exceed the capacity of the counter - as discussed in resolution and cascading above. Also determine which mode of counter best suits your application now and in the future. Windmill's hardware set-up program (SetupIML) automatically detects many types of counter - letting you choose a mode without programming.

For more information on timing and counting, please contact Windmill Software.


(For letters A-R please see our web site Glossary.)

Sample and Hold
A component of a type of analogue-to-digital converter. The analogue signal is frozen in a sample and hold circuit to prevent it changing during digitisation. For more information on A-D converters see Issue 3 of Monitor.
Normal channel scanning in a data acquisition system involves stepping round and reading each input channel in turn. The scan will return to the first channel once all the channels have been sampled.
Supervisory control and data acquisition - a large scale software package usually used to monitor and control a manufacturing process.
Seebeck Effect
The principle that describes how a thermocouple works. In a circuit in which there are junctions between dissimilar metals, an electromotive force (voltage) is set up when the junctions are at different temperatures.
A data acquisition card or module with a stable on-board reference voltage that software can use for automatic recalibration.
A measure of the minimum change in an input signal that an instrument can detect.
A device that can detect a change in a physical quantity (light or pressure for example) and produce a corresponding electrical signal.
Serial Communication
Where data is transferred one bit at a time.
Settling Time
When a change in signal occurs, the time taken for the input or output channel to settle to its new value.
Set Point
Value of a controlled variable, departure from which causes a controller to operate to reduce the error and restore the intended steady state.
International system of units. Abbreviation for Systeme International (d'Unites).
Signal Conditioning
Makes a signal suitable for input to an analogue-to-digital converter. For example, a signal may be filtered to remove noise, or amplified to meet the range of the A-D converter.
General term referring to a conveyor of information.
Single-Ended Input
An analogue input that is measured with respect to a common earth. Single ended inputs are only suitable for signals that are of good size - 100 mV full scale or above.
Simultaneous Sampling
When all analogue signals are read simultaneously. This is achieved by providing each input with its own A-D converter, and initiating sampling from a single clock. It ensures that there is no reduction in sampling rate when more signals are connected.
Sine Wave
Waveform of a single frequency, indefinitely repeated in time. In practice there must be a transient at the start and finish of such a wave.
Slew Rate
The maximum rate of change of an output signal.
A networked device that is controlled by another, master, device.
Software Trigger
A programmed event, such as a specific key press or mouse click, that triggers data capture.
Short pulse of voltage or current - usually undesirable.
Square Wave
Wave that alternates between two fixed values. Has very rapid (theoretically zero) rise and fall times.
      ___         ___
     |   |       |   |
  ___|   |_______|   |_____
The ability of an instrument or sensor to maintain a constant output when a constant input is applied.
When a material is distorted by forces acting on it, it is said to be strained. Strain is the ratio of change in dimension to original dimension.
Strain Gauge
A sensor that experiences a change in resistance when it is stretched or strained. It is attached to the body subjected to the strain.
Successive Approximation
A technique used in A-D converters to measure an analogue signal. It compares the signal with progressively smaller values, each step getting nearer the actual voltage. More details are in Monitor Issue 4.
A large, momentary, increase in the voltage on a power line.
Combination of several pieces of equipment to perform in a particular manner.

Do you have a comment or suggestion for this newsletter? Why not email the editor - Jill - at

* Copyright Windmill Software Ltd
* Reprinting permitted with this notice included
* For more articles see

We are happy for you to copy and distribute this newsletter, and use extracts from it on your own web site or publication, providing the above notice is included and a link back to our website is in place.


To subscribe to Monitor please fill in your email address below. We will not pass your address to any third parties.

*  Email:
*  Format:

Previous Issue Next Issue