di2733.txt ;*************************************************************************************************** ; LISTING 1 - PSPICE NETLIST FOR SWITCH WITH HYSTERESIS ; ; "Inline equations offer hysteresis switch in PSpice," EDN, Aug 16, 2001, pg 114 ; ;*************************************************************************************************** .subckt SWhyste NodeMinus NodePlus Plus Minus PARAMS: RON=1 ROFF=1MEG VT=5 VH=2 S5 NodePlus NodeMinus 8 0 smoothSW EBcrtl 8 0 Value = { IF ( V(plus)-V(minus) > V(ref), 1, 0 ) } EBref ref1 0 Value = { IF ( V(8) > 0.5, {VT-VH}, {VT+VH} ) } Rdel ref1 ref 100 Cdel ref 0 100p IC={VT+VH} Rconv1 8 0 10Meg Rconv2 plus 0 10Meg Rconv3 minus 0 10Meg .model smoothSW VSWITCH (RON={RON} ROFF={ROFF} VON=1 VOFF=0) .ends SWhyste