26 lines
1.2 KiB
TeX
26 lines
1.2 KiB
TeX
|
To illustrate how the components work together and can be used in various
|
||
|
different applications, a small text-adventure with audio effects was written in
|
||
|
C. The main goal was to show the capabilities of even small systems like the
|
||
|
one developed.
|
||
|
|
||
|
\subsection{General Implementation details}
|
||
|
|
||
|
Like the before examples, the textadventure was implemented on an ATMega2560
|
||
|
and uses 3 different Registers for transmission: PORTF, PORTK and PORTL for
|
||
|
address bus, data bus and control bus respectively, as can be seen in listing
|
||
|
\ref{lst:textadv-avr.h}
|
||
|
|
||
|
\lstinputlisting[language=C,frame=trBL,
|
||
|
breaklines=true, breakautoindent=true, formfeed=\newpage,
|
||
|
label={lst:textadv-avr.h}, caption={The avr.h header file},
|
||
|
columns=flexible, style=cstyle]{./code/textadv/include/avr.h}
|
||
|
|
||
|
The in listing \ref{lst:textadv-avr.h} shown defines MR_SHIFT, WR_SHIFT,
|
||
|
RD_SHIFT, CS_UART_SHIFT and CS_DAC_SHIFT are used to indicate the position of
|
||
|
the corresponding control lines inside the control bus register. All other
|
||
|
shift values are the same bitordering in input as in output.
|
||
|
|
||
|
The BUS_HOLD_US is used to tell the avr how many microsecons it takes for the
|
||
|
data bus to be latched into input register of the devices on write or how long
|
||
|
it takes for the data bus to become stable on read.
|