Hallo,
das mit der Spannungsmessung kann man so machen:

Code:
/*    This function returns the adc-value of the vplus-input ( ADC5 )
*    physical Vplus may be calculated by u=Vbandgap/1024*V_Plus_ADC_value*(R12+R13)/R13
*    Vbandgap=2.56V ( datasheet )
*    R12=12K
*    R13=10K
*    On my ASURO processor board I measured 2.73V on the ARef pin ( strange ) so I calculated
*    2.73V instead of the bandgap voltage mentioned in the datasheet
*/
unsigned int VPlus()
{
    ADMUX = (1 << REFS0) | (1 << REFS1) | 0x05;    // Bandgap Reference and ADC5
    ADCSRA |= (1 << ADSC);            // Start conversion
    while (!(ADCSRA & (1 << ADIF)));    // wait for conversion complete
    ADCSRA |= (1 << ADIF);            // clear ADCIF
    return(ADCL + (ADCH << 8));
}
Gruss,
stochri