Fix includes for glx check
[geda-pcb.git] / lib / misc.inc
blobb786495355d7f74060423256aab4c880aff11058
2 #                             COPYRIGHT
3
4 #   PCB, interactive printed circuit board design
5 #   Copyright (C) 1994,1995,1996 Thomas Nau
6
7 #   This program is free software; you can redistribute it and/or modify
8 #   it under the terms of the GNU General Public License as published by
9 #   the Free Software Foundation; either version 2 of the License, or
10 #   (at your option) any later version.
11
12 #   This program is distributed in the hope that it will be useful,
13 #   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 #   GNU General Public License for more details.
16
17 #   You should have received a copy of the GNU General Public License along
18 #   with this program; if not, write to the Free Software Foundation, Inc.,
19 #   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
21 #   Contact addresses for paper mail and Email:
22 #   Thomas Nau, Schlehenweg 15, 88471 Baustetten, Germany
23 #   Thomas.Nau@rz.uni-ulm.de
24
26 # misc packages
29 # -------------------------------------------------------------------
30 # the definition of a SD (ZIP) package
31 # based on 'old style format' by Olaf Kaluza (olaf@criseis.ruhr.de)
33 # For example, see http://focus.ti.com/lit/ml/mczi002/mczi002.pdf
34 # for the Texas Instruments SDZ (R-PZIP-T16) Ceramic Zig Zag package
35 # That drawing shows the pin width varying from 0.45mm to 0.65mm 
36 # (18 to 26 mils) and the width in the other dimension from .23mm
37 # to .35mm.  The cross section is rectangular.  This gives a diagonal
38 # from 0.505mm (19.9 mil) to 0.738mm (29 mil).
40 # $1: canonical name
41 # $2: name on PCB
42 # $3: value
43 # $4: number of pins
45 define(`PKG_SD',
46         `define(`MAXY', `eval(`$4' / 2 * 100 + 50)')
47 Element(0x00 "$1" "`$2'" "$3" 275 50 3 100 0x00)
49         forloop(`i', 1, eval($4 / 2),
50                 `PIN(50,  eval(100*(i-1)+50), 60, 35, eval(2*i-1))
51                 PIN(150, eval(100*(i-1)+100), 60, 35, eval(2*i))
52         ')
54         ElementLine(0 0 0 MAXY 20)
55         ElementLine(0 MAXY 200 MAXY 20)
56         ElementLine(200 MAXY 200 0 20)
57         ElementLine(200 0 0 0 20)
58         ElementLine(100 0 100 100 10)
59         ElementLine(100 100 0 100 10)
61         Mark(50 50)
62 )')
64 # -------------------------------------------------------------------
65 # the definition of a plastic power package vertical
66 # for TO220 (2-7pins), TO251, TOP3, MULTIWATT(8-15pins)
67 # based on 'old style format' by Olaf Kaluza (olaf@criseis.ruhr.de)
68 # $1: canonical name
69 # $2: name on PCB
70 # $3: value
71 # $4: pin count
72 # $5: pin spacing
73 # $6: body length (dimension parallel to rows of pins)
74 # $7: body width  (dimension perpendicular to rows of pins)
75 # $8: pin/tab spacing
76 # $9: pad size
77 # $10: drill size
78 # $11: pin row spacing
80 define(`GENERIC_PL_POWER',
81     `define(`pin1X', `eval((`$6' - (`$4' - 1) * `$5')/2)')
82 Element(0x00 "$1" "`$2'" "$3" eval(`$6'+60) 50 3 100 0x00)
84        forloop(`i', 1, `$4',
85                `PIN(eval(pin1X + (i-1)*`$5'), ifelse(eval(i % 2 == 0), 0, eval(`$8'+`$11'), `$8'), `$9', `$10', i)
86        ')
87        ElementLine(0 0 0 `$7' 20)
88        ElementLine(0 `$7' `$6' `$7' 20)
89        ElementLine(`$6' `$7' `$6' 0 20)
90        ElementLine(`$6' 0 0 0 20)
91        ElementLine(0 50 `$6' 50 10)
92        ElementLine(eval(`$6'/2 - 75) 0 eval(`$6'/2 - 75) 50 10)
93        ElementLine(eval(`$6'/2 + 75) 0 eval(`$6'/2 + 75) 50 10)
94        Mark(pin1X eval(`$7'+`$10'))
95  )')
97 # -------------------------------------------------------------------
98 # the definition of a resistor (0.25W) package
99 # $1: canonical name
100 # $2: name on PCB
101 # $3: value
102 define(`PKG_R025',
103 `Element(0x00 "$1" "`$2'" "$3" 120 30 0 100 0x00)
105         PIN(0, 50, 68, 38, 1)
106         PIN(400, 50, 68, 38, 2)
107         ElementLine(100 0 300 0 20)
108         ElementLine(300 0 300 100 20)
109         ElementLine(300 100 100 100 20)
110         ElementLine(100 100 100 0 20)
111         ElementLine(0 50 100 50 20)
112         ElementLine(300 50 400 50 20)
113         Mark(0 50)
116 # -------------------------------------------------------------------
117 # the definition of a SIL package without a common pin
118 # $1: canonical name
119 # $2: name on PCB
120 # $3: value
121 # $4: number of pins
122 define(`PKG_SIL',
123         `define(`MAXY', `eval(`$4' * 100 -50)')
124 Element(0x00 "$1" "`$2'" "$3" 160 10 3 100 0x00)
126         forloop(`i', 1, $4,
127                 `PIN(50, eval(i * 100 -50), 60, 28, i)
128         ')
129         ElementLine(  0 50   0 MAXY 20)
130         ElementLine(100 50 100 MAXY 20)
131         ElementArc(50  50 50 50 180 180 20)
132         ElementArc(50 MAXY 50 50   0 180 20)
133         forloop(`i', 1, eval($4 - 1),
134                 `ElementLine(0 eval(i * 200) 100 eval(i * 200) 10)
135         ')
136         Mark(50 50)
139 # -------------------------------------------------------------------
140 # the definition of a SIL package with a common pin
141 # $1: canonical name
142 # $2: name on PCB
143 # $3: value
144 # $4: number of pins
145 define(`PKG_CSIL',
146         `define(`MAXY', `eval(`$4' * 100 -50)')
147 Element(0x00 "$1" "`$2'" "$3" 160 10 3 100 0x00)
149         forloop(`i', 1, $4,
150                 `PIN(50, eval(i * 100 -50), 60, 28, i)
151         ')
152         ElementLine(  0 50   0 MAXY 20)
153         ElementLine(100 50 100 MAXY 20)
154         ElementLine(  0 100 100 100 10)
155         ElementArc(50  50 50 50 180 180 20)
156         ElementArc(50 MAXY 50 50   0 180 20)
157         Mark(50 50)
160 # -------------------------------------------------------------------
161 # a QFP-132 pin flat pack
163 # $1: canonical name
164 # $2: name on PCB
165 # $3: value
167 # based on mail by Volker Bosch (bosch@iema.e-technik.uni-stuttgart.de)
168 define(`PKG_QFP132',
169 `Element(0x00 "$1" "`$2'" "$3" 250 200 0 150 0x00)
171         forloop(`i', 1, 17,
172                 `define(`XPOS', eval(625 -i*25))'
173                 `PAD(XPOS, 40, XPOS, 90, 15, i)
174         ')
175         forloop(`i', 1, 16,
176                 `define(`XPOS', eval(1025 -i*25))'
177                 `PAD(XPOS, 40, XPOS, 90, 15, eval(i+116))
178         ')
179         forloop(`i', 1, 33,
180                 `define(`YPOS', eval(175 +i*25))'
181                 `PAD(30, YPOS, 80, YPOS, 15, i)
182         ')
183         forloop(`i', 1, 33,
184                 `define(`XPOS', eval(175 +i*25))'
185                 `PAD(XPOS, 1160, XPOS, 1110, 15, eval(i+50))
186         ')
187         forloop(`i', 1, 33,
188                 `define(`YPOS', eval(1025 -i*25))'
189                 `PAD(1120, YPOS, 1170, YPOS, 15, i)
190         ')
192         # Markierung pin 1
193         ElementArc(600 150 10 10 0 360 5)
195         # Nase links oben (PIN 17/18)
196         ElementLine( 125 175  75 150 20)
197         ElementLine(  75 150  75 125 20)
198         ElementLine(  75 125 125  75 20)
199         ElementLine( 125  75 150  75 20)
200         ElementLine( 150  75 175 125 20)
202         # Verbindungsline zur Ecke rechts oben
203         ElementLine( 175  125 1025 125 20)
205         # Nase rechts oben (PIN 116/117)
206         ElementLine(1025 125 1050  75 20)
207         ElementLine(1050  75 1075  75 20)
208         ElementLine(1075  75 1125 125 20) 
209         ElementLine(1125 125 1125 150 20)
210         ElementLine(1125 150 1075 175 20)
212         # Verbindungsline zur Ecke rechts unten
213         ElementLine(1075 175  1075 1025 20)
215         # Nase rechts unten (PIN 83/84)
216         ElementLine(1075 1025 1125 1050 20)
217         ElementLine(1125 1050 1125 1075 20)
218         ElementLine(1125 1075 1075 1125 20)
219         ElementLine(1075 1125 1050 1125 20)
220         ElementLine(1050 1125 1025 1075 20)
222         # Verbindungsline zur Ecke links unten 
223         ElementLine(1025 1075  175 1075 20)
225         # Nase links unten (PIN 50/51)
226         ElementLine( 175 1075 150 1125 20)
227         ElementLine( 150 1125 125 1125 20)
228         ElementLine( 125 1125  75 1075 20)
229         ElementLine(  75 1075  75 1050 20)
230         ElementLine(  75 1050 125 1025 20)
232         # Verbindungsline zur Ecke links oben
233         ElementLine( 125 1025 125 175 20)
235         # Markierung so anordnen, dass Pinanchse im 25-MIL-Raster zu liegen kommt
236         Mark(200 200)
239 # -------------------------------------------------------------------
240 # LED
241 # Pin 1 is -, 2 is +
243 # $1: canonical name
244 # $2: name on PCB
245 # $3: value
246 # $4: diameter
248 # based on mail by Volker Bosch (bosch@iema.e-technik.uni-stuttgart.de)
249 define(`PKG_LED',
250         `define(`RADIUS1', `eval(`$4' /2)')
251         define(`RADIUS2', `eval(`$4' /2 +20)')
252 Element(0x00 "$1" "`$2'" "$3" 100 70 0 100 0x00)
254 # typical LED is 0.5 mm or 0.020" square pin.  See for example
255 # http://www.lumex.com and part number SSL-LX3054LGD.
256 # 0.020" square is 0.0288" diagonal.  A number 57 drill is 
257 # 0.043" which should be enough.  a 65 mil pad gives 11 mils
258 # of annular ring.
260         PIN(-50, 0, 65, 43, 1)
261         PIN(50, 0, 65, 43, 2)
262    ifelse( eval(RADIUS1 - 10 > 85), 1, 
263         ElementArc(0 0 RADIUS1 RADIUS1     0 360 10)
265         ElementArc(0 0 RADIUS1 RADIUS1    45  90 10)
266         ElementArc(0 0 RADIUS1 RADIUS1   225  90 10)
268    ifelse( eval(RADIUS2 - 10 > 85), 1, 
269         ElementArc(0 0 RADIUS2 RADIUS2     0 360 10)
271         ElementArc(0 0 RADIUS2 RADIUS2    45  90 10)
272         ElementArc(0 0 RADIUS2 RADIUS2   225  90 10)
274         Mark(0 0)
277 # -------------------------------------------------------------------
278 # diodes
279 # Pin 1 is K, 2 is A
281 # $1: canonical name
282 # $2: name on PCB
283 # $3: value
284 # $4: distance in mil
286 define(`PKG_DIODE_LAY',
287         `define(`X1', `eval(`$4' /3)')
288         define(`X2', `eval(`$4' -X1)')
289         define(`Y', `eval(`$4' /2)')
290         define(`DELTA', `eval(X1 /2)')
291         define(`PINSIZE', `ifelse(eval($4 >= 500), 1, 80, 50)')
292         define(`DRILLSIZE', `ifelse(eval($4 >= 500), 1, 50, 30)')
293 Element(0x00 "$1" "`$2'" "$3" eval(X2+20) eval(Y-DELTA) 0 100 0x00)
295         PIN(0, Y, PINSIZE, DRILLSIZE, 1)
296         PIN($4, Y, PINSIZE, DRILLSIZE, 2)
298         ElementLine(0 Y X1 Y 10)
299         ElementLine(X2 Y $4 Y 10)
301         ElementLine(X1 Y X2 eval(Y-DELTA) 10)
302         ElementLine(X2 eval(Y-DELTA) X2 eval(Y+DELTA) 10)
303         ElementLine(X2 eval(Y+DELTA) X1 Y 10)
304         ElementLine(X1 eval(Y-DELTA) X1 eval(Y+DELTA) 10)
305         Mark(0 Y)
308 # -------------------------------------------------------------------
309 # the definition of a general axial package
310 # $1: canonical name
311 # $2: name on PCB
312 # $3: value
313 # $4: distance in mil
314 # $5: 1 for polarized, 0 for non polarized
315 define(`PKG_AXIAL_LAY',
316         `define(`X1', `eval(`$4' /4)')
317         define(`X2', `eval(`$4' -X1)')
318         define(`Y1', `eval(X1 /3)')
319         define(`Y2', `eval(Y1 *2)')
320         define(`PINSIZE', `ifelse(eval($4 >= 600), 1, 80, 55)')
321         define(`DRILLSIZE', `ifelse(eval($4 >= 600), 1, 50, 30)')
322         define(`YPT', `eval(Y1 - PINSIZE/2 - 10)')
323         define(`YPC', `eval(YPT - 20)')
324         define(`YPB', `eval(YPT - 40)')
325 Element(0x00 "$1" "`$2'" "$3" eval(X2+20) eval(Y2+20) 0 100 0x00)
327         PIN(0, Y1, PINSIZE, DRILLSIZE, 1)
328         PIN($4, Y1, PINSIZE, DRILLSIZE, 2)
330         ElementLine(0 Y1 X1 Y1 10)
331         ElementLine(X2 Y1 $4 Y1 10)
333         ElementLine(X1 0 X2 0 10)
334         ElementLine(X2 0 X2 Y2 10)
335         ElementLine(X2 Y2 X1 Y2 10)
336         ElementLine(X1 Y2 X1 0 10)
338         ifelse(1, $5,
339         ElementLine(0 YPB 0 YPT 10)
340         ElementLine(-20 YPC 20 YPC 10)
341         ElementLine(`eval($4 - 20)' YPC `eval($4 + 20)' YPC 10)
342         )
344 #       ElementArc(X1 Y 50 50 270 180 10)
345 #       ElementArc(X2 Y 50 50 90 180 10)
347         Mark(0 Y1)
350 # -------------------------------------------------------------------
351 # the definition of a more general axial package
352 # $1:  canonical name
353 # $2:  name on PCB
354 # $3:  value
355 # $4:  pad drill diameter [1/100 mm]
356 # $5:  pad diameter [1/100 mm]
357 # $6:  pad clearance diameter [1/100 mm]
358 # $7:  pad center to center [1/100 mm]
359 # $8:  courtyard in direction perpendicular to axis of part [1/100 mm] 
360 # $9:  courtyard in direction parallel to axis of part [1/100 mm]
361 # $10: 1 for polarized, 0 for non polarized
362 define(`PKG_AXIAL_H_MM100',
363         # grab the input values and convert to 1/100 mil
364         `define(`PX', `eval( ($7 * 10000) / 254 / 2)')
365         define(`DRILLSIZE', `eval( ($4 * 10000) / 254)')
366         define(`PINSIZE', `eval( ($5 * 10000) / 254)')
367         define(`PINANTI', `eval( ($6 * 10000) / 254)')
368         define(`PINCLEAR', `eval((PINANTI - PINSIZE)/2)')
369         define(`SILKW', `800')
370         define(`SILKX', `eval(($8 * 10000) / 254 / 2 )')
371         define(`SILKXC',`eval(-SILKX - 2*SILKW)')
372         define(`SILKY', `eval(($9 * 10000) / 254 / 2)')
373 # element_flags, description, pcb-name, value, mark_x, mark_y,
374 # text_x, text_y, text_direction, text_scale, text_flags
375 Element[0x00000000 "$1" "`$2'" "$3" 0 0 -SILKX -SILKY 0 100 ""]
377 # Pin[x, y, thickness, clearance, mask, drilling hole, name,
378 #     number, flags 
379 Pin[ -PX 0  PINSIZE PINCLEAR PINSIZE DRILLSIZE "1" "1" "square"]
380 Pin[  PX 0  PINSIZE PINCLEAR PINSIZE DRILLSIZE "2" "2" 0x0]
382 # Silk screen around package
383 ElementLine[ SILKX  SILKY  SILKX -SILKY SILKW]
384 ElementLine[ SILKX -SILKY -SILKX -SILKY SILKW]
385 ElementLine[-SILKX -SILKY -SILKX  SILKY SILKW]
386 ElementLine[-SILKX  SILKY  SILKX  SILKY SILKW] 
388 ifelse( 1, $10,
389         ElementLine[ SILKXC SILKY SILKXC -SILKY SILKW]
394 # -------------------------------------------------------------------
396 # general purpose crystal standing, 2 or 3 pins
397 # $1: canonical name
398 # $2: name on PCB
399 # $3: value
400 # $4: pin spacing in mil
401 # $5: length of component in mil
402 # $6: width of component in mil
403 # $7: diametr of pad in mil
404 # $8: diametr of drill in mil
405 # $9: number of pins
407 define(`PKG_CRYSTAL_V',
408        `define(`spacing',  `$4')
409         define(`sizX',     `$5')
410         define(`sizY',     `$6')
411         define(`pad',      `$7')
412         define(`drill',    `$8')
413         define(`centerY',  `eval(sizY / 2)')
414         define(`pinX',    `eval((sizX - spacing * (`$9'-1)) /2)')
416 Element(0x00 "$1" "$2" "$3" 0 eval(0 - 60) 0 100 0x00)
418         PIN(pinX, centerY, pad, drill, 1)
419         PIN(eval(pinX + spacing), centerY, pad, drill, 2)
420         ifelse(eval(`$9' == 3), 1,
421         PIN(eval(pinX + 2 * spacing), centerY, pad, drill, 3))
423         ElementLine(centerY 0 eval(sizX-centerY) 0 20)
424         ElementArc(eval(sizX-centerY) centerY centerY centerY 90 180 20)
425         ElementLine(eval(sizX-centerY) sizY centerY sizY 20)
426         ElementArc(centerY centerY centerY centerY 270 180 20)
428         Mark(pinX centerY)
432 # general purpose crystal laying, 2 or 3 pins
433 # $1: canonical name
434 # $2: name on PCB
435 # $3: value
436 # $4: pin spacing in mil
437 # $5: length of component in mil
438 # $6: height of component in mil
439 # $7: diametr of pad in mil
440 # $8: diametr of drill in mil
441 # $9: number of pins
443 define(`PKG_CRYSTAL_H',
444        `define(`base',     `$4')
445         define(`sizX',     `$5')
446         define(`sizY',     `$6')
447         define(`pad',      `$7')
448         define(`drill',    `$8')
449         define(`pinX',     `eval((sizX - base * (`$9'-1)) /2)')
450         define(`pinY',     `ifelse(eval(sizX > 500),1,eval(sizY+200),eval(sizY+100))')
451         define(`maxY',     `eval(sizY + offset)')
453 Element(0x00 "$1" "$2" "$3" 0 eval(0 - 60) 0 100 0x00)
455         PIN(pinX, pinY, pad, drill, 1)
456         PIN(eval(pinX + base), pinY, pad, drill, 2)
457         ifelse(eval(`$9' == 3), 1,
458         PIN(eval(pinX + 2 * base), pinY, pad, drill, 3))
460         ElementLine(0 0 sizX 0 20)
461         ElementLine(sizX 0 sizX sizY 20)
462         ElementLine(sizX sizY 0 sizY 20)
463         ElementLine(0 sizY 0 0 20)
465         Mark(pinX pinY)
468 # a crystal package for backward compatibility
470 # $1: canonical name
471 # $2: name on PCB
472 # $3: value
473 # $4: package width in MIL
475 define(`PKG_CRYSTAL',`PKG_CRYSTAL_V(`$1',`$2',`$3',`eval($4-100)',`$4',`100',`60',`28',`2')')
478 # -------------------------------------------------------------------
479 # a can oscillator package
481 # $1: canonical name
482 # $2: name on PCB
483 # $3: value
485 define(`PKG_OSC',
486 `Element(0x00 "$1" "`$2'" "$3" 270 300 3 100 0x00)
488         Pin(100 100 50 28 "NC" 0x01)
489         Pin(100 700 50 28 "GND" 0x01)
490         Pin(400 700 50 28 "CLK" 0x01)
491         Pin(400 100 50 28 "VCC" 0x01)
493         ElementLine(5 5 400 5 10)
494         ElementArc(400 100 95 95 180 90 10)
495         ElementLine(495 100 495 700 10)
496         ElementArc(400 700 95 95 90 90 10)
497         ElementLine(400 795 100 795 10)
498         ElementArc(100 700 95 95 0 90 10)
499         ElementLine(5 700 5 5 10)
501         ElementLine(100 60 400 60 10)
502         ElementArc(400 100 40 40 180 90 10)
503         ElementLine(440 100 440 700 10)
504         ElementArc(400 700 40 40 90 90 10)
505         ElementLine(400 740 100 740 10)
506         ElementArc(100 700 40 40 0 90 10)
507         ElementLine(60 700 60 100 10)
508         ElementArc(100 100 40 40 270 90 10)
510         Mark(100 100)
513 # -------------------------------------------------------------------
514 # 8 bit ISA Slot card
516 # Volker Bosch (bosch@iema.e-technik.uni-stuttgart.de), 12/95
518 # $1: canonical name
519 # $2: name on PCB
520 # $3: value
522 define(`PKG_ISA8',
523 `Element(0x00 "$1" "`$2'" "$3" 4000 0 0 100 0x00)
525     # Pins, entspr. Anschl. auf Loetseite (b31..b1)
526         Pin( 200 3850 60 35 "Gnd (b31)" 0x01)
527         Pin( 300 3850 60 35 "Osc" 0x01)
528         Pin( 400 3850 60 35 "+5V" 0x01)
529         Pin( 500 3850 60 35 "BALE" 0x01)
530         Pin( 600 3850 60 35 "TC" 0x01)
531         Pin( 700 3850 60 35 "/DAck2" 0x01)
532         Pin( 800 3850 60 35 "IRq3" 0x01)
533         Pin( 900 3850 60 35 "IRq4" 0x01)
534         Pin(1000 3850 60 35 "IRq5" 0x01)
535         Pin(1100 3850 60 35 "IRq6" 0x01)
536         Pin(1200 3850 60 35 "IRq7" 0x01)
537         Pin(1300 3850 60 35 "Clock" 0x01)
538         Pin(1400 3850 60 35 "/Ref" 0x01)
539         Pin(1500 3850 60 35 "DRq1" 0x01)
540         Pin(1600 3850 60 35 "/DAck1" 0x01)
541         Pin(1700 3850 60 35 "DRq3" 0x01)
542         Pin(1800 3850 60 35 "/DAck3" 0x01)
543         Pin(1900 3850 60 35 "/IOR" 0x01)
544         Pin(2000 3850 60 35 "/IOW" 0x01)
545         Pin(2100 3850 60 35 "/SMEMR" 0x01)
546         Pin(2200 3850 60 35 "/SMEMW" 0x01)
547         Pin(2300 3850 60 35 "Gnd" 0x01)
548         Pin(2400 3850 60 35 "+12V" 0x01)
549         Pin(2500 3850 60 35 "/0WS" 0x01)
550         Pin(2600 3850 60 35 "-12V" 0x01)
551         Pin(2700 3850 60 35 "DRq2" 0x01)
552         Pin(2800 3850 60 35 "-5V" 0x01)
553         Pin(2900 3850 60 35 "IEQ2" 0x01)
554         Pin(3000 3850 60 35 "+5V" 0x01)
555         Pin(3100 3850 60 35 "ResDrv" 0x01)
556         Pin(3200 3850 60 35 "Gnd (b1)" 0x01)
558       # Pins, entspr. Anschl. auf Bestueckseite
559         Pin( 200 3950 60 35 "SA0 (a31)" 0x01)
560         Pin( 300 3950 60 35 "SA1" 0x01)
561         Pin( 400 3950 60 35 "SA2" 0x01)
562         Pin( 500 3950 60 35 "SA3" 0x01)
563         Pin( 600 3950 60 35 "SA4" 0x01)
564         Pin( 700 3950 60 35 "SA5" 0x01)
565         Pin( 800 3950 60 35 "SA6" 0x01)
566         Pin( 900 3950 60 35 "SA7" 0x01)
567         Pin(1000 3950 60 35 "SA8" 0x01)
568         Pin(1100 3950 60 35 "SA9" 0x01)
569         Pin(1200 3950 60 35 "SA10" 0x01)
570         Pin(1300 3950 60 35 "SA11" 0x01)
571         Pin(1400 3950 60 35 "SA12" 0x01)
572         Pin(1500 3950 60 35 "SA13" 0x01)
573         Pin(1600 3950 60 35 "SA14" 0x01)
574         Pin(1700 3950 60 35 "SA15" 0x01)
575         Pin(1800 3950 60 35 "SA16" 0x01)
576         Pin(1900 3950 60 35 "SA17" 0x01)
577         Pin(2000 3950 60 35 "SA18" 0x01)
578         Pin(2100 3950 60 35 "SA19" 0x01)
579         Pin(2200 3950 60 35 "AEN" 0x01)
580         Pin(2300 3950 60 35 "IOChRdy" 0x01)
581         Pin(2400 3950 60 35 "SD0" 0x01)
582         Pin(2500 3950 60 35 "SD1" 0x01)
583         Pin(2600 3950 60 35 "SD2" 0x01)
584         Pin(2700 3950 60 35 "SD3" 0x01)
585         Pin(2800 3950 60 35 "SD4" 0x01)
586         Pin(2900 3950 60 35 "SD5" 0x01)
587         Pin(3000 3950 60 35 "SD6" 0x01)
588         Pin(3100 3950 60 35 "SD7" 0x01)
589         Pin(3200 3950 60 35 "/IOChCk (a1)" 0x01)
591       # Umrahmung
592         ElementLine(   0  100  100  100 2)
593         ElementLine( 100    0  100  100 2)
594         ElementLine( 100  100 4250  100 5)
595         ElementLine(4250  100 4250 3810 5)
596         ElementLine(4250 3810 3620 3810 5)
597         ElementLine(3620 3810 3620 3510 5)
598         ElementLine(3620 3510 3300 3510 5)
599         ElementLine(3300 3510 3300 3810 5)
600         ElementLine(3300 3810  100 3810 5)
601         ElementLine( 100 3810  100 3510 5)
602         ElementLine( 100 3510    0 3510 2)
604       # Markierung == Pin B1
605         Mark(3200 3850)
608 # -------------------------------------------------------------------
609 # an ovenized-oscillator package
611 # $1: canonical name
612 # $2: name on PCB
613 # $3: value
614 # Text(620 320 0 100 "GROUND" 0x0001)
615 # Text(620 520 0 100 "VECTRON LABORATORIES, INC." 0x0001)
616 # Text(620 720 0 100 "CO711 SERIES OSC" 0x0001)
617 # Text(620 920 0 100 "711-04-006" 0x0001)
618 # Text(620 1680 0 100 "+12 -> 15 VOLTS DC" 0x0001) 
619 define(`PKG_OVEN_OSC',
620 `Element(0x00 "$1" "`$2'" "$3" 580 280 0 100 0x00)
622         Pin(320 320 150 35 "NC" 0x01)
623         Pin(320 1000 150 35 "VCC" 0x01)
624         Pin(320 1680 150 35 "CLK" 0x01)
625         Pin(1680 320 150 35 "+12V" 0x01)
626         Pin(1680 1680 150 35 "GND" 0x01)
628         ElementLine(2020 1125 2020 875 10)
629         ElementLine(2100 875 2020 875 10)
630         ElementLine(2100 975 2100 875 10)
631         ElementLine(2075 975 2100 975 10)
632         ElementLine(2075 1025 2075 975 10)
633         ElementLine(2100 1025 2075 1025 10)
634         ElementLine(2100 1125 2100 1025 10)
635         ElementLine(2100 1125 2020 1125 10)
637         ElementLine(2000 320 2000 1680 10)
638         ElementLine(320 0 1680 0 10)
639         ElementLine(0 1680 0 320 10)
640         ElementLine(1680 2000 320 2000 10)
642         ElementArc(320 320 320 320 270 90 10)
643         ElementArc(320 1680 320 320 0 90 10)
644         ElementArc(1680 320 320 320 180 90 10)
645         ElementArc(1680 1680 320 320 90 90 10)
647         Mark(320 320)
650 # a radial capacitor package
652 # $1: canonical name
653 # $2: name on PCB
654 # $3: value
655 # $4: package width in MIL
656 # $5: set to 1 if a polarized part
657 define(`PKG_RADIAL_CAN',
658         `define(`X1', `eval(`$4' /4)')
659         define(`X2', `eval(`$4' -X1)')
660         define(`X3', `eval(`$4' /2)')
661         define(`Y', `eval(`$4' /2)')
662         define(`R', `eval(`$4' /2)')
663         define(`PINSIZE', `ifelse(eval($4 >= 600), 1, 80, 55)')
664         define(`DRILLSIZE', `ifelse(eval($4 >= 600), 1, 50, 30)')
665 Element(0x00 "$1" "`$2'" "$3" eval(`$4') 0 0 100 0x00)
667         PIN(X1, Y, 60, DRILLSIZE, 1)
668         PIN(X2, Y, 60, DRILLSIZE, 2)
669         ElementArc(X3 Y R R 0 360 10)
671         ifelse( 1, $5,
672         ElementLine(-60 Y            -20 Y 10)
673         ElementLine(-40 `eval(Y-20)' -40 `eval(Y+20)' 10)
674         ElementLine(`eval($4 + 20)' Y `eval($4 + 60)'  Y 10)
675         )
677         Mark (X1 Y)
680 # -------------------------------------------------------------------
681 # the definition of a more general radial package
682 # $1:  canonical name
683 # $2:  name on PCB
684 # $3:  value
685 # $4:  pad drill diameter [1/100 mm]
686 # $5:  pad diameter [1/100 mm]
687 # $6:  pad clearance diameter [1/100 mm]
688 # $7:  pad center to center [1/100 mm]
689 # $8:  courtyard diameter [1/100 mm]
690 # $9: 1 for polarized, 0 for non polarized
691 define(`PKG_RADIAL_MM100',
692         # grab the input values and convert to 1/100 mil
693         `define(`PX', `eval( ($7 * 10000) / 254 / 2)')
694         define(`DRILLSIZE', `eval( ($4 * 10000) / 254)')
695         define(`PINSIZE', `eval( ($5 * 10000) / 254)')
696         define(`PINANTI', `eval( ($6 * 10000) / 254)')
697         define(`PINCLEAR', `eval((PINANTI - PINSIZE)/2)')
698         define(`SILKW', `800')
699         define(`SILKRAD', `eval(($8 * 10000) / 254 / 2 )')
700         define(`MARKL', `5000')
701         define(`MARKS', `1000')
702         define(`PX1', `eval(-SILKRAD - MARKL - MARKS)')
703         define(`PXM', `eval(-SILKRAD - MARKL/2 - MARKS)')
704         define(`PX2', `eval(-SILKRAD - MARKS)')
705         define(`PY1', `eval(-MARKL)')
706         define(`PY2', `eval(PY1 + MARKL)')
707         define(`PYM', `eval( (PY1 + PY2) / 2)')
708 # element_flags, description, pcb-name, value, mark_x, mark_y,
709 # text_x, text_y, text_direction, text_scale, text_flags
710 Element[0x00000000 "$1" "`$2'" "$3" 0 0 PX1 0 0 100 ""]
712 # Pin[x, y, thickness, clearance, mask, drilling hole, name,
713 #     number, flags
714 Pin[ -PX 0  PINSIZE PINCLEAR PINSIZE DRILLSIZE "1" "1" "square"]
715 Pin[  PX 0  PINSIZE PINCLEAR PINSIZE DRILLSIZE "2" "2" 0x0]
717 # Silk screen around package
718 ElementArc[0 0 SILKRAD SILKRAD 0 360 SILKW]
720 ifelse( 1, $9,
721         ElementLine[ PX1 PYM PX2 PYM SILKW]
722         ElementLine[ PXM PY1 PXM PY2 SILKW]
727 # a core surface mount package
728 # 12/99 Larry Doolittle <LRDoolittle@lbl.gov>
730 # $1: canonical name
731 # $2: name on PCB
732 # $3: value
733 # $4: device length in MIL
734 # $5: device width in MIL
736 # Note that the pad width, length, and separation are derived from
737 # the given device dimensions.  I <LRDoolittle@lbl.gov> don't
738 # claim to have followed any industry standards here, these sizes
739 # are based on someone else's measurements:
740 #  0603 is 30x40 mil pads on 60 mil pad ctr
741 #  0805 is 44x60 mil pads on 80 mil pad ctr
742 # on a PC motherboard.  If you know the "real" values, please educate
743 # me and/or adjust this code.
745 define(`PKG_SMD_BASE',
746         `define(`T', `eval(`$4'/4+`$5'/2)')
747         define(`W', `eval(T/2+15)')
748         define(`X1', `0')
749         define(`X2',  ``$4'')
750         define(`Y',  `0')
751         define(`Y1',  `eval(Y-(`$5'-T)/2-5)')
752         define(`Y2',  `eval(Y+(`$5'-T)/2+5)')
753         # Silkscreen box coordinates
754         define(`X1L', `eval(X1-W)')
755         define(`X2L', `eval(X2+W)')
756         define(`Y1L', `eval(Y1-W)')
757         define(`Y2L', `eval(Y2+W)')
758 Element(0x00 "$1" "`$2'" "$3" eval(10+T/2) eval(Y2L+15) 0 100 0x00)
760         # PAD(X1, Y1, X1, Y2, T, 1)
761         # PAD(X2, Y1, X2, Y2, T, 2)
762         # Use Pad instead of PAD so both pads come out square
763         Pad(X1 Y1 X1 Y2 T "1" 0x100)
764         Pad(X2 Y1 X2 Y2 T "2" 0x100)
765         ElementLine(X1L Y1L X1L Y2L 8)
766         ElementLine(X1L Y2L X2L Y2L 8)
767         ElementLine(X2L Y2L X2L Y1L 8)
768         ElementLine(X2L Y1L X1L Y1L 8)
769         SMD_OUTLINE_EXTRA
772 define(`PKG_SMD_SIMPLE',
773         `define(`SMD_OUTLINE_EXTRA', `')
774         PKG_SMD_BASE(`$1', `$2', `$3', `$4', `$5')
777 define(`PKG_SMD_DIODE',
778         `define(`SMD_OUTLINE_EXTRA',
779                 `
780                 define(`XBAR', `eval(X1L+10)')
781                 ElementLine( XBAR Y1L XBAR Y2L 8 )
782         ')
783         PKG_SMD_BASE(`$1', `$2', `$3', `$4', `$5')
786 define(`PKG_SMD_POLAR',
787         `define(`SMD_OUTLINE_EXTRA',
788                 `
789                 # crude plus sign
790                 # ElementLine(      X1     eval(Y2L+20)       X1    eval(Y2L+70) 8)
791                 # ElementLine( eval(X1-25) eval(Y2L+45) eval(X1+25) eval(Y2L+45) 8)
792                 define(`XBAR', `eval(X1L+10)')
793                 ElementLine( XBAR Y1L XBAR Y2L 8 )
795         ')
796         PKG_SMD_BASE(`$1', `$2', `$3', `$4', `$5')
799 # a smd chip package, capacitor or resistor
801 # $1: canonical name
802 # $2: name on PCB
803 # $3: value
804 # $4: package designator length in MIL *100 + width in MIL /10
805 #     ie 402 == 40 X 20; 603 == 60 X 30 
807 define(`PKG_SMD_CHIP',
808         `define(`X1', `eval(eval(`$4' /100)*10)')
809         define(`Y1', `eval(eval(`$4'- X1 *10) *10)')
810 # line radius (LR) depicts offset to pads lines and pad "band width"
811         define(`LR', `ifelse(eval(Y1 < 40), 1, eval(Y1/4), 10)')
812 Element(0x00 "$1" "`$2'" "$3" 0 0 0 25 0x00)
814         PAD(LR LR LR eval(Y1-LR) eval(LR*2) )
815         PAD(eval(X1-LR) LR eval(X1-LR) eval(Y1-LR) eval(LR*2) )
817         ElementLine( 0  0 X1  0 5)
818         ElementLine(X1  0 X1 Y1 5)
819         ElementLine(X1 Y1  0 Y1 5)
820         ElementLine( 0 Y1  0  0 5)
822         Mark(eval(X1/2) eval(Y1/2))