6

I'm in the process of writing a datasheet for an Integrated Circuit, using LaTeX. Anyone knows how to draw a pin configuration diagram, like the one in the attached picture? enter image description here

2
  • 1
    Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – user31729
    Sep 20 '14 at 15:23
  • 1
    First, do you know how to draw (use Tikz)? Sep 21 '14 at 14:32
14

Here is a solution using tikz. The main feature, I think, is that the pin labels are easy to edit/change. This is possibly fortunate because the labels below are roughly the same as the OPs for pins 1-16 but the remaining labels need to be changed as they just repeat the labels for the first 16 pins.

Here is an image for what my code produces:

enter image description here

and here is the code itself:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{amsmath}
\begin{document}
\begin{tikzpicture}[scale=0.38,
     pin/.style={draw,rectangle,minimum width=1.8em,font=\small}
     ]
   % Main trick: loop over the label numbers and then adjust their position
   % in the tikzpicture using evaluate to calculate \y=y-coordinate of pin
   \foreach \i/\desc [evaluate=\i as \y using (17.5-\i)]
      in {1/{P0.21/PWm5/AD1.6/cap1.3},
          2/{P0.22/AD1.7/CAP0.0/Mat0.0},
          3/{RTCX1},
          4/{P1.19/TRACEPKT3},
          5/{RTCX2},
          6/{V$_{\text{SS}}$},
          7/{VODA},
          8/{P1.18/TRACEPKT2},
          9/{P0.25/AD0.4/AOUT},
         10/{D+},
         11/{D-},
         12/{P.17/TRACEPKT1},
         13/{P0.28/AD0.1/CAP0.2/MAT0.2},
         14/{P0.29/AD0.2/CAP0.3/MAT0.3},
         15/{P0.30/AD0.3/EINT3/CAP0.0},
         16/{P1.16/TRACEPKT0} }
   {
     \draw node[pin,anchor=east] at (0,\y){\small$\i$};
     \node[align=right,anchor=east] at (-1.6,\y){\desc};
   }
   \foreach \i/\desc [evaluate=\i as \x using (\i-15.5)]
     in {17/{P0.21/PWm5/AD1.6/cap1.3},
         18/{P0.22/AD1.7/CAP0.0/Mat0.0},
         19/{RTCX1},
         20/{P1.19/TRACEPKT3},
         21/{RTCX2},
         22/{V$_{\text{SS}}$},
         23/{VODA},
         24/{P1.18/TRACEPKT2},
         25/{P0.25/AD0.4/AOUT},
         26/{D+},
         27/{D-},
         28/{P.17/TRACEPKT1},
         29/{P0.28/AD0.1/CAP0.2/MAT0.2},
         30/{P0.29/AD0.2/CAP0.3/MAT0.3},
         31/{P0.30/AD0.3/EINT3/CAP0.0},
         32/{P1.16/TRACEPKT0} }
   {
     \draw node[pin,anchor=east,rotate=90] at (\x,0){\small$\i$};
     \node[align=right,anchor=east,rotate=90] at (\x,-1.6){\desc};
   }
   \foreach \i/\desc [evaluate=\i as \y using (\i-31.5)]
     in {33/{P0.21/PWm5/AD1.6/cap1.3},
         34/{P0.22/AD1.7/CAP0.0/Mat0.0},
         35/{RTCX1},
         36/{P1.19/TRACEPKT3},
         37/{RTCX2},
         38/{V$_{\text{SS}}$},
         39/{VODA},
         40/{P1.18/TRACEPKT2},
         41/{P0.25/AD0.4/AOUT},
         42/{D+},
         43/{D-},
         44/{P.17/TRACEPKT1},
         45/{P0.28/AD0.1/CAP0.2/MAT0.2},
         46/{P0.29/AD0.2/CAP0.3/MAT0.3},
         47/{P0.30/AD0.3/EINT3/CAP0.0},
         48/{P1.16/TRACEPKT0} }
   {
     \draw node[pin,anchor=west] at (18,\y){\small$\i$};
     \node[align=left,anchor=west] at (19.6,\y){\desc};
   }
   \foreach \i/\desc [evaluate=\i as \x using (65.5-\i)]
     in {49/{P0.21/PWm5/AD1.6/cap1.3},
         50/{P0.22/AD1.7/CAP0.0/Mat0.0},
         51/{RTCX1},
         52/{P1.19/TRACEPKT3},
         53/{RTCX2},
         54/{V$_{\text{SS}}$},
         55/{VODA},
         56/{P1.18/TRACEPKT2},
         57/{P0.25/AD0.4/AOUT},
         58/{D+},
         59/{D-},
         60/{P.17/TRACEPKT1},
         61/{P0.28/AD0.1/CAP0.2/MAT0.2},
         62/{P0.29/AD0.2/CAP0.3/MAT0.3},
         63/{P0.30/AD0.3/EINT3/CAP0.0},
         64/{P1.16/TRACEPKT0} }
   {
     \draw node[pin,anchor=west,rotate=90] at (\x,18){\small$\i$};
     \node[align=right,anchor=west,rotate=90] at (\x,19.6){\desc};
   }
   \draw[ultra thick]
      (0,0.8)--(0,17.2)--(0.8,18)--(17.2,18)--(18,17.2)
             --(18,0.8)--(17.2,0)--(0.8,0)--cycle;
   \draw(1.5,16.5)circle[radius=0.7];
   \node at (9,9){LPC2144/2146/2148};
 \end{tikzpicture}
