3
\$\begingroup\$

I prepared my own ideal comparator with hysteresis and it seems this comparator doesn't work OK. Can you tell me what is wrong with it? Here is the schematic of my comparator:

enter image description here

When I use it in a simple circuit, the behavior is very strange:

enter image description here

enter image description here

\$\endgroup\$
2
  • 1
    \$\begingroup\$ You're not showing us your entire schematic including the .tran command. Anyway, I suggest looking into tripdv and tripdt for your behavioral voltage source. \$\endgroup\$
    – Ste Kulov
    Commented May 2, 2023 at 21:56
  • \$\begingroup\$ Tripdv and tripdt solves the issue without slowining the simulation down. Thanks. \$\endgroup\$
    – Zdenek
    Commented May 9, 2023 at 15:12

1 Answer 1

1
\$\begingroup\$

You need the output to not be dependent on Vout and to be fixed, I would use V+ and V- in the if statements so the voltage output is not dependent on itself.

\$\endgroup\$
2
  • \$\begingroup\$ Ok, it make sense, but it is a comparator with hysteresis, so the output voltage has to stay on the same value when the input voltage is inside the hysteresis. So how should I tell to LTspice "stay on the current value" without the dependency that I used? \$\endgroup\$
    – Zdenek
    Commented May 2, 2023 at 18:05
  • \$\begingroup\$ You don't really need to stay in the current value, that's not what comparators do, they go to one of the rails either negative or positive. Replace the vout with V+ \$\endgroup\$
    – Voltage Spike
    Commented May 3, 2023 at 4:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.