我如何使用来表示IC电路图?
我正在考虑这样的事情:
我查看了整个手册并在 Google 上搜索了此信息,但一无所获。很难相信以前没人需要这个……
具有常规组件的文档的一个简单示例如下:
\documentclass{article}
\usepackage[symbols]{circuitikz}
\usepackage{tikz}
\begin{document}
\begin{circuitikz} \draw
(0,0) to[C, l=$10\micro\farad$] (0,2) -- (0,3)
to[R, l=$2.2\kilo\ohm$] (4,3) -- (4,2)
to[L, l=$12\milli\henry$, i=$i_1$] (4,0) -- (0,0)
(4,2) to[D*, *-*] (2,0) to [D*, -*] (0,2)
to[R, l=$1\kilo\ohm$] (2,2) to[cV, v=$0.3\kilo\ohm i_1$] (4,2)
(2,0) to[I, i=$1\milli\ampere$:15, -*] (2,2)
;
\end{circuitikz}
\end{document}
但是,我能找到任何方法来包含 IC 图像。
答案1
据我所知,circuiTikZ 可以生成基本的双极器件、一些三极器件(晶闸管、三端双向可控硅开关元件、电位器)、四极器件(变压器)、基本的双输入运算放大器、多端口逻辑门,但没有 IC 类型的器件。但是,您可以使用 tikz 命令、线条、矩形和节点来近似您想要的。以下是您发布的 IC 555 单稳态定时器图片的示例。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit} % positioning, calc libraries may also be useful
\usepackage[siunitx,european,american]{circuitikz}
\begin{document}
% set basic rectangular shape of IC
\tikzstyle{icdev}=[draw, text width=6em, minimum height=8em]
\begin{tikzpicture}[every node/.style = {font = \footnotesize},european]
\draw (0,4) node[left]{$V_{cc}$} % from top Vcc to bottom Gnd
to[short,o-] (0.8,4)
to[/tikz/circuitikz/bipoles/length=0.7cm,R] (0.8,2) % set bipole device size
to[/tikz/circuitikz/bipoles/length=0.7cm,C] (0.8,1.8) -- (0.8,0)
to[short,-o] (0,0) node[left]{GND}
;
\node (digichip) [icdev,xshift=3cm,yshift=2cm] {}; % position IC device body
% top terminal lines/pins - 4 RESET, 8 Vcc
\path [draw](0.8,4) -| (2.5,3.4) node[below]{RESET} node[above left]{4};
\path [draw](2.5,4) -| (3.5,3.4) node[below]{$V_{cc}$} node[above left] {8};
% bottom terminal lines/pins - 1 GND, 5 CTRL
\path [draw](0.8,0) -| (2.5,0.6) node[above]{GND} node[below left]{1};
\path [draw](2.5,0) -- (3.5,0)
to[/tikz/circuitikz/bipoles/length=0.7cm,C](3.5,0.6)
node[above]{CTRL} node[below left]{5}; % C = 10nf
% leftside terminal lines/pins - 7 DIS, 6 THR, 2 TRG
\draw (0.8,2.5) -- (1.83,2.5) node[right]{DIS} node[above left]{7}
(1.2,2.5) |- (1.83,2) node[right]{THR} node[above left]{6}
(1.1,1.5) -- (1.83,1.5) node[right]{TRG} node[above left]{2};
% rightside terminal line/pin - 3 out
\draw (4.17,2) node[left]{Out} -- (4.8,2) node[above left]{3};
\end{tikzpicture}
\end{document}
答案2
作为一名巫师,下面是基于以下实现的代码:亨利·门克,我们可以创建任何想要的原理图,并且像组件一样工作。
结果:
梅威瑟:
% By J. Leon V. coded based on the BSD, MIT, Beerware licences.
\documentclass[border=20pt]{standalone}
\usepackage{tikz}
\usepackage{siunitx}
\renewcommand*\familydefault{\sfdefault} % Serif Font
\usepackage[european]{circuitikz} % Paquete especializado en circuitos eléctricos.
\begin{document}
\ctikzset{bipoles/length=1cm} % Controls bipoles scale
\begin{tikzpicture}[
%Global Config
font=\small
]
%You can create an smart objet like Henry Menke in this post http://www.texample.net/tikz/examples/4-bit-counter/
% Variables: 1: Position 2: ID.
\def\TIMER555(#1)#2{%
\begin{scope}[shift={(#1)}]
\draw[fill=blue!10] (-1.5,-2) rectangle (1.5,2); % The body of IC
% Label and component identifier.
\draw[blue] (2,2.5) node []{\large \bf U - #2}; % IC LABEL
\draw[blue] (0,0.5) node [align=center]{\large NE-555\\TIMER}; % IC LABEL
% Draw the pins
% Some that you have to learn about label nodes, draw lines, and name coordinates in Tikz
\draw (0.9,-2) node [above]{GND} -- +(0,-0.5) node [anchor=-45]{1} coordinate (#2 GND); % Pin 1 GND
\draw (-1.5,-1.5) node [right]{TRG} -- +(-0.5,0) node [anchor=-135]{2} coordinate (#2 TRG); % Pin 2 TRG
\draw (1.5,0) node [left]{OUT} -- +(0.5,0) node [anchor=-45]{3} coordinate (#2 OUT); % Pin 3 OUT
\draw (0.9,2) node [below]{RESET} -- +(0,0.5) node [anchor=45]{4} coordinate (#2 RESET); % Pin 4 RESET
\draw (0,-2) node [above]{CTRL} -- +(0,-0.5) node [anchor=-45]{5} coordinate (#2 CTRL); % Pin 5 CTRL
\draw (-1.5,-.5) node [right]{THR} -- +(-0.5,0) node [anchor=-135]{6} coordinate (#2 THR); % Pin 6 THR
\draw (-1.5,1.5) node [right]{DIS} -- +(-0.5,0) node [anchor=-135]{7} coordinate (#2 DIS); % Pin 7 DIS
\draw (0,2) node [below]{$\mathsf{V_{CC}}$} -- +(0,0.5) node [anchor=45]{8} coordinate (#2 VCC); % Pin 8 VCC
\end{scope}
}
% Start drawing the circuit: Example "Dee-Dah" Siren
% Place the IC's in position
\TIMER555(0,0){1}
%Place polarization nodes:
\draw (-4.5,3.5) node[ocirc] (VCC){} node[left]{$\mathsf{V_{CC}}$};
\draw (-4.5,-4) node[ocirc] (GND){} node[left]{GND};
% Connect U-1
\draw(VCC) % Start point
to [short, o-] ++(1,0) coordinate (NOD1) % Use auxiliar coordinate (NOD1)
to [R, l^=R,*-*] (1 DIS -| NOD1) % to the point in the intersection between NOD1 and 1 DIS
to [eC,l^=C,*-] ++(0,-2)
to [short] (GND -| NOD1)
to [short] (GND);
\draw(1 VCC) to [short, -*] (1 VCC |- NOD1);
\draw(1 RESET) to [short] (1 RESET |- NOD1) to [short] (NOD1);
\draw(1 DIS) to [short, -*] (1 DIS -| NOD1);
\draw(1 THR) to [short] ++ (-0.5,0) coordinate (NOD2) to [short,-*] (1 DIS -| NOD2);
\draw(1 CTRL) to [eC,l_=0.01nF, -*] (1 CTRL |- GND);
\draw(1 GND) to [short] (1 GND |- GND) to [short] (GND -| NOD1);
%Place input/output nodes
\draw[color=blue,line width=2] (1 TRG) to [short] ++(-0.55,0) node[ocirc] (TRG){} node[below]{Trigger};
\draw[color=red,line width=2] (1 OUT) to [short] ++(0.55,0) node[ocirc](OUT){} node[below]{Out};
\end{tikzpicture}
\end{document}
附录:
一个更详细的例子这里对于以下结果:
答案3
这实际上是可以相信的,因为在 TikZ 中想出一个新的形状并不那么简单。由于 IC 类型太多样化,没有实际的方法将它们全部包括进来,因此通常会被跳过。相反,它们通常由连接上的简单矩形+标签组成。您可以重新锚定矩形形状,这相对容易,或者您可以只使用标签。
一个非常务实的示范是
\documentclass{article}
\usepackage{circuitikz,siunitx}
\begin{document}
\begin{circuitikz}
\draw (0,0) to[C, l=$\SI{10}{\micro\farad}$]
(0,2) --
(0,3) to[R, l=$\SI{2.2}{\kilo\ohm}$]
(4,3) --
(4,2) to[L, l=$\SI{12}{\milli\henry}$, i=$i_1$]
(4,0) --
(0,0)
(4,2) to[D*, *-*]
(2,0) to [D*, -*]
(0,2) to[R, l=$\SI{1}{\kilo\ohm}$]
(2,2) to[cV, v=$\SI{0.3}{\kilo\ohm} i_1$]
(4,2)
(2,0) to[I, i=$\SI1{\milli\ampere}$:15, -*]
(2,2)
;
\node[draw,label={[below=5mm]90:IC$1$},label={[right=8mm]180:IC$2$},minimum size=1.5cm] (ic) at (7,1){};
\draw (4,3) -|
(ic.90)
(ic.180) -|
(5,2) --
(4,2)
;
\end{circuitikz}
\end{document}
答案4
首先,使用pbox
包来显示多行标签。
\usepackage{pbox}
\newcommand{\ctikzlabel}[2]{\pbox{\textwidth}{#1\\#2}} % multiple-lines labels
然后使用relsize
包来改变字体大小并定义一个名为的样式pin
。
\usepackage{relsize}
\tikzset{
pin/.style = {font = \relsize{-2}} % pin font size
}
\ctikzset{
bipoles/length = 2em, % bipole size
font = \relsize{-1}, % default font size
}
使用相对位置来定位 IC,如(5.5,2)
示例中所示。您可以使用等将引脚与其他组件连接起来(u1 con)
。(u1 tri)
\begin{circuitikz}
% U1 NE555
\draw [thick] (5.5,2) coordinate (u1) rectangle ++(2,3); % shape
\draw [pin] (u1) ++ (0,0.5) coordinate (u1 con)
node[right]{CON}
node[above left]{5}; % CON
\draw [pin] (u1) ++ (0,1) coordinate (u1 tri)
node[right]{TRI}
node[above left]{2}; % TRI
\draw [pin] (u1) ++ (0,1.5) coordinate (u1 thr)
node[right]{THR}
node[above left]{6}; % THR
\draw [pin] (u1) ++ (0,2) coordinate (u1 dis)
node[right]{DIS}
node[above left]{7}; % DIS
\draw [pin] (u1) ++ (0,2.5) coordinate (u1 rst)
node[right]{RST}
node[above left]{4}; % RST
\draw [pin] (u1) ++ (1,3) coordinate (u1 vcc)
node[below]{VCC}
node[above left]{8}; % VCC
\draw [pin] (u1) ++ (1,0) coordinate (u1 gnd)
node[above]{GND}
node[below left]{1}; % GND
\draw [pin] (u1) ++ (2,2.5) coordinate (u1 out)
node[left]{OUT}
node[above right]{3}; % OUT
\draw (u1) ++ (2,0)
node[right]{\ctikzlabel{$U_1$}{NE555}}; % NE555P
% U1 NE555 Pins
\draw (u1 con) -- ++ (-1,0); % CON
\draw (u1 tri) -- ++ (-1,0); % TRI
\draw (u1 thr) -- ++ (-1,0); % THR
\draw (u1 dis) -- ++ (-1,0); % DIS
\draw (u1 rst) -- ++ (-1,0); % RST
\draw (u1 vcc) -- ++ (0,1); % VCC
\draw (u1 gnd) -- ++ (0,-1); % GND
\draw (u1 out) -- ++ (1,0); % OUT
\end{circuitikz}