20
ADC-20/ADC-24 User's Guide
if (bConversionFinished == TRUE)
{
// Do something with the value
ch+;
// This would be HRDL_ANALOG_IN_CHANNEL_8 for the ADC-20
if (channelNo > HRDL_ANALOG_IN_CHANNEL_16)
{
channelNo = HRDL_ANALOG_IN_CHANNEL_1;
}
}
else
{
// Do something else while waiting for the reading from the
// unit
}
}
}
void PollSingleValue(int16_t handle,
BOOL *bConversionFinished,
int32_t *lValue,
int16_t channel,
int16_t range,
int16_t singleEnded)
{
static BOOL bStartConversion = FALSE;
int16_t
overflow;
// Test to see if the conversion has finished
if (bStartedConversion)
{
if (HRDLReady(handle))
{
HRDLGetSingleValueAsync(handle, lValue, &overflow);
bConversionFinished = TRUE;
bConversionStarted = FALSE;
}
}
// Test to see if no conversion is in progress
if (!bStartedConversion)
{
// Start the conversion going
bStartedConversion = HRDLCollectSingleValueAsync(handle,
channel,
range,
conversionTime,
singleEnded);
bConversionFinished = TRUE;
}
}
Copyright © 2005–2016 Pico Technology Ltd. All rights reserved.
adc20.en r6