* this is a windows compare if input voltage
* over the cmp+ voltage output set 5V flag=1
* At flag=1, the voltage is below cmp- output set 0 and flag=0
* Name
* | Signal input
* | | output state
* | | | output refernce
* | | | | high limit
* | | | | | low limit
* | | | | | | output revers
.subckt WindowCMP IN OUT GND CMP+ CMP- OUTN
* Subcircuit Body
.model SW_XUTONG SW(Ron=.52 Roff=1Meg Vt=3 Vh=-.5 )
V1 5V GND 5
R1 OUT GND 1K
R2 OUTN 5V 1K
S1 OUTN GND OUT GND SW_XUTONG
.machCMP
*define two state
.state flag1 5
.state flag0 0
* old new
.rule flag1 flag0 V(IN)<V(CMP-)
.rule flag0 flag1 V(IN)>V(CMP+)
.output (OUT) state
.endmachCMP
.ends WindowCMP
用到了状态机写法
LM393是否可以直接用这个模型?
引用: qwqwqw2088 发表于 2023-3-21 15:10 LM393是否可以直接用这个模型?
这个只是个模拟状态机,看你用法看看这个波形是否符合你的预期,
如果你要339的话可以去TI官网下载一个