# Need a modified S-R latch

I have a comparator output who is normally high and goes low from time to time.

I need a latch which will change its output from high to low when the comparator's output change to low (and keep it low even if the comparator's output goes back to high).

I also need to have an second input to the latch to reset its output to high.

If the first input (the one connected to the comparator's output) is still low when I want to reset the latch I need its output to stay low.

+------+-------+-------+--------+
| Step | Input | Reset | Output |
+------+-------+-------+--------+
|    1 |     1 |     0 |      1 |
|    2 |     0 |     0 |      0 |
|    3 |     0 |     1 |      0 |
|    4 |     0 |     0 |      0 |
|    5 |     1 |     0 |      0 |
|    6 |     1 |     1 |      1 |
|    7 |     1 |     0 |      1 |
+------+-------+-------+--------+


The main constraints are:

• low PCB real estate
• low parts count (I'll need a dozen of those latches)
• low power consumption
• 5V logic

NB: the reset input can be the opposite way, it would not be a problem as it is from a simple debounced switch.

NB²: the reset is common to all the latches (giving this info in case it can reduce the part count)