ReferenceDriverNICounter Read Task

NI Counter Read Task

Learn how to acquire counter data from NI devices with Synnax.

For task lifecycle management, see the Task Basics page.

Task Configuration Reference

ParameterTypeRequiredDefaultDescription
namestringYes-Human-readable task name
sample_ratenumberYes-Samples per second (Hz), determined by module
stream_ratenumberNosample_rateRate data is streamed to Synnax (Hz), must be ≤ sample_rate
data_savingbooleanNofalseEnable permanent storage in Synnax
auto_startbooleanNofalseAutomatically start task after configuration
channelsarrayYes-List of counter input channel configurations

Channel Types Reference

Frequency (ci_frequency)

Measures the frequency of digital pulses.

ParameterTypeRequiredDefaultDescription
channelnumberYes-Synnax channel key
devicestringYes-Device identifier
portnumberYes-Counter port (0-indexed)
min_valnumberNo2Minimum frequency
max_valnumberNo100Maximum frequency
unitsenumNoHzHz, Ticks
edgeenumNoRisingRising, Falling
meas_methodenumNoDynAvgLowFreq1Ctr, HighFreq2Ctr, DynAvg
meas_timenumberNo0.000006Measurement time (seconds), used with HighFreq2Ctr
divisornumberNo4Integer divisor, used with LargeRng2Ctr
terminalstringNo-PFI terminal for signal routing
custom_scaleobjectNo-Custom scaling

Edge Count (ci_edge_count)

Counts rising or falling edges on a digital signal.

ParameterTypeRequiredDefaultDescription
channelnumberYes-Synnax channel key
devicestringYes-Device identifier
portnumberYes-Counter port (0-indexed)
active_edgeenumNoRisingRising, Falling
count_directionenumNoCountUpCountUp, CountDown, ExternallyControlled
initial_countnumberNo0Starting count value
terminalstringNo-PFI terminal for signal routing

Period (ci_period)

Measures the time between edges of a periodic signal.

ParameterTypeRequiredDefaultDescription
channelnumberYes-Synnax channel key
devicestringYes-Device identifier
portnumberYes-Counter port (0-indexed)
min_valnumberNo0.000001Minimum period
max_valnumberNo0.1Maximum period
unitsenumNoSecondsSeconds, Ticks
starting_edgeenumNoRisingRising, Falling
meas_methodenumNoDynAvgLowFreq1Ctr, HighFreq2Ctr, DynAvg
meas_timenumberNo0.001Measurement time (seconds), used with HighFreq2Ctr
divisornumberNo4Integer divisor, used with LargeRng2Ctr
terminalstringNo-PFI terminal for signal routing
custom_scaleobjectNo-Custom scaling

Pulse Width (ci_pulse_width)

Measures the width of pulses in a digital signal.

ParameterTypeRequiredDefaultDescription
channelnumberYes-Synnax channel key
devicestringYes-Device identifier
portnumberYes-Counter port (0-indexed)
min_valnumberNo0.000001Minimum pulse width
max_valnumberNo0.1Maximum pulse width
unitsenumNoSecondsSeconds, Ticks
starting_edgeenumNoRisingRising, Falling
terminalstringNo-PFI terminal for signal routing
custom_scaleobjectNo-Custom scaling

Semi Period (ci_semi_period)

Measures the half-period of a periodic signal.

ParameterTypeRequiredDefaultDescription
channelnumberYes-Synnax channel key
devicestringYes-Device identifier
portnumberYes-Counter port (0-indexed)
min_valnumberNo0.000001Minimum semi-period
max_valnumberNo0.1Maximum semi-period
unitsenumNoSecondsSeconds, Ticks
custom_scaleobjectNo-Custom scaling

Two Edge Separation (ci_two_edge_sep)

Measures the time between two different edges of a signal.

ParameterTypeRequiredDefaultDescription
channelnumberYes-Synnax channel key
devicestringYes-Device identifier
portnumberYes-Counter port (0-indexed)
min_valnumberNo0.000001Minimum separation time
max_valnumberNo1Maximum separation time
unitsenumNoSecondsSeconds, Ticks
first_edgeenumNoRisingRising, Falling
second_edgeenumNoFallingRising, Falling
custom_scaleobjectNo-Custom scaling

Velocity Linear (ci_velocity_linear)

