# Flip-flop logic for comparator of overcurrent detection

I'm working on the realization of overcurrent detection that will be powered by a battery supply. I successfully simulated a comparator with an operational amplifier that will set the output high when there is overcurrent and the flip-flop circuit has to carry that value (until the reset button is pressed) and send it to the buffer that will set the MOSFET transistor on/off. I'm trying to figure out what is the best way to implement the flip-flop logic that sends the information to the buffer. Below is the schematic of my project. Thank you very much for your ideas.

• Two transistor latch (bistable circuit), two NANDs, 4043 or 4044 ic (according logic), some folks even use 555. There is also possible use D flops like 4013 or 7474. Nov 26, 2023 at 9:27
• Regarding two NANDs: if possitive logic is needed (set and reset with logic High) two NORs is better option. Also two schmitt triggers will do the job. Nov 26, 2023 at 9:38

The function you want is called "set/reset latch".

There are some old chips that integrate multiple latches (CD4043/CD4044, 74xx279), but the simplest solution is to build a latch with two NAND or NOR gates ((SN)74xx2G00, (SN)74xx2G02):

(source: Wikipedia)

To ensure that it is in the correct state after power up, you need a reset signal during power up.

• I have created the schematic for the latch, but how do I convert the overvoltage value which is over 12V from the output of my comparator as "HIGH" value to the NOR gate? Below are pictures of the schematic and simulation. Schematic: imgur.com/tJRvY96 Simulation: imgur.com/FeuFFjW Nov 26, 2023 at 19:01
• Just adjust the pull-up resistor at the comparator's output. Which you forgot. (How an open-collector output works and how to do level shifting with it is a different question.)
– CL.
Nov 26, 2023 at 19:06
• I adjusted the pull-up resistor but the latch circuit still does not work. Is the value of the resistor wrong? imgur.com/lAJEUC9 Nov 26, 2023 at 19:31
• This is not a pull-up resistor. Look up how open-collector outputs work, and if needed, ask a new question.
– CL.
Nov 27, 2023 at 8:40