Jump to content
43oh

[ 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)

Link to post
Share on other sites
  • 1 month later...

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.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...