Hi Mishal,
If you are trying to measure the RPM of the motor, then you will simply
need to count the number of counts and then do some sort of
scaling. For example if you have 10 pulses per revolution, you
read every 100 milliseconds, and your count increased from 138 to 352
then that means:
((352-138 Pulses) / 10 Pulses/Rev) / (0.1 s / 60 s/min) = 12840 RPM
Just read your counts, compare it to your last value and do a little math to get you to your goal.
Regards,