Help with rpm counter coding

rpm is rotations per minute, thus mathematically it is rotation count divided by elapsed time (in minutes). In your formula mills()-timeold is the elapsed time in milliseconds and rpmcount is the rotation count. If you divide these you get rotations per millisecond. Since there are 60,000 milliseconds in a minute, the 60*1000 represents the conversion factor to convert rotations per millisecond to rotations per minute.