* Z:\home\khalils\Downloads\files\data\raw_asc\96d1a7f5fe62_Vin_mon_WCA.asc
* Generated by LTspice 26.0.1 for Windows.
V1 S 0 12
BV2 PSU_en 0 V={if(V(S)>7,5.5,0)}
R3 PSU_en B {WC1(22k,0.01,1)}
R4 B 0 {WC1(10k,0.05,2)}
M2 D G S S BSS84
XQ1 G B E BC847B ;pnba C)B)E
C1 Vin_mon 0 10n
R2 D Vin_mon {WC1(22k,0.01,5)}
R6 Vin_mon 0 {WC1(470R,0.05,6)}
R5 S G {WC1(10k,0.05,3)}
R1 E 0 {WC1(1k,0.05,4)}
V3 STEPPING 0 {STEPPING}
.model NMOS NMOS
.model PMOS PMOS
.lib C:\users\khalils\AppData\Local\LTspice\lib\cmp\standard.mos
.dc V1 0 40 0.1
* .tran 5m startup
* https://electronics.stackexchange.com/questions/546121/placement-of-mosfets-in-switchable-voltage-divider-for-voltage-measurements
***********************************************************
*
* BZX84-C3V3
*
* Nexperia
*
* Voltage regulator diodes
* VFmax = 0,9V @ IF = 10mA
* IRmax = 5A @ VR = 1V
* VZmax = 3,5V @ IZ = 5mA
* IZSM = 6A @ tp = 100s
*
*
*
* Package pinning does not match Spice model pinning.
* Package: SOT23
*
* Package Pin 1: Anode
* Package Pin 2: Not Connected
* Package Pin 3: Cathode
*
*
* Extraction date (week/year): #
* Simulator: PSPICE
*
***********************************************************
*
.MODEL BZX84-C3V3 D
+ IS = 7.035E-16
+ N = 0.9809
+ BV = 3.3
+ IBV = 0.005
+ RS = 0.3487
+ CJO = 3.162E-10
+ VJ = 0.6687
+ M = 0.3164
+ FC = 0.5
.ENDS
*
.FUNC MOD(a,b) {a-FLOOR(a/b)*b}
.FUNC BIT(x) {if(MOD(STEPPING,2**(X+1))>=2**x,1,0)}
.FUNC EVA1 (nom, tol, param_num) {if(STEPPING == -1, nom, nom*(1-tol)+2*nom*tol*BIT(param_num))}
.FUNC EVA2 (nom, min, max, param_num) {if(STEPPING == -1, nom, IF(BIT(param_num),max,min))}
.FUNC WC1 (nom, tol, param_num) EVA1(nom, tol, param_num)
.FUNC WC2 (nom, min, max, param_num) EVA2(nom, min, max, param_num)
.step param STEPPING -1 63 1
**********************************************************
*
* BC847
*
* Nexperia
*
* General purpose NPN transistor
* IC = 100 mA
* VCEO = 45 V
* hFE = 110 - 450 @ 5V/2mA
*
*
*
*
* Package pinning does not match Spice model pinning.
* Package: SOT 23
*
* Package Pin 1: Base
* Package Pin 2: Emitter
* Package Pin 3: Collector
*
*
* Extraction date (week/year): 24/2021
* Spicemodel includes temperature dependency
*
**********************************************************
*#
*
* Diode D1, Transistor Q2 and resistor RQ
* are dedicated to improve modeling of quasi
* saturation area and reverse mode operation
* and do not reflect physical devices.
*
.SUBCKT BC847A 1 2 3
Q1 1 2 3 MAIN 0.8636
Q2 11 2 33 MAIN 0.1364
RQ 11 1 324.8
D1 2 1 DIODE
*
.MODEL MAIN NPN
+ IS = 1.124E-14
+ NF = 0.9872
+ ISE = 2.566E-15
+ NE = 1.661
+ BF = {WC2(110,180,220,0)}
+ IKF = 0.09455
+ VAF = 36.27
+ NR = 0.9859
+ ISC = 7.015E-18
+ NC = 0.9228
+ BR = 7.047
+ IKR = 0.8167
+ VAR = 16.61
+ RB = 150
+ IRB = 0.0008356
+ RBM = 0.8289
+ RE = 0.804
+ RC = 0.2454
+ XTB = 1.382
+ EG = 1.11
+ XTI = 7.452
+ CJE = 1.264E-11
+ VJE = 0.7056
+ MJE = 0.3401
+ TF = 6.258E-10
+ XTF = 25
+ VTF = 2
+ ITF = 0.277
+ PTF = 0
+ CJC = 3.624E-12
+ VJC = 0.5036
+ MJC = 0.365
+ XCJC = 1
+ TR = 1.55E-07
+ CJS = 0
+ VJS = 0.75
+ MJS = 0.333
+ FC = 0.78
.MODEL DIODE D
+ IS = 1.365E-15
+ N = 0.988
+ BV = 1000
+ IBV = 0.001
+ RS = 2163
+ CJO = 0
+ VJ = 1
+ M = 0.5
+ FC = 0
+ TT = 0
+ EG = 1.11
+ XTI = 3
.ENDS
**********************************************************
*
* BC847
*
* Nexperia
*
* General purpose NPN transistor
* IC = 100 mA
* VCEO = 45 V
* hFE = 110 - 450 @ 5V/2mA
*
*
*
*
* Package pinning does not match Spice model pinning.
* Package: SOT 23
*
* Package Pin 1: Base
* Package Pin 2: Emitter
* Package Pin 3: Collector
*
*
* Extraction date (week/year): 24/2021
* Spicemodel includes temperature dependency
*
**********************************************************
*#
*
* Diode D1, Transistor Q2 and resistor RQ
* are dedicated to improve modeling of quasi
* saturation area and reverse mode operation
* and do not reflect physical devices.
*
.SUBCKT BC847B 1 2 3
Q1 1 2 3 MAIN 0.8636
Q2 11 2 33 MAIN 0.1364
RQ 11 1 324.8
D1 2 1 DIODE
*
.MODEL MAIN NPN
+ IS = 1.124E-14
+ NF = 0.9872
+ ISE = 2.566E-15
+ NE = 1.661
+ BF = {WC2(290,200,450,0)}
+ IKF = 0.09455
+ VAF = 36.27
+ NR = 0.9859
+ ISC = 7.015E-18
+ NC = 0.9228
+ BR = 7.047
+ IKR = 0.8167
+ VAR = 16.61
+ RB = 150
+ IRB = 0.0008356
+ RBM = 0.8289
+ RE = 0.804
+ RC = 0.2454
+ XTB = 1.382
+ EG = 1.11
+ XTI = 7.452
+ CJE = 1.264E-11
+ VJE = 0.7056
+ MJE = 0.3401
+ TF = 6.258E-10
+ XTF = 25
+ VTF = 2
+ ITF = 0.277
+ PTF = 0
+ CJC = 3.624E-12
+ VJC = 0.5036
+ MJC = 0.365
+ XCJC = 1
+ TR = 1.55E-07
+ CJS = 0
+ VJS = 0.75
+ MJS = 0.333
+ FC = 0.78
.MODEL DIODE D
+ IS = 1.365E-15
+ N = 0.988
+ BV = 1000
+ IBV = 0.001
+ RS = 2163
+ CJO = 0
+ VJ = 1
+ M = 0.5
+ FC = 0
+ TT = 0
+ EG = 1.11
+ XTI = 3
.ENDS
**********************************************************
*
* BC847
*
* Nexperia
*
* General purpose NPN transistor
* IC = 100 mA
* VCEO = 45 V
* hFE = 110 - 450 @ 5V/2mA
*
*
*
*
* Package pinning does not match Spice model pinning.
* Package: SOT 23
*
* Package Pin 1: Base
* Package Pin 2: Emitter
* Package Pin 3: Collector
*
*
* Extraction date (week/year): 24/2021
* Spicemodel includes temperature dependency
*
**********************************************************
*#
*
* Diode D1, Transistor Q2 and resistor RQ
* are dedicated to improve modeling of quasi
* saturation area and reverse mode operation
* and do not reflect physical devices.
*
.SUBCKT BC847C 1 2 3
Q1 1 2 3 MAIN 0.8636
Q2 11 2 33 MAIN 0.1364
RQ 11 1 324.8
D1 2 1 DIODE
*
.MODEL MAIN NPN
+ IS = 1.124E-14
+ NF = 0.9872
+ ISE = 2.566E-15
+ NE = 1.661
+ BF = {WC2(420,520,800,0)}
+ IKF = 0.09455
+ VAF = 36.27
+ NR = 0.9859
+ ISC = 7.015E-18
+ NC = 0.9228
+ BR = 7.047
+ IKR = 0.8167
+ VAR = 16.61
+ RB = 150
+ IRB = 0.0008356
+ RBM = 0.8289
+ RE = 0.804
+ RC = 0.2454
+ XTB = 1.382
+ EG = 1.11
+ XTI = 7.452
+ CJE = 1.264E-11
+ VJE = 0.7056
+ MJE = 0.3401
+ TF = 6.258E-10
+ XTF = 25
+ VTF = 2
+ ITF = 0.277
+ PTF = 0
+ CJC = 3.624E-12
+ VJC = 0.5036
+ MJC = 0.365
+ XCJC = 1
+ TR = 1.55E-07
+ CJS = 0
+ VJS = 0.75
+ MJS = 0.333
+ FC = 0.78
.MODEL DIODE D
+ IS = 1.365E-15
+ N = 0.988
+ BV = 1000
+ IBV = 0.001
+ RS = 2163
+ CJO = 0
+ VJ = 1
+ M = 0.5
+ FC = 0
+ TT = 0
+ EG = 1.11
+ XTI = 3
.ENDS
.backanno
.end

