This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

Counter and Timer Input and Output

Acquire counter data and generate pulses with National Instruments® devices

Before you use counter channels, see Hardware Discovery and Session Setup.

To learn how to create a session and acquire or generate counter and timer data, see Counter and Timer Input and Output Workflow.


addCounterInputChannel Add counter input channel
addCounterOutputChannel Add counter output channel
inputSingleScan Acquire single scan from all input channels
resetCounters Reset counter channel to initial count
startForeground Start foreground operations
startBackground Start background operations
removeChannel Remove channel from session object
stop Stop background operation
wait Block MATLAB until background operation completes


ActiveEdge Rising or falling edges of EdgeCount signals
ActivePulse Active pulse measurement of PulseWidth counter channel
CountDirection Specify direction of counter channel
Device Channel device information
EncoderType Encoding type of counter channel
Frequency Frequency of generated output
ID ID of channel in session
InitialCount Specify initial count point
MeasurementType Channel measurement type
Name Specify descriptive name for the channel
Terminal PFI terminal of counter subsystem
ZResetCondition Reset condition for Z-indexing
ZResetEnable Enable reset for Z-indexing
ZResetValue Reset value for Z-indexing

Examples and How To

Acquire and Generate Counter Data

Acquire Counter Input Data

Use the addCounterInputChannel method to add a channel that acquires edge count from a device.

Acquire Counter Input Data in the Foreground

This example shows how to acquire rising edge data from an NI USB-9402 with device ID 'cDAQ1Mod5', and plot the acquired data.

Generate Data on a Counter Channel

Use the addCounterOutputChannel method to add a channel that generates pulses on a counter/timer subsystem.

Generate Pulses on a Counter Output Channel

This example shows how to generate pulse data on an NI USB-9402 with device ID 'cDAQ1Mod5'.

Synchronize Using Counter Channels

Acquire Digital Data Using Counter Channels

This example shows how to acquire clocked digital data using a counter output channel that generates pulses as an external clock.


Analog and Digital Counters

Use digital and analog counters to count clock ticks and external events.

Was this topic helpful?