uC is sampling at 20 KSPS a ADC signal (i.e volage i/p) in continous mode.
In every 200ms cycle, uC is storing the maximum value and passing it on I2C bus.
but sometime uC is not able to capture a peak of Analog voltage i/p succesfully.
i am using a simple compare method of the read value with store value.
Can you suggest some sophisticative method to store the maximum value in every 200ms.
Example:
Code:
if ( AD.values.present.words[0] > AD.values.maximum[0])
// if the A-D value is bigger than the current maximum value
{AD.values.maximum[0] = AD.values.present.words[0];}
first thing you should check is the ADC input circuit, to be sure that no saturation occurs in presence of highest peak of the sampled signal. This could be easily verified with an oscilloscope by checking the OTR (Out of the Range) pin of the device (if any).