wiki:Examples
Last modified 2 years ago Last modified on 12/15/09 15:23:48

Examples

Pulse Diagram

A Digital Pulse Width Modulator diagram which shows clock signals and corresponding pulses.

[ PDF ] [ TEX ]

DPWM Diagram
\def\degr{${}^\circ$}
\begin{tikztimingtable}
  Clock 128\,MHz 0\degr    & H 2C N(A1) 8{2C} N(A5) 3{2C} G\\
  Clock 128\,MHz 90\degr   & [C] 2{2C} N(A2) 8{2C} N(A6) 2{2C} C\\
  Clock 128\,MHz 180\degr  & C 2{2C} N(A3) 8{2C} N(A7) 2{2C} G\\
  Clock 128\,MHz 270\degr  & 3{2C} N(A4) 8{2C} N(A8) 2C C\\
  Coarse Pulse             & 3L 16H 6L \\
  Coarse Pulse - Delayed 1 & 4L N(B2) 16H N(B6) 5L \\
  Coarse Pulse - Delayed 2 & 5L N(B3) 16H N(B7) 4L \\
  Coarse Pulse - Delayed 3 & 6L 16H 3L \\
  \\
  Final Pulse Set          & 3L 16H N(B5) 6L \\
  Final Pulse $\overline{\mbox{Reset}}$ & 6L N(B4) 16H 3L \\
  Final Pulse              & 3L N(B1) 19H N(B8) 3L \\
\extracode
  \tablerules
  \begin{pgfonlayer}{background}
    \foreach \n in {1,...,8}
      \draw [help lines] (A\n) -- (B\n);
  \end{pgfonlayer}
\end{tikztimingtable}








SR Flip-Flop Timing

This diagram shows the timing of a Set/Reset? Flip-Flop (SR-FF) It was redrawn in TeX using 'tikz-timing' from the following wikipedia file: http://commons.wikimedia.org/wiki/File:SR_FF_timing_diagram.png.

[ PDF ] [ TEX ]

SR-FF Diagram
% Defining foreground (fg) and background (bg) colors
\definecolor{bgblue}{rgb}{0.41961,0.80784,0.80784}%
\definecolor{bgred}{rgb}{1,0.61569,0.61569}%
\definecolor{fgblue}{rgb}{0,0,0.6}%
\definecolor{fgred}{rgb}{0.6,0,0}%
%
\begin{tikztimingtable}[
    timing/slope=0,         % no slope
    timing/coldist=2pt,     % column distance
    xscale=2.05,yscale=1.1, % scale diagrams
    semithick               % set line width
  ]
  \scriptsize clock     & 7{C}                              \\
  S                     & [fgblue] .75L h 2.25L H LLl       \\
  R                     & [fgblue]  1.8L .8H 2.2L 1.4H 0.8L \\
  Q                     &          L .8H 1.7L 1.5H LL       \\
  $\overline{\mbox{Q}}$ &          H .8L 1.7H 1.5L HH       \\
  Q                     & [fgred]  HLHHHLL                  \\
  $\overline{\mbox{Q}}$ & [fgred]  LHLLLHH                  \\
\extracode
 \makeatletter
 \begin{pgfonlayer}{background}
  % Draw shaded backgrounds
  \shade [right color=bgblue,left color=white]
     (7,-8.45) rectangle (-2,-4.6);
  \shade [right color=bgred,left color=white]
     (7,-12.8) rectangle (-2,-8.6);
  % Add background grid lines
  \begin{scope}[gray,semitransparent,semithick]
    \horlines{}
    \foreach \x in {1,...,6}
      \draw (\x,1) -- (\x,-12.8);
    % similar: \vertlines{1,...,6}
  \end{scope}
  % Add labels
  \node [anchor=south east,inner sep=0pt]
    at (7,-8.45) {\tiny clocked};
  \node [anchor=south east,inner sep=0pt,fgred]
    at (7,-12.8) {\tiny positive edge triggered};
 \end{pgfonlayer}
\end{tikztimingtable}%

SPI Timing Diagram

This diagram shows the timing of the Serial Peripheral Interface (SPI). It was redrawn in TeX using 'tikz-timing' from the following wikipedia file: http://en.wikipedia.org/wiki/File:SPI_timing_diagram.svg.

[ PDF ] [ TEX ]

SPI Diagram
% Preamble:
\usetikztiminglibrary[new={char=Q,reset char=R}]{counters}
% ...
% Document:
\begin{tikztimingtable}
  [timing/d/background/.style={fill=white},
   timing/lslope=0.2]
          CPOL=0 & LL 15{T} LL \\
          CPOL=1 & HH 15{T} HH \\
                 & H 17L H     \\
  \\
        Cycle \# & U     R 8{2Q} 2U    \\
            MISO & D{z}  R 8{2Q} 2D{z} \\
            MOSI & D{z}  R 8{2Q} 2D{z} \\
  \\
        Cycle \# & UU    R 8{2Q} U    \\
            MISO & D{z}U R 8{2Q} D{z} \\
            MOSI & D{z}U R 8{2Q} D{z} \\
\extracode
  % Add vertical lines in two colors
  \begin{pgfonlayer}{background}
    \begin{scope}[semitransparent,semithick]
      \vertlines[red]{2.1,4.1,...,17.1}
      \vertlines[blue]{3.1,5.1,...,17.1}
    \end{scope}
  \end{pgfonlayer}
  % Add big group labels
  \begin{scope}
    [font=\sffamily\Large,shift={(-6em,-0.5)},anchor=east]
    \node at (  0, 0) {SCK};    \node at (  0,-3 ) {SS};
    \node at (1ex,-9) {CPHA=0}; \node at (1ex,-17) {CPHA=1};
  \end{scope}
\end{tikztimingtable}%

Attachments