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.

measure temperature with cc2530 smartrf05

How I can measure temperature through of the reading of the ADC. I am using the following code in the GenericApp, but I  do not  know where use it in this code :

TR0 |= 0x01;      // TR0 must be modified prior to ATEST,
ATEST |= 0x01; // otherwise P0_0 and P0_1 forced with 0
uint16 tempSample = HalAdcRead( HAL_ADC_CHN_TEMP, HAL_ADC_RESOLUTION_12 );
TR0 &= ~0x01;
ATEST &= ~0x01;

  • Hi,

    German David Useche said:
    TR0 |= 0x01;      // TR0 must be modified prior to ATEST,
    ATEST |= 0x01; // otherwise P0_0 and P0_1 forced with 0
    uint16 tempSample = HalAdcRead( HAL_ADC_CHN_TEMP, HAL_ADC_RESOLUTION_12 );
    TR0 &= ~0x01;
    ATEST &= ~0x01;

    Very familiar code :)

    You can use it, for example, when you press on a joystick, key 2:

    if ( keys & HAL_KEY_SW_2 )
    {

    ....

    prior to sending the unicast message, you can send this sample as a part of

    the message to some other unit, if you want.

  • After reading the ADC with the function HalAdcRead, the reading is saved in the variable tempSample, my question is: How I can turn what is in this variable tempSample to degrees Celsius, to give a measure of temperature ?

    thanks  !!!