nimcWriteCaptureCompareData

NI-Motion Functions

nimcWriteCaptureCompareData

Device Compatibility

Device Compatibility
7330
N
7340
N
7344
N
7350
Y
7390
N
NI SoftMotion Controller for CANopen—Xenus
N
NI SoftMotion Controller for CANopen—Accelnet
N

Write Capture Compare Data

Usage

status = nimcWriteCaptureCompareData (TnimcDeviceHandle deviceHandle, TnimcAxisHandle axisHandle, i32 index, TnimcCaptureCompareData attribute, TnimcData* data);

Purpose

Loads position compare or position capture data for the selected axis.

Parameters

Name Type Description
deviceHandle TnimcDeviceHandle assigned by Measurement & Automation Explorer (MAX)
axisHandle TnimcAxisHandle axis to configure
index i32 encoder to configure
attribute TnimcCaptureCompareData attribute to read
data TnimcData* the value for the attribute you are reading

Parameter Discussion

axisHandle is the axis to configure with this function. Valid values are 1 through 30. On motion controllers that support fewer than thirty axes, configuring non-existent axes returns error –70006 (NIMC_badResourceIDOrAxisError).

index is the encoder to configure. Valid value is 1 for the primary encoder.

attribute is the attribute to load. The following is the valid attribute:

  • TnimcCaptureCompareDataComparePulseWidth

data is the value for the attribute you are loading in the following structure:

struct{
   i32 longData;
   u8 boolData;
   f64 doubleData;
} TnimcData;

Based on the attribute, the correct member of TnimcData must be set as follows:

  • For TnimcCaptureCompareDataComparePulseWidth set doubleData in the TnimcData structure to the value of the desired position compare output pulse width, in seconds. For example, enter 0.00001 seconds for a 10 µs pulse width. Valid values are the default value of 0.0000002 s (200 ns) and between 0.000001 s (1 µs) and 0.065535 s (65,535 µs) in 1 µs intervals.

Using This Function

Use this function to load configuration parameters for position capture and compare on the motion controller. This function allows you to set all attributes on a per axis basis.

The TnimcCaptureCompareDataComparePulseWidth attribute sets the pulse width of the position compare signal. Use this attribute to configure the pulse width of breakpoints that trigger devices that have specific minimum active pulse requirements.

Note  A breakpoint across RTSI always generates an active high pulse of 200 ns duration.
Caution  The position compare (breakpoint) frequency depends on the velocity and distance between position compare outputs and is limited by the pulse width. The position compare output frequency must meet the requirements specified below for correct operation.

The position compare output pulse must not overlap with the next position compare event. If the position compare output pulse overlaps with the next position compare event, position compare generation is stopped and the position compare output is disabled. To recover from this situation change the pulse width, velocity, or distance between position compare outputs. In addition, the position compare output frequency cannot be greater than the maximum value allowed for the specified position compare type. Therefore, the position compare output frequency, in hertz, at the specified pulse width, in seconds, must conform to the following two conditions:

     AND     
Position Compare (Breakpoint) Output Type Maximum Frequency
Single 150 Hz
Buffered, PID rate of
62.5 µs to 250 µs
2 kHz
Buffered, PID rate greater
than 250 µs
1 kHz
Periodic 4 MHz