AnsweredAssumed Answered

Having trouble with the diagnostic current sources

Question asked by ThorMJ on Jan 17, 2013
Latest reply on Feb 15, 2013 by MMA

I'm trying to troubleshoot my boards using the diagnostic current sources, but I'm not having much success with 'em.

I've even gone to using the  demo kit, where I can disconnect the RTD network using the dip switches; my code:

 

typedef
enum {
NotSet = 9,   //Sentinel to see if it wasn't set before ReadTemp() was called
Temp = 0,   //Differential 0-1
Flow = 5   //Differential 2-3
} ActiveChannel_t;

static ActiveChannel_t ActiveChannel;

void SetPriADC(const int diagnostic)
{
unsigned int diagbits;
unsigned int con,com;
if(diagnostic>0)
  diagbits = BIT13;   // + Side diagnostic 50uA current
else if (diagnostic < 0)
  diagbits = BIT14;     // - Side diagnostic 50uA current
else
  diagbits=0;     // No diagnostic current.

con=ADC0CON=
   BIT15     // Primary ADC Operational
   //| BIT12       // High Ref - Not Used
   | BIT10     // Unipolar Code
   | ActiveChannel<< 6  // Active Channel
   | diagbits
   //| BIT13
   ;

//ToDo - Do I need to recalibrate?
}

 

When I use diagnostic=+1 to turn on the + side, I get what appears to be a valid ADC reading, even if all the dipswitches are off (I was expecting 0xFFFFFF.

When I use diagnostic=-1 to turn on the - side, I get a 0, even if all the switches are ON (this is with a 100uA from the IEXC outputs; I was expecting a valid number, albeit slightly decreased).

 

Anyone have sample code for using the diagnostic currents?

 

Thanks,

Thor

Outcomes