/* Configure the compare data of an ADC digital comparator.  */
void ADCCompDataSet(unsigned long ulBase, unsigned long ulCompID, unsigned long ulLowRef, unsigned long ulHighRef)
/* Configure the compare data of an ADC digital comparator.  */
void ADCCompDataSet(unsigned long ulBase, unsigned long ulCompID, unsigned long ulLowRef, unsigned long ulHighRef)
{
    xASSERT(ulBase == ADC_BASE);
    xASSERT((ulCompID >= 0) && (ulCompID < 2));
    xASSERT(ulLowRef < 0xFFFF);
    xASSERT(ulHighRef < 0xFFFF);
    ulCompID += 0;
    xHWREG(ulBase + ADC0_SC2) |= ADC0_SC2_ACREN; 
    xHWREG(ulBase + ADC0_SC2) |= ADC0_SC2_ACFGT;
    xHWREG(ulBase + ADC0_CV1) &= ~ADC0_CV1_CV_M;
    xHWREG(ulBase + ADC0_CV1) |= ulLowRef;
    xHWREG(ulBase + ADC0_CV2) &= ~ADC0_CV2_CV_M;
    xHWREG(ulBase + ADC0_CV2) |= ulHighRef;  
}