unsigned int accumulator=0; // Here's where we integrate the
static long accumulator_1=0L; // ADC samples
AD0INT = 0; // Clear ADC conversion complete // indicator
accumulator = ((ADC0H <<8))& 0xff00 | ADC0L;// Read ADC value and add to running
accumulator_1 += accumulator;
accumulator = 0x00; // total
int_dec++; // Update decimation counter
if (int_dec == 9) // If zero, then post result
{
int_dec = 0; // Reset counter
Result = accumulator ;
accumulator = 0x00; // Reset accumulator
accumulator_1 = 0L;
}
}
//-----------------------------------------------------------------------------
// Support Subroutines
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Wait_MS
//-----------------------------------------------------------------------------
//
// Return Value : None
// Parameters:
// 1) unsigned int ms - number of milliseconds of delay
// range is full range of integer: 0 to 65335
//
// This routine inserts a delay of <ms> milliseconds.
//
//-----------------------------------------------------------------------------
void Wait_MS(unsigned int ms)
{