Measures linear velocity using a quadrature encoder.

ParameterTypeRequiredDefaultDescription
channelnumberYes-Synnax channel key
devicestringYes-Device identifier
portnumberYes-Counter port (0-indexed)
min_valnumberNo0Minimum velocity
max_valnumberNo1Maximum velocity
unitsenumNom/sm/s, in/s
decoding_typeenumNoX4X1, X2, X4, TwoPulse
dist_per_pulsenumberNo0.001Distance traveled per encoder pulse
terminal_astringNo-PFI terminal for encoder A signal
terminal_bstringNo-PFI terminal for encoder B signal
custom_scaleobjectNo-Custom scaling

Velocity Angular (ci_velocity_angular)

Measures angular velocity (rotational speed) using a quadrature encoder.

ParameterTypeRequiredDefaultDescription
channelnumberYes-Synnax channel key
devicestringYes-Device identifier
portnumberYes-Counter port (0-indexed)
min_valnumberNo0Minimum angular velocity
max_valnumberNo1Maximum angular velocity
unitsenumNoRPMRPM, Radians/s, Degrees/s
decoding_typeenumNoX4X1, X2, X4, TwoPulse
pulses_per_revnumberNo24Number of encoder pulses per revolution
terminal_astringNo-PFI terminal for encoder A signal
terminal_bstringNo-PFI terminal for encoder B signal
custom_scaleobjectNo-Custom scaling

Position Linear (ci_position_linear)

Tracks linear position using a quadrature encoder.

ParameterTypeRequiredDefaultDescription
channelnumberYes-Synnax channel key
devicestringYes-Device identifier
portnumberYes-Counter port (0-indexed)
unitsenumNoMetersMeters, Inches, Ticks
decoding_typeenumNoX4X1, X2, X4, TwoPulse
dist_per_pulsenumberNo0.000001Distance traveled per encoder pulse
initial_posnumberNo0.0Starting position
terminal_astringNo-PFI terminal for encoder A signal
terminal_bstringNo-PFI terminal for encoder B signal
z_index_enablebooleanNofalseEnable Z-index signal
z_index_valnumberNo0Position value when Z-index pulse occurs
z_index_phaseenumNoAHighBHighAHighBHigh, AHighBLow, ALowBHigh, ALowBLow
terminal_zstringNo-PFI terminal for Z-index signal
custom_scaleobjectNo-Custom scaling

Position Angular (ci_position_angular)

Tracks angular position (rotation angle) using a quadrature encoder.

ParameterTypeRequiredDefaultDescription
channelnumberYes-Synnax channel key
devicestringYes-Device identifier
portnumberYes-Counter port (0-indexed)
unitsenumNoDegreesDegrees, Radians, Ticks
decoding_typeenumNoX4X1, X2, X4, TwoPulse
pulses_per_revnumberNo24Number of encoder pulses per revolution
initial_anglenumberNo0.0Starting angle
terminal_astringNo-PFI terminal for encoder A signal
terminal_bstringNo-PFI terminal for encoder B signal
z_index_enablebooleanNofalseEnable Z-index signal
z_index_valnumberNo0Angle value when Z-index pulse occurs
z_index_phaseenumNoAHighBHighAHighBHigh, AHighBLow, ALowBHigh, ALowBLow
terminal_zstringNo-PFI terminal for Z-index signal
custom_scaleobjectNo-Custom scaling

Duty Cycle (ci_duty_cycle)

Measures the duty cycle of a periodic signal.

ParameterTypeRequiredDefaultDescription
channelnumberYes-Synnax channel key
devicestringYes-Device identifier
portnumberYes-Counter port (0-indexed)
min_valnumberNo2Minimum duty cycle frequency
max_valnumberNo10000Maximum duty cycle frequency
active_edgeenumNoRisingRising, Falling
terminalstringNo-PFI terminal for signal routing
custom_scaleobjectNo-Custom scaling

Important Rules

  • Sample rates: All channels in a task sample at the same rate. Create separate tasks for different rates.
  • One task per module: Only one running task can claim a module at a time.
  • Stream rate optimization: For low-rate tasks (< 50 Hz), set the stream rate to the sample rate. For high-rate tasks, keep stream the rate < 50 Hz for better performance.
  • Port validation: Counter ports cannot be duplicated within the same task.

How-To

Console

Python

TypeScript