1
\$\begingroup\$

I'm an absolute beginner with LTSpice; my first test circuit uses two D flip-flops: I checked the waveform and found that the D flip-flop is not working properly

Am I doing something wrong, or is LTSpice doing something wrong?

Contents of flipflops.asc file:

Version 4
SHEET 1 880 680
WIRE -640 -64 -736 -64
WIRE -400 -64 -480 -64
WIRE -144 -64 -256 -64
WIRE -64 -64 -80 -64
WIRE -144 -32 -208 -32
WIRE -640 -16 -720 -16
WIRE 64 0 32 0
WIRE -64 16 -64 -64
WIRE -32 16 -64 16
WIRE -16 16 -32 16
WIRE -32 32 -64 32
WIRE -16 32 -32 32
WIRE -208 64 -208 32
WIRE -208 64 -256 64
WIRE -144 64 -208 64
WIRE -64 64 -64 32
WIRE -64 64 -80 64
WIRE -144 96 -256 96
WIRE -736 160 -736 -64
WIRE -640 160 -736 160
WIRE -400 160 -480 160
WIRE -720 208 -720 -16
WIRE -704 208 -720 208
WIRE -720 336 -720 208
WIRE -720 336 -736 336
WIRE -400 336 -720 336
FLAG 64 0 Vout
IOPIN 64 0 Out
FLAG -256 -64 A
IOPIN -256 -64 In
FLAG -256 64 S
IOPIN -256 64 In
FLAG -256 96 B
IOPIN -256 96 In
FLAG -400 -64 A
IOPIN -400 -64 Out
FLAG -400 160 B
IOPIN -400 160 Out
FLAG -400 336 S
IOPIN -400 336 Out
FLAG -816 -64 0
FLAG -816 336 0
FLAG -736 -64 Vin
SYMBOL Digital\\and -112 -112 R0
SYMATTR InstName A1
SYMBOL Digital\\and -112 16 R0
SYMATTR InstName A2
SYMBOL Digital\\or 0 -48 R0
SYMATTR InstName A3
SYMBOL Digital\\inv -272 32 R270
SYMATTR InstName A4
SYMBOL Digital\\dflop -560 -112 R0
SYMATTR InstName A5
SYMBOL Digital\\dflop -560 112 R0
SYMATTR InstName A6
SYMBOL voltage -720 336 R90
WINDOW 0 -32 56 VBottom 2
WINDOW 3 32 56 VTop 2
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V1
SYMATTR Value PULSE(0 5 0 5n 5n 25m 50m)
SYMBOL voltage -720 -64 R90
WINDOW 0 -32 56 VBottom 2
WINDOW 3 -98 30 VTop 2
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V2
SYMATTR Value PULSE(0 5 0 5n 5n 15m 30m)
SYMBOL Digital\\inv -704 144 R0
SYMATTR InstName A7
TEXT -192 240 Left 2 !.tran 160m

netlist

A1 0 A 0 N002 0 0 N001 0 AND
A2 0 S 0 B 0 0 N003 0 AND
A3 0 0 N001 N003 0 0 Vout 0 OR
A4 S 0 0 0 0 N002 0 0 BUF
A5 Vin 0 S 0 0 0 A 0 DFLOP
A6 Vin 0 P001 0 0 0 B 0 DFLOP
V1 S 0 PULSE(0 5 0 5n 5n 25m 50m)
V2 Vin 0 PULSE(0 5 0 5n 5n 15m 30m)
A7 S 0 0 0 0 P001 0 0 BUF
.tran 320m
.backanno
.end

enter image description here

\$\endgroup\$
1
  • \$\begingroup\$ Can you explain more specifically what is going wrong? It seems to be working as expected for me. If you're a beginner, then I highly recommend reading the LTspice built-in help (shortcut key F1). More specifically, the page titled A. Special Functions. \$\endgroup\$
    – Ste Kulov
    Commented Oct 11, 2023 at 16:52

1 Answer 1

0
\$\begingroup\$

It doesn't appear that you have a model attached to the part, check the netlist to see if there is a model for the A parts, if there isn't then and one. If this came from the LT spice librarys you may still need to add a model. Another thing you can do is right click on the part and look though the properties to see if there is a model (usually a file or path listed)

\$\endgroup\$
3
  • \$\begingroup\$ I just edited the question and attached the netlist, it looks like there's no model, how can i slove it? \$\endgroup\$
    – neuron42
    Commented Oct 11, 2023 at 5:55
  • \$\begingroup\$ but i find there is a model path on the window after i right click A part \$\endgroup\$
    – neuron42
    Commented Oct 11, 2023 at 5:56
  • \$\begingroup\$ LTspice A-devices don't need model definitions, but their default parameters usually do need to be adjusted. My guess is that in @neuron42 's case that they are expecting all the A-devices to automatically work at 5V since that is what the input sources are set to. Vhigh defaults to 1V, so each device must be right-click edited to add Vhigh=5 to all of the Value fields. \$\endgroup\$
    – Ste Kulov
    Commented Oct 11, 2023 at 18:44

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.