Skip navigation
Home > All Places > WICED Studio Wi-Fi/Combo > WICED Studio Wi-Fi/Combo Forums > Blog > Authors JacobT_81

Step 1. Alter board specific platform.c so that ADC1 utilizes ADC_Channel_16.

 

Step 2. Copy the following code snip into your application and execute.

 

wiced_adc_t adc = WICED_ADC_1;
uint16_t mV;
float celsius;
uint32_t sample_cycle = 10;

/*init proper channel*/
wiced_adc_init(adc, sample_cycle); 

/*this in combination with switching to proper ADC channel is what allows temp sensor to be read*/     
ADC_TempSensorVrefintCmd(1); 

/*sample channel*/
wiced_adc_take_sample(adc, &mV);

/*conversion of mV to celsius--see datasheet*/
celsius = (float)mV;
celsius *= 3300;
celsius /= 0xfff;
celsius /= 1000.0;
celsius -= 0.760;
celsius /= .0025;
celsius += 25.0;

WPRINT_BT_APP_INFO(("***** Temperature in deg C =  %f ***** \n\r", celsius));

 

 

Specifics of conversion formula can be found in the datasheet. For more info on the implementation of conversion see: ARM Processors (Discovering the STM32F4): Working with STM32F4 Temperature Sensor

 

Jacob

Filter Blog

By date:
By tag: