Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Model of LM331 for LTSpice

Status
Not open for further replies.
Post your LTspice schematic
Used generic DFLOP, instead of the CD4013B FF.
See attachment . . .
LOG file is now down to 4 fail'ed '.meas' statements:
p6_p1=0.035 FROM 0 TO 0.035
t1: time=0.0321918 at 0.0321918
t2: time=0.0323835 at 0.0323835
per: (t2-t1)=0.000191633
freq: 1/(t2-t1)=5218.3
Measurement "t1_q" FAIL'ed
Measurement "t2_2" FAIL'ed
Measurement "per_q" FAIL'ed
Measurement "freq_q" FAIL'ed
 

Attachments

  • LM331_Stand-Alone_V-to-F_Converter_Test_meas.pdf
    491.9 KB · Views: 356
Used generic DFLOP, instead of the CD4013B FF.
See attachment . . .
LOG file is now down to 4 fail'ed '.meas' statements:
p6_p1=0.035 FROM 0 TO 0.035
t1: time=0.0321918 at 0.0321918
t2: time=0.0323835 at 0.0323835
per: (t2-t1)=0.000191633
freq: 1/(t2-t1)=5218.3
Measurement "t1_q" FAIL'ed
Measurement "t2_2" FAIL'ed
Measurement "per_q" FAIL'ed
Measurement "freq_q" FAIL'ed

Change the wire label at FF output so that it matches the value used in the meas statements

For example:
change the wire label at the FF output from "Vq" to just "q"

Also:

When using the digital "A device", set the following internal params so that it switches with reasonable characteristics
(right-click on symbol):

Vhigh=4.5 <-----logic high
Td=200n <-----Prop delay
Tau=20n <-----trise/tfall
Tripdt=2n <----sensitivity

Remove the ground connections from FF "pre" and "clr" or insert a resistor from each terminal to ground.
(This is for "A device" simulation purposes only)

Otherwise its behavior may be misleading.
Review "A device" help for param settings.
 
Last edited:
Change the wire label at FF output so that it matches the value used in the meas statements

For example:
change the wire label at the FF output from "Vq" to just "q"

Also:

When using the digital "A device", set the following internal params so that it switches with reasonable characteristics
(right-click on symbol):

Vhigh=4.5 <-----logic high
Td=200n <-----Prop delay
Tau=20n <-----trise/tfall
Tripdt=2n <----sensitivity

Remove the ground connections from FF "pre" and "clr" or insert a resistor from each terminal to ground.
(This is for "A device" simulation purposes only)

Otherwise its behavior may be misleading.
Review "A device" help for param settings.
Hi,
Changed FF output to 'q'.
Removed FF ground connections.
Where's any 'A device' help docs found and please translate 'A device' internal params. I found only what's in attachment, which also shows the 1 volt swing for V(q).

The following warning were flagged, plus the same '.meas' statement failures.
Attachment has the only FF I used in my electronics, the 74HC74 Dual-D, able to drive 10 LSTTL loads.
****
WARNING: Less than two connections to node Q. This node is used by A1.
Direct Newton iteration failed to find .op point. (Use ".option noopiter" to skip.)

p6_p1=0.035 FROM 0 TO 0.035
t1: time=0.0321884 at 0.0321884
t2: time=0.0323802 at 0.0323802
per: (t2-t1)=0.000191764
freq: 1/(t2-t1)=5214.75

Measurement "t1_q" FAIL'ed
Measurement "t2_2" FAIL'ed
Measurement "per_q" FAIL'ed
Measurement "freq_q" FAIL'ed
 

Attachments

  • LM331_Stand-Alone_V-to-F_Converter_Test_meas2.pdf
    622.9 KB · Views: 330
Hi,
Changed FF output to 'q'.
Removed FF ground connections.
Where's any 'A device' help docs found and please translate 'A device' internal params. I found only what's in attachment, which also shows the 1 volt swing for V(q).

The following warning were flagged, plus the same '.meas' statement failures.
Attachment has the only FF I used in my electronics, the 74HC74 Dual-D, able to drive 10 LSTTL loads.
****
WARNING: Less than two connections to node Q. This node is used by A1.
Direct Newton iteration failed to find .op point. (Use ".option noopiter" to skip.)

p6_p1=0.035 FROM 0 TO 0.035
t1: time=0.0321884 at 0.0321884
t2: time=0.0323802 at 0.0323802
per: (t2-t1)=0.000191764
freq: 1/(t2-t1)=5214.75

Measurement "t1_q" FAIL'ed
Measurement "t2_2" FAIL'ed
Measurement "per_q" FAIL'ed
Measurement "freq_q" FAIL'ed

1. You'll have to look in "Help" for "A device" info.

2. You forgot to remove the FF ground connections.

3. Your schematic should look like below.

