Problem with CD4040B counter simulation in PSpice

In summary: When I double-click on the CD4040 symbol in my PSPICE schematic,I get this in MicroCAP 9:(Also, what happens when you feed in the clock and monitor the LSB output? Try different amplitude clocks.)In summary, when trying to make a DAC R-2R ladder with the CD4040B counter, it is not a good practice to leave the CMOS inputs floating and the simulation stays exactly the same even when you supply the clock input. You should at least tie off the RESET input low (inactive) and check the counter outputs to be sure they are counting like you expect when you supply the clock input. If you're using LTspice, make
  • #1
milanetf
6
1
TL;DR Summary
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: 679
  • Screenshot_1.png
    Screenshot_1.png
    13 KB · Views: 316
Engineering news on Phys.org
  • #2
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
 
  • #3
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! :)
 
  • #4
What do you see when you monitor the input and output signals on the CD4040? Is it counting?
 
  • #5
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
 
  • #6
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
 
  • #7
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
 
  • #8
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: 230
  • Screenshot_2.png
    Screenshot_2.png
    33.6 KB · Views: 248
  • #9
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 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

  • CD4040.txt
    2.5 KB · Views: 224
  • #16
  • Like
Likes NTL2009 and berkeman

1. What is the CD4040B counter and how is it used in PSpice simulations?

The CD4040B is a 12-bit ripple counter integrated circuit (IC) that is commonly used in digital electronics. In PSpice simulations, it can be used to count clock pulses and generate output signals based on the count value.

2. Why am I experiencing problems with the CD4040B counter simulation in PSpice?

There could be several reasons for problems with the CD4040B counter simulation in PSpice. Some common issues include incorrect connections, improper setup of simulation parameters, or incorrect model selection for the IC. It is important to carefully review the setup and troubleshoot any potential errors.

3. How can I ensure accurate results in my CD4040B counter simulation in PSpice?

To ensure accurate results, it is important to carefully select the appropriate model for the CD4040B IC and verify that all connections and simulation parameters are set correctly. It may also be helpful to compare the simulation results with the expected behavior of the counter in a real-world circuit.

4. Are there any common mistakes to avoid when simulating the CD4040B counter in PSpice?

Some common mistakes to avoid when simulating the CD4040B counter in PSpice include incorrect connections, using the wrong model for the IC, and not setting up the simulation parameters properly. It is also important to make sure that the clock signal is properly connected and that the simulation time is sufficient for the counter to reach its maximum count value.

5. Can I use the CD4040B counter in PSpice for more complex simulations?

Yes, the CD4040B counter can be used in more complex simulations in PSpice. It can be combined with other components and models to create more advanced digital circuits and systems. However, it is important to carefully review the setup and ensure that all connections and parameters are accurately configured for the desired simulation.

Similar threads

Replies
9
Views
4K
  • Electrical Engineering
Replies
26
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
5
Views
3K
Replies
3
Views
2K
  • High Energy, Nuclear, Particle Physics
Replies
1
Views
778
  • Electrical Engineering
Replies
15
Views
4K
Replies
24
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
1K
  • Electrical Engineering
Replies
1
Views
946
Replies
4
Views
406
Back
Top