This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

why does three device in the same network inspect the different temperature

Hello,everyone,

I have builded a simple structure which contained a ED,a RE and a AP by CC1110 with the  help of Ifriedman and Stig. Each device can sample the temperature of itself. And then the temperature of the three device will be sent to AP together, and sent to the pC through series port .The process is shown below.

But there is always a device inspect the temperature much too different from that of other device. For example, yesterday, the AP 's temperature is always above 30 centigrade. and other devices's temperature are a little more than 20 centigrade.If the device isn't added to the work of net, it will show the temperature closed to the enviroment. Once it paticipate in the network, its temperature will increase quickly. 

Please tell me what cause the problem if you ever approch the problem or  have an idea, thank you very much!

The procedure to inspect temperature is below:

#ifndef TEMP_H
#define TEMP_H
#include "ioCC1110.h"

typedef unsigned char       BOOL;

// Data
typedef unsigned char       BYTE;
typedef unsigned short      WORD;
typedef unsigned long       DWORD;

// Unsigned numbers
typedef unsigned char       UINT8;
typedef unsigned char       INT8U;
typedef unsigned short      UINT16;
typedef unsigned short       INT16U;
typedef unsigned long       UINT32;
typedef unsigned long       INT32U;

// Signed numbers
typedef signed char         INT8;
typedef signed short        INT16;
typedef signed long         INT32;

#define ADC_REF_1_25_V      0x00
#define ADC_14_BIT          0x30
#define ADC_TEMP_SENS       0x0E

#define DISABLE_ALL_INTERRUPTS() (IEN0 = IEN1 = IEN2 = 0x00)

#define ADC_SINGLE_CONVERSION(settings) \
   do{ ADCCON3 = (settings); }while(0)

#define ADC_SAMPLE_SINGLE() \
  do { ADC_STOP(); ADCCON1 |= 0x40;  } while (0)

#define ADC_SAMPLE_READY()  (ADCCON1 & 0x80)

#define ADC_STOP() \
  do { ADCCON1 |= 0x30; } while (0)

#define ADC14_TO_CELSIUS(ADC_VALUE)    ( ((ADC_VALUE) >> 4) - 315)

/******************************************************************************
*******************      Power and clock management        ********************
*******************************************************************************

These macros are used to set power-mode, clock source and clock speed.

******************************************************************************/

// Macro for getting the clock division factor
#define CLKSPD  (CLKCON & 0x07)

// Macro for getting the timer tick division factor.
#define TICKSPD ((CLKCON & 0x38) >> 3)

// Macro for checking status of the crystal oscillator
#define XOSC_STABLE (SLEEP & 0x40)

// Macro for checking status of the high frequency RC oscillator.
#define HIGH_FREQUENCY_RC_OSC_STABLE    (SLEEP & 0x20)


// Macro for setting power mode
#define SET_POWER_MODE(mode)                   \
   do {                                        \
      if(mode == 0)        { SLEEP &= ~0x03; } \
      else if (mode == 3)  { SLEEP |= 0x03;  } \
      else { SLEEP &= ~0x03; SLEEP |= mode;  } \
      PCON |= 0x01;                            \
      asm("NOP");                              \
   }while (0)


// Where _mode_ is one of
#define POWER_MODE_0  0x00  // Clock oscillators on, voltage regulator on
#define POWER_MODE_1  0x01  // 32.768 KHz oscillator on, voltage regulator on
#define POWER_MODE_2  0x02  // 32.768 KHz oscillator on, voltage regulator off
#define POWER_MODE_3  0x03  // All clock oscillators off, voltage regulator off

// Macro for setting the 32 KHz clock source
#define SET_32KHZ_CLOCK_SOURCE(source) \
   do {                                \
      if( source ) {                   \
         CLKCON |= 0x80;               \
      } else {                         \
         CLKCON &= ~0x80;              \
      }                                \
   } while (0)

// Where _source_ is one of
#define CRYSTAL 0x00
#define RC      0x01

// Macro for setting the main clock oscillator source,
//turns off the clock source not used
//changing to XOSC will take approx 150 us
#define SET_MAIN_CLOCK_SOURCE(source) \
   do {                               \
      if(source) {                    \
        CLKCON |= 0x40;               \
        while(!HIGH_FREQUENCY_RC_OSC_STABLE); \
        SLEEP |= 0x04;                \
      }                               \
      else {                          \
        SLEEP &= ~0x04;               \
        while(!XOSC_STABLE);          \
        asm("NOP");                   \
        CLKCON &= ~0x47;              \
        SLEEP |= 0x04;                \
      }                               \
   }while (0)

void initTempSensor(void);
INT8 getTemperature(void);

#endif

#include "temp.h"

void initTempSensor(void){
   DISABLE_ALL_INTERRUPTS();

   SET_MAIN_CLOCK_SOURCE(0);

    *((BYTE __xdata*) 0xDF26) = 0x80;//change later

 //  initLcd();
}
INT8 getTemperature(void){
  UINT8   i;
  UINT16  accValue;
  UINT16  value;

  accValue = 0;
  for( i = 0; i < 4; i++ )
  {
    ADC_SINGLE_CONVERSION(ADC_REF_1_25_V | ADC_14_BIT | ADC_TEMP_SENS);
    ADC_SAMPLE_SINGLE();
    while(!ADC_SAMPLE_READY());

    value =  ADCL >> 2;
    value |= (((UINT16)ADCH) << 6);

    accValue += value;
  }
  value = accValue >> 2; // devide by 4

  return ADC14_TO_CELSIUS(value);
}

 ****************************************************************/
void main(void)

 char i;
        char temperature[10];

        INT16 avgTemp;

 initUARTtest();                                 //初始化串口
 
        initTempSensor();                               //初始化ADC
        while(1)
        {
          avgTemp = 0;
          for(i = 0 ; i < 64 ; i++)
          {
            avgTemp += getTemperature();
          }
             avgTemp /= 64;
             sprintf(temperature, (char *)"%dC", (INT8)avgTemp);
             UartTX_Send_String(temperature,6);
             UartTX_Send_word(0x0A);
             Delay(20000);
        }
}

 

 

the structure of network

  • Hi.


    Looks like you are not calibration the ADC. Unless you do this, the temperature will vary. There is a design note on this topic that can be found here:

    DN102 -- SoC Temperature Sensor
    http://www.ti.com/litv/pdf/swra101a

    Also note that the maximum ADC resolution is 12 bit.

     

  • Hello,Kjetil ,

    Thank you very much for your help.But I just know the voltage at C.

    How can I get the measured vlotage at 25C in CC1110 to calibrate.

  •  Hi again,

    Not quite sure if i know what you mean here. The 1-point calibration mentioned in the design note i linked indicates that one should compensate for the offset found in the ADC by doing a calculation of the 25C voltage based on the 0C voltage and the temperature
    coefficient and compare this with a actual measurement at the same temperature. 25C is just chosen as an example and could be anything. 

  • Sorry,I just find the parameter in the CC111032f

    Output voltage at -40 °C 0.660 V
    Output voltage at 0 °C 0.755 V
    Output voltage at +40 °C 0.859 V
    Output voltage at +80 °C 0.958 V
    Temperature coefficient 2.54 mV/°C Fitted from -20 °C to +80 °C
    Error in calculated
    temperature, calibrated -2 * 0 2 * °C From –20°C to +80°C when using 2.43 mV / °C, after 1-point
    calibration at room temperature
    * The indicated minimum and maximum error with 1-point calibration is based on measured values for typical process parameters
    Current consumption increase when enabled 0.3 mA

    can I put the 40 °C into the formula reffered before?