There are basically two ways to do this depending on the frequency of the input.
1. Set up a timer for a suitable timebase (say 1 second). Increment a counter for each input pulse during the period of this timer. At the end of the timer period, the counter will hold a value related to the frequency - in my example, the frequency in Hz.
2. For lower input frequencies, count clock cycles (or some division thereof) during the period of the input signal. This gives a number related to the period of the input and then a little maths will give you the frequency.