The fastest way to change or flip pins

I did a through test on the speed differences between direct port manipulation and using the Arduino digitalWrite() function. Check it out.

http://www.billporter.info/?p=308

You should put this in a PDF and stick it on the playground... :)

This difference has been shown here several times before. Keep in mind what you gain by using Arduino I/O commands Vs direct port access commands to justify the speed difference.

The Arduino statement is portable across all the different processors supported by the IDE, the direct port method requires port/bit names to be adjusted if used on the different supported AVR chips.

The Arduino statement allows the pin number to be a variable, useful for some solutions.

The Arduino statement knows how to deal with some other low level situations like if a digital output pin already running a PWM command when you wish to set if on or off, etc.

So while there is a big speed difference there are valid reason for it to be so, and as always is best when one gets to choose between difference methods rather then not having a choice at all.

Lefty