Consider that the 2 cells could be alkaline or NiMH and that they will be fed to a boost regulator that pushes them up to 3.3V. A fully fresh alkaline pair could also be 3.3V (1.65V each) and alkalines are generally considered dead at 0.8V, but some of the discharge graphs I've seen show a pretty significant bend at 1.0 or 1.1 even.
One way is to use AVCC for the reference and feed the battery voltage into ADC0, value 1023 would be 3.3V, value 511 would be 1.65V, but what value to use? Would I need to have an option to configure different values for Alkaline vs. NiMH ?
What about feeding the regulated voltage into ADC0 via a voltage divider and use the internal 2.56V? Then look for the regulated voltage to start dropping below 3.3V to some degree. Would that be workable and not require a setting for Alkaline/NiMH?
I'm probably going to be using an ATMEGA1284. The datasheet says the 2.56V is roughly +/- 9% accurate which doesn't sound that great which is why I was thinking of just feeding the battery voltage in against AVCC, but then again, if AVCC starts to fall below 3.3V, that will overstate the battery voltage...
An other ideas?