To read the frequency from the RA2 pin how do I do it?
This is a complex and advanced topic question not answered easily on a forum.
If the frequency signal is a single pure tone then use the PIC CCP module in capture mode (search web for how to do this. As a start look for Microchip tips & tricks application note DS41214A). If the signal is sinusoidal you will have to convert it to a square wave requiring hardware squaring circuits (comparator ect...) in order to interface it to the PIC.
>>> EDIT: After looking at the datasheet for this PIC, it doesn't have a CCP module so you are out of luck using this method. There is the possibility of using a timer to measure the period of your input square wave, but this will require some efficient code writing using interrupts (i.e. basically constructing a "soft" CCP hardware module in code).
If your frequency signal is audio or multi-tone then you will have to use DSP techniques (i.e. FFT processing) and perhaps use a dsPIC micro-controller for this depending upon your requirements. This technique will not be possible using such a small and under powered PIC due to speed and memory limitations.
From what I could see in your code comments the PIC16F1508/9 looks to be a poor choice for what you want to do.
Lastly
should be