\hypertarget{bumper_8h}{
\section{bumper.h File Reference}
\label{bumper_8h}\index{bumper.h@{bumper.h}}
}
{\tt \#include \char`\"{}datatypes.h\char`\"{}}\par
{\tt \#include \char`\"{}t89c51cc02.h\char`\"{}}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define \hyperlink{bumper_8h_e4584e337deb7efedb7396d6e0399401}{Bumper\_\-activate}()~P1\_\-4=1
\item 
\#define \hyperlink{bumper_8h_4414719322712b846b3ded296bc273b5}{Bumper\_\-deactivate}()~P1\_\-4=0
\item 
\#define \hyperlink{bumper_8h_755fb3cf3795c0b8cf875b2267b42f84}{BUMPERSENSORS\_\-NR}~8
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
\hypertarget{bumper_8h_431f15df1c41d763e4f63f8dfb16b819}{
void \hyperlink{bumper_8h_431f15df1c41d763e4f63f8dfb16b819}{Bumper\_\-init} (void)}
\label{bumper_8h_431f15df1c41d763e4f63f8dfb16b819}

\begin{CompactList}\small\item\em initialize bumper control subsystem \item\end{CompactList}\item 
void \hyperlink{bumper_8h_55fdb239dfe4844d007a90af9ca18e61}{Bumper\_\-select} (\hyperlink{datatypes_8h_92076741b75a8c2bdc5c24049c253d9a}{BYTE})
\begin{CompactList}\small\item\em select one of the outer bumper sensors for measurement \item\end{CompactList}\item 
\hyperlink{datatypes_8h_89b917a7bdb582e19cbde98e817fa0b3}{WORD} \hyperlink{bumper_8h_9d25ca9f5bf9d6d73368ab11e9e53ed8}{Bumper\_\-read} (\hyperlink{datatypes_8h_92076741b75a8c2bdc5c24049c253d9a}{BYTE})
\begin{CompactList}\small\item\em reads one of the perimeter bumper sensors \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}


Definition in file \hyperlink{bumper_8h-source}{bumper.h}.

\subsection{Define Documentation}
\hypertarget{bumper_8h_e4584e337deb7efedb7396d6e0399401}{
\index{bumper.h@{bumper.h}!Bumper_activate@{Bumper\_\-activate}}
\index{Bumper_activate@{Bumper\_\-activate}!bumper.h@{bumper.h}}
\subsubsection[Bumper\_\-activate]{\setlength{\rightskip}{0pt plus 5cm}\#define Bumper\_\-activate()~P1\_\-4=1}}
\label{bumper_8h_e4584e337deb7efedb7396d6e0399401}


activates reading of Bumper sensors 

Definition at line 6 of file bumper.h.

Referenced by Bumper\_\-read().\hypertarget{bumper_8h_4414719322712b846b3ded296bc273b5}{
\index{bumper.h@{bumper.h}!Bumper_deactivate@{Bumper\_\-deactivate}}
\index{Bumper_deactivate@{Bumper\_\-deactivate}!bumper.h@{bumper.h}}
\subsubsection[Bumper\_\-deactivate]{\setlength{\rightskip}{0pt plus 5cm}\#define Bumper\_\-deactivate()~P1\_\-4=0}}
\label{bumper_8h_4414719322712b846b3ded296bc273b5}


deactivates reading of Bumper sensors 

Definition at line 8 of file bumper.h.

Referenced by Bumper\_\-init(), and Bumper\_\-read().\hypertarget{bumper_8h_755fb3cf3795c0b8cf875b2267b42f84}{
\index{bumper.h@{bumper.h}!BUMPERSENSORS_NR@{BUMPERSENSORS\_\-NR}}
\index{BUMPERSENSORS_NR@{BUMPERSENSORS\_\-NR}!bumper.h@{bumper.h}}
\subsubsection[BUMPERSENSORS\_\-NR]{\setlength{\rightskip}{0pt plus 5cm}\#define BUMPERSENSORS\_\-NR~8}}
\label{bumper_8h_755fb3cf3795c0b8cf875b2267b42f84}


number of available bumper sensors 

Definition at line 11 of file bumper.h.

Referenced by main().

\subsection{Function Documentation}
\hypertarget{bumper_8h_9d25ca9f5bf9d6d73368ab11e9e53ed8}{
\index{bumper.h@{bumper.h}!Bumper_read@{Bumper\_\-read}}
\index{Bumper_read@{Bumper\_\-read}!bumper.h@{bumper.h}}
\subsubsection[Bumper\_\-read]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{datatypes_8h_89b917a7bdb582e19cbde98e817fa0b3}{WORD} Bumper\_\-read (\hyperlink{datatypes_8h_92076741b75a8c2bdc5c24049c253d9a}{BYTE} {\em bumpernr})}}
\label{bumper_8h_9d25ca9f5bf9d6d73368ab11e9e53ed8}


reads one of the perimeter bumper sensors 

A given bumper sensor is selected and then being read with the A/D converter.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em bumpernr}]the bumper to be read (0-7) \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]the relative voltage reading of the specified bumper (+5V means no contact) \end{Desc}


Definition at line 57 of file bumper.c.

References ADC(), Bumper\_\-activate, Bumper\_\-deactivate, and Bumper\_\-select().

Referenced by main().\hypertarget{bumper_8h_55fdb239dfe4844d007a90af9ca18e61}{
\index{bumper.h@{bumper.h}!Bumper_select@{Bumper\_\-select}}
\index{Bumper_select@{Bumper\_\-select}!bumper.h@{bumper.h}}
\subsubsection[Bumper\_\-select]{\setlength{\rightskip}{0pt plus 5cm}void Bumper\_\-select (\hyperlink{datatypes_8h_92076741b75a8c2bdc5c24049c253d9a}{BYTE} {\em sensorid})}}
\label{bumper_8h_55fdb239dfe4844d007a90af9ca18e61}


select one of the outer bumper sensors for measurement 

A 74HCT237 decoder IC is used to select one of the bumpers. This function applies the sensor address to its A bus.\par
 The A Bus is connected to P2.0 P2.1 and P1.5 for A0 - A2.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em sensorid}]- number of the bumper to be read \end{description}
\end{Desc}


Definition at line 33 of file bumper.c.

Referenced by Bumper\_\-read().