\documentclass[10pt,twocolumn]{article}

\usepackage{myfontstyle}
\usepackage{mypackages}
\usepackage{mymacros}
\usepackage{mycommands}
\usepackage{forest}

\begin{document}
\thispagestyle{fancy1}

%%% Title and Abstract------------------------
\twocolumn[
\begin{center}
	\hrule
	\vspace{3pt}
	% Title:
	{\sffamily\bfseries\Large
		Report for Laboratory Exercise 0: Getting Started
	} \\
	{\color{gray}
		\vspace{3pt}
		\hrule
		\vspace{3pt}
	}
	{
		\hspace*{\fill}
		Cameron Devine
		\hspace*{\fill}
	}\\
	\vspace{3pt}
	{\itshape
		\hspace*{\fill}
		Department of Mechanical Engineering, Saint Martin's University
		\hspace*{\fill} \\
		\hspace*{\fill}
		ME 477---Embedded Computing in Electromechanical Systems
		\hspace*{\fill}
	}\\
	\vspace{3pt}
	{
		\hspace*{\fill}
		\today{} % today's date ... can type manually instead
		\hspace*{\fill}
	}
	\vspace{3pt}
	{\color{gray}\hrule}
%	\vspace{2pt}
\end{center}
% Abstract:
\begin{adjustwidth}{1.5in}{1.5in}
{\small
\noindent\textbf{Abstract.} \hspace{1em}
For lab 0, a sum of squares function was written and tested.
The function was tested to ensure it works correctly and some improvements are suggested.
}
\end{adjustwidth}
\vspace{9pt}
\hrule
\vspace{1\baselineskip}
]

%%% Body -------------------------

\section{Description}
\label{sec:description}

For this lab, the main task is to compute and display the sum of a series of squares.
This is done by creating a function \texttt{sumsq}.
While this function works well, it is only possible to compute a single sum, as there is no method to reset the total back to zero or set the initial sum value.
The sum is found by using a static variable which has the desired square added to it each time the function is called.
The hierarchy of functions used in this lab is shown in fig.~\ref{fig:hierarchy}.

\begin{figure}
	\begin{center}
		\framebox{
			\begin{minipage}{0.6\columnwidth}
				%\noindent
				\texttt{main}\\
				$\rightarrow$\texttt{sumsq}
			\end{minipage}
		}
	\end{center}
	\caption{The hierarchy of functions used in Lab 0.}
	\label{fig:hierarchy}
\end{figure}

\section{Testing}

To test that the code is working correctly, the resulting sums were calculated by hand to be 4, 5, 9, and 18, when the initial sum value is 4, and 0, 1, 2, and 3 squared are added to the sum.
Once the values were calculated, they were checked with those displayed on the LCD screen.
Furthermore, the debugger was used to step through the program and check that it is operating as expected.

\section{Results}
\label{sec:results}

The code for this lab correctly printed the required values.
To allow computing multiple sums the \texttt{sumsq} function could be modified to include a second argument which could be set to \texttt{true} if the sum should be reset to zero, and \texttt{false} otherwise.

\section{Source listing}

The source code for this lab is shown below.

\lstinputlisting[frame=single, breaklines=true, language=c, showstringspaces=false]{main.c}

%%% References -------------------------

% \bibliographystyle{plainnat}
% \bibliography{report}

%%% Appendices -------------------------

% \appendix

% \section{An appendix}


\end{document}
