flex_read_adc16

NI-Motion Functions

flex_read_adc16

Device Compatibility

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

Read ADCs

Usage

status = flex_read_adc16(u8 boardID, u8 ADC, u8 returnVector);

Purpose

Reads the converted value from an ADC input channel.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer (MAX)
ADC u8 ADC channel to read
returnVector u8 destination for the return data

Parameter Discussion

ADC is the Analog-to-Digital Converter channel to read. Valid ADC resources are NIMC_ADC1 through NIMC_ADC30. On motion controllers that support fewer than thirty axes, reading non-existent ADCs returns error –70006 (NIMC_badResourceIDOrAxisError). Refer to ADC Channels for ADC 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 don't return 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 converted voltage from any of the analog input channels. You can only read values from channels that have been either directly enabled by the Enable ADCs function or automatically enabled by being mapped to an enabled axis.

For an ADC channel mapped to an axis, this function returns the actual ADC value. In contrast, the Read Position function executed on the owner axis returns an ADC value that has been offset by a reset value stored when the Reset Position function was executed. ADC channels are never internally reset so their DC values are preserved.