Debian Codegraph @

texmf-dist/doc/latex/circuit-macros/examples/Optoiso.m4

raw
1 .PS
2 # Optoiso.m4
3 cct_init
4 movewid = 0.25
5
6 # `optoiso([L|R][A|B|C])'
7 define(`optoiso',`ifinstr(`$1',C,
8 `[{ u = dimen_
9 hd = u/5
10 Q: bi_tr(up hd*4,ifinstr(`$1',R,R))
11 line from Q.E ifinstr(`$1',R,left,right)(hd+u/3); Pin4: dot(,,1)
12 line from Q.C to (Pin4,Q.C); Pin5: dot(,,1)
13 T: (Q.B,Pin5)+(0,4*hd)
14 line from Q.B to T then to (Pin5,T); Pin6: dot(,,1)
15 D: diode(from Pin6 +(ifinstr(`$1',R,+,-)(u/3+hd*8),0) down hd*4)
16 line from D.start ifinstr(`$1',R,right,left) (hd*2+u/3); Pin1: dot(,,1)
17 line from D.end to (Pin1,D.end); Pin2: dot(,,1)
18 line from (D.end,Pin4) to (Pin1,Pin4) chop hd chop 0; Pin3: dot(,,1)
19 B: box wid hd*10 ht hd*10 with .c at 0.5 between Pin4 and Pin1
20 arrow from B.c+(ifinstr(`$1',R,,-)hd*1.5,hd*1.5) to B.c chop 0 chop -0.7*hd
21 F: (ifinstr(`$1',R,,-)hd*0.5,-hd*0.5)
22 arrow from last arrow.start+(F.x,F.y) to last arrow.end+(F.x,F.y)
23 `$2' }]',
24 `[{u = dimen_/2
25 Q: bi_trans(up u*2,ifinstr(`$1',R,R),ifinstr(`$1',B,B)CBUdE)
26 E: Q.E; C: Q.C; A:ifinstr(`$1',R,Q.e+(u*3/2,u),Q.w+(-u*3/2,u)); K: A-(0,u*2)
27 ifinstr(`$1',B,line from Q.B to (Q.B,E); B: Here)
28 D: diode(from A to K)
29 arrow from D.c+(0,u/6) to Q.ifinstr(`$1',R,e,w)+(0,u/6) chop u/3 chop u/4
30 arrow from last arrow.start-(0,u/3) to last arrow.end-(0,u/3)
31 Enc: box rad u wid abs(C.x-A.x)+u*2 ht u*2 with .c at 0.5 between C and K
32 `$2' }]')')
33
34 define(`optlabels',
35 `{"\sl C" ht 0.1 at last [].C above
36 "\sl E" at last [].E below
37 ifinstr(`$1',B,`"\sl B" at last [].B below')
38 "\sl A" at last [].A above
39 "\sl K" at last [].K below}')
40
41 Q: optoiso; optlabels; move
42 {`"\tt optoiso"' at last [].s+(0,-0.22)}
43 optoiso(Rightorientation); optlabels; move
44 {`"\tt optoiso(R)"' at last [].s+(0,-0.22)}
45 optoiso(B); optlabels(B); move
46 {`"\tt optoiso(B)"' at last [].s+(0,-0.22)}
47 optoiso(RB); optlabels(B)
48 {`"\tt optoiso(RB)"' at last [].s+(0,-0.22)}
49
50 R: optoiso(C) with .nw at Q.sw+(0.33,-0.75); move 1
51 {"\sl 1" at R.Pin1 rjust; "\sl 2" at R.Pin2 rjust
52 "\sl 3" wid 0.3 at R.Pin3 rjust}
53 {"\sl 4" at R.Pin4 ljust; "\sl 5" at R.Pin5 ljust
54 "\sl 6" at R.Pin6 ljust }
55 {`"\tt optoiso(C)"' at R.s below }
56 S: optoiso(RC)
57 {"\sl 1" at S.Pin1 ljust; "\sl 2" at S.Pin2 ljust
58 "\sl 3" at S.Pin3 ljust }
59 {"\sl 4" at S.Pin4 rjust; "\sl 5" at S.Pin5 rjust
60 "\sl 6" wid 0.3 at S.Pin6 rjust }
61 {`"\tt optoiso(RC)"' at S.s below }
62
63 .PE