\def\BookletBaseClass{book} \documentclass[openany,twoside,a5paper]{book} %\documentclass[openany,twoside]{booklet} %\documentclass[oddleft]{booklet} \usepackage{acro}[1995/02/19] \usepackage{% vmargin,% fancyheadings,% varioref,% rcs,% lgrind,% emlines2,% multicol,% cols,% makeidx,% array,% nbox,% xr,% explanation,% booktabs,% version,% prog,% enumerate,% amstext,% %showkeys,% amssymb,% amsmath,% theorem,% nick,% lastpage,% float,% answers,% verbatim} \setpapersize{A5}% \shiftmargins \setmarginsrb{13mm}% left For a book, the inner. {9mm}% top {20mm}% right For a book, the outer. {10mm}% bottom {12pt}% headheight---increase to stop fancyhead warn {4mm}% headsep {0pt}% footheight {8mm}% footskip \RCS$Revision: 1.8 $ \RCS$Date: 1996/02/27 13:52:58 $ \providecommand{\revision}{ver \RCSRevision{}% ,\hspace{0.8ex} \RCSDate% } \DeclareRobustCommand{\referenceNum}{EE/27/LA/20/95} % 6, 7,..., 21. % Turn off lgrind's special handling of the vertical bar: %|- % For the external references (xr.sty): \externaldocument[asmpv114:]{../56ptws0/asmpv114} \pagestyle{fancyplain} \newcommand*{\file}[1]{\texttt{#1}} \setlength{\extrarowheight}{1.5pt} % Is this okay? \newcommand*{\clearemptydoublepage}% {\newpage{\pagestyle{empty}\cleardoublepage}} \newcommand*{\headSize}{\scriptsize} \newcommand*{\outerHead}{\textbf{\normalsize\thepage}} \newcommand*{\outerRightFoot}{\tiny\referenceNum} \newcommand*{\outerLeftFoot}{\tiny\revision} \renewcommand*{\chaptermark}[1]{\markboth{#1}{#1}} \renewcommand*{\sectionmark}[1]{\markright{\thesection\ \ #1}} \lhead% [\fancyplain{}{\outerHead}]% %{\fancyplain{}{\bfseries\rightmark}} {\fancyplain{}{\textbf{Errata: corrections to errors in this book}}} \rhead% [\fancyplain{}{\textbf{Errata: corrections to errors in this book}}]% % %[\fancyplain{}{\bfseries\leftmark}]% {\fancyplain{}{\outerHead}} \lfoot[\fancyplain{}{\outerLeftFoot}]{} \rfoot[]{\fancyplain{}{\outerRightFoot}} \cfoot[\fancyplain{}{}]{\fancyplain{}{}} \DeclareRobustCommand{\Lsh}{\textless\!\!\textless} \DeclareRobustCommand{\Rsh}{\textgreater\!\!\textgreater} % \newcommand{\nBox}[2][40mm]{\parbox[c][3\baselineskip][c]{#1}{\centering#2}} % From asmprim.tex: %\renewcommand*{\chaptermark}[1]{\markboth{#1}{#1}} %\renewcommand*{\sectionmark}[1]{\markright{\thesection\ #1}} %\newcommand*{\outerLeftFoot}{\tiny\revision} %\newcommand*{\outerRightFoot}{\tiny\referenceNum} %\lfoot[\fancyplain{}{\outerLeftFoot}]{} %\rfoot[]{\fancyplain{}{\outerRightFoot}} % !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! % Belongs in lect2.dtx! % !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! \raggedbottom \newcommand*{\qc}{\textsf{Quincy}\xspace} \providecommand{\DP}{\textsf{MS-DOS Prompt}\xspace} \providecommand{\ed}{\textsf{MS-DOS Editor}\xspace} \providecommand{\hp}{\textsf{HP Real-time C Debugger}\xspace} \providecommand{\te}{\textsf{Terminal}\xspace} \renewcommand{\floatpagefraction}{0.75} % default is .5, to increase % density. \renewcommand*{\bottomfraction}{0.6} % default is 0.3 \renewcommand*{\topfraction}{0.85} % default is 0.7 \renewcommand*{\textfraction}{0.1} % default is 0.2 \floatstyle{ruled} \floatname{program}{Program example} \newfloat{program}{tbhp}{lop}[chapter] \newcommand*{\tableFontSize}{\footnotesize} % Stuff for the title page: \DeclareFontFamily{U}{cminch}{} \DeclareFontShape{U}{cminch}{b}{n} { <72><217><434> cminch }{} \DeclareFixedFont{\cmthreeinch}{U}{cminch}{b}{n}{217} \DeclareFixedFont{\cmfourinch}{U}{cminch}{b}{n}{434} \newcommand*{\HRule}{\rule{\linewidth}{1mm}} \newlength{\embeddedWidth} \settowidth{\embeddedWidth}{\sffamily\Huge\bfseries embedded} \newlength{\cWidth} \newlength{\cHeight} \settowidth{\cWidth}{\cmfourinch\char'103} \settoheight{\cHeight}{\cmfourinch\char'103} \newlength{\cPos} \setlength{\cPos}{0.6\cWidth} \addtolength{\cPos}{-\embeddedWidth} %\title{\raggedleft %\sffamily\Huge\bfseries {\raggedright Learning and using\\[1ex]} %{\cmfourinch\char'103}\hspace*{-0.6\cWidth}\raisebox{0.5\cHeight}[0pt][0pt]{% %\parbox{\embeddedWidth}{in\\embedded\\systems}}\hspace*{\cPos}\mbox{}\\[1ex] %\Large Nick Urbanik\\[1.5ex] %\normalsize example programs by {\large Vincent Hui}\\[6ex] %\normalsize \RCSDate\\[2ex] %Hong Kong Technical College (Tsing Yi)\\[2ex] %Department of Electrical and Communications Engineering %} %\author{} %\date{} %\title{Learning and using C with embedded systems: a laboratory guide for % \emph{Digital Systems and Microprocessors}} %\author{Nick Urbanik \and Vincent Hui\thanks{Vincent Hui contributed most of the % examples in this booklet.}\\[2ex] %Department of Electrical and Communications Engineering\\ %Hong Hong Technical College (Tsing Yi)} %\date{\RCSDate} % The set up for the exercises: \theorembodyfont{\rmfamily} \theoremstyle{margin}% This is my modified thm.sty. \newtheorem{exercise}{Exercise}[chapter] \newtheorem{example}{Example}[chapter] \theoremheaderfont{\scshape} \Newassociation{Solution}{Soln}{exsolns} \renewcommand{\Solnlabel}[1]{\textsc{Solution } #1} \makeindex \newcommand*{\nn}[1]{#1n} % For index entries in footnotes. \renewcommand*{\bibname}{References} \begin{document} \pagenumbering{Alph} \thispagestyle{plain} %{\bfseries\Huge Errata} \chapter*{Errata: corrections to errors in this book} \section*{Please add these corrections first} Unfortunately, this book was printed before the proof reading was complete. There are a number of errors in the book; those I could find are corrected here. I will be grateful to any reader---student or staff---who can point out any other errors, whether factual, spelling, typographical or gramatical. I am interested in feedback about ways I can improve the next edition.\footnote{I know many cross references and index items will be wrong, as mentioned on page~\pageref{pag:wrongRefs}, but getting these right in the next edition of this book is trivial.} \section*{Major errors and omissions} \begin{description} \item[page 55, 6th bulletted point] The dip switches are connected to port C, not to port~A\e. The second sentence should read: \begin{quote} This is the port~C data register on the \PIT. \end{quote} and \emph{not} \begin{quote} This is the port~A data register on the \PIT. \end{quote} \item[page 110, solution to exercise 2.6 (g)] \mbox{}\\[-2ex] \begin{enumerate} \item[(g)] To solve this, you really need to look at table~A.1 on page~116 which shows operator precedence, or in other words, which operator is evaluated first. \label{soln:precedenceExample} From that table, we see that `@>=@', `@<=@', `@<@' and `@>@' have precedence level 10, `@&&@' has precedence level 5, `@!@' has the high priority of 14, `@||@' has a priority of 4 and binary `@-@' has a priority of 12. The expressions are evaluated in order of this priority, those with a higher precedence level first. Let us put parentheses around this expression to see how it is evaluated by the C compiler. @ 10 >= 0 && 30 <= 30 || ! ( 50 < 0 ) && 7 - 3 > 5@\\ @= ( ( ( 10 >= 0 ) && ( 30 <= 30 ) ) )@\\ @|| ( ! ( 50 < 0 ) && ( ( 7 - 3 ) > 5 ) )@\\ @= ( 1 && 1 ) || ( ! 0 && ( 4 > 5 ) )@\\ @= 1 || ( 1 && 0 )@\\ @= 1 || 0@\\ @= 1@, which has the logical value @true@. \end{enumerate} \item[page 117, solution to exercise 3.1] Replace the whole of the solution part (a) with the following: \begin{enumerate}[(a)] \item If there are three address line inputs to the address decoder, A$_{23\text{--}21}$, then a new range of addresses is selected when A$_{21}$ changes. So the lowest address, A00000\hex is active when A$_{23}$ = 1, A$_{22}$ = 0 and A$_{21}$ = 1. This three-bit number is 101\bin. When this three-bit number is incremented, then the \DUART will cease to be activated. This will happen when A$_{23}$ = 1, A$_{22}$ = 1 and A$_{21}$ = 0. The highest address with A$_{23}$ = 1, A$_{22}$ = 0 and A$_{21}$ = 1 is BFFFFF\hex. That is the highest address at which the chip select of the \DUART will be activated. \end{enumerate} The second part should be labelled (b), not \textbf{2.} \end{description} \section*{Minor corrections} \begin{description} \item[page 1, section 1.1.1, 4th line from bottom] Write @#include @ instead of @#include