Skip to content

Commit

Permalink
common: figureADC: Move the common code for the figure here
Browse files Browse the repository at this point in the history
* src/common/figureADC.tex: Move the common code for the figure here.
* Makefile.am (COMMON): Register it.
* src/en/sparc.tex, src/ru/sparc.tex: Include it.
* src/en/sections/white-noise-adc.tex, src/ru/sections/white-noise-adc.tex: Use
it.
  • Loading branch information
artyom-poptsov committed Jan 10, 2025
1 parent 86c9539 commit 29b89c0
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 50 deletions.
3 changes: 2 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ SECTIONS = \

COMMON = \
src/common/figureSoundGraph.tex \
src/common/figurePWMGraph.tex
src/common/figurePWMGraph.tex \
src/common/figureADC.tex

COMMIT = $(shell git rev-parse HEAD)

Expand Down
26 changes: 26 additions & 0 deletions src/common/figureADC.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
\newcommand{\figureADC}[1]{
\begin{figure}[ht]
\centering
\begin{tikzpicture}
\draw[thick] (0, 0) -- (0, 5.5) -- (3, 5.5) -- (3, 0) -- (0, 0);
\draw (1.5, 2.5) node[right, above] {ADC};
\draw (1.5, 5.5) -- (1.5, 6.5) node[right, above] {VCC};
\draw (1.5, 0) -- (1.5, -1) node[right, below] {GND};
\draw (-2, 5.0)
-- (-1, 5.0) node[left, above, text width=2cm] {$V_{ref}$}
-- (0, 5.0);
\draw (0, 3.00)
-- (-1, 3.00) node[left, above, text width=2cm] {ANALOG INPUT}
-- (-2, 3.00);
\draw (-2, 0.5)
-- (-1, 0.5) node[left, above, text width=2cm] {CLOCK INPUT}
-- (0, 0.5);
\draw(-0.25, 0.25) -- (0.25, 0.75);
\foreach \n/\y in {0/0.5, 1/1.0, 2/1.5, 3/2.0, 4/2.5, 5/3.0, 6/3.5, 7/4.0, 8/4.5, 9/5.0} {
\draw (3, \y) node[anchor=south west] {OUTPUT \n} -- (5, \y);
};
\end{tikzpicture}
\caption{#1}
\label{fig:adc-schematics}
\end{figure}
}
27 changes: 3 additions & 24 deletions src/en/sections/white-noise-adc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,9 @@ \section{Analog-to-digital converter}
The ADC can be depicted schematically as is shown on the
fig. \ref{fig:adc-schematics}.

\begin{figure}[ht]
\centering
\begin{tikzpicture}
\draw[thick] (0, 0) -- (0, 5.5) -- (3, 5.5) -- (3, 0) -- (0, 0);
\draw (1.5, 2.5) node[right, above] {ADC};
\draw (1.5, 5.5) -- (1.5, 6.5) node[right, above] {VCC};
\draw (1.5, 0) -- (1.5, -1) node[right, below] {GND};
\draw (-2, 5.0)
-- (-1, 5.0) node[left, above, text width=2cm] {$V_{ref}$}
-- (0, 5.0);
\draw (0, 3.00)
-- (-1, 3.00) node[left, above, text width=2cm] {ANALOG INPUT}
-- (-2, 3.00);
\draw (-2, 0.5)
-- (-1, 0.5) node[left, above, text width=2cm] {CLOCK INPUT}
-- (0, 0.5);
\draw(-0.25, 0.25) -- (0.25, 0.75);
\foreach \n/\y in {0/0.5, 1/1.0, 2/1.5, 3/2.0, 4/2.5, 5/3.0, 6/3.5, 7/4.0, 8/4.5, 9/5.0} {
\draw (3, \y) node[anchor=south west] {OUTPUT \n} -- (5, \y);
};
\end{tikzpicture}
\caption{Schematic depiction of the analog-to-digital converted (ADC.)}
\label{fig:adc-schematics}
\end{figure}
\figureADC{
Schematic depiction of the analog-to-digital converted (ADC.)
}

The ADC takes some analog signal into the input (``ANALOG INPUT'') and encodes
it in each moment in time as the sequence of logical levels: ``HIGH'' (``1'')
Expand Down
1 change: 1 addition & 0 deletions src/en/sparc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
\input{sections/commands.tex}
\input{common/figureSoundGraph.tex}
\input{common/figurePWMGraph.tex}
\input{common/figureADC.tex}

\counterwithin{listing}{section}

Expand Down
28 changes: 3 additions & 25 deletions src/ru/sections/white-noise-adc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,9 @@ \section{Аналогово-цифровое преобразование}

%% TODO: Добавить AREF -- задаёт максимум для конвертера

\begin{figure}[ht]
\centering
\begin{tikzpicture}
\draw[thick] (0, 0) -- (0, 5.5) -- (3, 5.5) -- (3, 0) -- (0, 0);
\draw (1.5, 2.5) node[right, above] {ADC};
\draw (1.5, 5.5) -- (1.5, 6.5) node[right, above] {VCC};
\draw (1.5, 0) -- (1.5, -1) node[right, below] {GND};
\draw (-2, 5.0)
-- (-1, 5.0) node[left, above, text width=2cm] {$V_{ref}$}
-- (0, 5.0);
\draw (0, 3.00)
-- (-1, 3.00) node[left, above, text width=2cm] {ANALOG INPUT}
-- (-2, 3.00);
\draw (-2, 0.5)
-- (-1, 0.5) node[left, above, text width=2cm] {CLOCK INPUT}
-- (0, 0.5);
\draw(-0.25, 0.25) -- (0.25, 0.75);
\foreach \n/\y in {0/0.5, 1/1.0, 2/1.5, 3/2.0, 4/2.5, 5/3.0, 6/3.5, 7/4.0, 8/4.5, 9/5.0} {
\draw (3, \y) node[anchor=south west] {OUTPUT \n} -- (5, \y);
};
\end{tikzpicture}
\caption{Схематическое изображение 10-битного аналогово-цифрового
преобразователя.}
\label{fig:adc-schematics}
\end{figure}
\figureADC{
Схематическое изображение 10-битного аналогово-цифрового преобразователя.
}

На вход АЦП (``ANALOG INPUT'') подаётся аналоговый сигнал, а на выходах
(``OUTPUT 0'' .. ``OUTPUT 9'') кодируется значение входного сигнала в каждый
Expand Down
1 change: 1 addition & 0 deletions src/ru/sparc.tex
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
\input{sections/commands.tex}
\input{common/figureSoundGraph.tex}
\input{common/figurePWMGraph.tex}
\input{common/figureADC.tex}

\counterwithin{listing}{section}
\renewcommand\listingscaption{Листинг}
Expand Down

0 comments on commit 29b89c0

Please sign in to comment.