Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
There is no analog comparator (like lm339 or similar) in 16F819, like on some PICs.
All you get in analog is an A/D converter, but You'd have to sample manually to get the value and determine what to do from there.
You might(?) get by if you use an input like RB0 with interrupt on falling edge, and use an resistor divider to trigger the interrupt when battery voltage falls below some value. This is highly NOT recommended, and NOT very reliable solution, but it might work. It would be better to use an schmitt input for something like that. Like RA4 or RA5 (they are Schmitt), but again You'll need to poll the pin.
The comparator You saw in datasheet is part of the CCP module. It compares binary values of Timer1 with predefined limit (so it doesn't go all the way to 0xFFFF).
Another solution would be to use said CCP module to start ADC on overflow (check “special event trigger" in datasheet). And use the ADC interrupt to check periodically.
For reliable operation, a PIC with a comparator or some external circuitry would be best solution. If not possible, I think ADC polling gives better reliability over simple resistor divider and hoping it works.