CE220567_BLE_Thermometer Project Question

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello,

I have a question about the math behind converting the result from the ADC in to an understandable temperature reading in the thermometer example project. The code I am talking about is under the display.c file:

pastedImage_0.png

DECIMAL_2DIGIT_SCALER is defined as uint8_t = 100u. How exactly does the uint8 value of 0x100 convert the hex value to a value that can be displayed in a readable decimal form as temperature? I understand the basics behind taking the product and modulus to get the decimal and fraction values, but how did the programmers determine that 0x100 was the hex value that would convert the ADC result?

Thanks,

Amanda

0 Likes
1 Solution
ajays_86
Employee
Employee
First like received

Hi Amanda,

GetTemperature() function returns the temperature value in float and DECIMAL_2DIGIT_SCALER (100u) is used  just for separating decimal and fraction values.

If you are looking for getting temperature from ADC results, please refer temperature.c/.h files.

Thanks,

Ajay

View solution in original post

0 Likes
2 Replies
RyanZhao
Moderator
Moderator
Moderator
250 sign-ins First question asked 750 replies posted

Hi Amanda,

Here the 100u is decimal 100, not 0x100.

Kindly let me know if I misunderstood your questions.

Thanks,

Ryan

0 Likes
ajays_86
Employee
Employee
First like received

Hi Amanda,

GetTemperature() function returns the temperature value in float and DECIMAL_2DIGIT_SCALER (100u) is used  just for separating decimal and fraction values.

If you are looking for getting temperature from ADC results, please refer temperature.c/.h files.

Thanks,

Ajay

0 Likes