pstricks: kleines beispiel vom herrn perner und makefile spass von mir
authorBernhard Urban <lewurm@gmail.com>
Mon, 22 Mar 2010 00:50:57 +0000 (01:50 +0100)
committerBernhard Urban <lewurm@gmail.com>
Mon, 22 Mar 2010 01:34:58 +0000 (02:34 +0100)
schaut ganz nett aus...

.gitignore
spec/Makefile
spec/ProtocolHeader.sty
spec/sm/rs232-rs.tex [new file with mode: 0644]
spec/spec.tex

index 62981eae58a174100e517c2ff946a6eedf2bf26e..973ad17c55d3bbbf14895788dae82b57a50ce5ee 100644 (file)
@@ -6,6 +6,7 @@ spec/*.toc
 spec/*.backup
 spec/*.out
 spec/*.pdf
+spec/sm/*.pdf
 *.swp
 *~
 
index e79e671652b6a35ab6dc929509f86f2a86656920..6b9d295c30714ec33312bf6481fd34674df43f90 100644 (file)
@@ -1,13 +1,22 @@
+SHELL := bash
 PROJECT = spec
 
 all: protocol
 
-protocol: $(subst .dia,.png,$(shell ls *.dia))
-       pdflatex $(PROJECT)
-       pdflatex $(PROJECT)
+protocol: $(PROJECT).tex $(subst .dia,.png,$(shell ls *.dia)) $(subst .tex,.pdf,$(shell ls sm/*.tex))
+       pdflatex $(PROJECT).tex
+       pdflatex $(PROJECT).tex
 
 %.png: %.dia
        dia $< -e $@ -t png
 
+%.pdf: %.tex
+       latex -output-directory=sm $<
+       dvips $(subst .tex,.dvi,$<) -o $(subst .tex,.ps,$<)
+       ps2pdf $(subst .tex,.ps,$<) $@
+       pdfcrop $@ $(subst .pdf,.pdf2,$@)
+       mv $(subst .pdf,.pdf2,$@) $@
+       rm sm/{*.dvi,*.ps,*.aux,*.log}
+
 clean:
-       -rm -f *.aux *.log *.dvi *.toc *.out *.pdf *.png
+       -rm -f {,sm/}{*.aux,*.log,*.dvi,*.toc,*.out,*.pdf,*.png}
index 748fe2aeb03f9520469cc9f27e1c513a93f77702..f6cf7a2e739ad983edea61587c20d05c17b27cfc 100644 (file)
@@ -12,6 +12,7 @@
 \usepackage{amssymb}\r
 \usepackage{amsmath}\r
 \usepackage{longtable,colortbl}\r
+\usepackage{pdfpages}\r
 \r
 \hypersetup{%\r
   colorlinks=true,\r
        \addtocounter{reqcounter}{1}\r
        \textbf{Req \arabic{reqcounter}} #1\\\r
        \label{Req \arabic{reqcounter}} %this could be done better with a second argument, but that's tiresome to write in the text\r
-}
\ No newline at end of file
+}\r
diff --git a/spec/sm/rs232-rs.tex b/spec/sm/rs232-rs.tex
new file mode 100644 (file)
index 0000000..6688f37
--- /dev/null
@@ -0,0 +1,48 @@
+% http://ftp.univie.ac.at/packages/tex/graphics/pstricks/base/doc/pstricks-doc.pdf
+% http://www.tug.org/PSTricks/main.cgi?file=doc/docs
+
+% 18:59:41 <martinp> http://pastebin.com/tcp16Gp minimales "sample"
+% 01:53:07 <martinp> die nodes werden deine lieblinge sein ;)
+% 01:53:19 <martinp> ncline, ncarc und nccircle
+% 01:53:32 <martinp> angle und arcangle als parameter sind ganz nützlich ;)
+% 01:54:08 <martinp> rest siehst eh in dem "sample" von mir ;)
+% 01:55:08 <martinp> aja, was du auf jedenfall vermeiden solltest sind leere reihen in der psmatrix
+% 01:55:14 <martinp> da kommt dann immer blödsinn raus
+% 01:55:39 <martinp> wennst mehr platz zwischen den nodes brauchst solltest colsep und rowsep verändern
+% 01:56:02 <martinp> eine \mbox{ } als knoten hab ich noch nicht probiert, könnte vlt aber auch gehen
+% 01:56:40 <martinp> \ncarc[arcangle=20]{rs}{i}^{bla} setzt bla als label über die linie
+% 01:56:45 <martinp> \ncarc[arcangle=20]{rs}{i}_{bla} unter die linie
+% 01:57:07 <martinp> die ncput in dem sample in die linie (ohne * wird die linie auch nicht ausgeblendet)
+% 01:57:55 <martinp> ^ und _ sind eigentlich nur abkürzungen für naput oder so in die richtung
+% 01:58:13 <martinp> [npos=.4] ist auch ganz nett für die puts, damit veränderst die pos. der label auf der 
+%                    linie (zwischen start und ende)
+% 01:58:33 <martinp> und wennst böse kanten hast die du stark biegen musst
+% 01:59:03 <martinp> da ist es besser ncurv zu erhöhen als den arcangle (zumindest ab einem bestimmten arcangle 
+%                    auch die einzige möglichkeit mehr "kurve" zu bekommen)
+\documentclass{minimal}
+\pagestyle{empty}
+
+\usepackage{pstricks}
+\usepackage{pst-node}
+
+\begin{document}
+
+\begin{psmatrix}[mnode=circle, colsep=2cm, rowsep=2cm]
+[mnode=R,name=res]{RESET} & [name=i]{idle} & [name=rsp]{\shortstack{read \\ Stop-Bit}} \\
+& [name=rs]{\shortstack{read \\ Start-Bit}} & [name=rb]{read Bit}\\
+\end{psmatrix}
+
+\psset{arrows=->, shortput=nab}
+
+\ncline[linestyle=dotted]{res}{i}
+
+\ncarc[arcangle=25]{i}{rs}\ncput*[npos=.38]{\shortstack{falling\\edge rxd}}
+\ncarc[arcangle=25]{rs}{i}\ncput*[npos=.36]{rxd=1}
+
+\ncline{rs}{rb}\ncput*{rxd=0}
+
+\ncline{rb}{rsp}\ncput*{bitcount=8}
+\nccircle[angle=180]{rb}{.7cm}\ncput*{bitcount$<$8}
+
+\ncline{rsp}{i}
+\end{document}
index 8fa89e995d4fe0e1a211a674916fcbe3b7592dce..64a6a64a0c60ef6a328554e6a4f4ad3ea1ecc13d 100644 (file)
@@ -195,6 +195,13 @@ wie schauen interne strukturen aus? (speicher, logische bloecke, parallele proze
 \subsection{PS/2}
 
 \subsection{RS232}
+%test, TODO
+\begin{figure}[!ht]
+\includegraphics[width=0.9\textwidth]{sm/rs232-rs.pdf}
+\centering
+\caption{Statemachine zum Empfangen auf der RS232 Schnittstelle (8N1)}
+\label{fig:rs232-rs}
+\end{figure}
 
 \subsection{History}