21
Programmer's reference
5.4.7
HRDLGetTimesAndValues
int32_t HRDLGetTimesAndValues
(
int16_t handle,
int32_t * times,
int32_t * values,
int16_t * overflow,
int32_t noOfValues
)
This function returns the requested number of samples for each enabled channel and
the times when the samples were taken, so the
values
array needs to be (number of
values) x (number of enabled channels). When one or more of the digital IOs are
enabled as inputs, they count as one additional channel. The function informs the user
if the voltages for any of the enabled channels have overflowed.
Arguments
handle
Handle returned by
times
Pointer to an
int32_t
where times will be written.
values
Pointer to an
int32_t
where sample values will be written. If more
than one channel is active, the samples are interleaved. If digital
channels are enabled then they are always the first values. See table
below for the order in which data are returned.
overflow
Pointer to an
int16_t
indicating any inputs that have exceeded
their maximum voltage range. Channels with overvoltages are
indicated by a high bit, with the
indicating channel 1 and the
channel 16.
noOfValues
The number of samples to collect for each active channel
Returns
A non-zero number if successful indicating the number of values returned,
0 if the call failed or no values available
Ordering of returned data (example)
When two analog channels (e.g. 1 and 5) are enabled and a digital channel is set as
an input, the data are returned in the following order:
Sample No: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 . n-3 n-2 n-1
Channel:
DI 1 5
DI 1 5
DI 1 5
DI 1 5
DI 1 5
. DI 1
5
where
n
represents the value returned by the function and
DI
the digital inputs.
The channels are always ordered from channel 1 up to the maximum channel number
(ADC-24: channel 16, ADC-20: channel 8). If one or more digital channels are set as
inputs then the first sample contains the digital channels.
Digital inputs
The digital channels are represented by a binary bit pattern with 0 representing off,
and 1 representing on. Digital input 1 is in bit 0.
adc20.en r6
Copyright © 2005–2016 Pico Technology Ltd. All rights reserved.