0
\$\begingroup\$

I created a schematic of a Controlled Oscillator. Frequency is controlled by an external resistor. It's working prefectly as a schematic, but it doesn't work as a hierarchical block. The block of the oscillator also doesn't work when the frequency is fixed - i.e. sensing of the current flowing out throught RT pin is removed. Could you please advice if there is some manual what is allowed/not allowed to use in schematic when I want to create a hierarchical block. enter image description here

From schematic above, I created asy file and sub file:

.subckt OSC_test Latch Start_nOK Start_OK C1 OSC_rst OSC_set RT
C1 in+ 0 100p
V1 in- 0 0.5V
V2 Hyst 0 0.5V
V3 RT 0 1V
I1 0 in+ 3.333µ
B1 in+ 0 I={if(V(Out)>2, 10*(I(B2)+I(I1)),0uA)}
S1 0 in+ N006 0 OSC
A1 N005 N007 0 0 0 N006 OSC_str 0 SRFLOP Vhigh = 1V
A2 Start_nOK Start_nOK 0 Latch Latch 0 N007 0 OR
B2 0 in+ I=-I(V3)*0.989
C2 N005 0 10n
R1 N005 Start_OK 12k
B3 N002 0 V=if(V(in+_,in-_)>V(hyst),V(V+), if(V(in+_,in-_)<-V(hyst),V(0),V(out))) tripdv=0.01 tripdt=1p
R2 V+ 0 1G
R3 in+_ N003 500
R4 in-_ N004 500
C3 in+_ 0 1p
C4 in-_ 0 1p
R5 0 Hyst 1G
R6 Cout N002 10m
C5 Cout 0 100p
E1 Out 0 Cout 0 1
E2 N003 0 in+ 0 1
E3 N004 0 in- 0 1
B4 N001 0 V=if(V(Out)<1,V(V+),V(0)) tripdv=0.01 tripdt=1p
R7 CoutB N001 10m
C6 CoutB 0 100p
E4 OutB 0 CoutB 0 1
R8 in+_ in-_ 10G
R9 in- 0 10G
R10 in+ 0 10G
V5 V+ 0 5V
.ic v(c1) =0
.model OSC SW(Ron=1 Roff=10G Vt=.5 Vh=-.2)
.ic V(Cout) = 0
.ic V(in+_) = 0
.ic V(in-_) = 0
.ic V(CoutB) = 0
.ends OSC_test

enter image description here

When the oscillator is in one block, it suddenly doesn't work by the same way as the schematic.

Is there any possibility how to share my files sub, asy and asc for reviewing?

\$\endgroup\$
3
  • \$\begingroup\$ You can copy/paste the text inside of your .asc and .asy files as a code block, similar to how I did with your .sub file. \$\endgroup\$
    – Ste Kulov
    Commented Jun 23, 2023 at 16:54
  • \$\begingroup\$ It seems all issue is caused by µ symbol in a sub file. When I changed the current value 3.333µ to 3.333u, everything is ok. \$\endgroup\$
    – Zdenek
    Commented Jun 26, 2023 at 15:09
  • \$\begingroup\$ Ah, yes. You should post that as an answer and accept it after the time limit expires. It is interesting that LTspice itself has problems with this since it can accept the character no problem. I've only come across this issue when exporting my netlists to subcircuits for use in other SPICE programs (e.g. ngspice). Anyway, there is an option in the LTspice settings: [Tools]->[Control Panel]->[Netlist Options] where you can check a box to force it to use u instead of µ. \$\endgroup\$
    – Ste Kulov
    Commented Jun 26, 2023 at 20:02

1 Answer 1

1
\$\begingroup\$

This issue is caused by µ symbol in a sub file. When I changed the current value 3.333µ to 3.333u, the oscillator block works without any issue. Therefore, it is better to choose an option in the LTspice settings: [Tools]->[Control Panel]->[Netlist Options] and check a box to force it to use u instead of µ.

\$\endgroup\$

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.