Temp sensor reading on MKL16ZxxM4

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Temp sensor reading on MKL16ZxxM4

937 Views
adrian11
Contributor I

I am just starting to work with ADC and the temp sensor and I have some basic questions:

I set up my ADC with some basic settings (SC2 = 0x0, CFG = 0x78, SC1 = 0x1F) and write SC1 = 0x1A to trigger the conversion. I after I read COCO == 0, I try to read the R register. Based on my configuration, this should give me a 10-bit, single-ended voltage value at ambient temperature. If I read the value of the R register as uint32_t temp = *(uint32_t*)0x4003b010, am I going to get the correct value that I need for my calculations? What unit is this value going to be?

Thank you in advance for your assistance.

Tags (2)
0 Kudos
2 Replies

491 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi adrian,

1)  when   COCO == 1 , conversion is completed;

2)  ADC input measured Value = temp *( Vref /( 0xFFFFFFFF +1) )

3) About the use of  temperature sensor , you can refer to this   http://cache.freescale.com/files/microcontrollers/doc/app_note/AN3031.pdf  , even though it about the HCSO8 microcontroller ,

the theory is the same.

Best Regards,

Alice

------------------------------------------------------------------------------------------

If this post answers your question, please click the Correct Answer button.

-----------------------------------------------------------------------------------

If this post help your question, please click the helpful Answer button.

491 Views
egoodii
Senior Contributor III

I cringe every time I hear about AN3031.  The temperature reference cell, as well as the bandgap cell, both create an 'absolute' voltage that is independent of Vdd (or more particularly, Vref).  Sure, the raw conversion of those analog values returns a 'number of ADC counts' that represents them as a fraction of said Vref, but it is MUCH EASIER to 'think' about them in a pure millivolt realm, rather than doing all the math in the 'ADC counts' realm.  The whole chart of Figure 1 is just an example of how it CONFUSES the fact that the temp-ref voltage is a single value for any given temperature, irrespective of Vdd or Vref.  And of course the internal Bandgap is only +/-3%, so as a 'reference' to compute Vref FROM it is 'not very good'.  You might look at my conversation in:

Re: K70 Temperature reading - Slopes