We are closed 23 Sep - 6 Oct 2015 - there is no shipment or support during this period

The following information is for the EMANT300, EMANT380

Counter

Counters basically count the number of pulses at its input. The EMANT3X0 DAQ module has one 16 bit counter input. Please note that since the counter shares the same clock as the PWM function, you can only use either the PWM function or Counter function.

The input to the counter must be a 3.3V (for EMANT380) or 5V (for EMANT300) digital signal. From the specifications, it can be either TTL or CMOS signal. The input can be accessed through pin 21 of the DB25 connector or the screw terminal labeled COUNTER in the Light Application Adaptor.

To use the counters, the user must first configure the Counter. The .NET methods or LabVIEW VI used is the Configure PWM Counter. Set the flag to Counter.

The counter has two modes Timed or Event.

The Event mode is straightforward. Every time a digital pulse appears, the counter is incremented. When the count reaches 2^16 or 65536 it rolls over and resets to 0.

In the Timed mode, the counter is read and then reset every time the time programmed elapses. The time can be set from 2ms to 128ms. (MSINT + 1 = Elapsed Time)

If the above waveform is a 1Khz square wave signal and the time elasped is set to 100ms (MSINT=99), in the Timed mode, the Read Counter VI or method would return a count of 100. The period of 1ms would also be returned and the frequency of 1000Hz can be easily calculated. The EMANT300 Example Measure Frequency Hardware Timing.VI demonstrates this.

Visual Basic 2005 Code Snippet

' Configure Counter
Emant3001.ConfigPWMCounter(Emant.Emant300.PWMORCNT.Count, Emant.Emant300.EVENTORTIMED.Timed, 99, 0)
' Read Counter
Count = Emant3001.ReadCounter(Period)

As the max elapsed time is 128ms, this solution will not be suitable for measuring lower frequencies. In such a case, we use the Event mode and use a software timer to obtain the elasped time. The EMANT300 Example Measure Frequency Software Timing.VI show frequency measurement by calling the counter every 1 second. In order to avoid the overflow problem (the count max out at 65536), the VI checks for this condition and corrects the count in such an instance by adding 65536 to the returned count.