\documentclass[12pt]{article}

\usepackage{amssymb,latexsym,color}
\usepackage{epsfig}
\usepackage{hyperref}

%\leftfooter{Assignment 2, sfwreng 4aa3/4ga3}
%\title{Sfwr Eng 4aa3/4ga3 Assignment 2}
\textwidth 6.0in
\textheight 9.0in
%\oddsidemargin -0.5in
\topmargin -0.5in
\begin{document}
\begin{center}
\textbf{\Large{Mechtron 3TB4: Embedded Systems Design II\\
Tutorial~1 Practice Questions}}\\
Due: To be prepared before your first tutorial session.  You will be quizzed on the content covered by these questions! Approximate marking scheme is provided after each question in square parentheses [].
\end{center}
\begin{itemize}
\item[Q.1] %Create a table for half stepping of motore and reverse direction
In class we discussed half-stepping sequence for a stepper motor with 2-poles on the rotor and 4-poles on the stator ref. figure~\ref{stepper21}.
\begin{figure}[htb]
\centering
\includegraphics{../figures/stepper21}
\caption{\label{stepper21}}
\end{figure}
%\clearpage

\begin{enumerate}\item[a)] 
Make a table showing sequences for all half steps required to rotate the motor 360 degrees in clockwise direction [5].
\item[b)] Make a table showing sequences for all half steps required to rotate the motor 360 degrees in counterclockwise direction [5].
\end{enumerate}

\item[Q.2]
Consider a stepper motor with 2-bipolar windings on the stator and a 6-pole permanent magnet rotor ref. figure~\ref{stepperA12}.
\begin{figure}[htb]
\centering
\includegraphics[width=0.9\textwidth]{../figures/stepperA12}
\caption{\label{stepperA12}}
\end{figure}
%\clearpage

\begin{enumerate}
\item[a)]
How many steps are requied by this motor to complete one revolution? [2]
\item[b)] What is the step resolution for this motor? [1]
\item[c)] Show the sequences for all steps required to rotate this motor by 75 degrees only [3].
\end{enumerate}
\item[Q.3] %questions 1 to 5 of practice
You are given a stepper motor shown in figure~\ref{stepperA1}. 
\begin{figure}[htb]
\centering
\includegraphics[width=0.9\textwidth]{../figures/stepperA1}
\caption{\label{stepperA1}}
\end{figure}
\clearpage

Using ohmmeter in the lab, you
determined that one of the windings was shorted, as indicated in the figure. Can you
still use this motor to perform both full- and half-steps? How will the performance of
the motor be affected?

\item[Q4.] Explain why nested interrupt support may be beneficial in an embedded system
implementation? [2]
\item[Q5.] Your company is developing new microprocessor architecture. You are in charge of
developing interrupt support hardware with the following characteristics:
\begin{itemize}
\item Only one instruction executes at any given time. Currently
executing instruction is completed before servicing the interrupt,
unless the instruction itself is the cause of the interrupt.
\item On interrupt, only the return address is stored automatically. The
address is stored to an auxiliary register.
\item Addresses of ISRs are stored in a vector table.
\end{itemize}
\begin{enumerate}
\item[a)] What hardware components have to (i.e. are absolutely necessary) be added to the
processor, if any, to support the interrupts as described? [2]
\item[b)] What hardware components have to (i.e. are absolutely necessary) be added to the
devices, if any, to support the interrupts as described? [2]
\item[c)] What structures have to (i.e. are absolutely necessary) be added in
memory, if any, to support the interrupts as described? [1]
\end{enumerate}
\item[Q6.] Your company is developing a new software development system for AVR
(ATmega324P). You are in charge of developing library functions. Among others,
you are required to develop a library function with the following prototype:
\begin{verbatim}
void delay (unsigned int time);
\end{verbatim}
The function does nothing for a specified amount of time, and returns after the time
has expired. The library you are developing is targeting low power applications. You
can use Timer0 for this purpose, and you can assume that no other part of the
application uses Timer0.\\
Write C code that implements this function [10].
%b. How would your answer in a) have to change if the main program was allowed to use Timer0?
\end{itemize}

\end{document}