Question:
Why don't you just run the whole circuit with a 5v supply (then remove R2)?

1600033362545.png


DFlop Component Attribute settings:

1600033739257.png
 
1. You'll have to look in "Help" for "A device" info.
Question:
Why don't you just run the whole circuit with a 5v supply (then remove R2)?
Agree on a 5v supply, after seeing attachment!
Two '.meas' statements remain to be fixed another day, plus this warning:
* * *
WARNING: Less than two connections to node Q. This node is used by A1.
Direct Newton iteration failed to find .op point. (Use ".option noopiter" to skip.)

p6_p1=0.035 FROM 0 TO 0.035
t1: time=0.0321825 at 0.0321825
t2: time=0.0323741 at 0.0323741
per: (t2-t1)=0.000191643
freq: 1/(t2-t1)=5218.04
t1_q: time=0.0327628 at 0.0327628
t2_2: time=0.0331464 at 0.0331464

Measurement "per_q" FAIL'ed
Measurement "freq_q" FAIL'ed
_____________________^^^
 

Attachments

  • LM331_Stand-Alone_V-to-F_Converter_Test_5volt.pdf
    228 KB · Views: 326
Agree on a 5v supply, after seeing attachment!
Two '.meas' statements remain to be fixed another day, plus this warning:
* * *
WARNING: Less than two connections to node Q. This node is used by A1.

This is warning that there is only one connection at the FF "Q" net.
You can ignore this warning or connect a 10k load resistor from FF "Q" to ground like I did.

Measurement "per_q" FAIL'ed
Measurement "freq_q" FAIL'ed

You made a typing error in the second .meas statement.
change:
.meas tran T2_2 ........
to:
.meas tran T2_q

Also,

Change Dflop attribute value "Vhigh=4.5" to "Vhigh=5.0"

See Below.

1600060124018.png
 
Last edited:
This is warning that there is only one connection at the FF "Q" net.
You can ignore this warning or connect a 10k load resistor from FF "Q" to ground like I did.
Hi,
Instead of the 10k phantom load, I attached the actual load for "Q" net.
Snapshot shows 'EAR' having R34, 220 ohm to ground and C10, 10 nF & R33, 4K in series, feeding pin 20 of IC1

The other simulation tweak, couldn't V(in) plot display a ramp-up leading edge, like V(ina)?
My first experience with this app, I fed a 60 hz DC pulse to V-F input, which the software displayed on the computer screen, just like a $$$ Tektronic!
 

Attachments

  • FF_actual_load.pdf
    47.3 KB · Views: 297
Hi,
Instead of the 10k phantom load, I attached the actual load for "Q" net.
Snapshot shows 'EAR' having R34, 220 ohm to ground and C10, 10 nF & R33, 4K in series, feeding pin 20 of IC1

The other simulation tweak, couldn't V(in) plot display a ramp-up leading edge, like V(ina)?
My first experience with this app, I fed a 60 hz DC pulse to V-F input, which the software displayed on the computer screen, just like a $$$ Tektronic!

what is EAR?

Not sure what you mean by “couldn’t v(in) plot”
Just click the “in” wire label.

please post your schematic.
 
Last edited:
what is EAR?

Not sure what you mean by “couldn’t v(in) plot”
Just click the “in” wire label.

please post your schematic.
'EAR' is the 'IN' port of the Z80 microprocessor, that the LM331 V-F's flip flop feeds.
I posted the schematic in post #37.

What I mean by "couldn't V(in) plot" is to use a 0 to 1 volt 60 hz square wave, instead of just a static DC V(in), to see if it can plot with a dynamic input.
 
'EAR' is the 'IN' port of the Z80 microprocessor, that the LM331 V-F's flip flop feeds.
I posted the schematic in post #37.

What I mean by "couldn't V(in) plot" is to use a 0 to 1 volt 60 hz square wave, instead of just a static DC V(in), to see if it can plot with a dynamic input.

You mean a 60Hz square wave input of increase magnitude? Over what span of time?

The square wave won't be square in magnitude if I do that. But I can run multiple sims while increasing the square wave amplitude by a "stepped" amount. If you notice on the schematic, there is a commented out statement:

.step param IN 250m 1 250m

This means "step the IN param from 250mV to 1V in 250mV increments". If you uncomment it, it will execute at the next run.
 
Last edited:
You mean a 60Hz square wave input of increase magnitude? Over what span of time?
The square wave won't be square in magnitude if I do that. But I can run multiple sims while increasing the square wave amplitude by a "stepped" amount. If you notice on the schematic, there is a commented out statement:
.step param IN 250m 1 250m
This means "step the IN param from 250mV to 1V in 250mV increments". If you uncomment it, it will execute at the next run.
How should I uncomment: '.step param IN 250m 1 250m'

