8.1.2 An Example

The pseudocode of an UART receiver interrupt is simplified as follows (not to handle error flags):


\begin{algorithmic}
\STATE grab the byte
\IF{fifo has space}
\STATE add the b...
... nothing, maybe to set a flag to indicate the problem
\ENDIF
\end{algorithmic}

The matching handler thread may look like the following:


\begin{algorithmic}
\LOOP
\STATE P the receiver fifo semphoare
\STATE grab a ...
...rom the fifo
\STATE process it (can be leeeengthy)
\ENDLOOP
\end{algorithmic}



Copyright © 2008-10-25 by Tak Auyeung