Debian Codegraph @

texmf-dist/doc/latex/circuit-macros/examples/extras/CSlight.m4

raw
1 .PS
2 # Csource.m4
3 ifmpost(command "verbatimtex")
4 command "\newcommand\scriptstack[2][c]{\hbox{\scriptsize\shortstack[#1]{#2}}}%"
5 command "{\scriptsize"
6 ifmpost(command "etex")
7 define(`density',0.90)
8 setrgb(density, density, density)
9
10 cct_init
11 linewid = 0.4
12
13 define(`npair',`[define(`m4lr',ifelse(`$1',,l,r))
14 J: mosfet(down_ dimen_,ifelse(`$1',,R,L),uHSDF,E)
15 "\scriptstack[l]{$Q_{`$2'}$\\ 2N5464}" at J.n+(0,8pt__)
16 G: J.G
17 line ifelse(`$1',,right,left) dimen_/4 from J.D
18 Q: bi_tr(up_ dimen_,ifelse(`$1',,L,R),,E) with .B at Here
19 ifelse(`$1',,r,l)label(,`\scriptstack[m4lr]{$Q_{`$3'}$\\ 2N4239}')
20 E: Q.E
21 S: dot(at (Q.C,J.S))
22 line from J.S to S then to Q.C ]')
23
24 define(`ppair',`[define(`m4lr',ifelse(`$1',,l,r))
25 J: mosfet(down_ dimen_,ifelse(`$1',,R,L),dHSDF,E)
26 "\scriptstack[l]{$Q_{`$2'}$\\ 2N3819}" at J.s-(0,8pt__)
27 G: J.G
28 line ifelse(`$1',,right,left) dimen_/4 from J.S
29 Q: bi_tr(down_ dimen_,ifelse(`$1',,R,L),P,E) with .B at Here
30 ifelse(`$1',,l,r)label(,`\scriptstack[m4lr]{$Q_{`$3'}$\\ 2N4236}')
31 E: Q.E
32 S: dot(at (Q.C,J.D))
33 line from J.D to S then to Q.C ]')
34
35 R2: resistor(down_ dimen_)
36 llabel(,`\scriptstack[l]{$R_2$\\ 150}')
37 dot
38 Q13: bi_tr(down_ dimen_,,P,E) with .E at Here
39 rlabel(,`\scriptstack[r]{$Q_{13}$\\ 2N4236}')
40 line down 3.1*elen_ from Q13.C
41 Q14: bi_tr(up_ dimen_,R,,E) with .C at Here
42 llabel(,`\scriptstack[r]{$Q_{14}$\\ 2N4239}')
43 dot(at Q14.E)
44 { line left_ dimen_*1.3 then up_ dimen_
45 R1: potentiometer(up_ dimen_) with .Start at Here
46 rlabel(,`\scriptstack[l]{$R_1$\\ $20\,$K}')
47 { ground(at R1.T1) }
48 line from R1.End to (R1.End,Q13.E) then to Q13.E }
49 { dot(at Q13.C+(0,-elen_))
50 line to (R1.R,Here)+(-dimen_/2,0)
51 { arrowline(right_ dimen_/2); llabel(,i_1) }
52 V1: gap(down_ dimen_,1); rlabel(+,V_1,-)
53 line down_ dimen_/4 chop dotrad_ chop 0; ground(,T) }
54 R3: resistor(down_ dimen_)
55 llabel(,`\scriptstack[l]{$R_3$\\ 150}')
56 dot(at Q13.C+(0,-2*elen_))
57 line right_ dimen_/2
58 A1: opamp with .In2 at Here; "$A_1$" at A1.C
59 "`\scriptstack[l]{Nexus\\ SQ-10A}'" at A1.s below
60 line left_ dimen_/4 from A1.In1 then up_ dimen_/2 then right dimen_
61 dot
62 { resistor(up_ elen_)
63 llabel(,`\scriptstack[r]{$R_{14}$\\ $19\,$K}')
64 line to (Here,Q13.E) then to Q13.E }
65 line to (A1.Out,Here)
66 dot
67 { line to A1.Out
68 dot
69 resistor(down_ to (Here,Q14.E))
70 llabel(,`\scriptstack[l]{$R_{13}$\\ $91\,$K}')
71 line to Q14.E }
72 R6: resistor(right_ dimen_)
73 rlabel(,`\scriptstack[l]{$R_6$\\ $15\,$K}')
74 dot
75 line to (Here,A1.In1) then right_ dimen_/4
76 A2: opamp with .In1 at Here; "$A_2$" at A2.C
77 "`\scriptstack[l]{Nexus\\ SQ-10A}'" at A2.s below
78 line left_ dimen_/4 from A2.In2
79 ground
80
81 dot(at A2.Out)
82 DP1: npair(,3,4) with .E at (A2.Out,Q14.B)+(elen_*1.25,0)
83 line from A2.Out to (A2.Out,DP1.G) then to DP1.G
84 line from DP1.E to (DP1.E,R3.bottom); dot
85 D4: reversed(`diode',up_ dimen_/2 from DP1.S)
86 D3: reversed(`diode',up_ dimen_/2 from Here+(0,-dimen_/6))
87 llabel(,`\scriptstack[r]{$D_4$\\ OMC-V\\ $D_3$}')
88 DP2: ppair(,1,2) with .E at (DP1.E,Q13.B)
89 D1: diode(down_ dimen_/2 from DP2.S)
90 D2: diode(down_ dimen_/2 from Here+(0,dimen_/6))
91 rlabel(,`\raisebox{5pt}{\scriptstack[r]{$D_1$\\ $D_2$\\ OMC-V}}')
92 dot(at (Here,A2))
93 line to D2.bottom
94 line from DP2.G to (A2.Out,DP2.G) then to A2.Out
95 line from DP2.E to (DP2.E,R2.top); dot
96
97 T: dot(at (DP1.E,A2)+(dimen_,0))
98 DP3: npair(,7,8) with .G at (Here,DP1.G)+(dimen_/4,0)
99 dot(at DP3.E)
100 line to Q14.B
101 DP4: ppair(,5,6) with .G at (DP3.G,DP2.G)
102 dot(at DP4.E)
103 line to Q13.B
104 line from DP3.G to (T,DP3.G) then to (T,DP4.G) then to DP4.G
105 R11: resistor(down_ dimen_ from DP4.S)
106 rlabel(,`\scriptstack[r]{$R_{11}$\\ $20$}')
107 D5: diode(up_ from DP3.S to (DP3.S,A2),Z)
108 llabel(,`\scriptstack[r]{$D_5$\\ 1N4729$_{\vphantom{1}}$}')
109 line to R11.end
110 C4: capacitor(right_ dimen_*1.3 from DP3.S,C)
111 llabel(`C_4'); rlabel(,`0.68\,\mu\hbox{F}')
112 C3: capacitor(right_ dimen_*1.3 from DP4.S,C)
113 llabel(`C_3'); rlabel(,`0.68\,\mu\hbox{F}')
114 dot
115 dot(at (Here,R6))
116 C2: reversed(`capacitor',left_ dimen_*1.3,C)
117 rlabel(,,`C_2'); llabel(,`0.1\,\mu\hbox{F}')
118 line to R6.end
119
120 R5: resistor(up_ from R6.end to (R6.end,Q13.B))
121 rlabel(,`\scriptstack[l]{$R_5$\\ $100\,$K}')
122 dot(at R5.top-(0,dimen_/2))
123 line left_ dimen_/2
124 capacitor(down_ dimen_,C)
125 rlabel(,`\scriptstack[r]{$C_1$\\ $1\,\mu$F}')
126 ground(,T)
127
128 line from DP4.E to (DP4.E,R2.bottom)
129 resistor(up_ to (Here,R2.top))
130 rlabel(,`\scriptstack[l]{$R_9$\\ $910$}')
131 dot
132 resistor(down_ from DP3.E to (DP3.E,R3.bottom))
133 llabel(,`\scriptstack[l]{$R_{10}$\\ $910$}')
134 dot
135
136 line from R5.top to (R5,Q13.E)
137 resistor(right_ elen_)
138 llabel(,`\scriptstack[l]{$R_4$\\ $100\,$K}')
139 line to (C4.end,Here) then to C4.end
140
141 DP5: npair(L,11,10) with .E at (C4.end,DP1.E)+(elen_*0.8,0)
142 line from DP5.E to (DP5.E,R3.bottom); dot
143 line from R3.bottom to Here+(dimen_/2,0)
144 dot(,,1)
145 `"${}-E_{CC}$"' ljust
146 D6: diode(up_ from DP5.S to (DP5.S,A2),Z)
147 llabel(,`\scriptstack[r]{$D_6$\\ 1N4728}')
148 DP6: ppair(L,12,9) with .E at (DP5.E,DP2.E)
149 line from DP6.E to (DP6.E,R2.top); dot
150 line from R2.top to Here+(dimen_/2,0)
151 dot(,,1)
152 `"${}+E_{CC}$"' ljust
153 resistor(down_ from DP6.S to (DP6.S,C2))
154 rlabel(,`\scriptstack[r]{$R_{12}$\\ $20$}')
155 dot
156 { line to C2.e }
157 line to D6.end
158
159 Vr: dot(at (DP6.G,V1.top)+(dimen_/4,0))
160 line from DP6.G to (Vr,DP6.G) then to (Vr,DP5.G) then to DP5.G
161 reversed(`arrowline',right_ dimen_/2 from Vr); llabel(,i_2)
162 V2: gap(down_ dimen_,1); llabel(+,V_2,-)
163 line down_ dimen_/4 chop dotrad_ chop 0; ground(,T)
164
165 dot(at (Vr,T))
166 resistor(left_ to (DP6.E,Here))
167 rlabel(,`\scriptstack[l]{$R_{15}$\\ $200$}')
168 line to (DP1.E,Here)
169 dot
170
171 command "ifmpost(verbatimtex) }% ifmpost(etex)"
172 resetrgb
173 .PE