I want to set one pin's output value, and then set a different pin's output value so that the two pins change value one after the other. However, the compiler optimises the two calls to change both pins in one go.
PORTD |= _BV(0); //set pd0 to high
PORTD |= _BV(1); //set pd1 to high
PORTD &= ~(_BV(1)); //set pd1 to low
The two pins go high simultaneously. I tried inserting a NOP between these but it doesn't change behaviour.
(I originally intended to include an oscilloscope screengrab to show what was happening - that's how I knew (or got the wrong impression) that the two pins were changing at the same time. But the photo wasn't shifting from my Nexus 7 for me to access it from my laptop.)