National Instruments 320174B-01 Computer Hardware User Manual


 
Configuration and Installation Chapter 2
Lab-NB User Manual 2-22 © National Instruments Corporation
+5 V
I/O Connector
CLK
GATE
OUT
DGND
Lab-NB Board
Counter (from Group B)
4.7 k
13
Signal
Source
Switch
Figure 2-16. Event-Counting Application with External Switch Gating
Pulse-width measurement is performed by level gating. The pulse to be measured is applied to
the counter GATE input. The counter is loaded with the known count and is programmed to
count down while the signal at the GATE input is high. The pulse width equals the counter
difference (loaded value minus read value) multiplied by the CLK period.
Time-lapse measurement is performed by programming a counter to be edge gated. An edge is
applied to the counter GATE input to start the counter. The counter can be programmed to start
counting after receiving a low-to-high edge. The time lapse since receiving the edge equals the
counter value difference (loaded value minus read value) multiplied by the CLK period.
Frequency measurement is performed by programming a counter to be level gated and by
counting the number of falling edges in a signal applied to a CLK input. The gate signal applied
to the counter GATE input is of known duration. In this case, the counter is programmed to
count falling edges at the CLK input while the gate is applied. The frequency of the input signal
then equals the count value divided by the gate period. Figure 2-17 shows the connections for a
frequency measurement application. A second counter could also be used to generate the gate
signal in this application.