Debian Codegraph @

texmf-dist/doc/latex/circuit-macros/examples/dpv/ex01DPV.m4

raw
1 .PS
2 # TimerDPV.m4
3 cct_init(svg_font(sans-serif,10.5bp__))
4
5 define(`ic555DIP',`[Chip: box ht boxwid wid boxwid "555"
6 P7: "7" ljust at 1/6<Chip.sw,Chip.nw>
7 P6: "6" ljust at 1/2<Chip.sw,Chip.nw>
8 P2: "2" ljust at 5/6<Chip.sw,Chip.nw>
9 P4: "4" below at 1/3<Chip.nw,Chip.ne>
10 P8: "8" below at 2/3<Chip.nw,Chip.ne>
11 P3: "3" rjust at Chip.e
12 P1: "1" above at Chip.s
13 ]')
14
15 Timer: [
16 define(`elen_',`linewid')
17 Vs: dot
18 down_
19 variable(`resistor(,,E); llabel(,svg_norm(1 M`'svg_ohm))');
20 resistor(,,E); llabel(,svg_norm(100 k`'svg_ohm))
21 capacitor(,E); llabel(svg_norm(220 svg_micro`'F))
22 Zero: dot
23
24 dot(at Vs+(elen_*4/3,0))
25 resistor(,,E); llabel(,svg_norm(33 k`'svg_ohm))
26 line to (Here,Zero) chop 0 chop elen_
27 C2: capacitor; llabel(svg_norm(0.1 svg_micro`'F))
28 dot
29
30 IC1: ic555DIP with .P7 at C2.start + (elen_,0)
31 line from IC1.P4 to (IC1.P4,Vs); dot
32 line from IC1.P8 to (IC1.P8,Vs); dot
33 line from IC1.P1 to (IC1.P1,Zero); dot
34 line from IC1.P2 to (C2,IC1.P2); dot
35 crossover(from IC1.P7 to (Zero,IC1.P7),R,C2); dot
36 line from IC1.P6 left elen_/2 then down IC1.P6.y-IC1.P7.y; dot
37 line from IC1.P3 right elen_*2/3
38 R: dot
39 line right_ elen_/3
40 B: buzzer(,,C) with .In3 at Here
41 line from B.In1 to (R,B.In1)
42 reversed(`diode',to (Here,Vs),LE); "red" at last line.c+(elen_/2,0)
43 resistor(down_ elen_ from R,,E); llabel(,svg_norm(470 svg_ohm))
44 diode(to (Here,Zero),LE); {"green" wid 0.4 at last line.c+(elen_*2/3,0)}
45 line to Zero chop 0 chop -elen_
46 line up_ (Vs.y-Here.y)/3
47 battery(up_ (Vs.y-Here.y)/3); rlabel(,,svg_norm(9 V))
48 switch(to (Here,Vs),,D)
49 line to (R,Vs)
50 ]
51 Ex01: [
52 # ex01.m4
53
54 linewid = linewid*1.5 # let's make the circuit elements bigger than usual
55 define(`elen_',linewid) # but not longer
56
57 del = elen_/4 # a spacing parameter
58 move right 0.4
59 Vin: source(up_ elen_ + 2*del, V); llabel(,v`'svg_sub(s),)
60
61 switch(right_ elen_,,C); rlabel(,t = svg_norm(0),)
62 resistor; llabel(,svg_norm(47 ohm),); b_current()
63 { "svg_it(i`'svg_sub(R))" at last arrow.end+(0,3bp__) above rjust }
64
65 line right_ elen_/2 then down_ del
66 P:parallel_(`L:inductor(,W); llabel(,"L" wid 0.15,); b_current()',
67 `capacitor(,C); rlabel(+,v`'svg_sub(C),-); llabel(,,C)')
68 { "svg_it(i`'svg_sub(L))" at P.E1.L.start+(2bp__,0) ljust below }
69 line to (Here,Vin.start) then to Vin.start
70
71 define(`meshcurrent',`[arc -> cw with .c at (0,0) \
72 from (Rect_(`$1',-30)) to (Rect_(`$1',30)) "svg_it(`$2')"]')
73
74 right_
75 meshcurrent(del,i`'svg_sub(2)) at last[].C
76 meshcurrent(2*del,i`'svg_sub(1)) at Vin.start + (4*del,3*del)
77 ] with .sw at Timer.se+(0.5,0)
78
79 command "</g>" # end font
80 .PE