| 1 |
.PS |
| 2 |
# Timer.m4 |
| 3 |
cct_init |
| 4 |
ifpostscript(,latexcommand({\small\sf)) |
| 5 |
|
| 6 |
define(`ic555DIP',`[Chip: box ht boxwid wid boxwid "555" |
| 7 |
P7: "7" ljust at 1/6<Chip.sw,Chip.nw> |
| 8 |
P6: "6" ljust at 1/2<Chip.sw,Chip.nw> |
| 9 |
P2: "2" ljust at 5/6<Chip.sw,Chip.nw> |
| 10 |
P4: "4" below at 1/3<Chip.nw,Chip.ne> |
| 11 |
P8: "8" below at 2/3<Chip.nw,Chip.ne> |
| 12 |
P3: "3" rjust at Chip.e |
| 13 |
P1: "1" above at Chip.s |
| 14 |
]') |
| 15 |
|
| 16 |
Timer: [ |
| 17 |
define(`elen_',`linewid') |
| 18 |
Vs: dot |
| 19 |
down_ |
| 20 |
variable(`resistor(,,E); llabel(,\SI{1}{M})') |
| 21 |
resistor(,,E); llabel(,\SI{100}{\kilo{}}) |
| 22 |
capacitor(,E); llabel(\SI{220}{\micro{}}) |
| 23 |
Zero: dot |
| 24 |
|
| 25 |
dot(at Vs+(elen_*4/3,0)) |
| 26 |
resistor(,,E); llabel(,\SI{33}{\kilo{}}) |
| 27 |
line to (Here,Zero) chop 0 chop elen_ |
| 28 |
C2: capacitor; llabel(\SI{0.1}{\micro{}}) |
| 29 |
dot |
| 30 |
|
| 31 |
IC1: ic555DIP with .P7 at C2.start + (elen_,0) |
| 32 |
line from IC1.P4 to (IC1.P4,Vs); dot |
| 33 |
line from IC1.P8 to (IC1.P8,Vs); dot |
| 34 |
line from IC1.P1 to (IC1.P1,Zero); dot |
| 35 |
line from IC1.P2 to (C2,IC1.P2); dot |
| 36 |
crossover(from IC1.P7 to (Zero,IC1.P7),R,C2); dot |
| 37 |
line from IC1.P6 left elen_/2 then down IC1.P6.y-IC1.P7.y; dot |
| 38 |
line from IC1.P3 right elen_*2/3 |
| 39 |
R: dot |
| 40 |
line right_ elen_/3 |
| 41 |
B: buzzer(,,C) with .In3 at Here |
| 42 |
line from B.In1 to (R,B.In1) |
| 43 |
reversed(`diode',to (Here,Vs),LE); "red" at last line.c+(elen_/2,0) |
| 44 |
resistor(down_ elen_ from R,,E); llabel(,\num{470}) |
| 45 |
diode(to (Here,Zero),LE); {"green" at last line.c+(elen_*2/3,0)} |
| 46 |
line to Zero chop 0 chop -elen_ |
| 47 |
line up_ (Vs.y-Here.y)/3 |
| 48 |
battery(up_ (Vs.y-Here.y)/3); rlabel(,,\SI{9}{V}) |
| 49 |
switch(to (Here,Vs),,D) |
| 50 |
line to (R,Vs) |
| 51 |
] |
| 52 |
Ex01: [ |
| 53 |
# ex01.m4 |
| 54 |
linewid = linewid*1.5 # let's make the circuit elements bigger than usual |
| 55 |
define(`elen_',linewid) # but not longer |
| 56 |
del = elen_/4 # a spacing parameter |
| 57 |
|
| 58 |
Vin: source(up_ elen_ + 2*del); llabel(-,v_s,+) |
| 59 |
|
| 60 |
switch(right_ elen_,,C); rlabel(,t = 0,) |
| 61 |
resistor; llabel(,47\`,'\Omega,); b_current(i_R\strut,above rjust) |
| 62 |
|
| 63 |
line right_ elen_/2 then down_ del |
| 64 |
parallel_(`inductor(,W); llabel(,L,); b_current(\>`'i_L)', |
| 65 |
`capacitor(,C); rlabel(+,v_C,-); llabel(,,\;C)') |
| 66 |
line to (Here,Vin.start) then to Vin.start |
| 67 |
|
| 68 |
arcd(last []+(4pt__,0),del,30,330) <- ; "$i_2$" at last arc |
| 69 |
arcd(Vin.c+(4*del,0),2*del,30,330) <- ; "$i_1$" at last arc |
| 70 |
|
| 71 |
] with .sw at Timer.se+(0.5,0) |
| 72 |
|
| 73 |
ifpostscript(,latexcommand(}%)) |
| 74 |
.PE |