The program works by polling RA0 for a low, then checks state of RA1, which will determine direction. Then 200 step pulses are sent to RB5, which will turn this particular motor (1.8 degrees per step) 360 degrees for every position (20 in this case for 360 degrees) on the encoder.

RA0 and RA1 both have Schmitt trigger inputs, one should also connect a .0047 uF cap to ground from each pin.