User Manual
Programmer's reference23
Copyright © 2005-2010 Pico Technology Ltd. All rights reserved.adc20.en
5.4.7
HRDLGetTimesAndValues
long HRDLGetTimesAndValues (
short handle,
long * times,
long * values,
short * overflow,
long 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 HRDLOpenUnit.
times
Pointer to a long where times will be written.
values
Pointer to a long 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 a short indicating any inputs that have exceeded their
maximum voltage range. Channels with overvoltages are indicated
by a high bit, with the LSB indicating channel 1 and the MSB 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.