RPM with other inputs

Add a Serial.print of rpmcount before

Serial.print("rpm ");
Serial.println(rpm,DEC);

and see what you get.

Second there are 3 different errors in the line

rpm =60000000/(micros() - timeold)*20;

So Serial.print() micros()-timeold and do the calculation your self and compare the Arduinos result and your own!.

Mark