Hi,
I have defined the following macro:
#define ADC_REF_AVCC() \
ADMUX &= ~(1 << REFS1); \
ADMUX |= (1 << REFS0) //Analogue Vcc as ref
ADC_REF_AVCC();
When I call this it sets both the bits (REFS1 & 0).
ADMUX &= ~(1 << REFS1);
ADMUX |= (1 << REFS0);
However, if I include the 2 lines directly in my code (like the above) it clears the REFS1 bit and set the REFS0 bit like it should.