0
\$\begingroup\$

I created a part from the SPICE code of a 4n32. I found the SPICE code from here.

And here is the section about this part:

*******************************************************************************
* A = diode anode
* K = diode cathode
* C = BJT collector
* B = BJT base
* E = BJT emitter
.SUBCKT A4N32 A K C B E PARAMS: REL_CTR=1
* 4N32 from Motorola Optoelectronics data book Q3/93  -  RPerez
D1 A D Demit   ;Gallium arsenide infrared emitting diode
Vsense D K 0    ;Diode Current sense -> IF
* Gpcg models CTR 
Gpcg C B TABLE  ;Photodetector {IC@IF * (normalized CTR at IF)/(Q1 BF)
+ {70m*REL_CTR*(8.448148613*0.998979389^(1/(abs(I(Vsense))+0.1p))*
+ I(Vsense)^0.449371295)/18k} (0,0) (0.3m,0.3m)
Q1 C B V Qdtect1   ;phototransistor detector
Q2 C V E E Qdtect2   ;Darlington
.model Demit D IS=1P N=1.948621 RS=1.560495 BV=3 IBV=0.05U
+ CJO=18.8P VJ=0.532794 M=0.27985 EG=1.424 TT=500N
.model Qdtect1 NPN IS=0.625P BF=135 NF=1.0941401 BR=10 TF=0 TR=1.2u
+ CJE=8.24P VJE=0.99 MJE=0.247851 CJC=8.01P VJC=0.514483 MJC=0.370451
+ ISC=0 VAF=275 IKF=0  ISE=0.1p
.model Qdtect2 NPN IS=0.625P BF=135 NF=1.0941401 BR=10 TF=0 TR=1.2u
+ CJE=8.24P VJE=0.99 MJE=0.247851
+ ISC=0 VAF=275 IKF=0  ISE=0.1p ISS=0 CJS=3.82p VJS=0.99 MJS=0.200397
.ends
*$
*******************************************************************************

Then I use this part in the following circuit:

enter image description here

The pin number assignment are are:

enter image description here

What could be the reason that the output is inverted?

\$\endgroup\$
0

1 Answer 1

1
\$\begingroup\$

In LTspice, exponentiation is **, not ^ (which is meant as XOR). Just search and replace the two occurences of it. Instead of:

+ {70m*REL_CTR*(8.448148613*0.998979389^(1/(abs(I(Vsense))+0.1p))* + I(Vsense)^0.449371295)/18k} (0,0) (0.3m,0.3m)

have:

+ {70m*REL_CTR*(8.448148613*0.998979389**(1/(abs(I(Vsense))+0.1p))* + I(Vsense)**0.449371295)/18k} (0,0) (0.3m,0.3m)

\$\endgroup\$
0

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.