I'm making a system with main power and a 3V battery (some like CR2032) through a diode for RTC keeping time. Then I want to monitor the charge of battery to light a led when the battery is close to the end of its life to inform the need of change it. How can I monitor the charge? I have a PIC microcontroller (with AD peripheral, comparator, etc) in the system.
Microchip.com has many manuals and application guides available on their website. In their "Tips N Tricks" manual the first Tip is Low Battery Detection. They also have a "Comparator Tips N Tricks" manual. Melanie Newman posted on PIClist.com several years ago "Comparators 101" which uses low battery detection as the example.
I don't think you can charge a CR2032. I use them on my DS1337's but I write a "service required" routine into all of my clock-based programs so the customer must have their system looked at every 2 years. I'm in the service revenue business. I also update the DST files at that time and offer program updates.
Lithium battery holds its voltage till it's almost dead, so you can set the critical voltage to 0.8 (80%) of its nominal voltage, roughly 2.5V .. see chart below ..
To ensure its long term operation make sure you don't drain it to much while reading its voltage - use high impedance buffer between battery and PIC's ADC pin and a MOSFET switch to disconnect battery from the sensing circuit ..