pine 140 Posted September 16, 2012 Share Posted September 16, 2012 In the classical temperature reading example in CCS, the following code is used for reading and calculation: ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start // oC = ((A10/1024)*1500mV)-986mV)*1/3.55mV = A10*423/1024 - 278 temp = ADC10MEM; IntDegC = ((temp - 673) * 423) / 1024; While in the sample code from Energia, the following line gave a substantially different forumla.. so I'm wondering there are differences between the two analog values read? values[j] = ((uint32_t)analogRead(TEMPSENSOR)*27069 - 18169625) *10 >> 16; Quote Link to post Share on other sites
energia 485 Posted September 19, 2012 Share Posted September 19, 2012 Rei Vilo would have to explain why he did it this way since he wrote the code. Probably to get more precision. With that said, you can use the formula that is used in the CCS example without a problem. pine 1 Quote Link to post Share on other sites
gwdeveloper 275 Posted September 19, 2012 Share Posted September 19, 2012 There are more accurate methods to calculate the temperature than what TI originally supplied... http://www.43oh.com/forum/viewtopic.php?f=10&t=2474 http://www.43oh.com/forum/viewtopic.php?f=10&t=2549 energia and pine 2 Quote Link to post Share on other sites
Rei Vilo 695 Posted September 19, 2012 Share Posted September 19, 2012 The formula I used came from the original sketch. I checked it against the seminal post Using the internal temperature sensor from opossum. Thank you, opossum, for the detailed formula! pine 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.