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.

TMDSRM48USB temperature sensor



Hello,

I need to obtain the temperature value from temperature sensor available on TMDSRM48USB kit.

I need to transmit the temperature continuously on Terminal/SCILIN port.

I am able to obtain some value from ADC but its not exact.

I want to display upto 2 digits after decimal. I have a rough code taken from light sensor.

@file sys_main.c


/* USER CODE BEGIN (0) */
#include "sci.h"
#include "adc.h"
#include "stdlib.h"
/* USER CODE END */

/* Include Files */

#include "sys_common.h"
#include "system.h"

/* USER CODE BEGIN (1) */
unsigned char command[8];
/* USER CODE END */

/** @fn void main(void)
* @brief Application main function
* @note This function is empty by default.
*
* This function is called after startup.
* The user can use this function to implement the application.
*/

/* USER CODE BEGIN (2) */
void cal_Temp(void);

/* USER CODE END */

void main(void)
{
/* USER CODE BEGIN (3) */
sciInit();
adcInit();
while(1){

cal_Temp();
}
/* USER CODE END */
}

/* USER CODE BEGIN (4) */
void cal_Temp(void){
adcData_t adc_data ; //ADC data structure
adcData_t *adc_data_ptr = &adc_data;
unsigned char NumberOfChars ,value;

adcStartConversion(adcREG1,adcGROUP1);
while(!adcIsConversionComplete(adcREG1,adcGROUP1)); //wait for adc conversion
adcGetData(adcREG1,1U,adc_data_ptr); //store conversion into pointer
value = (unsigned int) adc_data_ptr->value;
NumberOfChars= ltoa(value, (char *)command);
sciSend(scilinREG,NumberOfChars,command);
sciSend(scilinREG,2,(unsigned char*)"\r\n");
}

/* USER CODE END */