Greetings, I am new member and this is my first post.
Please help me how to read encoder speed and direction for my application.

I am using 24 position rotary encoder, pulled high, connected to ground when active. PIC 16F88
Variables are : speed , direction

This is what I want:
1) If I turn the shaft slowly ( say 1 rpm ) then speed = 1
2) If I turn the shaft fast ( say 10 rpm ) then speed = 255
3) The direction will be 1 for clockwise, 0 for ccw rotation