Go Down

Topic: DUE temperature sensor API (Read 5 times) previous topic - next topic

mantoui

Reference manual says processor has temperature sensor on ADC channel 15, what is the API for reading temperature?

Grumpy_Mike

I don't know for sure as I haven't got a Due yet but what happens when you try and read analogue channel 15.
Maybe there isn't one, it wouldn't surprise me because there wasn't one on the old arduino and that had a temperature sensor in it as well.

mantoui

Yes, I don't have a board yet either (wrong side of the pond) -- looking at the underlying source, me thinks an analogRead(15) might work ...

Graynomad

#3
Oct 25, 2012, 06:43 pm Last Edit: Oct 25, 2012, 06:46 pm by Graynomad Reason: 1
From the data sheet

Quote
AD15 is not an actual pin but is connected to a temperature sensor.


and

Quote
The temperature sensor is connected to Channel 15 of the ADC.
The temperature sensor provides an output voltage VT that is proportional to absolute temperature (PTAT). To activate the temperature sensor, TSON bit (ADC_ACR) needs to be set.


So analogRead(15) will only work if the TSON bit in ADC_ACR is set by the looks of it. So it's up to the Arduino guys to do that or I guess you can do it yourself.
_____
Rob
Rob Gray aka the GRAYnomad www.robgray.com

Grumpy_Mike

Yes but on the normal arduino they masked out the upper part of the channel select byte so you could not access the things like the sensor, zero volts 5V and internal Vref. It would have been so much more flexible if they had not done this. You need to look at the C code for the analogue read on a Due to see what they have done this time.

Go Up