Are you rotating the encoder for all six seconds? If you only rotate it while counting pulses on PortB.7, you will miss the pulses on portB.6.