% Format: LaTeX

% $Header: J:\MICROP\56FTWS0\RCS\learnc.tex 1.4 1996/02/20 15:46:18 Nick Exp Nick $

% $Log: learnc.tex $
% Revision 1.4  1996/02/20  15:46:18  Nick
% This is a major revision.  I have added much more material,
% including exercises with solutions, more diagrams, and have clarified
% some explanations.  It looks like it is shaping up to become my major
% opus for the uear.
%
% Revision 1.3  1996/02/10 16:41:25  Nick
% A significant rearangement.
% The info on the parts of the compiler have been moved to the back.
% Some changes I noted in the train have been made.
% Still quite a long way to go, but we're on the way.
%
% Revision 1.2  1996/01/31 16:43:01  Nick
% This version has all the program examples as floats with a list
% of programs.  It now needs some practical advice on using the
% Quincy interpreter, and some exercises.
%
% Revision 1.1  1996/01/30 14:40:26  Nick
% Initial revision
%
% Revision 1.3  1995/10/19  21:58:39  Nick
% Have added Vincent's examples.
%


% Turn off special treatment of the vertical bar by lgrind so
% tabular environment works.
%|-
%@-
\begin{filecontents}{acro.sty}
\ProvidesPackage{acro}[1996/02/19  Abbreviations and acronyms]
% Written by Nick Urbanik,

% $Header: J:\MICROP\56FTWS0\RCS\learnc.tex 1.4 1996/02/20 15:46:18 Nick Exp Nick $

% $Log: learnc.tex $
% Revision 1.4  1996/02/20  15:46:18  Nick
% This is a major revision.  I have added much more material,
% including exercises with solutions, more diagrams, and have clarified
% some explanations.  It looks like it is shaping up to become my major
% opus for the uear.
%
% Revision 1.4  1996/01/24  00:35:39  Nick
% Added slanted LEDs, embedded systems and DTMF.
%
% Revision 1.2  1995/09/14  21:53:41  Nick
% This is a merging of my acro.sty at home and that at work.
%

\RequirePackage{xspace,relsize,scl}

\DeclareRobustCommand{\Slash}{{\raisebox{0.3ex}{\relsize{-3}/}}}
\DeclareRobustCommand{\leftPar}{{\raisebox{0.1ex}{\relsize{-2}(}}}
\DeclareRobustCommand{\rightPar}{{\raisebox{0.1ex}{\relsize{-2})}}}

