Counting Edges

NI DAQ Assistant

Counting Edges

In edge counting, your device counts rising or falling edges using a counter. You can choose to do either single-point (on-demand or hardware timed) edge counting or buffered (sample clock) edge counting.

When doing on-demand edge counting, each subsequent read returns the number of edges counted since the counter was started. If you perform multiple reads without first starting the counter, the counter implicitly starts and stops with each Read function/VI call, and the number of counted edges is not cumulative between read calls.

When doing hardware-timed edge counting, the read returns a value on each active edge of the sample clock. In this mode, you cannot specify a buffer. You must supply an external sample clock for hardware-timed edge counting.

When doing buffered edge counting, the number of edges counted is latched on each active edge of the sample clock and stored in the buffer. You must supply an external sample clock for buffered edge counting.

The following figure shows an example of edge counting in which the counter in a device counts five edges on the input terminal.

When doing buffered edge counting, the number of edges counted is latched on each active edge of the sample clock and stored in the buffer. There is no built-in clock for buffered edge counting, so you must supply an external sample clock.