>> PIC: Set bit, NOP, Clear bit >> AVR: Read I/O, Or bit high, Output, Read I/O, And bit low, Output. > >PIC: bsf PORTB,4 > nop > bcf PORTB,4 ; -> 800ns pulse on scope (10MHz) > > >AVR: sbi PORTB,PB4 > nop > cbi PORTB,PB4 ; -> 300ns pulse on scope (10MHz) Sorry, I forgot, I haven't played with that code in a while. > >BTW, the PIC function destroyed the output latch of input pins (most of us >stumbled on this when first doing I2C). > >The AVR function didn't. > >Any questions? I didn't need any NOP on the AVR parts, I can bit-twiddle as fast as I like without problems. The PIC didn't always output properly when I didn't use the NOP. In both cases, I didn't care about that bit's previous state, I was explicitly sending bit sequences in straightline code. Without the NOP, (which isn't needed in the AVR) it's 4X faster at raw bit I/O at any given clock.