\hypertarget{adc_8h}{
\section{adc.h File Reference}
\label{adc_8h}\index{adc.h@{adc.h}}
}
{\tt \#include \char`\"{}t89c51cc02.h\char`\"{}}\par
{\tt \#include \char`\"{}datatypes.h\char`\"{}}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{adc_8h_4b4a2ddcb45df0c8497c47d4ed800e2a}{ADC\_\-init} (void)
\begin{CompactList}\small\item\em initialize A/D hardware \item\end{CompactList}\item 
\hyperlink{datatypes_8h_89b917a7bdb582e19cbde98e817fa0b3}{WORD} \hyperlink{adc_8h_c5145c080f2e033408d9fd62a94fed4c}{ADC} (\hyperlink{datatypes_8h_92076741b75a8c2bdc5c24049c253d9a}{BYTE})
\begin{CompactList}\small\item\em execute A/D conversion for specific input channel \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}


Definition in file \hyperlink{adc_8h-source}{adc.h}.

\subsection{Function Documentation}
\hypertarget{adc_8h_c5145c080f2e033408d9fd62a94fed4c}{
\index{adc.h@{adc.h}!ADC@{ADC}}
\index{ADC@{ADC}!adc.h@{adc.h}}
\subsubsection[ADC]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{datatypes_8h_89b917a7bdb582e19cbde98e817fa0b3}{WORD} ADC (\hyperlink{datatypes_8h_92076741b75a8c2bdc5c24049c253d9a}{BYTE} {\em channel})}}
\label{adc_8h_c5145c080f2e033408d9fd62a94fed4c}


execute A/D conversion for specific input channel 

Reads the voltage from the specified input source and does a standard conversion.\par
 A reading of 0x0000 implies +0V while 0x03ff implies +5V

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em channel}]0-7 the A/D channel we want to measure (corresponds to a pin number) \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]conversion result as a 16Bit value \end{Desc}


Definition at line 29 of file adc.c.

Referenced by Bumper\_\-read(), Fingersensors\_\-read(), Photosensor\_\-read(), and Sharp\_\-read().\hypertarget{adc_8h_4b4a2ddcb45df0c8497c47d4ed800e2a}{
\index{adc.h@{adc.h}!ADC_init@{ADC\_\-init}}
\index{ADC_init@{ADC\_\-init}!adc.h@{adc.h}}
\subsubsection[ADC\_\-init]{\setlength{\rightskip}{0pt plus 5cm}void ADC\_\-init (void)}}
\label{adc_8h_4b4a2ddcb45df0c8497c47d4ed800e2a}


initialize A/D hardware 

The A/D converter of the T89C51CC02 is initialized to use P1.0 and P1.1 as analogue inputs. A standard conversion (see T89C51CC02 datasheet) is used. 

Definition at line 13 of file adc.c.

Referenced by main().