Hello.
I have a simple circuit with PC fan. It's tachometer output is tied to VDD via 10K resistor and goes into PIC16F886. Fan model is AD0812UX-A7BGL-LF
and rated speed is 3700 RPM. It has PWM input pin, which I control via the same IC. Code is below

Code:
CHECK:
if BUT3=0 then dly=dly-1
if BUT4=0 then dly=dly+1
pulsin rpm,0, cnt


lcdout $fe, $1, "PWM=", #dly, "     ", #cnt, "    "
hpwm 2,dly,20000
pause 100
GOTO CHECK
PULSIN inputs some readings, which are consistent with fan speed, but how to convert them into RPM?
AT PWM=0, PULSIN returns 3700. With increase of fan speed, value drops, at PWM=255, it returns 820.

Any ideas?