please help me out with a programme for measuring frequency from 1k to 1.5k
The most efficient code is quite often _not_ code, but actual hardware.
Have you looked into the possibilities of your timers and/or pwm functions of the chip? Can you start/stop a timer from the outside, with the state change of an input pin?