Question about Counter in LTspice for Load Disconnection/Reconnection

Thread Starter

Paula Lomparde

Joined Mar 6, 2025
11
Hi, I’m taking a university course and I have some doubts about how to implement a counter in LTspice for load management. This is not for any assignment, but I’ve been trying to solve it for a while and I haven’t been able to.

I have two input signals: one for disconnection and one for reconnection. If both are 0 (00), the system should disconnect a load. If they are 01 or 10, nothing should change. If both are 1 (11), then a load should be reconnected. (I would have 4 loads)

I would really appreciate any help. Thanks!
I’d also like to know what type of counter would be suitable for this in LTspice and if anyone has a working SPICE model.
 

crutschow

Joined Mar 14, 2008
38,423
I have two input signals: one for disconnection and one for reconnection. If both are 0 (00), the system should disconnect a load. If they are 01 or 10, nothing should change. If both are 1 (11), then a load should be reconnected. (I would have 4 loads)
It would appear that you need a latch for this purpose, not a counter.
The latch is set when the the input is 11 and reset when the input is 00.
 

Thread Starter

Paula Lomparde

Joined Mar 6, 2025
11
hi Paula,
Please post your circuit diagram.
E
I don’t have a circuit yet because I’m still trying to figure out how to implement this. However, I believe it can be achieved using a counter to control all the loads. I don’t see how a latch alone could manage multiple loads effectively.
If the input is 00, it should disconnect Load 1 (Q1). If it receives another 00 pulse, it should disconnect Load 2 (Q2). But if the input is 11, it should reconnect Load 2 (Q2), and so on.
Would a counter still be the best choice for this, or should I consider a different approach?
 

crutschow

Joined Mar 14, 2008
38,423
If the input is 00, it should disconnect Load 1 (Q1). If it receives another 00 pulse, it should disconnect Load 2 (Q2). But if the input is 11, it should reconnect Load 2 (Q2), and so on.
Okay, I didn't understand that you wanted to connect/disconnect the loads in sequence.
For that a decade counter, such as the CD4017 should work.
For an LTspice simulation, you would need to download the models for that.
 

Thread Starter

Paula Lomparde

Joined Mar 6, 2025
11
Okay, I didn't understand that you wanted to connect/disconnect the loads in sequence.
For that a decade counter, such as the CD4017 should work.
For an LTspice simulation, you would need to download the models for that.
Thank you so much for the replying.
Do you have the LTSpice model to download?
 

ericgibbs

Joined Jan 29, 2010
21,421
Hi Paula,
Use F2 key on your asc file to show the available models, do you see any Logic IC models in your installation?
E
 

Thread Starter

Paula Lomparde

Joined Mar 6, 2025
11
See attached for both the CD4000 and the 74HCxxx digital models.
Put the .lib files in the lib\cmp folder, and the contents of the .zip file in the lib\symbol folder.


Hello,
I am trying to simulate the 74HC163 in LTspice, but I keep getting the following error message:
Unknown subcircuit called in: 74HC163 vcc=5 speed=1.0 tripdt=1e-9
I have checked the .lib file and found that the model definition is:

.SUBCKT 74HC163 MR PE CEP CET CP D0 D1 D2 D3 Q0 Q1 Q2 Q3 TC VCC VGND

I also noticed that VCC and VGND do not appear in the .asy symbol, so I tried modifying them to add these connections, but LTspice still does not recognize them correctly.

Could you guide me on how to make the model work properly? Should I modify anything else in the .lib or .asy files?

Thank you for your help.
 

Thread Starter

Paula Lomparde

Joined Mar 6, 2025
11
Hi Paula.
Add this to yor circuit.
.inc 74HC.lib
E



Hi again,
I've been working on my idea with the counter, but I haven't achieved a satisfactory result yet.
I have two comparators: one that triggers disconnection on a falling edge at 0V and another that triggers reconnection on a rising edge at 1V. With these signals, I want to control the disconnection and reconnection of loads, ideally using a counter or another central component that can manage the entire process efficiently.
I’m attaching my model so you can better understand what I’ve tried so far. Any suggestions or guidance on how to implement this properly would be greatly appreciated.

Thanks in advance!
 

Attachments

ericgibbs

Joined Jan 29, 2010
21,421
Hi Paula,
Checked your simulation.
Your description of the pulse edges action that what you are requiring, is difficult to follow.
I would suggest posting a hand drawn pulse train, showing the edges and the timing details.

E
 

eetech00

Joined Jun 8, 2013
4,704
Hi, I’m taking a university course and I have some doubts about how to implement a counter in LTspice for load management. This is not for any assignment, but I’ve been trying to solve it for a while and I haven’t been able to.

I have two input signals: one for disconnection and one for reconnection. If both are 0 (00), the system should disconnect a load. If they are 01 or 10, nothing should change. If both are 1 (11), then a load should be reconnected. (I would have 4 loads)

I would really appreciate any help. Thanks!
I’d also like to know what type of counter would be suitable for this in LTspice and if anyone has a working SPICE model.
Hi

Your description of the signal inputs states versus the "connect" state describes an 'AND" function of the two signal inputs. What other circuit behavior is required?
 
Top