\end{document}
3
  • Thank you very much for your great code example. But I think you forgot \usepackage{amsmath}.
    – jlk
    Sep 21 '14 at 20:14
  • I get an Error-Message without amsmath: ! Undefined control sequence. \desc ->V$_{\text {SS}}$ l.28 }
    – jlk
    Sep 21 '14 at 21:50
  • @harryhaller Oops, sorry, you are right: it's because of the \text. I'll add it in. Thanks.
    – user30471
    Sep 21 '14 at 21:52
6

Here is a Circuitiz component version for a general 64 Lead Quad Flat Package. (My OCD seems to be acting up.) Of course, I usually stick components into a separate file where I never have to look at the code again.

LQFP

\documentclass{standalone}
\usepackage{circuitikz}

\newlength{\ResUp} \newlength{\ResDown}
\newlength{\ResLeft} \newlength{\ResRight}

% ************************** multipoles *****************************

\ctikzset{multipoles/.is family}
\ctikzset{multipoles/pin spacing/.initial = 5mm} % default value

\pgfkeys{/tikz/pin spacing/.initial = 0mm}
\pgfkeys{/tikz/pin spacing/.default = 0mm}

\newlength{\IClen}  % scale factor
\newcommand{\pinsize}{\ifdim\IClen<3.5mm \tiny \else \scriptsize \fi}

\newcommand{\Compass}% define anchors for compass points
{\anchor{north east}{\northeast}
\anchor{south west}{\southwest}
\anchor{north}{\pgfextracty{\ResUp}{\northeast}\pgfpoint{0cm}{\ResUp}}
\anchor{north west}{\pgfextracty{\ResUp}{\northeast}\pgfextractx{\ResLeft}{\southwest}\pgfpoint{\ResLeft}{\ResUp}}
\anchor{west}{\pgfextractx{\ResLeft}{\sosuthwest}\pgfpoint{\ResLeft}{0cm}}
\anchor{south}{\pgfextracty{\ResDown}{\southwest}\pgfpoint{0cm}{\ResDown}}
\anchor{south east}{\pgfextracty{\ResDown}{\southwest}\pgfextractx{\ResRight}{\northeast}\pgfpoint{\ResRight}{\ResDown}}
\anchor{east}{\pgfextractx{\ResRight}{\northeast}\pgfpoint{\ResRight}{0cm}}}

% ***************************** QFP 64 *********************************
% anchors p1 - p64

