133 lines
2.9 KiB
TeX
133 lines
2.9 KiB
TeX
\documentclass[12pt]{article}
|
|
|
|
\usepackage{comment}
|
|
\usepackage{float}
|
|
\usepackage{amsmath}
|
|
\usepackage{amssymb}
|
|
\usepackage{pdfpages}
|
|
\usepackage[hidelinks]{hyperref}
|
|
\usepackage{listings}
|
|
\usepackage[margin=1in]{geometry}
|
|
|
|
\newcommand{\docTitle}{Musical Greeting Card}
|
|
|
|
\newcommand{\courseNum}{ECE 312}
|
|
\newcommand{\labName}{Lab 2}
|
|
\newcommand{\labSection}{D21}
|
|
|
|
|
|
\hypersetup{
|
|
pdftitle={\docTitle{}},
|
|
pdfauthor={David Lenfesty \& Willard Farmer},
|
|
bookmarksnumbered=true,
|
|
bookmarksopen=true,
|
|
bookmarksopenlevel=1,
|
|
colorlinks=false,
|
|
pdfstartview=Fit,
|
|
pdfpagemode=UseOutlines, % this is the option you were lookin for
|
|
pdfpagelayout=TwoPageRight
|
|
}
|
|
|
|
\title{ {\Huge \docTitle{}} \\
|
|
\courseNum{} - \labName{} - \labSection{} - Tuesday}
|
|
\author{
|
|
David Lenfesty\\
|
|
\texttt{lenfesty@ualberta.ca}\\
|
|
\texttt{ID: 1531446}
|
|
\and
|
|
Willard Farmer\\
|
|
\texttt{wfarmer@ualberta.ca}\\
|
|
\texttt{ID: XXXXXXX}
|
|
}
|
|
|
|
\begin{document}
|
|
\pagenumbering{roman}
|
|
\maketitle
|
|
\newpage
|
|
\tableofcontents
|
|
\newpage
|
|
|
|
\pagenumbering{arabic}
|
|
|
|
\section{Brief Description}
|
|
|
|
The main point of the
|
|
|
|
\section{Target Specifications}
|
|
|
|
% Should we add more?
|
|
\begin{enumerate}
|
|
\item The card shall use the Attiny2313A processor and the PS1420P02CT piezo buzzers.
|
|
\item The card shall start and end playing when the button is pressed.
|
|
\item The card shall operate on 3V.
|
|
\item The card shall be able to play two notes at once, in the first and fourth octaves.
|
|
\item The card must be able to play songs a minimum of 15 seconds in length.
|
|
\item The card shall be able to be easily reprogrammed in order to play different songs.
|
|
\end{enumerate}
|
|
|
|
\section{Schematic}
|
|
|
|
\section{Firmware Plan}
|
|
|
|
\begin{lstlisting}
|
|
main():
|
|
initialize_gpio()
|
|
initialize_timer()
|
|
|
|
loop forever:
|
|
if playing:
|
|
play_beat()
|
|
|
|
if not playing and button_is_pressed:
|
|
delay(debounce_time)
|
|
set flag playing
|
|
enable_interrupts()
|
|
|
|
if interrupt_button_press:
|
|
reset flag playing
|
|
play_rest()
|
|
|
|
// Will play rest of current beat then shut off
|
|
button_press_interrupt():
|
|
disable_interrupts()
|
|
set flag interrupt_button_press
|
|
|
|
// Plays one full beat
|
|
play_beat():
|
|
if current_note_has_duration:
|
|
keep playing note
|
|
else:
|
|
read next note
|
|
play_note(next_note)
|
|
current_note_duration--
|
|
|
|
|
|
delay(on_time)
|
|
|
|
if current_note_has_duration:
|
|
keep playing note
|
|
else
|
|
play_rest()
|
|
|
|
delay_rest_time
|
|
|
|
\end{lstlisting}
|
|
|
|
\newpage
|
|
|
|
\section{Parts Required}
|
|
|
|
\begin{table}[H]
|
|
\centering
|
|
\begin{tabular}{c | c | c}
|
|
\textbf{Partno. / Description} & \textbf{Number Required} & \textbf{Return} \\
|
|
Attiny2313A & 1 & $\square$ \\
|
|
Piezoelectric Buzzer & 2 & $\square$ \\
|
|
Momentary Pushbutton & 1 & $\square$ \\
|
|
\end{tabular}
|
|
\end{table}
|
|
|
|
|
|
|
|
\end{document}
|