* LTspice schematic (.asc):
Version 4
SHEET 1 7904 2148
WIRE 752 -272 688 -272
WIRE 688 -240 688 -272
WIRE 688 -144 688 -160
WIRE 320 96 208 96
WIRE 592 96 320 96
WIRE 208 112 208 96
WIRE 320 128 320 96
WIRE 208 208 208 192
WIRE 592 224 592 96
WIRE 320 240 320 208
WIRE 512 240 320 240
WIRE 544 240 512 240
WIRE 592 336 592 320
WIRE 592 336 512 336
WIRE 592 352 592 336
WIRE 320 368 320 240
WIRE -192 416 -304 416
WIRE 16 416 -112 416
WIRE 240 416 16 416
WIRE 256 416 240 416
WIRE -304 448 -304 416
WIRE 16 448 16 416
WIRE 592 464 592 432
WIRE 720 464 592 464
WIRE 1056 464 720 464
WIRE 320 480 320 464
WIRE 720 480 720 464
WIRE 320 496 320 480
WIRE 592 496 592 464
WIRE -304 544 -304 528
WIRE 16 544 16 528
WIRE 592 576 592 560
WIRE 720 576 720 560
WIRE 320 592 320 576
FLAG 16 544 0
FLAG 320 592 0
FLAG -304 544 0
FLAG 208 208 0
FLAG 1056 464 Vin_mon
FLAG 720 576 0
FLAG 592 576 0
FLAG -304 416 PSU_en
FLAG 208 96 Vin
FLAG 240 416 B
FLAG 512 240 G
FLAG 320 480 E
FLAG 512 336 D
FLAG 592 96 S
FLAG 688 -144 0
FLAG 752 -272 STEPPING
IOPIN 752 -272 Out
SYMBOL voltage 208 96 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V1
SYMATTR Value 12
SYMBOL voltage -304 432 R0
WINDOW 3 24 87 Left 2
WINDOW 0 38 65 Left 2
SYMATTR Value V={if(V(Vin)>7,5.5,0)}
SYMATTR InstName V2
SYMATTR Prefix B
SYMBOL res -208 432 R270
WINDOW 0 -36 58 VTop 2
WINDOW 3 65 77 VBottom 2
SYMATTR InstName R3
SYMATTR Value {WC1(22k,0.01,1)}
SYMBOL res 0 432 R0
WINDOW 3 34 74 Left 2
SYMATTR Value {WC1(10k,0.05,2)}
SYMATTR InstName R4
SYMBOL pmos 544 320 M180
SYMATTR InstName M2
SYMATTR Value BSS84
SYMBOL npn 256 368 R0
SYMATTR InstName Q1
SYMATTR Value BC847B
SYMATTR Prefix X
SYMBOL cap 576 496 R0
SYMATTR InstName C1
SYMATTR Value 10n
SYMBOL res 576 336 R0
SYMATTR InstName R2
SYMATTR Value {WC1(22k,0.01,5)}
SYMBOL res 704 464 R0
SYMATTR InstName R6
SYMATTR Value {WC1(470R,0.05,6)}
SYMBOL res 304 112 R0
SYMATTR InstName R5
SYMATTR Value {WC1(10k,0.05,3)}
SYMBOL res 304 480 R0
SYMATTR InstName R1
SYMATTR Value {WC1(1k,0.05,4)}
SYMBOL voltage 688 -256 R0
SYMATTR InstName V3
SYMATTR Value {STEPPING}
TEXT -272 256 Left 2 !.dc V1 0 40 0.1
TEXT -272 280 Left 2 ;.tran 5m startup
TEXT -752 784 Left 2 ;https://electronics.stackexchange.com/questions/546121/placement-of-mosfets-in-switchable-voltage-divider-for-voltage-measurements
TEXT 1912 -416 Left 2 !***********************************************************\n*\n* BZX84-C3V3\n*\n* Nexperia\n*\n* Voltage regulator diodes\n* VFmax = 0,9V    @ IF = 10mA\n* IRmax = 5µA     @ VR = 1V\n* VZmax = 3,5V    @ IZ = 5mA\n* IZSM  = 6A      @ tp = 100µs\n*\n*\n*\n* Package pinning does not match Spice model pinning.\n* Package: SOT23\n*\n* Package Pin 1: Anode\n* Package Pin 2: Not Connected\n* Package Pin 3: Cathode\n*\n*\n* Extraction date (week/year): #\n* Simulator: PSPICE\n*\n***********************************************************\n*\n.MODEL BZX84-C3V3 D\n+ IS = 7.035E-16\n+ N = 0.9809\n+ BV = 3.3\n+ IBV = 0.005\n+ RS = 0.3487\n+ CJO = 3.162E-10\n+ VJ = 0.6687\n+ M = 0.3164\n+ FC = 0.5\n.ENDS\n*
TEXT -776 -280 Left 2 !.FUNC MOD(a,b) {a-FLOOR(a/b)*b}\n.FUNC BIT(x) {if(MOD(STEPPING,2**(X+1))>=2**x,1,0)}\n.FUNC EVA1 (nom, tol, param_num) {if(STEPPING == -1, nom, nom*(1-tol)+2*nom*tol*BIT(param_num))}\n.FUNC EVA2 (nom, min, max, param_num) {if(STEPPING == -1, nom, IF(BIT(param_num),max,min))}\n.FUNC WC1 (nom, tol, param_num) EVA1(nom, tol, param_num)\n.FUNC WC2 (nom, min, max, param_num) EVA2(nom, min, max, param_num)
TEXT -776 -112 Left 2 !.step param STEPPING -1 63 1
TEXT 2752 -416 Left 2 !**********************************************************\n*\n* BC847\n*\n* Nexperia\n*\n* General purpose NPN transistor\n* IC   = 100 mA\n* VCEO = 45 V \n* hFE  = 110 - 450 @ 5V/2mA\n* \n*\n*\n*\n* Package pinning does not match Spice model pinning.\n* Package: SOT 23\n* \n* Package Pin 1: Base\n* Package Pin 2: Emitter\n* Package Pin 3: Collector\n* \n*\n* Extraction date (week/year): 24/2021\n* Spicemodel includes temperature dependency\n*\n**********************************************************\n*#\n*\n* Diode D1, Transistor Q2 and resistor RQ \n* are dedicated to improve modeling of quasi\n* saturation area and reverse mode operation\n* and do not reflect physical devices.\n*\n.SUBCKT BC847A 1 2 3\nQ1 1 2 3 MAIN 0.8636\nQ2 11 2 33 MAIN 0.1364\nRQ 11 1 324.8\nD1 2 1 DIODE\n*\n.MODEL MAIN NPN\n+ IS = 1.124E-14\n+ NF = 0.9872\n+ ISE = 2.566E-15\n+ NE = 1.661\n+ BF = {WC2(110,180,220,0)}\n+ IKF = 0.09455\n+ VAF = 36.27\n+ NR = 0.9859\n+ ISC = 7.015E-18\n+ NC = 0.9228\n+ BR = 7.047\n+ IKR = 0.8167\n+ VAR = 16.61\n+ RB = 150\n+ IRB = 0.0008356\n+ RBM = 0.8289\n+ RE = 0.804\n+ RC = 0.2454\n+ XTB = 1.382\n+ EG = 1.11\n+ XTI = 7.452\n+ CJE = 1.264E-11\n+ VJE = 0.7056\n+ MJE = 0.3401\n+ TF = 6.258E-10\n+ XTF = 25\n+ VTF = 2\n+ ITF = 0.277\n+ PTF = 0\n+ CJC = 3.624E-12\n+ VJC = 0.5036\n+ MJC = 0.365\n+ XCJC = 1\n+ TR = 1.55E-07\n+ CJS = 0\n+ VJS = 0.75\n+ MJS = 0.333\n+ FC = 0.78\n.MODEL DIODE D\n+ IS = 1.365E-15\n+ N = 0.988\n+ BV = 1000\n+ IBV = 0.001\n+ RS = 2163\n+ CJO = 0\n+ VJ = 1\n+ M = 0.5\n+ FC = 0\n+ TT = 0\n+ EG = 1.11\n+ XTI = 3\n.ENDS
TEXT 3560 -416 Left 2 !**********************************************************\n*\n* BC847\n*\n* Nexperia\n*\n* General purpose NPN transistor\n* IC   = 100 mA\n* VCEO = 45 V \n* hFE  = 110 - 450 @ 5V/2mA\n* \n*\n*\n*\n* Package pinning does not match Spice model pinning.\n* Package: SOT 23\n* \n* Package Pin 1: Base\n* Package Pin 2: Emitter\n* Package Pin 3: Collector\n* \n*\n* Extraction date (week/year): 24/2021\n* Spicemodel includes temperature dependency\n*\n**********************************************************\n*#\n*\n* Diode D1, Transistor Q2 and resistor RQ \n* are dedicated to improve modeling of quasi\n* saturation area and reverse mode operation\n* and do not reflect physical devices.\n*\n.SUBCKT BC847B 1 2 3\nQ1 1 2 3 MAIN 0.8636\nQ2 11 2 33 MAIN 0.1364\nRQ 11 1 324.8\nD1 2 1 DIODE\n*\n.MODEL MAIN NPN\n+ IS = 1.124E-14\n+ NF = 0.9872\n+ ISE = 2.566E-15\n+ NE = 1.661\n+ BF = {WC2(290,200,450,0)}\n+ IKF = 0.09455\n+ VAF = 36.27\n+ NR = 0.9859\n+ ISC = 7.015E-18\n+ NC = 0.9228\n+ BR = 7.047\n+ IKR = 0.8167\n+ VAR = 16.61\n+ RB = 150\n+ IRB = 0.0008356\n+ RBM = 0.8289\n+ RE = 0.804\n+ RC = 0.2454\n+ XTB = 1.382\n+ EG = 1.11\n+ XTI = 7.452\n+ CJE = 1.264E-11\n+ VJE = 0.7056\n+ MJE = 0.3401\n+ TF = 6.258E-10\n+ XTF = 25\n+ VTF = 2\n+ ITF = 0.277\n+ PTF = 0\n+ CJC = 3.624E-12\n+ VJC = 0.5036\n+ MJC = 0.365\n+ XCJC = 1\n+ TR = 1.55E-07\n+ CJS = 0\n+ VJS = 0.75\n+ MJS = 0.333\n+ FC = 0.78\n.MODEL DIODE D\n+ IS = 1.365E-15\n+ N = 0.988\n+ BV = 1000\n+ IBV = 0.001\n+ RS = 2163\n+ CJO = 0\n+ VJ = 1\n+ M = 0.5\n+ FC = 0\n+ TT = 0\n+ EG = 1.11\n+ XTI = 3\n.ENDS
TEXT 4368 -416 Left 2 !**********************************************************\n*\n* BC847\n*\n* Nexperia\n*\n* General purpose NPN transistor\n* IC   = 100 mA\n* VCEO = 45 V \n* hFE  = 110 - 450 @ 5V/2mA\n* \n*\n*\n*\n* Package pinning does not match Spice model pinning.\n* Package: SOT 23\n* \n* Package Pin 1: Base\n* Package Pin 2: Emitter\n* Package Pin 3: Collector\n* \n*\n* Extraction date (week/year): 24/2021\n* Spicemodel includes temperature dependency\n*\n**********************************************************\n*#\n*\n* Diode D1, Transistor Q2 and resistor RQ \n* are dedicated to improve modeling of quasi\n* saturation area and reverse mode operation\n* and do not reflect physical devices.\n*\n.SUBCKT BC847C 1 2 3\nQ1 1 2 3 MAIN 0.8636\nQ2 11 2 33 MAIN 0.1364\nRQ 11 1 324.8\nD1 2 1 DIODE\n*\n.MODEL MAIN NPN\n+ IS = 1.124E-14\n+ NF = 0.9872\n+ ISE = 2.566E-15\n+ NE = 1.661\n+ BF = {WC2(420,520,800,0)}\n+ IKF = 0.09455\n+ VAF = 36.27\n+ NR = 0.9859\n+ ISC = 7.015E-18\n+ NC = 0.9228\n+ BR = 7.047\n+ IKR = 0.8167\n+ VAR = 16.61\n+ RB = 150\n+ IRB = 0.0008356\n+ RBM = 0.8289\n+ RE = 0.804\n+ RC = 0.2454\n+ XTB = 1.382\n+ EG = 1.11\n+ XTI = 7.452\n+ CJE = 1.264E-11\n+ VJE = 0.7056\n+ MJE = 0.3401\n+ TF = 6.258E-10\n+ XTF = 25\n+ VTF = 2\n+ ITF = 0.277\n+ PTF = 0\n+ CJC = 3.624E-12\n+ VJC = 0.5036\n+ MJC = 0.365\n+ XCJC = 1\n+ TR = 1.55E-07\n+ CJS = 0\n+ VJS = 0.75\n+ MJS = 0.333\n+ FC = 0.78\n.MODEL DIODE D\n+ IS = 1.365E-15\n+ N = 0.988\n+ BV = 1000\n+ IBV = 0.001\n+ RS = 2163\n+ CJO = 0\n+ VJ = 1\n+ M = 0.5\n+ FC = 0\n+ TT = 0\n+ EG = 1.11\n+ XTI = 3\n.ENDS