All I'm suggesting is to sweep a 0-1 volt square wave input frequency from 10 hz to 100 hz to 1,000 hz to 10,000 hz etc., and see what input bandwith frequency's V(q) can plot digitally. Stop sweep when V(q) get's corrupted.
 
Last edited:
How should I uncomment: '.step param IN 250m 1 250m'

All I'm suggesting is to sweep a 1 volt square wave input frequency from 10 hz to 100 hz to 1,000 hz to 10,000 hz etc., and see what input bandwith frequency the output can plot digitally. Then stop the sweep, when V(out) gets corrupted.

Why? The output frequency will be the same. Either 0 or FS frequency.
 
Why? The output frequency will be the same. Either 0 or FS frequency.
Agree, V(q) will be either 0 or ~20khz, 50% duty cycle, but at some V(in) frequency, V(q) get's corrupted.
My question is, can simulation plot this 'roll-off' frequency of V(in), showing when V(q) get's a corrupted 50% duty cycle?

Also, how is the SPICE directive '.step param IN 250m 1 250m' be uncommented in your schematic?
thx!
 
Agree, V(q) will be either 0 or ~20khz, 50% duty cycle, but at some V(in) frequency, V(q) get's corrupted.
My question is, can simulation plot this 'roll-off' frequency of V(in), showing when V(q) get's a corrupted 50% duty cycle?

Also, how is the SPICE directive '.step param IN 250m 1 250m' be uncommented in your schematic?
thx!

how is v(q) going to get “corrupted”? The flip flop is edge triggered. It can’t get “corrupted”.
Why is the filter needed at the EAR input?

you can uncomment by rht-clk the text and select directive.
 
how is v(q) going to get “corrupted”? The flip flop is edge triggered. It can’t get “corrupted”.
Why is the filter needed at the EAR input?

you can uncomment by rht-clk the text and select directive.
I'll take your word for 'no' corrupted V(q).

By asking why I need a filter for EAR input, 'EAR' R34, 220 ohm to ground form's IC1's input impedence, which will be the actual FF's load, while C10, 10 nF block's DC from IC1 & R33, 4K in series to pin 20 of IC1 would be a crap-shoot, maybe a quazi choke. Please remember this design was for using a 'tape' cassette, that's known for 'hiss'.

The present values are for a 1 volt full scale sensitivity and I would like to sense higher ranges by preceding the V-F with a resistive voltage divider.
Hit the link below to see if using this 1M pot with switch can be simulated with a 10 volt and 100 volt sensitivity range, too.
link
Since simulation is stable with my pick of Ct, I'd like to push sensitivity up a notch using a 47pf for Ct . . .
 
Last edited:
I'll take your word for 'no' corrupted V(q).

By asking why I need a filter for EAR input, 'EAR' R34, 220 ohm to ground form's IC1's input impedence, which will be the actual FF's load, while C10, 10 nF block's DC from IC1 & R33, 4K in series to pin 20 of IC1 would be a crap-shoot, maybe a quazi choke. Please remember this design was for using a 'tape' cassette, that's known for 'hiss'.

You never said anything about audio....and I did ask.

But anyway...You do realize that the FF is a digital device, right? So there is no analog signal at its output. It's output is a digital square wave. That's why use of the filter is confusing to me. Seems like that should be at the front of the input signal chain before the V-F.

Frankly, I still don't know what your trying to design.

The present values are for a 1 volt full scale sensitivity and I would like to sense higher ranges by preceding the V-F with a resistive voltage divider.
Hit the link below to see if using this 1M pot with switch can be simulated with a 10 volt and 100 volt sensitivity range, too.
link

Simulating the pot is no problem.

Since simulation is stable with my pick of Ct, I'd like to push sensitivity up a notch using a 47pf for Ct . . .

You realize you'll be changing the FS frequency, right?
 
You never said anything about audio....and I did ask.

But anyway...You do realize that the FF is a digital device, right? So there is no analog signal at its output. It's output is a digital square wave. That's why use of the filter is confusing to me. Seems like that should be at the front of the input signal chain before the V-F.

Frankly, I still don't know what your trying to design.

Simulating the pot is no problem.

You realize you'll be changing the FS frequency, right?
The cassette signal represent's digital, as shown on attachment. I could provide the software docs, if you code, which just might help grasp the design.

Please provide your concept of simulating the 1M pot to sense higher ranges to 10 volts, 100 volts DC, etc., utilizing its switch. When the switch is OFF, the pot's output to V(in) should be at 1M.

The plan is to go from a 1 volt full scale sensitivity level, down to a .1 volt full scale sensitivity level, so FS frequency should not change.
. . . your reach must exceed your grasp, during simulation
 

Attachments

  • digital.pdf
    733.6 KB · Views: 299
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top