Problem with CD4040B counter simulation in PSpice

Click For Summary

Discussion Overview

The discussion revolves around issues encountered while simulating a CD4040B counter in PSpice, specifically in the context of creating a DAC R-2R ladder. Participants are exploring the reasons for unexpected output behavior, which is a straight line instead of the anticipated staircase waveform.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Experimental/applied

Main Points Raised

  • One participant reports that the output of their DAC simulation is a straight line rather than a staircase, indicating a potential issue with the CD4040B counter setup.
  • Another participant suggests that floating CMOS inputs can cause noise and power consumption issues, recommending that the RESET input be tied low.
  • A participant questions whether the CD4040 is counting correctly and asks about the power supply and clock input levels, noting that a 1V square wave may not meet the Vih specification.
  • Concerns are raised about the absence of visible power supply connections in the PSpice symbol for the CD4040, leading to confusion about how to properly set up the simulation.
  • Suggestions are made to simplify the circuit and to ensure that the supply voltage and clock signal levels are appropriate for the CD4040 operation.
  • One participant mentions observing an unexpected output voltage level of 2.6V, questioning whether the correct operating voltage is being applied.
  • Another participant shares their experience with a different SPICE tool, noting that they achieved closer results but are still unclear about the output voltage offset issue.
  • There is a request for the complete model definition of the CD4040 to better understand its operation in the simulation.
  • Discussion includes the output drive capability of the CD4040 at different supply voltages, indicating that the ladder network's impedance may need adjustment to avoid exceeding the chip's drive capability.

Areas of Agreement / Disagreement

Participants express various concerns and suggestions, but there is no consensus on the specific cause of the simulation issue or the correct setup for the CD4040B counter in PSpice. Multiple competing views and approaches are presented.

Contextual Notes

Participants note limitations in the visibility of power pins in the PSpice model and the need for proper voltage levels for the CD4040 to function correctly. There are unresolved questions regarding the output voltage levels and the appropriate setup for the DAC circuit.

milanetf
Messages
6
Reaction score
1
TL;DR
Problems with results of DAC R-2R converter with CD4040B ripple counter
I am trying to make a DAC R-2R ladder with CD4040B counter. Output should be a staircase but it is just a straight line in my simulation. I am probably doing something wrong as I am not that experienced with Spice so I would appreciate any help. I tried it without counter(just attached four clocks on every bit) and it worked just as supposed.
 

Attachments

  • Screenshot1.png
    Screenshot1.png
    5.8 KB · Views: 797
  • Screenshot_1.png
    Screenshot_1.png
    13 KB · Views: 421
Engineering news on Phys.org
Welcome to the PF. :smile:

I don't know if it's the source of the problem, but it is bad practice in general to leave CMOS inputs floating. In real circuits, it generates noise and increases the power consumption of the device with the floating CMOS input.

So in your circuit you should at least tie off the RESET input low (inactive). Then check the counter outputs to be sure they are counting like you expect when you supply the clock input.

1566312826906.png
 
Hi,thanks for your reply. I did as you said for the reset input, but the simulation stays the same. I am not sure what is the problem as this circuit really isn't that complicated. Thanks for the advice anyway! :)
 
What do you see when you monitor the input and output signals on the CD4040? Is it counting?
 
Also, what is the power supply for the CD4040? Are you just feeding a 1V square wave into the clock input? That will not meet the Vih spec of the CD4040...

1566320542072.png
 
I know that it should have a power supply but there is no other input on this symbol, except INPUT and RESET. I have a component and it has a clk input and a supply voltage but here in spice,this symbol does not have anything else. I guess I am missing something :D
 
What do you get when you double-click on the CD4040 symbol in your PSPICE schematic? Here is what I get in MicroCAP 9:

