AnsweredAssumed Answered

ADUC 7023 - Internal Temperature Sensor for External Vref

Question asked by xin on Apr 4, 2013
Latest reply on Apr 9, 2013 by ABuda

Dear Sir,

I have a question about REFCON and Internal Temperature Sensor.

I want to use the external refernce source(2.5V) for Internal Temperature ADC.

But I can not get the correct value.

 

Pls refer to the code, below.  Is there any problem?.

 

REFCON = 0x03;          // internal 2.5V reference enabled

TSCON  = 0x01;          // Internal temperature chopping enabled

ADCCON = 0x3723;        // Bit 15-14: Reserved

                            // BIT 13: Temperature sensor conversion enable

                            // Bit 12-10: ADC clock speed. 101: fADC/32. 41.78MHz/32 = 1.3MHz

                            // Bit 9-8: ADC acquistion time. 10: default, 8 clocks

                            // Bit 7: Enable start conversion. 1: start

                            // Bit 6: Reserved

                            // Bit 5: ADC power control. 1: ADC in normal mode

                            // Bit 4-3: Conversion mode. 00: single ended

                            // Bit 2-0: Conversion type. 011: single software conversion.

                            // Sample rate: (8+19)clock * 32/41.78MHz = 20 us/sample       

    delay( 1000 );

 

    ADCCP = 0x10; 

     tmp = ADCDAT;

      

    // Start A/D conversion

    ADCCON |= 0x37A3;

     delay( 2000 );

     if( ADCSTA )

    {

        ADCRaw1 = ADCDAT >> 16;

    }

 

    // Start A/D conversion

    ADCCON |= 0x37A3;

   delay( 2000 );

    if( ADCSTA )

    {

        ADCRaw2 = ADCDAT >> 16;

    }

 

    ADCRaw = ( ADCRaw1 + ADCRaw2 ) / 2

     sTemp = ( ( ( ADCRaw * 2500.00 / 4096.00 - 1369.00 ) * 0.22624 ) + 25 ) ;

Outcomes