Is stm32 micro-controls are capable to calculate Natural Logarithm ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-03-08 9:38 PM
I am using Thermistor (NTC Type ) as temperature sensor .
So to calculate the temperature from adc value of STM32 I am using this formula(taken from this site :- https://www.jameco.com/jameco/workshop/techtip/temperature-measurement-ntc-thermistors.html)
1/T = 1/T0 + 1/B * ln( ( adcMax / adcVal ) – 1 )
where :-
T0= 298.15 K
B=3345.80 K
I am using Board 6-Bit adc .
So I want ask that can I use above formula in my program, because I am confuse that controller can calculate "ln (Natural Logarithm) ".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-03-08 11:21 PM
Interface temperature sensor with any of the adc pin in controller, from pin read the value
sysTemperature = HAL_ADC_GetValue(&hadc1);
sysTemp_inmV = ((float)sysTemperature/4096.0) * 3300; //ref = 3.3
sysTemp_inCel = sysTemp_inmV/10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-03-09 12:05 AM
Thanks.
Here 12bit adc enable ?
Because 4096 is value 2^12.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-03-09 3:25 AM
Following functions calculate the natural logarithm (base e):
#include <math.h>
double log(double x);
float logf(float x);
long double logl(long double x);
You may also try to avoid the log calculation by tabulating the function at a suitable step and linearly interpolate between the steps; or by fittingthe function by polynomial.
JW
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-03-10 9:17 PM
OK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2019-03-11 12:34 AM
Does this mean that you got the answer you look for? If yes, please click on "Select as Best" for the good answer.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
