Jump to content
Sign in to follow this  
KittyHawk

[ Energia library ] MSP430 internal temp sensor

Recommended Posts

Library for MSP430 internal temperature sensor usage. This sensor is not very precise but can be used if necessary.

You can access source code and see example file here:
https://github.com/JFF-Bohdan/msp430intertempsensor

Notice, that you can use float values for temperature or int16 (also with decimal part of temperature value). When using int16 temperature will be returned in this way:

  • 23.5 C will be returned as 235 (0xEB) integer value;
  • 54.3 C will be returned as 543 (0x21F) integer value

When using float values (on my MSP430G2553) memory usage will be like this:
binary sketch size: 7 625 bytes (of a 16 384 byte maximum)

When using int16 memory usage will be:
binary sketch size: 3 359 bytes (of a 16 384 byte maximum)

Share this post


Link to post
Share on other sites

Thanks for sharing

 

But I found an error : pinMode(TEMPSENSOR, INPUT) is not needed at all as TEMPSENSOR is not a pin and just an entry of the analog multiplexer. And moreover, it drives the real pins. I found this bug because when a measured the temperature, a led on pin P2_2 shuted off. And both led and temperature measurement worked well after pinMode() was erased.

 

Finally as there is only one temperature sensor, you can add pre-instanciation in your library. And I think init() phase is not very useful as a dedicated function. Including it in update() would be better.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×