% Make an acro able to work in maths mode, so I can use overline.
\DeclareMathAlphabet{\mathsc}{OT1}{cmr}{m}{sc}
\DeclareRobustCommand{\acro}[1]{\textsc{\lowercase{#1}}}
\DeclareRobustCommand{\acroSl}[1]{\textscl{\lowercase{#1}}}
\DeclareRobustCommand{\overbar}[1]%
  {\ensuremath{\overline{\mathsc{\lowercase{#1}}}}}

\providecommand*{\AC}{\acro{AC}\xspace}
\providecommand*{\AD}{\acro{A\Slash{}{}D}\xspace}
\providecommand*{\ADsl}{\acroSl{A\Slash{}{}D}\xspace}
\providecommand*{\ALU}{\acro{ALU}\xspace}
\providecommand*{\ANSI}{\acro{ANSI}\xspace}
\providecommand*{\ASCII}{\acro{ASCII}\xspace}
\providecommand*{\AS}{$\overline{\acro{AS}}$\xspace}
\providecommand*{\BASIC}{\acro{BASIC}\xspace}
\providecommand*{\BIOS}{\acro{BIOS}\xspace}
\providecommand*{\CDROM}{\acro{CDROM}\xspace}
\providecommand*{\CMOS}{\acro{CMOS}\xspace}
\providecommand*{\CPU}{\acro{CPU}\xspace}
\providecommand*{\CRT}{\acro{CRT}\xspace}
\providecommand*{\CS}{$\overline{\acro{CS}}$\xspace}
\providecommand*{\EEPROM}{\acro{EEPROM}\xspace}
\providecommand*{\EPROM}{\acro{EPROM}\xspace}
\providecommand*{\DA}{\acro{D\Slash{}{}A}\xspace}
\providecommand*{\DAsl}{\acroSl{D\Slash{}{}A}\xspace}
\providecommand*{\DC}{\acro{DC}\xspace}
\providecommand*{\DIP}{\acro{DIP}\xspace}
\providecommand*{\DMA}{\acro{DMA}\xspace}
\providecommand*{\DOS}{\acro{DOS}\xspace}
\providecommand*{\DMAC}{\acro{DMAC}\xspace}
\providecommand*{\DTACK}{$\overline{\acro{DTACK}}$\xspace}
\providecommand*{\DTMF}{\acro{DTMF}\xspace}
\providecommand*{\DUART}{\acro{DUART}\xspace}
\providecommand*{\FIFO}{\acro{FIFO}\xspace}
\providecommand*{\FLIGHT}{\acro{FLIGHT-68K}\xspace}
\providecommand*{\FLIGHTsl}{\acroSl{FLIGHT-68K}\xspace}
\providecommand*{\GNU}{\acro{GNU}\xspace}
\providecommand*{\HC}{\acro{HC}\xspace}
\providecommand*{\HD}{\acro{HD}\xspace}
\providecommand*{\HKTC}{\acro{HKTC\leftPar{}TY\rightPar}\xspace}
\providecommand*{\HKTCsl}{\acroSl{HKTC\leftPar{}TY\rightPar}\xspace}
\providecommand*{\HLL}{\acro{HLL}\xspace}
\providecommand*{\IC}{\acro{IC}\xspace}
\providecommand*{\ICE}{\acro{ICE}\xspace}
\providecommand*{\IM}{\acro{IM}\xspace} % interrupt mask
\DeclareRobustCommand{\IO}{\acro{I\Slash{}{}O}\xspace}
\DeclareRobustCommand{\IOsl}{\acroSl{I\Slash{}{}O}\xspace}
\providecommand*{\ISA}{\acro{ISA}\xspace}
\providecommand*{\ISR}{\acro{ISR}\xspace}
\providecommand*{\LAN}{\acro{LAN}\xspace}
\providecommand*{\LDS}{\overbar{LDS}\xspace}
\providecommand*{\LED}{\acro{LED}\xspace}
\providecommand*{\LEDsl}{\acroSl{LED}\xspace}
\providecommand*{\LIFO}{\acro{LIFO}\xspace}
\providecommand*{\LLL}{\acro{LLL}\xspace}
\providecommand*{\LRC}{\acro{LRC}\xspace}
\providecommand*{\LSB}{\acro{LSB}\xspace}
\providecommand*{\MPU}{\acro{MPU}\xspace}
\providecommand*{\NMI}{\acro{NMI}\xspace}
\providecommand*{\MSDOS}{\acro{MS-DOS}\xspace}
\providecommand*{\MSDOSsl}{\acroSl{MS-DOS}\xspace}
\providecommand*{\MSB}{\acro{MSB}\xspace}
\providecommand*{\OS}{\acro{O\Slash{}{}S}\xspace}
\providecommand*{\OSsl}{\acroSl{O\Slash{}{}S}\xspace}
\providecommand*{\PAL}{\acro{PAL}\xspace}
\providecommand*{\PC}{\acro{PC}\xspace}
\providecommand*{\PCB}{\acro{PCB}\xspace}
\providecommand*{\PGA}{\acro{PGA}\xspace}
\providecommand*{\PIT}{\acro{PI\Slash{}{}T}\xspace}
\providecommand*{\PITsl}{\acroSl{PI\Slash{}{}T}\xspace}
\providecommand*{\PLCC}{\acro{PLCC}\xspace}
\providecommand*{\PLD}{\acro{PLD}\xspace}
\providecommand*{\PROM}{\acro{PROM}\xspace}
\providecommand*{\RAM}{\acro{RAM}\xspace}
\providecommand*{\RESET}{$\overline{\acro{RESET}}$\xspace}
\providecommand*{\ROM}{\acro{ROM}\xspace}
\providecommand*{\RTS}{\acro{RTS}\xspace}
\providecommand*{\RW}{\acro{R\Slash{}{}\overbar{W}}\xspace}
\providecommand*{\TTL}{\acro{TTL}\xspace}
\providecommand*{\UDS}{\overbar{UDS}\xspace}
\providecommand*{\UNIX}{\acro{UNIX}\xspace}
\providecommand*{\VRC}{\acro{VRC}\xspace}
\providecommand*{\VSC}{\acro{VSC}\xspace}
\providecommand*{\VTC}{\acro{VTC}\xspace}

\providecommand*{\es}{embedded system\xspace}
\providecommand*{\uc}{microcontroller\xspace}
\providecommand*{\Uc}{Microcontroller\xspace}
\providecommand*{\up}{microprocessor\xspace}
\providecommand*{\Up}{Microprocessor\xspace}
\providecommand*{\MPA}{Microprocessor Applications Laboratory\xspace}
\providecommand*{\mpa}{microprocessor lab\xspace}


% Hex digits in mathematics mode:
\providecommand*{\A}{\ensuremath{\mathrm{A}}}
\providecommand*{\Bh}{\ensuremath{\mathrm{B}}}
\providecommand*{\B}{\ensuremath{\mathrm{B}}}
\providecommand*{\C}{\ensuremath{\mathrm{C}}}
\providecommand*{\D}{\ensuremath{\mathrm{D}}}
\providecommand*{\E}{\ensuremath{\mathrm{E}}}
\providecommand*{\F}{\ensuremath{\mathrm{F}}}

% for kilobytes:
\providecommand*{\Kb}{\mathrm{K}}
% megabytes:
\providecommand*{\M}{\mathrm{M}}
\end{filecontents}

\begin{filecontents}{thm.sty}
% Modified version of thm.sty by Nick Urbanik, 19-2-96.
% Modified to create an exercise like TeXbook.
% Select this with \theoremstyle{margin}.
\def\FMithmInfo{1995/11/23 v2.2c Theorem extension package (FMi)}
%%
%% Package `theorem' to use with LaTeX2e
%% Copyright (C) 1989-1995 Frank Mittelbach, all rights reserved.
\begingroup \makeatletter
\@ifundefined{theorem@style}{\input{theorem.sty}}{}
\ProvidesFile{thm.sty}
             [\FMithmInfo]
\gdef\th@margin{\normalfont\slshape
  \def\@begintheorem##1##2{\item
       [\theorem@headerfont \llap{$\blacktriangleright$}\hskip\labelsep ##1\ ##2]}%
\def\@opargbegintheorem##1##2##3{%
  \item[\theorem@headerfont \llap{$\blacktriangleright$}\hskip\labelsep ##1\ ##2 (##3)]}}
\endgroup

\endinput
\end{filecontents}
%@+

\def\BookletBaseClass{book}

\documentclass[openany]{booklet}
%\documentclass[oddleft]{booklet}

\usepackage{acro}[1995/02/19]

\usepackage{%
   lgrind,%
   emlines2,%
   multicol,%
   cols,%
   makeidx,%
   array,%
   nbox,%
   xr,%
   explanation,%
   booktabs,%
   version,%
   prog,%
   enumerate,%
   amstext,%
   showkeys,%
   amssymb,%
   amsmath,%
   theorem,%
   float,%
   answers,%
   verbatim}

\RCS$Revision: 1.4 $
\RCS$Date: 1996/02/20 15:46:18 $

\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}

\includeversion{notes}
\excludeversion{slides}
\includeversion{elecEng}

\setlength{\extrarowheight}{4pt}
\DeclareRobustCommand{\Lsh}{@<<@}
\DeclareRobustCommand{\Rsh}{@>>@}
% \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}[section]

\newcommand*{\tableFontSize}{\footnotesize}

%\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}

% 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{}

\begin{document}
\pagenumbering{roman}
\thispagestyle{empty}
\vspace*{0pt}
{\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}\break
\vfill
\normalsize \RCSDate\\[1.5ex]
Hong Kong Technical College (Tsing Yi)\\
Department of Electrical and Communications Engineering\break}
%\vspace*{\stretch{1}}
\newpage


% {\fontsize{3in}{20pt}\usefont{U}{cminch}{b}{n}\char'103}

%{\cmthreeinch\char'103}


\end{document}



