ADC port manipulation I was modifying this ADC Touch implementation, namely switching analogRead and pinMode to what I thought would be port manipulation equivalents.

I get very different readings (better and more stable in my case).

So, what I think is equivalent is actually quite different. Can someone point the differences to me?

Original:

    pinMode(ADCChannel, INPUT_PULLUP);

    ADMUX |=   0b11111;
    ADCSRA |= (1&lt;&lt;ADSC); //start conversion
    while(!(ADCSRA &amp; (1&lt;&lt;ADIF))); //wait for conversion to finish
    ADCSRA |= (1&lt;&lt;ADIF); //reset the flag

    pinMode(ADCChannel, INPUT);
    _value += analogRead(ADCChannel);


Modified:

    DDRC &amp;= ~(1 &lt;&lt; ADCChannel);
    PORTC |= (1 &lt;&lt; ADCChannel);

    ADMUX |=   0b11111;
    ADCSRA |= (1&lt;&lt;ADSC); //start conversion
    while(!(ADCSRA &amp; (1&lt;&lt;ADIF))); //wait for conversion to finish
    ADCSRA |= (1&lt;&lt;ADIF); //reset the flag

    DDRC &amp;= ~(1 &lt;&lt; ADCChannel);
    _value += analogRead(ADCChannel);
Your modified code doesn't disable the pullup on the pin.

PORTC &amp;= ~_BV(ADCChannel);