AnsweredAssumed Answered

Seen errors in example program

Question asked by Karthickph on Mar 31, 2014
Latest reply on Apr 1, 2014 by MMA

Hi there,

It seems there are errors in the given example programs written by analog devices.  Actually, for testing purpose initially I took 'ADC0_RTD' program for measuring the temperature using RTD pt100.  For example see that below, configuration states that internal reference has been selected.  But actually, external reference has been configured.

ADC0CON = BIT0 + BIT2 + BIT4 + BIT10 + BIT15;     // Gain = 32, Unipolar, enable ADC0, Int Reference

And, in the below statement, excitation source0 has been configured for driving 200uA current.. But the comment says, 400uA.

IEXCON = BIT1 + BIT6;  // Enable Excitation Current Source 0 - 400uA

But, the real problem is If I flash this example program, the results were not correct ie, around ambient temperature, the program says that temperature of RTD is -8 degC.   I don;t the where the real problem is?  Also please clarify how this formuale is arrived? Why the reference voltage (internal or external) is not considered?

  // Equation = ADC0Result * ((RREF/Gain)/# of bits)

  Rrtd = (float)ulADC0Result * ((5600.0 /32.0) /0xFFFFFF);

 

Regards,

Karthick

Outcomes