flex_read_dac

NI-Motion Functions

flex_read_dac

Device Compatibility

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

Read DAC (to var)

Usage

status = flex_read_dac(u8 boardID, u8 axisOrDAC, u8 returnVector);

Purpose

Reads the commanded DAC output value for an axis.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
axisOrDAC u8 axis or DAC to read
returnVector u8 destination for the return data

Parameter Discussion

axisOrDAC is the axis or DAC to read. Valid axis or DAC resources are NIMC_AXIS1 through NIMC_AXIS30 and NIMC_DAC1 through NIMC_DAC30. On motion controllers that support fewer than thirty axes, reading non-existent axes or DACs returns error –70006 (NIMC_badResourceIDOrAxisError). Refer to Axes and DAC Outputs for axis and DAC resource IDs.

returnVector indicates the destination for the return data generated by this function. Available return vectors include return data to the host (0xFF), to a variable (0x01 through 0x78), to an indirect variable (0x81 through 0xF8), and return no data (0). Refer to Input and Return Vectors for more detailed information.

Note  The suffix _rtn on the function indicates that the data must be returned to the host. When this calling convention is used, no returnVector is required.

Using This Function

This function returns the value of the specified DAC output. When sent to an axis, this function returns the value of the primary DAC mapped to that axis. The signed 16-bit value returned corresponds to the ±10 V full scale range of the DAC.

This function is used to monitor the output command from the PID loop. When the DAC output is connected to a torque block servo amplifier, you can use this value to calculate motor torque or to monitor the acceleration and deceleration portions of a trajectory to see how close the control loop is to saturating at its maximum torque limits.

When the DAC output is connected to a velocity block servo amplifier, the DAC value read is a direct representation of the instantaneous commanded velocity.