(also, what happens when you feed in the clock and monitor the LSB output? Try different amplitude clocks?

1566322482894.png
 
I noticed that even when I leave both input floating the simulation stays exactly the same as before,it still shows that straight line at the same voltage level,even more confusing,maybe that will help you understand what is going on,because I am stuck for days at this.
Double clicking on symbol is just editing properties. When clicking od edit PSpise model this pop up. Also when I feed the clock and monitor LSB it is also just a voltage level(straight line) at 2.6V.
 

Attachments

  • Screenshot_3.png
    Screenshot_3.png
    9.9 KB · Views: 312
  • Screenshot_2.png
    Screenshot_2.png
    33.6 KB · Views: 335
milanetf said:
Also when I feed the clock and monitor LSB it is also just a voltage level(straight line) at 2.6V.
How come it is 2.6V? I thought these CMOS devices needed 3 to 18 volts supply and the high output should be very close to this, such as 2.95V. I am not sure you have correct operating voltage, but I am sorry I don't know how to specify that in SPICE.
 
  • #10
Screenshot_3.png shows power pins can be made visible.
Connect the supplies.

2.65 volts is near the middle of 0V and 5V supplies.

Maybe you could simplify your circuit.
Set supply voltage and all signal inputs to 0V and 5V.
Generate a 1kHz clock and view it.

Then simulate a CD4001 NOR gate. Use it to invert the 1 kHz clock.
When that works, add the CD4040 to the simulated circuit.

I cannot make you a Pspice example circuit because I use LTspice.
Logic functions in LTspice default to levels of 0 and 1 volt. Expect surprises.
 
  • #11
Try adding a battery for the supply voltage.
Battery "-" to GND (or the Gnd symbol) and to a network you name VSS
Battery "+" to a network you name VDD (VDD for CMOS devices, VCC for bipolar devices)

The VSS and VDD don't have to go anywhere other than the supply (battery), naming them should get Pspice parts libraries to recognize it as a supply.

Make the clock signal amplitude from 0V to the battery voltage.

EDIT: This is from the ORCAD manual but probably very similar to PSpice.

To display invisible power pins
Invisible power pins always appear in the part editor. The
method by which you display invisible power pins in the
schematic page editor determines whether you can connect
wires and other connectivity objects to them
On a part instance
1 Select the part in the schematic page editor.
2 From the Edit menu, choose Properties.
3 Find the Power Pins Visible property column on the
property editor Parts tab and select the check box, then
close the property editor.

Cheers,
Tom
 
Last edited:
  • #12
milanetf said:
I noticed that even when I leave both input floating the simulation stays exactly the same as before,it still shows that straight line at the same voltage level,even more confusing,maybe that will help you understand what is going on,because I am stuck for days at this.
I did a quick test in MicroCAP 9 SPICE, and got closer to having it working. I'm still not clear why the output voltage levels are too high even when I run the CD4040 at VDD = 5V and use a 5V pulse input source into the clock. I use a DC voltage source on the Reset input to verify that there is no clock output signal when RESET is HIGH = 5V, and the output signal is the clock /2 when RESET is LOW = 0V. I'll try to figure out where the output signal offset is coming from later today if I have time. I mainly use SPICE for analog simulations, so I haven't seen this offset before.

1566406586568.png


1566406673340.png


Run a Transient Analysis:

1566406616660.png


1566406720872.png
 
  • #13
Thanks a lot guys for your replies, I had to work the whole day today so I didnt have any time to test your solutions. I will try it first thing tomorrow and let you know how it went. Once again,thank you!
 
  • Like
Likes   Reactions: berkeman
  • #14
In post #8 there is screenshot 2. That is the CD4040 model definition. Some code is missing.
Can you attach the entire model definition for the CD4040 as a file.txt
Then I can find out how the model actually works.
 
  • #15
Yes,I just noticed that. Here it is:
 

Attachments

  • #16
  • Like
Likes   Reactions: NTL2009 and berkeman

Similar threads

Replies
9
Views
7K
  • · Replies 26 ·
Replies
26
Views
4K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 24 ·
Replies
24
Views
4K
  • · Replies 15 ·
Replies
15
Views
7K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 3 ·
Replies
3
Views
6K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
2
Views
4K