Help using the analog comparator

I would like to use the analog comparator without interrupts. In other words, I want to poll the output at a time of my choosing. In the sketch below, that would be each time through the loop. However, I can't seem to get the comparator output to toggle. Can you tell me what I am doing wrong?

void setup()
{
  // Turn off ADC, turn on Analog comparator and select the mux
  PRR &= ~(1<<PRADC);
  ACSR &= ~(1<<ACD) & ~(1<<ACIE) & ~(1<<ACIC);
  ACSR |= (1<<ACBG) | (1<<ACO);
  ADCSRB |= (1<<ACME);
  ADCSRA &= ~(1 << ADEN);
  // 0000 selects ADC0 channel
  ADMUX &= ~(1<<MUX3) & ~(1<<MUX2) & ~(1<<MUX1) & ~(1<<MUX0);
  DIDR0 |= (1<<ADC5D)|(1<<ADC4D)|(1<<ADC3D)|(1<<ADC2D)|(1<<ADC1D);
  DIDR1 |= (1<<AIN1D) | (1<<AIN0D);
  DDRD=0xFF;
  PORTD=0xFF;
}

void loop()
{
  if (ACO)
    PORTD=0xFF;
  else 
    PORTD=0x00;
}

I am using an ATMEGA328p in a standalone application.

ACO is bit 5 in the ACSR. In iom328P.h it is defined as 5 so it will never test as anything but true. Try:

  if (ACSR & _BV(ACO))

johnwasser:
ACO is bit 5 in the ACSR. In iom328P.h it is defined as 5 so it will never test as anything but true. Try:

  if (ACSR & _BV(ACO))

That worked - THANK YOU!!!