I am using a atmega328p, external 16MHz crystal oscillator programmed with an avrisp mkII. I made a test program which toggles PORTB
DDRB = 0xff;
PORTB = 0x00;
PORTB = 0xff;
Without AVcc connected, if I look on the PORTB pins with an oscilloscope i see them toggling at 1/4 the oscillator speed as i expected, but when I connect AVcc to 5V everything stops working. Is there an obvious reason for this? I am confused...