I've posted (part I of) a tutorial regarding direct IO from input port pins 5
and 6. A nice application is shown - rotation counter on input port using motor
built-in encoders.
Read it here: http://nxtasy.org/2007/04/13/digital-io-on-input-port-part-i/