Monitor Newsletter Archive
Issue 7: Timing and Counting
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:
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.
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.
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.
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.
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.
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.
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 (https://www.windmillsoft.com/551.html). A frequency of 10 MHz would give a minimum time separation of 0.1 microseconds.
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.)
Do you have a comment or suggestion for this newsletter? Why not email the editor - Jill - at [email protected]
* Copyright Windmill Software Ltd * Reprinting permitted with this notice included * For more articles see https://www.windmill.co.uk
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.
Previous Issue Next Issue