Arduino Basic Program question

Hey Everybody,

became resently a Arduino Uno user. Neat little thing.
Anyway, was reading a book Mastering Microcontrollers - Helped by Arduino by Clemens Valens.
Must read from my perspective.

On page 149 it states that

“the ADC of the AVR is is a complex precision device that Arduino and its limited API do not really do justice”.

There is a on-chip temperature sensor accessible by changing in wiring_analog.c
ADMUX = (analog_reference << 6) (pin & 0x07)
to
ADMUX = (analog_reference << 6) (pin & 0x0f)

it says that you have now a total of 16 (0 through 15) channels instead of 8 (0 through 7) channels and channel 8 corresponds to the on-chip temperature sensor. Selecting channel 14 allows you to measure the internal reference of 1.1V
Channel 15 is connected to 0V, wich is convenient for calibrating a measurement or to verify the proper operation of the ADC, or, in some cases, of your system. The other channels are reserved and if you select one of them, the result zill be unpredictable.
The sketch for the temperature sensor is a followed:

/*
* On- chip Thermometer
*/
int A8 = 22;
void setup()
{
Serial.begin(115200);
analogReference(INTERNAL);
}
void looop()
{
Serial;println(analogRead(A8);
delay(1000);
}

The rest you can read in the book.

this is pretty sweet, to be honest.
my question around it was, why did the Arduino Team leave this option out. What implementations would it have on the whole Arduino usage by changing it. (Sorry, big novice here)

why did the Arduino Team leave this option out.

Because the onboard thermometer is not very accurate. It is intended to shut the chip down if it gets too hot. "Too hot" doesn't mean "more than 37.4 degrees C". It means that the value returned is "large", for some definition of large.

I have used this internal temp sensor once to seed the random function but it appears to be too stable

Another possible application could be a (part of a) self test of the ADC as it should return a "reasonable" value

The AVR internal temperature sensor is a subject that never fails to pop up once a year or so. It's interesting but bottom line is that it is not a useful feature and I've yet to see a useful utilization of using it in a practical project.

On the other hand access to the internal 1.1vdc voltage reference has been shown useful for being able to calculate the Vcc of a AVR at run time, useful in battery powered projects.

Heer_Lorcan: my question around it was, why did the Arduino Team leave this option out. What implementations would it have on the whole Arduino usage by changing it. (Sorry, big novice here)

The Arduino system is designed to make microcontrollers accessible to beginners and to people whose prinicpal interest is not computers - for example artists. In this case I think a sensible pragmatic decision was taken.

There is nothing in the Arduino system to prevent people with extra knowledge making use of the full range of Atmega features. All the Atmega registers are readily accessible.

...R