User Manual

Programmer's reference21
Copyright © 2005-2010 Pico Technology Ltd. All rights reserved.adc20.en
5.4.6
HRDLGetSingleValueAsync
short HRDLGetSingleValueAsync (
short handle,
long * value,
short * overflow )
This function retrieves the reading when the HRDLCollectSingleValueAsync has been
called.
Arguments
handle
Handle returned by HRDLOpenUnit
value
Pointer to a long where the ADC value will be written
overflow
Pointer to a value that indicates when the voltage on a channel has
exceeded the upper or lower limits.
Bit 0: Channel 1
...
Bit 15: Channel 16
Returns
1 if a valid handle is passed and the function succeeds
0 if not
Sample code
Code extract to get a single value reading without blocking the calling thread:
void main()
{
BOOL bConversionFinished = FALSE;
short channelNo;
long value;
short handle;
// open and initialise the unit
.
.
.
// set the channel parameters
channelNo = HRDL_ANALOG_IN_CHANNEL_1;
range = HRDL_2500_MV;
singleEnded = TRUE;
bConversionFinished = FALSE;
while (true)
{
PollSingleValue(handle,
&bConversionFinished,
&value,
channelNo,
range,
singleEnded);
if(bConversionFinished == TRUE)
{
// do something with the value
channelNo++;