* Z:\home\khalils\Downloads\files\data\raw_asc\LTC1998.asc
* Generated by LTspice 26.0.1 for Windows.
* Library below included based on ModelFile attribute of instance XU1 (C:\users\khalils\AppData\Local\LTspice\lib\sym\Comparators\LTC1998.asy)
R6 N005 0 200k
CBATTERY BATT 0 500
S2 BATT N005 OUT 0 LOADSW
B1 N003 0 V=V(BATT)*V(OUT)/V(VL)
V2 N004 0 10
V1 N001 0 5
C3 OUT 0 0.1
R2 VHA VTHA 100k
R1 N004 VHA 850k
XU1 BATT 0 VTHA VHA VL OUT LTC1998 ;pnba BATT)GND)VTHA)VHA)VL)BATTLO
S1 N002 BATT N003 0 CHARGER
V3 VL 0 3
R3 VTHA 0 50k
R4 N002 N001 30k
.tran 100 startup
.model CHARGER SW(Ron=1G Roff=1 Vt=2.1 Vh=2)
.model LOADSW SW(Ron=1 Roff=1G Vt=2.5)
.lib LTC1998.sub
.backanno
.end

* LTspice schematic (.asc):
Version 4
SHEET 1 1108 680
WIRE -240 -112 -288 -112
WIRE -112 -112 -160 -112
WIRE 32 -112 -32 -112
WIRE 256 -112 112 -112
WIRE 384 -112 256 -112
WIRE 448 -112 384 -112
WIRE 960 -112 448 -112
WIRE 256 -80 256 -112
WIRE 48 -16 48 -64
WIRE 96 0 96 -64
WIRE 256 16 256 -16
WIRE 96 112 96 80
WIRE 384 176 384 -112
WIRE 16 192 -96 192
WIRE 128 192 96 192
WIRE 192 192 128 192
WIRE 224 192 192 192
WIRE -96 208 -96 192
WIRE 128 224 128 192
WIRE 224 240 224 192
WIRE 256 240 224 240
WIRE 560 240 512 240
WIRE 592 240 560 240
WIRE 736 240 672 240
WIRE 960 240 960 -112
WIRE 912 256 880 256
WIRE 256 304 224 304
WIRE 576 304 512 304
WIRE 912 304 576 304
WIRE -96 336 -96 288
WIRE 128 336 128 304
WIRE 192 336 128 336
WIRE 224 336 224 304
WIRE 224 336 192 336
WIRE 128 352 128 336
WIRE 576 352 576 304
WIRE 960 368 960 320
WIRE 128 464 128 432
WIRE 384 464 384 368
WIRE 384 464 128 464
WIRE 576 464 576 416
WIRE 384 512 384 464
WIRE 960 512 960 448
SYMBOL cap 560 352 R0
SYMATTR InstName C3
SYMATTR Value 0.1
SYMBOL res 112 208 R0
SYMATTR InstName R2
SYMATTR Value 100k
SYMBOL voltage 576 240 R270
WINDOW 0 24 96 Left 2
WINDOW 3 24 16 Left 2
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V3
SYMATTR Value 3
SYMBOL bv 96 -16 R0
SYMATTR InstName B1
SYMATTR Value V=V(BATT)*V(OUT)/V(VL)
SYMBOL res 112 336 R0
SYMATTR InstName R3
SYMATTR Value 50k
SYMBOL voltage -144 -112 R90
WINDOW 0 -47 40 VRight 2
WINDOW 3 51 55 VRight 2
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V1
SYMATTR Value 5
SYMBOL LTC1998 384 272 R0
WINDOW 3 -103 2 Left 2
SYMATTR InstName U1
SYMBOL sw 960 224 R0
SYMATTR InstName S2
SYMATTR Value LOADSW
SYMBOL cap 240 -80 R0
SYMATTR InstName BATTERY
SYMATTR Value 500
SYMBOL voltage -96 192 R0
WINDOW 0 24 96 Left 2
WINDOW 3 24 16 Left 2
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V2
SYMATTR Value 10
SYMBOL sw 16 -112 R270
WINDOW 3 28 92 VRight 2
WINDOW 0 47 41 VRight 2
SYMATTR Value CHARGER
SYMATTR InstName S1
SYMBOL res 0 208 R270
WINDOW 0 32 56 VTop 2
WINDOW 3 0 56 VBottom 2
SYMATTR InstName R1
SYMATTR Value 850k
SYMBOL res 944 352 R0
SYMATTR InstName R6
SYMATTR Value 200k
SYMBOL res -16 -128 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R4
SYMATTR Value 30k
FLAG 384 512 0
FLAG -96 336 0
FLAG 736 240 0
FLAG -288 -112 0
FLAG 256 16 0
FLAG 576 464 0
FLAG 960 512 0
FLAG 48 -16 0
FLAG 880 256 0
FLAG 576 304 OUT
FLAG 96 112 0
FLAG 448 -112 BATT
FLAG 560 240 VL
FLAG 192 192 VHA
FLAG 192 336 VTHA
TEXT -16 536 Left 2 !.tran 100 startup
TEXT 328 600 Left 2 !.model CHARGER SW(Ron=1G Roff=1 Vt=2.1 Vh=2)
TEXT 328 568 Left 2 !.model LOADSW SW(Ron=1 Roff=1G Vt=2.5)