The method for detecting end of charge depends somewhat on battery chemistry and on the behavior of your charger.
First read about the behavior of the particular type of battery you are charging and decide how you are going to detect that the battery is full.
Look at graphs of terminal voltage and charging current versus time/state of charge in battery datasheets.
If you are charging a lithium ion battery then you must use a charger with well-defined maximum voltage and current limit (or you risk the battery catching fire if it does not have an internal protection circuit in the battery pack). If you know that the charger is turned on then you can just monitor charge current, the battery is fully charged when the charge current is below about C/50 (this means 1/50th of the rated capacity of the battery pack eg about 10mA for a 500mAh pack when charger is supplying maximum voltage).
Old ni-cad batterys are a little more difficult to check accurately. You can charge at a constant current and look for the terminal voltage to rise to about 1.55volts then start to drop again or you can monitor battery temperature (or battery temperature above ambient temperature if you want to be clever. The end of charge point is not always well defined if the batteries are old or partially charged when you start charging. With your microcontroller you can also assume that the batteries are full after x hours of charging.
You can use the analog to digital converter in the 16F877a to get numbers corresponding to the battery voltage and current.
You must use some analog circuitry to scale the signal to protect the PIC and make it stay in the 0-5volt range of the pins on the PIC.
For battery voltage it depends on the voltage range, eg for a 12volt battery you may have 15volts maximum. You can use a potential divider with two resistors to reduce the voltage to a range the pic can handle. IF the battery can be connected when the pic does not have 5volt power you should not put much current into the pic pin so making the resistor values fairly high ma be good.
To measure current with the pic you have a few options. Usually you have a low value resistor in series and you measure the voltage across it. You may need an opamp circuit to scale the voltage across the resistor.