Hello!
I'm not sure you can do that with a PIC. Well, it depends on your encoder, but for instance
if you use a 16 bits encoder running at 6000 rpm, you will get 6.4 million transitions per second,
and catching interrupts at that speed will be tricky.
What kind of encoder is it?
Dora.
Update: apparently the encoder is not that performant. Just do the calculation to verify if it
can be done. 0.18 degree resolution means 2000 step per turn (therefore 11 bits). But with
4000 rpm, it's still quite a challenge, I guess.