Chapter 8 CountersNI USB-621x User Manual 8-4 ni.comControlling the Direction of CountingIn edge counting applications, the counter can count up or down. You canconfigure the counter to do the following:• Always count up• Always count down• Count up when the Counter n B input is high; count down whenit is lowFor information about connecting counter signals, refer to the DefaultCounter/Timer Pinouts section.Pulse-Width MeasurementIn pulse-width measurements, the counter measures the width of a pulse onits Gate input signal. You can configure the counter to measure the widthof high pulses or low pulses on the Gate signal.You can route an internal or external periodic clock signal (with a knownperiod) to the Source input of the counter. The counter counts the numberof rising (or falling) edges on the Source signal while the pulse on the Gatesignal is active.You can calculate the pulse width by multiplying the period of the Sourcesignal by the number of edges returned by the counter.A pulse-width measurement is accurate even if the counter is armed whilea pulse train is in progress. If a counter is armed while the pulse is in theactive state, it waits for the next transition to the active state to begin themeasurement.Single Pulse-Width MeasurementWith single pulse-width measurement, the counter counts the number ofedges on the Source input while the Gate input remains active. When theGate input goes inactive, the counter stores the count in a hardware saveregister and ignores other edges on the Gate and Source inputs. Softwarethen reads the stored count.