I plan to use an internal comparator on a PIC16F1789 (http://ww1.microchip.com/downloads/en/DeviceDoc/40001675C.pdf ) to monitor the battery. Battery will be a single cell Li-ion. LDO regulator is set for 3.3V. The signal will be when Vdd voltage fails out of regulation, e.g., drops to 3.1V. Here's my planned circuit (based on Microchip documents). Both Vref+ and OUTPUT will be internal connections..

My assumption is that register CMxCON0,5 should be clear, which sets CxOUT to internal only. Do the settings for the pin usually assigned to that comparator make a difference? Let's say I use comparator 1, which can output to RA4. I am assuming RA4 can be used for anything, including a digital i/o if needed. I will monitor the output status with register CMOUT,MCxOUT.
Second, do PIC comparators require pull-ups? That is, are they normally open collector?
Those questions could easily be answered in hardware, except I would need to take down my current project and rebuild it.
Regards, John

My assumption is that register CMxCON0,5 should be clear, which sets CxOUT to internal only. Do the settings for the pin usually assigned to that comparator make a difference? Let's say I use comparator 1, which can output to RA4. I am assuming RA4 can be used for anything, including a digital i/o if needed. I will monitor the output status with register CMOUT,MCxOUT.
Second, do PIC comparators require pull-ups? That is, are they normally open collector?
Those questions could easily be answered in hardware, except I would need to take down my current project and rebuild it.
Regards, John
Last edited: