Skip to content

Instantly share code, notes, and snippets.

@raziele
Created March 21, 2020 20:08
Show Gist options
  • Save raziele/06be19a52a0d2ee0c05a9c07373b6f41 to your computer and use it in GitHub Desktop.
Save raziele/06be19a52a0d2ee0c05a9c07373b6f41 to your computer and use it in GitHub Desktop.
% Diagram of the LQFP 48 pins IC version for SN32F707
% based on Andrew's work:
% https://tex.stackexchange.com/questions/202230/how-to-draw-an-integrated-circuit-pin-configuration-like-in-data-sheets
\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 (13.5-\i)]
in {1/{URXD1/P0.0},
2/{UTXD1/P0.1},
3/{SCL1/P0.2},
4/{SDA1/P0.3},
5/{SCL0/P0.4},
6/{SDA0/P0.5},
7/{SCK0/P0.6},
8/{SEL0/P0.7},
9/{MISO0/P0.8},
10/{MOSI0/P0.9},
11/{SWCLK/P0.10},
12/{SWDIO/P0.11} }
{
\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-11.5)]
in {13/{AIN0/P2.0},
14/{AIN1/P2.1},
15/{AIN2/P2.2},
16/{AIN3/P2.3},
17/{AIN4/P2.4},
18/{AVDD},
19/{AVSS},
20/{AIN5/P2.5},
21/{AIN6/P2.6},
22/{AIN7/P2.7},
23/{AIN8/P2.8},
24/{AIN9/P2.9} }
{
\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-23.5)]
in {25/{P1.0/I2SMCLK},
26/{P1.1/I2SSDA},
27/{P1.2/I2SBCLK},
28/{P1.3/I2SWS},
29/{P1.4/DPDWAKEUP},
30/{P1.5},
31/{P1.6/URXD0},
32/{P1.7/UTXD0},
33/{P1.8/UCTS0},
34/{P1.9/USCLK0},
35/{P1.10/URTS0},
36/{P1.11/CLKOUT} }
{
\draw node[pin,anchor=west] at (14,\y){\small$\i$};
\node [align=left,anchor=west] at (15.6,\y){\desc};
}
\foreach \i/\desc [evaluate=\i as \x using (49.5-\i)]
in {37/{P3.0/UDTR0/SEL1},
38/{P3.1/UDSR0/SCK1},
39/{P3.2/UDCD0/MISO1},
40/{P3.3/URI0/MOSI1},
41/{P3.4/LXTALIN},
42/{P3.5/LXALOUT},
43/{P3.6/RESET},
44/{P3.7/XTALIN},
45/{P3.8/XTALOUT},
46/{VSS},
47/{VREG18},
48/{VDD} }
{
\draw node[pin,anchor=west,rotate=90] at (\x,14){\small$\i$};
\node [align=left,anchor=west,rotate=90] at (\x,15.6){\desc};
}
\draw[ultra thick]
(0,0.8)--(0,13.2)--(0.8,14)--(13.2,14)--(14,13.2)
--(14,0.8)--(13,0)--(0.8,0)--cycle;
\draw(1.5,12.2)circle[radius=0.7];
\node [text width=2.5cm, align=center] at (7,7){SN32F707 (LQFP 48 pins)};
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment