nimcReadCaptureCompareData

NI-Motion Functions

nimcReadCaptureCompareData

Device Compatibility

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

Read Capture Compare Data

Usage

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

Purpose

Reads position compare or position capture data from the selected axis.

Parameters

Name Type Description
deviceHandle TnimcDeviceHandle assigned by Measurement & Automation Explorer (MAX)
axisHandle TnimcAxisHandle axis to read
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 read with this function. Valid values are 1 through 30. On motion controllers that support fewer than thirty axes, reading 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 read. The following are valid attributes:

  • TnimcCaptureCompareDataCapturedPosition
  • TnimcCaptureCompareDataCaptureOccurred
  • TnimcCaptureCompareDataCompareOccurred

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

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

Based on the attribute, the correct member of TnimcData will be returned by the motion controller. The values of the other elements in the structure are undefined.

Using This Function

Use this function to read position compare or position capture data from the selected axis.

Caution  If this function uses reflective memory, it should not be used for event checking. In this case, only use the information returned by this function for display purposes. Refer to Reflective Memory Functions for more information.

For TnimcCaptureCompareDataCaptureOccurred and TnimcCaptureCompareDataCompareOccurred, the boolData element contains the position capture or position compare status. TnimcTrue indicates that the position capture or position compare has occurred and TnimcFalse indicates that the position capture or position compare has not occurred.

For TnimcCaptureCompareDataCapturedPosition, read doubleData in the TnimcData structure to retrieve the position capture position.

Note  Refer to Function Execution Times for benchmark timing information about your controller.