Interrupts and PWM/DigitalWrite

Can you tell me exactly what you have connected the encoder to? Also, how fast are you spinning the encoder?