RPM counter using 8051 microcontroller
You would have to measure


either the duration between the last pulse and the end of your 1-second measurement period (and calculate that into your formula as a fraction of a pulse)
or (preferably) the duration between two pulses (ditching the 1-second period and using the inverse of the pulse duration to calculate the pulse frequency).


To implement this, you just need to reverse your current measuring principle: Instead of counting pulses per second, you would count milli- or microseconds1 per pulse. 

1: or whatever fraction of a second you can easily obtain from a timer



Additionally, you might want to compute a sliding window average of your measurements to reduce their fluctuation.