* Z:\home\khalils\Downloads\files\data\raw_asc\3e775f304c94_SPWM_Generator.asc
* Generated by LTspice 26.0.1 for Windows.
* We the output amplitude to be able to go between 1V pk - pk, to 3V pk - pk.\nWe get 1V pk - pk when R3 = 2k\nWe get 3V pk - pk when R3 = 6k\n \nWe want the frequency to go between 30kHz and 100kHz at 2V pk - pk (R3 = 5k Ohm)\nwe can find frequency roughly with the following equation: f = (1000/R1) * 30,000\nWe get 30kHz when R1= 1k Ohm\nWe get 100kHz when R1 = 200 Ohm
V1 V+ 0 5
XU1 N004 Vref V+ 0 N003 TL972 ;pnba In+)In-)V+)V-)OUT
R2 N003 N004 10k
R3 Triangle N004 5k
XU4 audio Triangle V+ 0 N005 LMV393 ;pnba In+)In-)V+)V-)OUT
R4 V+ N002 10k
V3 audio 0 SINE(2.5 1 500 0)
XU3 Triangle audio V+ 0 N002 LMV393 ;pnba In+)In-)V+)V-)OUT
C1 Triangle N001 15n
R7 V+ N005 10k
XU2 Vref N001 V+ 0 Triangle TL972 ;pnba In+)In-)V+)V-)OUT
R1 N001 N003 200
V2 Vref 0 2.5
.tran 0 0.0005 0.0001 0.01 startup
.include lib/LMH6658.lib
.include lib/TL972.lib
.include lib/LMV393.MOD
.backanno
.end

* LTspice schematic (.asc):
Version 4
SHEET 1 1592 708
WIRE 320 -16 256 -16
WIRE 448 -16 384 -16
WIRE 1024 16 1024 0
WIRE 1184 48 1184 16
WIRE 1184 48 1056 48
WIRE -32 96 -96 96
WIRE 1024 96 1024 80
WIRE 96 112 32 112
WIRE 128 112 96 112
WIRE 256 112 256 -16
WIRE 256 112 208 112
WIRE 304 112 256 112
WIRE -32 128 -96 128
WIRE 448 128 448 -16
WIRE 448 128 368 128
WIRE 528 128 448 128
WIRE -720 144 -720 112
WIRE -624 144 -624 112
WIRE -528 144 -528 112
WIRE 304 144 256 144
WIRE 0 160 0 144
WIRE 336 176 336 160
WIRE 1024 192 1024 176
WIRE 1184 224 1184 192
WIRE 1184 224 1056 224
WIRE -96 256 -96 128
WIRE -48 256 -96 256
WIRE 96 256 96 112
WIRE 96 256 32 256
WIRE -720 272 -720 224
WIRE -624 272 -624 224
WIRE -528 272 -528 224
WIRE 1024 272 1024 256
WIRE -96 320 -96 256
WIRE 144 320 -96 320
WIRE 448 320 448 128
WIRE 448 320 224 320
SYMBOL voltage -720 128 R0
SYMATTR InstName V1
SYMATTR Value 5
SYMBOL OpAmps\\opamp2 1024 -16 R0
SYMATTR InstName U3
SYMATTR Value LMV393
SYMBOL res 240 304 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R3
SYMATTR Value 5k
SYMBOL voltage -624 128 R0
SYMATTR InstName V2
SYMATTR Value 2.5
SYMBOL voltage -528 128 R0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V3
SYMATTR Value SINE(2.5 1 500 0)
SYMBOL res 1168 -80 R0
SYMATTR InstName R4
SYMATTR Value 10k
SYMBOL res 224 96 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R1
SYMATTR Value 200
SYMBOL OpAmps\\opamp2 336 64 R0
SYMATTR InstName U2
SYMATTR Value TL972
SYMBOL res 1168 96 R0
SYMATTR InstName R7
SYMATTR Value 10k
SYMBOL OpAmps\\opamp2 0 48 R0
SYMATTR InstName U1
SYMATTR Value TL972
SYMBOL res 48 240 R90
WINDOW 0 0 56 VBottom 2
WINDOW 3 32 56 VTop 2
SYMATTR InstName R2
SYMATTR Value 10k
SYMBOL OpAmps\\opamp2 1024 160 R0
SYMATTR InstName U4
SYMATTR Value LMV393
SYMBOL cap 384 -32 R90
WINDOW 0 0 32 VBottom 2
WINDOW 3 32 32 VTop 2
SYMATTR InstName C1
SYMATTR Value 15n
FLAG -720 112 V+
FLAG -720 272 0
FLAG 0 80 V+
FLAG 336 96 V+
FLAG 0 160 0
FLAG 336 176 0
FLAG -624 112 Vref
FLAG -624 272 0
FLAG -96 96 Vref
FLAG 256 144 Vref
FLAG 528 128 Triangle
FLAG 1024 96 0
FLAG 1024 272 0
FLAG 1024 0 V+
FLAG 1024 176 V+
FLAG -528 272 0
FLAG -528 112 audio
FLAG 992 32 audio
FLAG 992 240 audio
FLAG 992 64 Triangle
FLAG 992 208 Triangle
FLAG 1184 -64 V+
FLAG 1184 112 V+
TEXT -744 -128 Left 2 !.tran 0 0.0005 0.0001 0.01 startup
TEXT -744 -152 Left 2 !.include lib/LMH6658.lib
TEXT -744 -176 Left 2 !.include lib/TL972.lib
TEXT 896 -176 Left 2 !.include lib/LMV393.MOD
TEXT -168 496 Left 2 ;We the output amplitude to be able to go between 1V pk - pk, to 3V pk - pk.\nWe get 1V pk - pk when R3 = 2k\nWe get 3V pk - pk when R3 = 6k\n \nWe want the frequency to go between 30kHz and 100kHz at 2V pk - pk (R3 = 5k Ohm)\nwe can find frequency roughly with the following equation: f = (1000/R1) * 30,000\nWe get 30kHz when R1= 1k Ohm\nWe get 100kHz when R1 = 200 Ohm