Hi, I want to get the temperature reading from the internal sensor. I configured the setting as follows:
and here is the code to read the temperature:
#include "new_thread0.h"
/* New Thread entry function */
void new_thread0_entry(void)
{
g_adc0.p_api->open(g_adc0.p_ctrl, g_adc0.p_cfg);
g_adc0.p_api->scanCfg(g_adc0.p_ctrl, g_adc0.p_channel_cfg);
g_adc0.p_api->scanStart(g_adc0.p_ctrl);
/* TODO: add your own code here */
adc_data_size_t reading = 0;
while (1)
{
g_adc0.p_api->read(g_adc0.p_ctrl, ADC_REG_TEMPERATURE, &reading);
tx_thread_sleep (1);
}
}
The program can enter this entry function but I always get 0. Can anyone point out the problem? THX!