I'm trying to detect if the battery in this circuit is charging or not by comparing the voltages across the diode. The battery is not charging if it's at a voltage higher than the charging input. For example when the battery is at 10V and the charger is at 9V, the battery is not charging. The battery is charging when the current is flowing across the diode and produces a voltage drop. To detect if a battery is charging, the battery voltage must be less than or equal to the charging input.
I've come up with this naive circuit that powers a comparator with the battery voltage since it's typically higher than the charger's. The inverting input comes from the battery, and the non-inverting input comes from the charger. When the battery is lower than the charger, the circuit properly turns on the output in simulation. From my research and experimentation (with an LM339N), it appears that real comparators need a power voltage higher than the two inputs to properly compare them.
I don't want to add a voltage booster to my circuit, and I don't want to use two ADCs
Is there a chip or circuit that can determine if the diode in my charging circuit is forward biased?