|
An Adc object manages a single analog-to-digital converter
on an XMP motion controller. The XMP controller supports 8 channels
(0 to 7) of 16 bit analog-to-digital conversions.
To configure the voltage range for an analog input, use the method
mpiAdcConfigSet(MPIAdc adc, MPIAdcConfig *config, void *external),
where adc is a handle to an MPIAdc object, and config
is a pointer to a MPIAdcConfig structure. The MPIAdcConfig structure
contains a "range" element, which specifies the analog input's voltage
range. The XMP controller supports voltage ranges of 10.0V, 5.0V,
2.5V, or 1.25V volt ranges (all ranges are bipolar). Set the MPIAdcConfig
range to one of the following values:
|
To use the ADC, first create an ADC object using mpiAdcCreate(MPIControl
control, long number), where control is a handle to an MPIControl
object and number is the analog-to-digital converter channel
number.
The number of ADCs on the controller can be configured using the
method mpiControlConfigSet(MPIControl control, MPIControlConfig
*config, void *external). The MPIControlConfig structure contains
an element called adcCount, which is used to specify the number
of analog-to-digital converter channels. The default setting is
for eight (8) axes.
After the ADC has been configured, to read a channel use the method
mpiAdc Input(MPIAdc adc, unsigned long *input), where
adc is a handle to an MPIAdc object, and input is a pointer to the
digitally converted value.
|