retrolefty,
i see, interesting code there...
so you use the Vcc as reference but select the bandgap as source, since BG is a known fixed value(thermal variations notwithstanding) you then use the measured difference to infer the real Vcc.
I like it, a lot!, it's much more elegant than my idea of using a external divider and analog pin, and much more precise.
I have some questions about it:
1) I don't quite follow the mapping equation you did, why are you using *1023, shouldn't it be *1024 since you have the number of steps there?, why the +5 then /10?(maybe if put differently i could understand it, maybe it's my particular math view hehehe
2) about the bitshifts in ADMUX, aren't they backwards?, i mean, how to you shift a 0 by a value?, couldn't you just use a bitfield directly?(admux = 0101110b), since those macros correspond directly to bits, also, couldn't you use the _BV macro?
I'd forgotten all about the direct MUX access for the ADC(and i even twiddled with it once to use the internal temp sensor, but gave up as it's horribly inaccurate and needs calibration), guess too much "analogread" dulled my AVR-fu (incidentally, it would be very nice if base arduino analogread included this calibration, maybe an "analogreadcal" or a callibration flag, or "analogcal()" function).
Hav you considered adding it to the playground?