3 # surface mounted components
6 # Oct 10 2002 - Egil Kvaleberg <egil@kvaleberg.no>
12 # -------------------------------------------------------------------
14 # internal: general purpose two pole surface mount
18 # $4: length of component in mil
19 # $5: width of component in mil, also width of pad
20 # $6: length of pad, expressed in percent of component length
21 # $7: 1 if pin 1 should be marked
23 define(`COMMON_SMT_2PAD_MIL',
26 define(`metalX', `eval((sizX * $6) / 100)')
27 define(`addFRAME', `eval(sizY / 5)')
28 define(`addTIN', `eval(sizY / 5)')
29 define(`padX', `eval(metalX + 2*addTIN)')
30 define(`padY', `eval(sizY + 2*addTIN)')
31 define(`width', `eval(sizX/2 + addFRAME + addTIN)')
32 define(`height', `eval(sizY/2 + addFRAME + addTIN)')
33 define(`centerX', `eval((sizX - padX + 2*addTIN)/2)')
34 define(`silkW', `ifelse(eval(sizY >= 50), 1, 10, eval(sizY/5))')
35 # how much to grow the pads by for soldermask
37 # clearance from planes
38 define(`clearance', 10)
39 Element(0x00 "$1" "`$2'" "$3" 0 0 eval(width + 20) 0 3 100 0x00)
41 ifelse(eval($7 > 0), 1,
42 `ElementLine(eval(-width-silkW) eval(-height + addFRAME) eval(-width-silkW) eval(height-addFRAME) eval(2*silkW))
43 ElementLine(eval(-width-silkW) eval( height - addFRAME) eval(-width + padX/2 -silkW) height silkW)
44 ElementLine(eval(-width + padX/2 - silkW) height width height silkW)
45 ElementLine(width height width -height silkW)
46 ElementLine(width -height eval(-width + padX/2 -silkW) -height silkW)
47 ElementLine(eval(-width + padX/2 -silkW) -height eval(-width-silkW) eval(-height + addFRAME) silkW)
49 `ElementLine(-width -height -width height silkW)
50 ElementLine(-width height width height silkW)
51 ElementLine(width height width -height silkW)
52 ElementLine(width -height -width -height silkW)
55 ifelse(eval(padX > padY), 1,
56 `Pad(eval((-2*centerX - padX + padY)/2) 0
57 eval((-2*centerX + padX - padY)/2) 0
58 padY eval(2*clearance) eval(padY + 2*maskGrow) "1" "1" 0x00000100)
59 Pad(eval(( 2*centerX - padX + padY)/2) 0
60 eval(( 2*centerX + padX - padY)/2) 0
61 padY eval(2*clearance) eval(padY + 2*maskGrow) "2" "2" 0x00000100)
63 `Pad(-centerX eval((-padY+padX)/2)
64 -centerX eval((padY-padX)/2)
65 padX eval(2*clearance) eval(padX + 2*maskGrow) "1" "1" 0x00000100)
66 Pad(centerX eval((-padY+padX)/2)
67 centerX eval((padY-padX)/2)
68 padX eval(2*clearance) eval(padX + 2*maskGrow) "2" "2" 0x00000100)
73 # -------------------------------------------------------------------
75 # internal: general purpose two pole surface mount
79 # $4: pad X (size of pad in direction perpendicular to axis of part) [1/100 mm]
80 # $5: pad Y (size of pad in direction parallel to axis of part) [1/100 mm]
81 # $6: pad center to center spacing [1/100 mm]
82 # $7: courtyard size in direction parallel to axis of part [1/100 mm] (V1)
83 # $8: courtyard size in direction perpendicular to axis of part [1/100 mm] (V2)
84 # $9: length of silk screen line [1/100 mm] (R1)
85 # $10: spacing of silk screen line [1/100 mm] (R2)
87 define(`PKG_SMT_2PAD_MM100',
88 # grab the input values and convert to 1/100 mil
89 `define(`X', `eval(($4 * 10000)/254)')
90 define(`Y', `eval(($5 * 10000)/254)')
91 define(`C', `eval(($6 * 10000)/254)')
92 define(`V1', `eval(($7 * 10000)/254)')
93 define(`V2', `eval(($8 * 10000)/254)')
94 define(`R1', `eval(($9 * 10000)/254)')
95 define(`R2', `eval(($10 * 10000)/254)')
96 # how much to grow the pads by for soldermask [1/100 mil]
97 define(`maskGrow', 300)
98 # clearance from planes [1/100 mil]
99 define(`clearance', 1000)
100 # silk screen width [1/100 mil]
101 define(`SILKW', `800')
102 # courtyard silk screen width [1/100 mil]
104 # element_flags, description, pcb-name, value, mark_x, mark_y,
105 # text_x, text_y, text_direction, text_scale, text_flags
106 Element[0x00000000 "$1" "`$2'" "$3" 0 0 -3150 -3150 0 100 ""]
109 # Pad[x1, y1, x2, y2, thickness, clearance, mask, name , pad number, flags]
110 ifelse(eval(Y > X), 1,
111 `Pad[eval( (-1*C - (Y - X))/2) 0
112 eval( (-1*C + (Y - X))/2) 0
113 X eval(2*clearance) eval(X + 2*maskGrow) "1" "1" "square"]
114 Pad[eval( ( C - (Y - X))/2) 0
115 eval( ( C + (Y - X))/2) 0
116 X eval(2*clearance) eval(X + 2*maskGrow) "2" "2" "square"]
118 `Pad[eval( -1*C/2 ) eval(-(X-Y)/2)
119 eval( -1*C/2 ) eval( (X-Y)/2)
120 Y eval(2*clearance) eval(Y + 2*maskGrow) "1" "1" "square"]
121 Pad[eval( C/2 ) eval(-(X-Y)/2)
122 eval( C/2 ) eval( (X-Y)/2)
123 Y eval(2*clearance) eval(Y + 2*maskGrow) "2" "2" "square"]
126 ifelse(eval(R1 > 0), 1,
127 `ElementLine[eval(-1*R1/2) eval(-1*R2/2) eval(R1/2) eval(-1*R2/2) SILKW]
128 ElementLine[eval(-1*R1/2) eval( R2/2) eval(R1/2) eval( R2/2) SILKW]
132 # This draws a 1 mil placement courtyard outline in silk. It should probably
133 # not be included since you won't want to try and fab a 1 mil silk line. Then
134 # again, it is most useful during parts placement. It really is time for some
135 # additional non-fab layers...
137 # ElementLine[eval(-1*V1/2) eval(-1*V2/2) eval(-1*V1/2) eval( V2/2) CYW]
138 # ElementLine[eval(-1*V1/2) eval(-1*V2/2) eval( V1/2) eval(-1*V2/2) CYW]
139 # ElementLine[eval( V1/2) eval( V2/2) eval( V1/2) eval(-1*V2/2) CYW]
140 # ElementLine[eval( V1/2) eval( V2/2) eval(-1*V1/2) eval( V2/2) CYW]
144 # -------------------------------------------------------------------
147 # general purpose 3 pole surface mount
151 # $4: outer pad width (mil) (in direction perpendicular to part)
152 # $5: outer pad length (mil) (in direction parallel with part)
153 # $6: outer pad spacing (mil) (center to center)
154 # $7: inner pad width (mil) (in direction perpendicular to part)
155 # $8: inner pad length (mil) (in direction parallel with part)
156 # $9: distance from edge of pad to silk (mil) (in direction
157 # perpendicular to part)
158 # $10: distance from edge of pad to silk (mil) (in direction
159 # parallel with part)
160 # $11: Set to "no" to skip silk screen on the sides of the part
161 define(`COMMON_SMT_3PAD_MIL',
169 define(`SLKL', `$10')
171 # silk screen width (mils)
172 define(`SILKW', `10')
174 # silk screen bounding box
175 define(`XMIN', `eval( -PADS/2 - PADL/2 - SLKL - SILKW/2)')
176 define(`XMAX', `eval( PADS/2 + PADL/2 + SLKL + SILKW/2)')
177 define(`YMIN', `eval(-PADW2/2 - SLKW - SILKW/2)')
178 define(`YMAX', `eval( PADW2/2 + SLKW + SILKW/2)')
179 define(`SKIP_SILK', `$11')
182 Element(0x00 "$1" "`$2'" "$3" eval(XMIN+20) eval(YMAX+20) 0 100 0x00)
184 ifelse(0, eval(PADW>PADL),
185 # Pads which have the perpendicular pad dimension less
186 # than or equal to the parallel pad dimension
187 Pad(eval(-1*( PADS + PADL - PADW)/2) 0
188 eval((-1*PADS + PADL - PADW)/2) 0 eval(PADW) "1" 0x100)
189 Pad(eval(-1*(-1*PADS + PADL - PADW)/2) 0
190 eval(( PADS + PADL - PADW)/2) 0 eval(PADW) "3" 0x100)
192 # Pads which have the perpendicular pad dimension greater
193 # than or equal to the parallel pad dimension
194 Pad(eval(-1*PADS/2) eval(-1*(PADW - PADL)/2)
195 eval(-1*PADS/2) eval((PADW - PADL)/2) eval(PADL) "1" 0x100)
196 Pad(eval( PADS/2) eval(-1*(PADW - PADL)/2)
197 eval( PADS/2) eval((PADW - PADL)/2) eval(PADL) "3" 0x100)
200 ifelse(0, eval(PADW2>PADL2),
201 # Pads which have the perpendicular pad dimension less
202 # than or equal to the parallel pad dimension
203 Pad(eval((-PADL2 + PADW2)/2) 0
204 eval(( PADL2 - PADW2)/2) 0 PADW2 "2" 0x100)
206 # Pads which have the perpendicular pad dimension greater
207 # than or equal to the parallel pad dimension
208 Pad(0 eval((-PADW2 + PADL2)/2)
209 0 eval(( PADW2 - PADL2)/2) PADL2 "2" 0x100)
214 ElementLine(XMIN YMIN XMIN YMAX SILKW)
215 ElementLine(XMAX YMAX XMAX YMIN SILKW)
217 ifelse(SKIP_SILK,"no",
220 ElementLine(XMIN YMIN XMAX YMIN SILKW)
221 ElementLine(XMAX YMAX XMIN YMAX SILKW)
223 # Mark the common centroid of the part
229 # -------------------------------------------------------------------
231 # SOT23 style transistor: 3, 4, 5 or 6 pins
235 # $4: pin spacing, lengthwise, mil
236 # $5: pin spacing across, in mil
237 # $6: size of pad, in percent of spacing across
238 # $7: pin numbers, "abc", where a is lower left, b is lower right, c is upper
239 # if "abcd", c is upper right, d is upper left, and a is a wider pad
241 define(`COMMON_SMT_TRANSISTOR_MIL',
242 `define(`spaceX', `$4') # 78 for SOT23
243 define(`spaceY', `$5') # 82 for SOT23
244 define(`padY', `eval((spaceY * $6) / 100)') # 41 for SOT23
245 define(`padX', `ifelse(eval(len(`$7') >= 5), 1,
246 `eval((spaceX * 31) / 100)',
247 `eval((padY * 85) / 100)'
248 )') # 34 for SOT23, 24 for SOT25
249 define(`addFRAME', `eval(padY / 5)')
250 define(`maxX', `eval(2*addFRAME+spaceX+padX)')
251 define(`maxY', `eval(2*addFRAME+spaceY+padY)')
252 define(`centerX', `eval(maxX / 2)')
253 define(`centerY1', `eval(addFRAME + padY/2)')
254 define(`centerX1', `eval(addFRAME + padX/2)')
255 define(`deltaY', `eval((padY-padX)/2)')
256 define(`silkW', `ifelse(eval(spaceY >= 50), 1, 10, eval(spaceY/5))')
259 Element(0x00 "$1" "`$2'" "$3" eval(maxX+20) 0 3 100 0x00)
261 ElementLine(0 0 0 maxY silkW)
262 ElementLine(0 maxY maxX maxY silkW)
263 ElementLine(maxX maxY maxX 0 silkW)
264 ElementLine(maxX 0 0 0 silkW)
269 Pad(eval(centerX1+deltaY) eval(centerY1+spaceY)
270 eval(centerX1+2*deltaY) eval(centerY1+spaceY)
271 padX "substr(`$7',indeX,1)" "substr(`$7',indeX,1)" 0x100)
273 `Pad(centerX1 eval(centerY1+spaceY-deltaY)
274 centerX1 eval(centerY1+spaceY+deltaY)
275 padX "substr(`$7',indeX,1)" "substr(`$7',indeX,1)" 0x100)
277 define(`indeX',incr(indeX))
280 ifelse(eval(len(`$7') == 6), 1,
281 `Pad(centerX eval(centerY1+spaceY-deltaY)
282 centerX eval(centerY1+spaceY+deltaY)
283 padX "substr(`$7',indeX,1)" "substr(`$7',indeX,1)" 0x100)
284 define(`indeX',incr(indeX))
288 Pad(eval(centerX1+spaceX) eval(centerY1+spaceY-deltaY)
289 eval(centerX1+spaceX) eval(centerY1+spaceY+deltaY)
290 padX "substr(`$7',indeX,1)" "substr(`$7',indeX,1)" 0x100)
291 define(`indeX',incr(indeX))
294 ifelse(eval(len(`$7') >= 4), 1,
295 `Pad(eval(centerX1+spaceX) eval(centerY1-deltaY)
296 eval(centerX1+spaceX) eval(centerY1+deltaY)
297 padX "substr(`$7',indeX,1)" "substr(`$7',indeX,1)" 0x100)
298 define(`indeX',incr(indeX))
302 ifelse(eval(len(`$7') != 4), 1,
303 `Pad(centerX eval(centerY1-deltaY)
304 centerX eval(centerY1+deltaY)
305 padX "substr(`$7',indeX,1)" "substr(`$7',indeX,1)" 0x100)
306 define(`indeX',incr(indeX))
310 ifelse(eval(len(`$7') >= 4), 1,
311 `Pad(centerX1 eval(centerY1-deltaY)
312 centerX1 eval(centerY1+deltaY)
313 padX "substr(`$7',indeX,1)" "substr(`$7',indeX,1)" 0x100)
316 Mark(centerX1 eval(centerY1+spaceY))
319 # -------------------------------------------------------------------
321 # SOT223 style transistor, multiple pins on one side, large pin on other side
322 # supports 2+1, 3+1 and 4+1 pins
326 # $4: pin spacing, lengthwise, mil
327 # $5: pin spacing across, in mil
328 # $6: size of pad, in percent of spacing across
329 # $7: pin numbers, "abcd", where abc is three pins on one side, d the extra pin
331 define(`COMMON_SMT_TRANSISTORX_MIL',
332 `define(`spaceX', `$4')
333 define(`spaceY', `$5')
334 define(`padY', `eval((spaceY * $6) / 100)')
335 define(`padX', `ifelse(eval(len(`$7') >= 5), 1,
336 `eval((spaceX * 21) / 100)',
337 `eval((spaceX * 31) / 100)'
339 define(`addFRAME', `eval(padY / 5)')
340 define(`maxX', `eval(2*addFRAME+spaceX+padX)')
341 define(`maxY', `eval(2*addFRAME+spaceY+padY)')
342 define(`centerX', `eval(maxX / 2)')
343 define(`centerY1', `eval(addFRAME + padY/2)')
344 define(`centerX1', `eval(addFRAME + padX/2)')
345 define(`deltaY', `eval((padY-padX)/2)')
346 define(`silkW', `ifelse(eval(spaceY >= 50), 1, 10, eval(spaceY/5))')
349 Element(0x00 "$1" "`$2'" "$3" eval(maxX+20) 0 3 100 0x00)
351 ElementLine(0 0 0 maxY silkW)
352 ElementLine(0 maxY maxX maxY silkW)
353 ElementLine(maxX maxY maxX 0 silkW)
354 ElementLine(maxX 0 0 0 silkW)
356 # 1st pin on pin side
357 Pad(centerX1 eval(centerY1+spaceY-deltaY)
358 centerX1 eval(centerY1+spaceY+deltaY)
359 padX "substr(`$7',indeX,1)" "substr(`$7',indeX,1)" 0x100)
360 define(`indeX',incr(indeX))
362 ifelse(eval(len(`$7') == 4), 1,
363 `Pad(centerX eval(centerY1+spaceY-deltaY)
364 centerX eval(centerY1+spaceY+deltaY)
365 padX "substr(`$7',indeX,1)" "substr(`$7',indeX,1)" 0x100)
366 define(`indeX',incr(indeX))
368 ifelse(eval(len(`$7') == 5), 1,
369 `Pad(eval(centerX1+spaceX/3) eval(centerY1+spaceY-deltaY)
370 eval(centerX1+spaceX/3) eval(centerY1+spaceY+deltaY)
371 padX "substr(`$7',indeX,1)" "substr(`$7',indeX,1)" 0x100)
372 define(`indeX',incr(indeX))
373 Pad(eval(centerX1+2*spaceX/3) eval(centerY1+spaceY-deltaY)
374 eval(centerX1+2*spaceX/3) eval(centerY1+spaceY+deltaY)
375 padX "substr(`$7',indeX,1)" "substr(`$7',indeX,1)" 0x100)
376 define(`indeX',incr(indeX))
379 # last pin on pin side
380 Pad(eval(centerX1+spaceX) eval(centerY1+spaceY-deltaY)
381 eval(centerX1+spaceX) eval(centerY1+spaceY+deltaY)
382 padX "substr(`$7',indeX,1)" "substr(`$7',indeX,1)" 0x100)
383 define(`indeX',incr(indeX))
385 # extra wide pin on opposite side
386 Pad(eval(centerX+spaceX/4) centerY1
387 eval(centerX-spaceX/4) centerY1
388 padY "substr(`$7',indeX,1)" "substr(`$7',indeX,1)" 0x100)
390 Mark(centerX1 eval(centerY1+spaceY))
393 # -------------------------------------------------------------------
396 # definition of a SMT dual inline package of any size
401 # $5: width of component itself in mils (228 for SO) -> 261
402 # $6: pin spacing in 1/100 mils (500 for SO)
403 # $7: pad fatness in mils (20 for SO)
404 # $8: pad basic length in mils, will add extra tin here (50 for SO)
406 define(`COMMON_SMT_DUALINLINE',
407 `define(`pinCOUNT', `$4')
408 define(`pinS100', `$6')
410 define(`addTIN', `eval(padY / 5)')
411 define(`maxX', `eval($5 + 2*addTIN)')
412 define(`padX', `eval($8 + 2*addTIN)')
413 define(`maxY', `eval((pinCOUNT/2 * pinS100) / 100)')
414 define(`lowX1', `eval(padY/2)')
415 define(`highX1', `eval(padX-padY)')
416 define(`lowX2', `eval(maxX - (padX-padY))')
417 define(`highX2', `eval(maxX - padY/2)')
418 define(`centerX', `eval(maxX / 2)')
419 Element(0x00 "$1" "`$2'" "$3" eval(centerX + 20) 50 3 100 0x00)
421 forloop(`i', 1, eval(pinCOUNT/2),
422 `PAD(lowX1, eval((i*pinS100 - pinS100/2)/100),
423 highX1, eval((i*pinS100 - pinS100/2)/100), padY, i)
425 forloop(`i', 1, eval(pinCOUNT/2),
426 `PAD(lowX2, eval(maxY - (i*pinS100 - pinS100/2)/100),
427 highX2, eval(maxY - (i*pinS100 - pinS100/2)/100), padY, eval(i + pinCOUNT/2))
429 define(`smaxX', `eval(maxX+rSILK)')
430 define(`smaxY', `eval(maxY+rSILK)')
431 define(`rSh', `eval(-rSILK)')
432 define(`radW', `eval($5/3)')
433 define(`radP', `eval(pinS100/100)')
434 define(`rad', `ifelse(1,eval(radW<radP),radW,radP)')
435 ElementLine(rSh rSh eval(centerX - rad) rSh rSILK)
436 ElementArc(centerX rSh rad rad 0 180 rSILK)
437 ElementLine(eval(centerX + rad) rSh smaxX rSh rSILK)
438 ElementLine(smaxX rSh smaxX smaxY rSILK)
439 ElementLine(smaxX smaxY rSh smaxY rSILK)
440 ElementLine(rSh smaxY rSh rSh rSILK)
441 Mark(eval(padX/2) eval(pinS100/200))
446 # -------------------------------------------------------------------
448 # general purpose two pole surface mount
449 # size args for a 0805 is 8,5 for 0402 is 4,2 etc
453 # $4: length of component in mil
454 # $5: width of component in mil
456 define(`PKG_SMT_2PAD_MIL',
457 `COMMON_SMT_2PAD_MIL(`$1', `$2', `$3', `$4', `$5', 20, 0)')
459 # general purpose two pole surface mount, pin 1 is marked
463 # $4: length of component in 1/10 mm
464 # $5: width of component in 1/10 mm
466 define(`PKG_SMT_2PAD_EIA',
467 `COMMON_SMT_2PAD_MIL(`$1', `$2', `$3',
468 `eval(($4*1000)/254)', `eval(($5*1000)/254)', 20, 1)')
471 # general purpose diode surface mount, pin 1 is marked
475 # $4: length of component in 1/10 mm
476 # $5: width of component in 1/10 mm
478 define(`PKG_SMT_DIODE',
479 `COMMON_SMT_2PAD_MIL(`$1', `$2', `$3',
480 `eval(($4*1000)/254)', `eval(($5*1000)/254)', 30, 1)')
483 # diode in transistor housing, 2 active pins, 1 is cathode, 2 is anode
487 # $4: pin spacing lengthwise in 1/10 mm
488 # $5: pin spacing across in 1/10 mm
490 define(`PKG_SMT_TRANSISTOR2',
491 `COMMON_SMT_TRANSISTOR_MIL(`$1', `$2', `$3',
492 `eval(($4*1000)/254)', `eval(($5*1000)/254)', 50, `231')')
496 # general purpose transistor, 3 pins
500 # $4: pin spacing lengthwise in 1/10 mm
501 # $5: pin spacing across in 1/10 mm
503 define(`PKG_SMT_TRANSISTOR3',
504 `COMMON_SMT_TRANSISTOR_MIL(`$1', `$2', `$3',
505 `eval(($4*1000)/254)', `eval(($5*1000)/254)', 50, `123')')
508 # general purpose transistor, 4 pins
512 # $4: pin spacing lengthwise in 1/10 mm
513 # $5: pin spacing across in 1/10 mm
515 define(`PKG_SMT_TRANSISTOR4',
516 `COMMON_SMT_TRANSISTOR_MIL(`$1', `$2', `$3',
517 `eval(($4*1000)/254)', `eval(($5*1000)/254)', 50, `1234')')
520 # general purpose transistor, 5 pins
524 # $4: pin spacing lengthwise in 1/10 mm
525 # $5: pin spacing across in 1/10 mm
527 define(`PKG_SMT_TRANSISTOR5',
528 `COMMON_SMT_TRANSISTOR_MIL(`$1', `$2', `$3',
529 `eval(($4*1000)/254)', `eval(($5*1000)/254)', 50, `12345')')
530 define(`PKG_SMT_TRANSISTOR5A',
531 `COMMON_SMT_TRANSISTOR_MIL(`$1', `$2', `$3',
532 `eval(($4*1000)/254)', `eval(($5*1000)/254)', 50, `45123')')
535 # general purpose transistor, 6 pins
539 # $4: pin spacing lengthwise in 1/10 mm
540 # $5: pin spacing across in 1/10 mm
542 define(`PKG_SMT_TRANSISTOR6',
543 `COMMON_SMT_TRANSISTOR_MIL(`$1', `$2', `$3',
544 `eval(($4*1000)/254)', `eval(($5*1000)/254)', 50, `123456')')
547 # general purpose transistor, 3 pins on one side, cooling tab/pin on other
551 # $4: pin spacing lengthwise in 1/10 mm
552 # $5: pin spacing across in 1/10 mm
554 define(`PKG_SMT_TRANSISTOR4X',
555 `COMMON_SMT_TRANSISTORX_MIL(`$1', `$2', `$3',
556 `eval(($4*1000)/254)', `eval(($5*1000)/254)', 50, `1234')')
558 # SO package, narrow and wide
564 # $6: pin pitch 1/100mil
566 # BUG: total package size in Y is larger
569 # 14 plasticX,Y=157,344
570 # 24W plasticX,Y=299,614
571 define(`PKG_SO', `COMMON_SMT_DUALINLINE(`$1',`$2',`$3',`$4',`$5',`$6',20,50)')
574 # NOTE: 24 plasticX,Y=245,368
575 define(`PKG_SSO', `COMMON_SMT_DUALINLINE(`$1',`$2',`$3',`$4',`$5',`$6',16,40)')
578 # NOTE: 28 plasticX,Y=469,319
579 # NOTE: 32A plasticX,Y=728,319
580 # BUG: check total size wrt rounding, it shoudl
581 # BUG: numbering is all different -- check
582 define(`PKG_TSOP', `COMMON_SMT_DUALINLINE(`$1',`$2',`$3',`$4',`$5',`$6',12,40)')
585 # NOTE: 8 plasticX,Y=177,122
586 # BUG: check total size wrt rounding
587 # BUG: numbering is all different -- check
588 define(`PKG_TSSOP', `COMMON_SMT_DUALINLINE(`$1',`$2',`$3',`$4',260,2600,14,40)')
590 # BUG: add SO8ePAD = SO8 plus dX=95+ dy=122+ solder pad
591 #efine(`xKG_SO', `COMMON_SMT_DUALINLINE(`$1',`$2',`$3',`$4',244,5000,20,50)')
592 # BUG: add PowerSO.PDF = MO166 - include dx=244+ dy=630 wide strip / X,Y=437,630
593 #efine(`PKG_MO166', `COMMON_SMT_DUALINLINE(`$1',`$2',`$3',`$4',570,5000,25,50)') # 24:
596 # -------------------------------------------------------------------
597 # the definition of a SMT dual inline package
602 # $5: pad width (1/1000 mil)
603 # $6: pad length (1/1000 mil)
604 # $7: pad pitch (1/1000 mil)
605 # $8: pad seperation (gap in the copper) for pads on opposite sides of
606 # the package (1/1000 mil)
607 # $9: define to make the pins get numbered starting with the highest pin
608 # instead of pin 1. Needed for certain brain damaged packages like
609 # the Mini-Circuits KK81
610 # pin 1 will be upper left, pin N/2 will be lower left,
611 # pin N will be upper right as defined here
612 define(`COMMON_SMT_DIL_MIL',
615 define(`NPADS', `$4')
616 # pad width in 1/1000 mil
617 define(`PADWIDTH', `$5')
618 # pad length in 1/1000 mil
619 define(`PADLENGTH',`$6')
620 # pad pitch 1/1000 mil
622 # seperation between pads on opposite sides 1/1000 mil
623 define(`PADSEP',`$8')
625 # X coordinates for the right hand column of pads (1/100 mils)
626 define(`X1', `eval( (PADSEP/2 + PADLENGTH - PADWIDTH/2)/10)')
627 define(`X2', `eval( (PADSEP/2 + PADWIDTH/2)/10)')
629 # pad clearance to plane layer in 1/100 mil
630 define(`PADCLEAR', 1000)
632 # pad soldermask width in 1/100 mil
633 define(`PADMASK', eval(PADWIDTH/10 + 1000))
635 # silk screen width (1/100 mils)
636 define(`SILKW', `1000')
637 define(`SILKSEP', `500')
640 # figure out if we have an even or odd number of pins per side
641 define(`TMP1', eval(NPADS/4))
642 define(`TMP2', eval((4*TMP1 - NPADS) == 0))
643 ifelse(TMP2, 1, `define(`EVEN',"yes")', `define(`EVEN',"no")')
645 # silk bounding box is -XMAX,-YMAX, XMAX,YMAX (1/100 mils)
646 define(`XMAX', `eval( (PADSEP/2 + PADLENGTH + 5*SILKW)/10 + SILKSEP )')
648 `define(`YMAX', `eval( ((NPADS/4)*PITCH - PITCH/2 + PADWIDTH/2 + 5*SILKW)/10 + SILKSEP )')',
649 `define(`YMAX', `eval( ((NPADS/4)*PITCH + PADWIDTH/2 + 5*SILKW)/10 + SILKSEP )')'
654 ifelse(REV,"reverse",
655 `define(`CURPIN', NPADS)'
657 `define(`CURPIN', `1')'
659 # element_flags, description, pcb-name, value, mark_x, mark_y,
660 # text_x, text_y, text_direction, text_scale, text_flags
661 Element[0x00000000 "$1" "`$2'" "$3" 0 0 -2000 -6000 0 100 0x00000000]
664 # Pad[x1, y1, x2, y2, thickness, clearance, mask, name , pad number, flags]
665 forloop(`i', 1, eval(NPADS / 2),
667 `Pad[ -X1 eval( (-(NPADS/4)*PITCH - PITCH/2 + i*PITCH)/10)
668 -X2 eval( (-(NPADS/4)*PITCH - PITCH/2 + i*PITCH)/10)
669 eval(PADWIDTH/10) PADCLEAR PADMASK "CURPIN" "CURPIN" 0x00000100]',
670 `Pad[ -X1 eval( (-(NPADS/4)*PITCH - PITCH + i*PITCH)/10)
671 -X2 eval( (-(NPADS/4)*PITCH - PITCH + i*PITCH)/10)
672 eval(PADWIDTH/10) PADCLEAR PADMASK "CURPIN" "CURPIN" 0x00000100]')
674 ifelse(REV,"reverse",
675 `define(`CURPIN', decr(CURPIN))',
676 `define(`CURPIN', incr(CURPIN))'
679 forloop(`i', eval((NPADS / 2) + 1), NPADS,
681 `Pad[ X1 eval( ((NPADS/4)*PITCH + PITCH/2 - (i-NPADS/2)*PITCH)/10)
682 X2 eval( ((NPADS/4)*PITCH + PITCH/2 - (i-NPADS/2)*PITCH)/10)
683 eval(PADWIDTH/10) PADCLEAR PADMASK "CURPIN" "CURPIN" 0x00000100]',
684 `Pad[ X1 eval( ((NPADS/4)*PITCH + PITCH - (i-NPADS/2)*PITCH)/10)
685 X2 eval( ((NPADS/4)*PITCH + PITCH - (i-NPADS/2)*PITCH)/10)
686 eval(PADWIDTH/10) PADCLEAR PADMASK "CURPIN" "CURPIN" 0x00000100]')
687 ifelse(REV,"reverse",
688 `define(`CURPIN', decr(CURPIN))',
689 `define(`CURPIN', incr(CURPIN))'
693 ElementLine[-XMAX -YMAX -XMAX YMAX SILKW]
694 ElementLine[-XMAX YMAX XMAX YMAX SILKW]
695 ElementLine[ XMAX YMAX XMAX -YMAX SILKW]
696 ElementLine[-XMAX -YMAX -2500 -YMAX SILKW]
697 ElementLine[ XMAX -YMAX 2500 -YMAX SILKW]
699 # punt on the arc on small parts as it can cover the pads
700 ifelse(eval((PADSEP)/1000 > 70), 1, `ElementArc[0 -YMAX 2500 2500 0 180 SILKW]', )
704 # dimensions are given in 1/100 mm.
705 # $5-$8 are pad width, length, pitch, and sep
706 define(`COMMON_SMT_DIL_MM', `COMMON_SMT_DIL_MIL(`$1',`$2',`$3',`$4',
707 eval($5*100000/254),eval($6*100000/254),eval($7*100000/254),eval($8*100000/254), `$9')')
709 define(`PKG_US', `COMMON_SMT_DIL_MM(`$1',`$2',`$3',`$4',30,70,50,200)')