\pgfdeclareshape{qfp64}{
\anchor{center}{\pgfpointorigin} % within the node, (0,0) is the center

\anchor{text}% this is used to center the text in the node
 {\pgfpoint{-.5\wd\pgfnodeparttextbox}{-.5\ht\pgfnodeparttextbox}}

\savedmacro{\resize}{   % called automatically
 \setlength{\IClen}{\pgfkeysvalueof{/tikz/pin spacing}} % from node[]
 \ifdim\IClen=0mm \setlength{\IClen}
  {\pgfkeysvalueof{/tikz/circuitikz/multipoles/pin spacing}} \fi    % from \ctikzset{}
}
\savedanchor\icpinla{\pgfpoint{-9.8\IClen}{7.5\IClen}}  % pin 1
\anchor{p1}{\icpinla}
\savedanchor\icpinlb{\pgfpoint{-9.8\IClen}{6.5\IClen}}  % pin 2
\anchor{p2}{\icpinlb}
\savedanchor\icpinlc{\pgfpoint{-9.8\IClen}{5.5\IClen}}  % pin 3
\anchor{p3}{\icpinlc}
\savedanchor\icpinld{\pgfpoint{-9.8\IClen}{4.5\IClen}}  % pin 4
\anchor{p4}{\icpinld}
\savedanchor\icpinle{\pgfpoint{-9.8\IClen}{3.5\IClen}}  % pin 5
\anchor{p5}{\icpinle}
\savedanchor\icpinlf{\pgfpoint{-9.8\IClen}{2.5\IClen}}  % pin 6
\anchor{p6}{\icpinlf}
\savedanchor\icpinlg{\pgfpoint{-9.8\IClen}{1.5\IClen}}  % pin 7
\anchor{p7}{\icpinlg}
\savedanchor\icpinlh{\pgfpoint{-9.8\IClen}{0.5\IClen}}  % pin 8
\anchor{p8}{\icpinlh}
\savedanchor\icpinli{\pgfpoint{-9.8\IClen}{-0.5\IClen}}  % pin 9
\anchor{p9}{\icpinli}
\savedanchor\icpinlj{\pgfpoint{-9.8\IClen}{-1.5\IClen}}  % pin 10
\anchor{p10}{\icpinlj}
\savedanchor\icpinlk{\pgfpoint{-9.8\IClen}{-2.5\IClen}}  % pin 11
\anchor{p11}{\icpinlk}
\savedanchor\icpinll{\pgfpoint{-9.8\IClen}{-3.5\IClen}}  % pin 12
\anchor{p12}{\icpinll}
\savedanchor\icpinlm{\pgfpoint{-9.8\IClen}{-4.5\IClen}}  % pin 13
\anchor{p13}{\icpinlm}
\savedanchor\icpinln{\pgfpoint{-9.8\IClen}{-5.5\IClen}}  % pin 14
\anchor{p14}{\icpinln}
\savedanchor\icpinlo{\pgfpoint{-9.8\IClen}{-6.5\IClen}}  % pin 15
\anchor{p15}{\icpinlo}
\savedanchor\icpinlp{\pgfpoint{-9.8\IClen}{-7.5\IClen}}  % pin 16
\anchor{p16}{\icpinlp}

\savedanchor\icpinba{\pgfpoint{-7.5\IClen}{-9.8\IClen}} % pin 17
\anchor{p17}{\icpinba}
\savedanchor\icpinbb{\pgfpoint{-6.5\IClen}{-9.8\IClen}} % pin 18
\anchor{p18}{\icpinbb}
\savedanchor\icpinbc{\pgfpoint{-5.5\IClen}{-9.8\IClen}} % pin 19
\anchor{p19}{\icpinbc}
\savedanchor\icpinbd{\pgfpoint{-4.5\IClen}{-9.8\IClen}} % pin 20
\anchor{p20}{\icpinbd}
\savedanchor\icpinbe{\pgfpoint{-3.5\IClen}{-9.8\IClen}} % pin 21
\anchor{p21}{\icpinbe}
\savedanchor\icpinbf{\pgfpoint{-2.5\IClen}{-9.8\IClen}} % pin 22
\anchor{p22}{\icpinbf}
\savedanchor\icpinbg{\pgfpoint{-1.5\IClen}{-9.8\IClen}} % pin 23
\anchor{p23}{\icpinbg}
\savedanchor\icpinbh{\pgfpoint{-0.5\IClen}{-9.8\IClen}} % pin 24
\anchor{p24}{\icpinbh}
\savedanchor\icpinbi{\pgfpoint{0.5\IClen}{-9.8\IClen}}  % pin 25
\anchor{p25}{\icpinbi}
\savedanchor\icpinbj{\pgfpoint{1.5\IClen}{-9.8\IClen}}  % pin 26
\anchor{p26}{\icpinbj}
\savedanchor\icpinbk{\pgfpoint{2.5\IClen}{-9.8\IClen}}  % pin 27
\anchor{p27}{\icpinbk}
\savedanchor\icpinbl{\pgfpoint{3.5\IClen}{-9.8\IClen}}  % pin 28
\anchor{p38}{\icpinbl}
\savedanchor\icpinbm{\pgfpoint{4.5\IClen}{-9.8\IClen}}  % pin 29
\anchor{p29}{\icpinbm}
\savedanchor\icpinbn{\pgfpoint{5.5\IClen}{-9.8\IClen}}  % pin 30
\anchor{p30}{\icpinbn}
\savedanchor\icpinbo{\pgfpoint{6.5\IClen}{-9.8\IClen}}  % pin 31
\anchor{p31}{\icpinbo}
\savedanchor\icpinbp{\pgfpoint{7.5\IClen}{-9.8\IClen}}  % pin 32
\anchor{p32}{\icpinbp}

\savedanchor\icpinra{\pgfpoint{9.8\IClen}{-7.5\IClen}}  % pin 33
\anchor{p33}{\icpinra}
\savedanchor\icpinrb{\pgfpoint{9.8\IClen}{-6.5\IClen}}  % pin 34
\anchor{p34}{\icpinrb}
\savedanchor\icpinrc{\pgfpoint{9.8\IClen}{-5.5\IClen}}  % pin 35
\anchor{p35}{\icpinrc}
\savedanchor\icpinrd{\pgfpoint{9.8\IClen}{-4.5\IClen}}  % pin 36
\anchor{p36}{\icpinrd}
\savedanchor\icpinre{\pgfpoint{9.8\IClen}{-3.5\IClen}}  % pin 37
\anchor{p37}{\icpinre}
\savedanchor\icpinrf{\pgfpoint{9.8\IClen}{-2.5\IClen}}  % pin 28
\anchor{p38}{\icpinrf}
\savedanchor\icpinrg{\pgfpoint{9.8\IClen}{-1.5\IClen}}  % pin 39
\anchor{p39}{\icpinrg}
\savedanchor\icpinrh{\pgfpoint{9.8\IClen}{-0.5\IClen}}  % pin 40
\anchor{p40}{\icpinrh}
\savedanchor\icpinri{\pgfpoint{9.8\IClen}{0.5\IClen}}  % pin 41
\anchor{p41}{\icpinri}
\savedanchor\icpinrj{\pgfpoint{9.8\IClen}{1.5\IClen}}  % pin 42
\anchor{p42}{\icpinrj}
\savedanchor\icpinrk{\pgfpoint{9.8\IClen}{2.5\IClen}}  % pin 43
\anchor{p43}{\icpinrk}
\savedanchor\icpinrl{\pgfpoint{9.8\IClen}{3.5\IClen}}  % pin 44
\anchor{p44}{\icpinrl}
\savedanchor\icpinrm{\pgfpoint{9.8\IClen}{4.5\IClen}}  % pin 45
\anchor{p45}{\icpinrm}
\savedanchor\icpinrn{\pgfpoint{9.8\IClen}{5.5\IClen}}  % pin 46
\anchor{p46}{\icpinrn}
\savedanchor\icpinro{\pgfpoint{9.8\IClen}{6.5\IClen}}  % pin 47
\anchor{p47}{\icpinro}
\savedanchor\icpinrp{\pgfpoint{9.8\IClen}{7.5\IClen}}  % pin 48
\anchor{p48}{\icpinrp}

\savedanchor\icpinta{\pgfpoint{7.5\IClen}{9.8\IClen}}   % pin 49
\anchor{p49}{\icpinta}
\savedanchor\icpintb{\pgfpoint{6.5\IClen}{9.8\IClen}}   % pin 50
\anchor{p50}{\icpintb}
\savedanchor\icpintc{\pgfpoint{5.5\IClen}{9.8\IClen}}   % pin 51
\anchor{p51}{\icpintc}
\savedanchor\icpintd{\pgfpoint{4.5\IClen}{9.8\IClen}}   % pin 52
\anchor{p52}{\icpintd}
\savedanchor\icpinte{\pgfpoint{3.5\IClen}{9.8\IClen}}   % pin 53
\anchor{p53}{\icpinte}
\savedanchor\icpintf{\pgfpoint{2.5\IClen}{9.8\IClen}}   % pin 54
\anchor{p54}{\icpintf}
\savedanchor\icpintg{\pgfpoint{1.5\IClen}{9.8\IClen}}   % pin 55
\anchor{p55}{\icpintg}
\savedanchor\icpinth{\pgfpoint{0.5\IClen}{9.8\IClen}}   % pin 56
\anchor{p56}{\icpinth}
\savedanchor\icpinti{\pgfpoint{-0.5\IClen}{9.8\IClen}}  % pin 57
\anchor{p57}{\icpinti}
\savedanchor\icpintj{\pgfpoint{-1.5\IClen}{9.8\IClen}}  % pin 58
\anchor{p58}{\icpintj}
\savedanchor\icpintk{\pgfpoint{-2.5\IClen}{9.8\IClen}}  % pin 59
\anchor{p59}{\icpintk}
\savedanchor\icpintl{\pgfpoint{-3.5\IClen}{9.8\IClen}}  % pin 60
\anchor{p60}{\icpintl}
\savedanchor\icpintm{\pgfpoint{-4.5\IClen}{9.8\IClen}}  % pin 61
\anchor{p61}{\icpintm}
\savedanchor\icpintn{\pgfpoint{-5.5\IClen}{9.8\IClen}}  % pin 30
\anchor{p62}{\icpintn}
\savedanchor\icpinto{\pgfpoint{-6.5\IClen}{9.8\IClen}}  % pin 31
\anchor{p63}{\icpinto}
\savedanchor\icpintp{\pgfpoint{-7.5\IClen}{9.8\IClen}}  % pin 32
\anchor{p64}{\icpintp}

\savedanchor{\northeast}{\pgfpoint{9.8\IClen}{9.8\IClen}}
\savedanchor{\southwest}{\pgfpoint{-9.8\IClen}{-9.8\IClen}}
\Compass% standard anchors

\foregroundpath{ % border and pin numbers are drawn here
 \pgfsetlinewidth{0.1\IClen}
 \pgfpathmoveto{\pgfpoint{-9\IClen}{8.4\IClen}}
 \pgfpathlineto{\pgfpoint{-9\IClen}{-8.4\IClen}}
 \pgfpathlineto{\pgfpoint{-8.4\IClen}{-9\IClen}}
 \pgfpathlineto{\pgfpoint{8.4\IClen}{-9\IClen}}
 \pgfpathlineto{\pgfpoint{9\IClen}{-8.4\IClen}}
 \pgfpathlineto{\pgfpoint{9\IClen}{8.4\IClen}}
 \pgfpathlineto{\pgfpoint{8.4\IClen}{9\IClen}}
 \pgfpathlineto{\pgfpoint{-8.4\IClen}{9\IClen}}
 \pgfpathlineto{\pgfpoint{-9\IClen}{8.4\IClen}}
 \pgfpathclose
 \pgfusepath{draw}  %draw border
 \pgfsetlinewidth{0.06\IClen}
 \pgfpathcircle{\pgfpoint{-7.8\IClen}{7.8\IClen}}{0.6\IClen}
 \pgfpathrectanglecorners{\pgfpoint{-9.8\IClen}{7.2\IClen}}{\pgfpoint{-9\IClen}{7.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-9.8\IClen}{6.2\IClen}}{\pgfpoint{-9\IClen}{6.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-9.8\IClen}{5.2\IClen}}{\pgfpoint{-9\IClen}{5.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-9.8\IClen}{4.2\IClen}}{\pgfpoint{-9\IClen}{4.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-9.8\IClen}{3.2\IClen}}{\pgfpoint{-9\IClen}{3.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-9.8\IClen}{2.2\IClen}}{\pgfpoint{-9\IClen}{2.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-9.8\IClen}{1.2\IClen}}{\pgfpoint{-9\IClen}{1.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-9.8\IClen}{0.2\IClen}}{\pgfpoint{-9\IClen}{0.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-9.8\IClen}{-0.2\IClen}}{\pgfpoint{-9\IClen}{-0.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-9.8\IClen}{-1.2\IClen}}{\pgfpoint{-9\IClen}{-1.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-9.8\IClen}{-2.2\IClen}}{\pgfpoint{-9\IClen}{-2.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-9.8\IClen}{-3.2\IClen}}{\pgfpoint{-9\IClen}{-3.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-9.8\IClen}{-4.2\IClen}}{\pgfpoint{-9\IClen}{-4.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-9.8\IClen}{-5.2\IClen}}{\pgfpoint{-9\IClen}{-5.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-9.8\IClen}{-6.2\IClen}}{\pgfpoint{-9\IClen}{-6.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-9.8\IClen}{-7.2\IClen}}{\pgfpoint{-9\IClen}{-7.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-7.2\IClen}{-9.8\IClen}}{\pgfpoint{-7.8\IClen}{-9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-6.2\IClen}{-9.8\IClen}}{\pgfpoint{-6.8\IClen}{-9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-5.2\IClen}{-9.8\IClen}}{\pgfpoint{-5.8\IClen}{-9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-4.2\IClen}{-9.8\IClen}}{\pgfpoint{-4.8\IClen}{-9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-3.2\IClen}{-9.8\IClen}}{\pgfpoint{-3.8\IClen}{-9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-2.2\IClen}{-9.8\IClen}}{\pgfpoint{-2.8\IClen}{-9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-1.2\IClen}{-9.8\IClen}}{\pgfpoint{-1.8\IClen}{-9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-0.2\IClen}{-9.8\IClen}}{\pgfpoint{-0.8\IClen}{-9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{0.2\IClen}{-9.8\IClen}}{\pgfpoint{0.8\IClen}{-9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{1.2\IClen}{-9.8\IClen}}{\pgfpoint{1.8\IClen}{-9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{2.2\IClen}{-9.8\IClen}}{\pgfpoint{2.8\IClen}{-9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{3.2\IClen}{-9.8\IClen}}{\pgfpoint{3.8\IClen}{-9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{4.2\IClen}{-9.8\IClen}}{\pgfpoint{4.8\IClen}{-9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{5.2\IClen}{-9.8\IClen}}{\pgfpoint{5.8\IClen}{-9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{6.2\IClen}{-9.8\IClen}}{\pgfpoint{6.8\IClen}{-9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{7.2\IClen}{-9.8\IClen}}{\pgfpoint{7.8\IClen}{-9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{9.8\IClen}{-7.2\IClen}}{\pgfpoint{9\IClen}{-7.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{9.8\IClen}{-6.2\IClen}}{\pgfpoint{9\IClen}{-6.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{9.8\IClen}{-5.2\IClen}}{\pgfpoint{9\IClen}{-5.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{9.8\IClen}{-4.2\IClen}}{\pgfpoint{9\IClen}{-4.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{9.8\IClen}{-3.2\IClen}}{\pgfpoint{9\IClen}{-3.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{9.8\IClen}{-2.2\IClen}}{\pgfpoint{9\IClen}{-2.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{9.8\IClen}{-1.2\IClen}}{\pgfpoint{9\IClen}{-1.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{9.8\IClen}{-0.2\IClen}}{\pgfpoint{9\IClen}{-0.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{9.8\IClen}{0.2\IClen}}{\pgfpoint{9\IClen}{0.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{9.8\IClen}{1.2\IClen}}{\pgfpoint{9\IClen}{1.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{9.8\IClen}{2.2\IClen}}{\pgfpoint{9\IClen}{2.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{9.8\IClen}{3.2\IClen}}{\pgfpoint{9\IClen}{3.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{9.8\IClen}{4.2\IClen}}{\pgfpoint{9\IClen}{4.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{9.8\IClen}{5.2\IClen}}{\pgfpoint{9\IClen}{5.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{9.8\IClen}{6.2\IClen}}{\pgfpoint{9\IClen}{6.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{9.8\IClen}{7.2\IClen}}{\pgfpoint{9\IClen}{7.8\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{7.2\IClen}{9.8\IClen}}{\pgfpoint{7.8\IClen}{9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{6.2\IClen}{9.8\IClen}}{\pgfpoint{6.8\IClen}{9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{5.2\IClen}{9.8\IClen}}{\pgfpoint{5.8\IClen}{9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{4.2\IClen}{9.8\IClen}}{\pgfpoint{4.8\IClen}{9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{3.2\IClen}{9.8\IClen}}{\pgfpoint{3.8\IClen}{9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{2.2\IClen}{9.8\IClen}}{\pgfpoint{2.8\IClen}{9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{1.2\IClen}{9.8\IClen}}{\pgfpoint{1.8\IClen}{9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{0.2\IClen}{9.8\IClen}}{\pgfpoint{0.8\IClen}{9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-0.2\IClen}{9.8\IClen}}{\pgfpoint{-0.8\IClen}{9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-1.2\IClen}{9.8\IClen}}{\pgfpoint{-1.8\IClen}{9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-2.2\IClen}{9.8\IClen}}{\pgfpoint{-2.8\IClen}{9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-3.2\IClen}{9.8\IClen}}{\pgfpoint{-3.8\IClen}{9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-4.2\IClen}{9.8\IClen}}{\pgfpoint{-4.8\IClen}{9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-5.2\IClen}{9.8\IClen}}{\pgfpoint{-5.8\IClen}{9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-6.2\IClen}{9.8\IClen}}{\pgfpoint{-6.8\IClen}{9\IClen}}
 \pgfpathrectanglecorners{\pgfpoint{-7.2\IClen}{9.8\IClen}}{\pgfpoint{-7.8\IClen}{9\IClen}}
 \pgfusepath{draw}  %draw pins
 \pgftext[at=\pgfpoint{-9.4\IClen}{7.5\IClen}]{\pinsize 1}
 \pgftext[at=\pgfpoint{-9.4\IClen}{6.5\IClen}]{\pinsize 2}
 \pgftext[at=\pgfpoint{-9.4\IClen}{5.5\IClen}]{\pinsize 3}
 \pgftext[at=\pgfpoint{-9.4\IClen}{4.5\IClen}]{\pinsize 4}
 \pgftext[at=\pgfpoint{-9.4\IClen}{3.5\IClen}]{\pinsize 5}
 \pgftext[at=\pgfpoint{-9.4\IClen}{2.5\IClen}]{\pinsize 6}
 \pgftext[at=\pgfpoint{-9.4\IClen}{1.5\IClen}]{\pinsize 7}
 \pgftext[at=\pgfpoint{-9.4\IClen}{0.5\IClen}]{\pinsize 8}
 \pgftext[at=\pgfpoint{-9.4\IClen}{-0.5\IClen}]{\pinsize 9}
 \pgftext[at=\pgfpoint{-9.4\IClen}{-1.5\IClen}]{\pinsize 10}
 \pgftext[at=\pgfpoint{-9.4\IClen}{-2.5\IClen}]{\pinsize 11}
 \pgftext[at=\pgfpoint{-9.4\IClen}{-3.5\IClen}]{\pinsize 12}
 \pgftext[at=\pgfpoint{-9.4\IClen}{-4.5\IClen}]{\pinsize 13}
 \pgftext[at=\pgfpoint{-9.4\IClen}{-5.5\IClen}]{\pinsize 14}
 \pgftext[at=\pgfpoint{-9.4\IClen}{-6.5\IClen}]{\pinsize 15}
 \pgftext[at=\pgfpoint{-9.4\IClen}{-7.5\IClen}]{\pinsize 16}
 \pgftext[at=\pgfpoint{-7.5\IClen}{-9.4\IClen},rotate=90]{\pinsize 17}
 \pgftext[at=\pgfpoint{-6.5\IClen}{-9.4\IClen},rotate=90]{\pinsize 18}
 \pgftext[at=\pgfpoint{-5.5\IClen}{-9.4\IClen},rotate=90]{\pinsize 19}
 \pgftext[at=\pgfpoint{-4.5\IClen}{-9.4\IClen},rotate=90]{\pinsize 20}
 \pgftext[at=\pgfpoint{-3.5\IClen}{-9.4\IClen},rotate=90]{\pinsize 21}
 \pgftext[at=\pgfpoint{-2.5\IClen}{-9.4\IClen},rotate=90]{\pinsize 22}
 \pgftext[at=\pgfpoint{-1.5\IClen}{-9.4\IClen},rotate=90]{\pinsize 23}
 \pgftext[at=\pgfpoint{-0.5\IClen}{-9.4\IClen},rotate=90]{\pinsize 24}
 \pgftext[at=\pgfpoint{0.5\IClen}{-9.4\IClen},rotate=90]{\pinsize 25}
 \pgftext[at=\pgfpoint{1.5\IClen}{-9.4\IClen},rotate=90]{\pinsize 26}
 \pgftext[at=\pgfpoint{2.5\IClen}{-9.4\IClen},rotate=90]{\pinsize 27}
 \pgftext[at=\pgfpoint{3.5\IClen}{-9.4\IClen},rotate=90]{\pinsize 28}
 \pgftext[at=\pgfpoint{4.5\IClen}{-9.4\IClen},rotate=90]{\pinsize 29}
 \pgftext[at=\pgfpoint{5.5\IClen}{-9.4\IClen},rotate=90]{\pinsize 30}
 \pgftext[at=\pgfpoint{6.5\IClen}{-9.4\IClen},rotate=90]{\pinsize 31}
 \pgftext[at=\pgfpoint{7.5\IClen}{-9.4\IClen},rotate=90]{\pinsize 32}
 \pgftext[at=\pgfpoint{9.4\IClen}{-7.5\IClen}]{\pinsize 33}
 \pgftext[at=\pgfpoint{9.4\IClen}{-6.5\IClen}]{\pinsize 34}
 \pgftext[at=\pgfpoint{9.4\IClen}{-5.5\IClen}]{\pinsize 35}
 \pgftext[at=\pgfpoint{9.4\IClen}{-4.5\IClen}]{\pinsize 36}
 \pgftext[at=\pgfpoint{9.4\IClen}{-3.5\IClen}]{\pinsize 37}
 \pgftext[at=\pgfpoint{9.4\IClen}{-2.5\IClen}]{\pinsize 38}
 \pgftext[at=\pgfpoint{9.4\IClen}{-1.5\IClen}]{\pinsize 39}
 \pgftext[at=\pgfpoint{9.4\IClen}{-0.5\IClen}]{\pinsize 40}
 \pgftext[at=\pgfpoint{9.4\IClen}{0.5\IClen}]{\pinsize 41}
 \pgftext[at=\pgfpoint{9.4\IClen}{1.5\IClen}]{\pinsize 42}
 \pgftext[at=\pgfpoint{9.4\IClen}{2.5\IClen}]{\pinsize 43}
 \pgftext[at=\pgfpoint{9.4\IClen}{3.5\IClen}]{\pinsize 44}
 \pgftext[at=\pgfpoint{9.4\IClen}{4.5\IClen}]{\pinsize 45}
 \pgftext[at=\pgfpoint{9.4\IClen}{5.5\IClen}]{\pinsize 46}
 \pgftext[at=\pgfpoint{9.4\IClen}{6.5\IClen}]{\pinsize 47}
 \pgftext[at=\pgfpoint{9.4\IClen}{7.5\IClen}]{\pinsize 48}
 \pgftext[at=\pgfpoint{7.5\IClen}{9.4\IClen},rotate=90]{\pinsize 49}
 \pgftext[at=\pgfpoint{6.5\IClen}{9.4\IClen},rotate=90]{\pinsize 50}
 \pgftext[at=\pgfpoint{5.5\IClen}{9.4\IClen},rotate=90]{\pinsize 51}
 \pgftext[at=\pgfpoint{4.5\IClen}{9.4\IClen},rotate=90]{\pinsize 52}
 \pgftext[at=\pgfpoint{3.5\IClen}{9.4\IClen},rotate=90]{\pinsize 53}
 \pgftext[at=\pgfpoint{2.5\IClen}{9.4\IClen},rotate=90]{\pinsize 54}
 \pgftext[at=\pgfpoint{1.5\IClen}{9.4\IClen},rotate=90]{\pinsize 55}
 \pgftext[at=\pgfpoint{0.5\IClen}{9.4\IClen},rotate=90]{\pinsize 56}
 \pgftext[at=\pgfpoint{-0.5\IClen}{9.4\IClen},rotate=90]{\pinsize 57}
 \pgftext[at=\pgfpoint{-1.5\IClen}{9.4\IClen},rotate=90]{\pinsize 58}
 \pgftext[at=\pgfpoint{-2.5\IClen}{9.4\IClen},rotate=90]{\pinsize 59}
 \pgftext[at=\pgfpoint{-3.5\IClen}{9.4\IClen},rotate=90]{\pinsize 60}
 \pgftext[at=\pgfpoint{-4.5\IClen}{9.4\IClen},rotate=90]{\pinsize 61}
 \pgftext[at=\pgfpoint{-5.5\IClen}{9.4\IClen},rotate=90]{\pinsize 62}
 \pgftext[at=\pgfpoint{-6.5\IClen}{9.4\IClen},rotate=90]{\pinsize 63}
 \pgftext[at=\pgfpoint{-7.5\IClen}{9.4\IClen},rotate=90]{\pinsize 64}
}}

\begin{document}
\fbox{
\begin{circuitikz}

\node[qfp64,pin spacing=5mm] (IC) at (0,0) {name};
\node[left] at (IC.p1) {pin 1};
\node[left] at (IC.p16) {pin 16};
\node[left,rotate=90] at (IC.p17) {pin 17};
\node[left,rotate=90] at (IC.p32) {pin 32};
\node[right] at (IC.p33) {pin 33};
\node[right] at (IC.p48) {pin 48};
\node[right,rotate=90] at (IC.p49) {pin 49};
\node[right,rotate=90] at (IC.p64) {pin 64};

\end{circuitikz}
}
\end{document}
8
  • Holy moly! That's alot of hard-coded stuff. Can you clean the code so TikZ beginners like me have a chance of understanding what's going on? :-) Sep 21 '14 at 21:31
  • @Svend Tveskæg - I have a tutorial on my web site for a somewhat simpler IC - an 8 pin DIP. elfsoft2000.com/projects/index.htm Sep 22 '14 at 3:27
  • Then why use so 'ugly' code here? Some for loops would be nice. Sep 22 '14 at 3:34
  • LaTeX works by macro expansion. Loops may be prettier, but they save you nothing. Sep 22 '14 at 3:35
  • Except alot of typing in cases like this. Sep 22 '14 at 3:42
5

A PSTricks solution:

\documentclass{article}

\usepackage[
  margin = 2.3cm % avoids `overfull \hbox' warning
]{geometry}
\usepackage{mathtools}
\usepackage{multido}
\usepackage{pst-node}

% idea taken from http://tex.stackexchange.com/a/24133/15874
\makeatletter
  \newcommand*\textoverline[1]{$\overline{\hbox{#1}}\m@th$}
\makeatother

% labels
\def\Left(#1)#2{\rput[r](-8.2,#1){\MakeUppercase{#2}}}
\def\Bottom(#1)#2{\rput[t](#1,-8.2){\rotateleft{\MakeUppercase{#2}}}}
\def\Right(#1)#2{\rput[l](8.2,#1){\MakeUppercase{#2}}}
\def\Top(#1)#2{\rput[b](#1,8.2){\rotateleft{\MakeUppercase{#2}}}}
\newcommand*\subtext[2]{$\text{#1}_{\text{#2}}$}
% boxes with numbers
\newcommand*\boxA[1]{\fnode(-7.5,\rA){P#1}\rput(P#1){$#1$}}
\newcommand*\boxB[1]{\fnode( 7.5,\rB){P#1}\rput(P#1){$#1$}}

\pagestyle{empty}

\begin{document}

\psset{
  unit = 0.5,
  framesize = 15pt 10pt
}
\begin{pspicture}(-16.4,-15.9)(16.5,16.5)
  % font size
  \footnotesize
  % frame
  \psline(-6.5,7)(-7,6.5)(-7,-6.5)(-6.5,-7)(6.5,-7)(7,-6.5)(7,6.5)(6.5,7)(-6.5,7)
  % circle
  \pscircle(-6.3,6.3){0.4}
  % text at centre
  \rput(0,0){\MakeUppercase{lpc2144/2146/2148}}
  % boxes with numbers
  \multido{
    \rA =  6.0+-0.8,
    \rB = -6.0+ 0.8,
    \iA =  1+1,
    \iB = 17+1,
    \iC = 33+1,
    \iD = 49+1
  }{16}{
                \boxA{\iA}
    \rotateleft{\boxA{\iB}}
                \boxB{\iC}
    \rotateleft{\boxB{\iD}}
  }
  % right labels
  \Right(-6.0){p0.8/txd1/pwm4/ad1.1}
  \Right(-5.2){p0.9/rxd1/pwm6/eint3}
  \Right(-4.4){p0.10/rts1/cap1.0/ad1.2}
  \Right(-3.6){p1.23/pipestat2}
  \Right(-2.8){p0.11/cts1/cap1.1/scl1}
  \Right(-2.0){p0.12/dsr1/mat1.0/ad1.3}
  \Right(-1.2){p0.13/dtr1/mat1.1/ad1.4}
  \Right(-0.4){p1.22/pipestat1}
  \Right(0.4){p0.14/dcd1/eint1/sda1}
  \Right(1.2){\subtext{V}{ss}}
  \Right(2.0){\subtext{V}{dd}}
  \Right(2.8){p1.21/pipestat0}
  \Right(3.6){p0.15/ri1/eint2/ad1.5}
  \Right(4.4){p0.16/eint0/mat0.2/cap0.2}
  \Right(5.2){p0.17/cap1.2/sck1/mat1.2}
  \Right(6.0){p1.20/tracesync}
  % bottom labels
  \Bottom(-6.0){P0.31/up\textunderscore led/connect}
  \Bottom(-5.2){\subtext{V}{ss}}
  \Bottom(-4.4){p0.0/txd0/pwm1}
  \Bottom(-3.6){p1.31/\textoverline{trst}}
  \Bottom(-2.8){p0.1/rxd0/pwm3/eint0}
  \Bottom(-2.0){p0.2/scl0/cap0.0}
  \Bottom(-1.2){\subtext{V}{dd}}
  \Bottom(-0.4){p1.26/rtck}
  \Bottom(0.4){\subtext{V}{ss}}
  \Bottom(1.2){p0.3/sda0/mat0.0/ad0.6}
  \Bottom(2.0){p0.4/sck0/mat0.1/ad0.6}
  \Bottom(2.8){p1.25/extin0}
  \Bottom(3.6){p0.5/miso0/mat0.1/ad0.7}
  \Bottom(4.4){p0.6/mosi0/cap0.2/ad1.0}
  \Bottom(5.2){p0.7/ssel0/pwm2/eint2}
  \Bottom(6.0){p1.24/traceclk}
  % left labels
  \Left(6.0){p0.21/pwm5/ad1.6/cap1.3}
  \Left(5.2){p0.22/ad1.7/cap0.0/mat0.0}
  \Left(4.4){rtcx1}
  \Left(3.6){p1.19/tracepkt3}
  \Left(2.8){rtcx2}
  \Left(2.0){\subtext{V}{ss}}
  \Left(1.2){\subtext{V}{dda}}
  \Left(0.4){p1.18/tracepkt2}
  \Left(-0.4){p0.25/ad0.4/aout}
  \Left(-1.2){d$+$}
  \Left(-2.0){d$-$}
  \Left(-2.8){p1.17/tracepkt1}
  \Left(-3.6){p0.28/ad0.1/cap0.2/mat0.2}
  \Left(-4.4){p0.29/ad0.2/cap0.3/mat0.3}
  \Left(-5.2){p0.30/ad0.3/eint3/cap0.0}
  \Left(-6.0){p1.16/tracepkt0}
  % top labels
  \Top(6.0){\subtext{V}{bat}}
  \Top(5.2){\subtext{V}{ss}}
  \Top(4.4){\subtext{V}{dd}}
  \Top(3.6){p1.30/tms}
  \Top(2.8){p0.18/cap1.3/miso1/mat1.3}
  \Top(2.0){p0.19/mat1.2/mosi1/cap1.2}
  \Top(1.2){p0.20/mat1.3/ssel1/eint3}
  \Top(0.4){p1.29/tck}
  \Top(-0.4){\textoverline{reset}}
  \Top(-1.2){p0.23/\subtext{V}{bus}}
  \Top(-2.0){\subtext{V}{ssa}}
  \Top(-2.8){p1.28/tdi}
  \Top(-3.6){xtal2}
  \Top(-4.4){xtal1}
  \Top(-5.2){\subtext{V}{aef}}
  \Top(-6.0){p1.27/tdo}
\end{pspicture}

\end{document}

output

0

You might take a look at

  1. xcircuit and its symbol-libraries (i.e. http://opencircuitdesign.com/xcircuit/)
  2. dia (http://dia-installer.de/shapes/index.html.en)
  3. Circuit_macros https://ece.uwaterloo.ca/~aplevich/Circuit_macros/html/examples.html
  4. circuitikz -> e.g. Display ICs with circuitikz

The first two tools are more like drawing tools but in contrary to others programms they allow you to save the picture as pdf/eps/ps with a .tex-file containing the text.

1
  • 2
    Answers with links have the principal disadvantage, that links can be dead at some time ;-)
    – user31729
    Sep 20 '14 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.