\hypertarget{main_8c}{
\section{main.c File Reference}
\label{main_8c}\index{main.c@{main.c}}
}
{\tt \#include \char`\"{}t89c51cc02.h\char`\"{}}\par
{\tt \#include \char`\"{}datatypes.h\char`\"{}}\par
{\tt \#include \char`\"{}adc.h\char`\"{}}\par
{\tt \#include \char`\"{}can.h\char`\"{}}\par
{\tt \#include \char`\"{}timer.h\char`\"{}}\par
{\tt \#include \char`\"{}sharp.h\char`\"{}}\par
{\tt \#include \char`\"{}fingersensors.h\char`\"{}}\par
{\tt \#include \char`\"{}photosensor.h\char`\"{}}\par
{\tt \#include \char`\"{}bumper.h\char`\"{}}\par
{\tt \#include \char`\"{}command.h\char`\"{}}\par
{\tt \#include \char`\"{}eeprom.h\char`\"{}}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define \hyperlink{main_8c_d72dbcf6d0153db1b8d8a58001feed83}{DEBUG}~1
\item 
\#define \hyperlink{main_8c_b102e48866057482dc131595cf5b070a}{LENGTH\_\-SENSORBUFFER}~128
\item 
\#define \hyperlink{main_8c_0863ac9279897a664956fef9723ea32a}{SAMPLEPOINTS}~18
\item 
\#define \hyperlink{main_8c_f7b7dc9a200cb1404c280bd500fd1551}{BUFFER\_\-LENGTH}~6 $\ast$ SAMPLEPOINTS
\item 
\#define \hyperlink{main_8c_08c68f63285ded6ede8a7b79fd831bad}{SERIALNUMBER}~0x01
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{main_8c_cdef7a1fd863a6d3770c1268cb06add3}{main} ()
\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
const char \hyperlink{main_8c_c91cf940e10a61b95cabc3258a06186b}{version} \mbox{[}$\,$\mbox{]} = \char`\"{}Sensor Control 07092007 \#1\char`\"{}
\item 
\hyperlink{datatypes_8h_89b917a7bdb582e19cbde98e817fa0b3}{WORD} xdata \hyperlink{main_8c_3b28e2d504920c3fd76418064fa4cc98}{sensorbuffer} \mbox{[}BUFFER\_\-LENGTH\mbox{]}
\begin{CompactList}\small\item\em circular buffer for sensor readings \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}


Definition in file \hyperlink{main_8c-source}{main.c}.

\subsection{Define Documentation}
\hypertarget{main_8c_f7b7dc9a200cb1404c280bd500fd1551}{
\index{main.c@{main.c}!BUFFER_LENGTH@{BUFFER\_\-LENGTH}}
\index{BUFFER_LENGTH@{BUFFER\_\-LENGTH}!main.c@{main.c}}
\subsubsection[BUFFER\_\-LENGTH]{\setlength{\rightskip}{0pt plus 5cm}\#define BUFFER\_\-LENGTH~6 $\ast$ SAMPLEPOINTS}}
\label{main_8c_f7b7dc9a200cb1404c280bd500fd1551}


size of sensor backbuffer in WORDS 

Definition at line 34 of file main.c.

Referenced by main().\hypertarget{main_8c_d72dbcf6d0153db1b8d8a58001feed83}{
\index{main.c@{main.c}!DEBUG@{DEBUG}}
\index{DEBUG@{DEBUG}!main.c@{main.c}}
\subsubsection[DEBUG]{\setlength{\rightskip}{0pt plus 5cm}\#define DEBUG~1}}
\label{main_8c_d72dbcf6d0153db1b8d8a58001feed83}


Debug flag - enables additional debug output via CAN 

Definition at line 24 of file main.c.\hypertarget{main_8c_b102e48866057482dc131595cf5b070a}{
\index{main.c@{main.c}!LENGTH_SENSORBUFFER@{LENGTH\_\-SENSORBUFFER}}
\index{LENGTH_SENSORBUFFER@{LENGTH\_\-SENSORBUFFER}!main.c@{main.c}}
\subsubsection[LENGTH\_\-SENSORBUFFER]{\setlength{\rightskip}{0pt plus 5cm}\#define LENGTH\_\-SENSORBUFFER~128}}
\label{main_8c_b102e48866057482dc131595cf5b070a}


Maximum size of the external data memory in 16Bit Words 

Definition at line 27 of file main.c.\hypertarget{main_8c_0863ac9279897a664956fef9723ea32a}{
\index{main.c@{main.c}!SAMPLEPOINTS@{SAMPLEPOINTS}}
\index{SAMPLEPOINTS@{SAMPLEPOINTS}!main.c@{main.c}}
\subsubsection[SAMPLEPOINTS]{\setlength{\rightskip}{0pt plus 5cm}\#define SAMPLEPOINTS~18}}
\label{main_8c_0863ac9279897a664956fef9723ea32a}


combined number of samples taken per measurement point 

Definition at line 31 of file main.c.

Referenced by main().\hypertarget{main_8c_08c68f63285ded6ede8a7b79fd831bad}{
\index{main.c@{main.c}!SERIALNUMBER@{SERIALNUMBER}}
\index{SERIALNUMBER@{SERIALNUMBER}!main.c@{main.c}}
\subsubsection[SERIALNUMBER]{\setlength{\rightskip}{0pt plus 5cm}\#define SERIALNUMBER~0x01}}
\label{main_8c_08c68f63285ded6ede8a7b79fd831bad}


main serial number of the firmware 

Definition at line 37 of file main.c.

Referenced by main().

\subsection{Function Documentation}
\hypertarget{main_8c_cdef7a1fd863a6d3770c1268cb06add3}{
\index{main.c@{main.c}!main@{main}}
\index{main@{main}!main.c@{main.c}}
\subsubsection[main]{\setlength{\rightskip}{0pt plus 5cm}void main ()}}
\label{main_8c_cdef7a1fd863a6d3770c1268cb06add3}


Initializes all sensor subsystems and implements the main sensor reading cycle. 

Definition at line 53 of file main.c.

References ADC\_\-init(), BUFFER\_\-LENGTH, Bumper\_\-init(), Bumper\_\-read(), BUMPERSENSORS\_\-NR, can\_\-data, CAN\_\-enablechannel, CAN\_\-init(), CAN\_\-Send\-Msg(), CAN\_\-setchannel, CH\_\-DISABLE, CH\_\-Tx\-ENA, Check\-Monitor(), Command\_\-Read\-Default\-Configuration(), Command\_\-Report\-Due(), Command\_\-Timecheck\-Enable, fingersensors, Fingersensors\_\-init(), FINGERSENSORS\_\-NR, Fingersensors\_\-read(), measurement\_\-task, Photosensor\_\-init(), Photosensor\_\-Power\-Off, Photosensor\_\-read(), read\_\-eeprom\_\-config, readenable, reporting, SAMPLEPOINTS, sensorbuffer, SERIALNUMBER, Sharp\_\-init(), Sharp\_\-Power\-Off, Sharp\_\-Power\-On, Sharp\_\-read(), and Timer\_\-init().

\subsection{Variable Documentation}
\hypertarget{main_8c_3b28e2d504920c3fd76418064fa4cc98}{
\index{main.c@{main.c}!sensorbuffer@{sensorbuffer}}
\index{sensorbuffer@{sensorbuffer}!main.c@{main.c}}
\subsubsection[sensorbuffer]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{datatypes_8h_89b917a7bdb582e19cbde98e817fa0b3}{WORD} xdata \hyperlink{main_8c_3b28e2d504920c3fd76418064fa4cc98}{sensorbuffer}\mbox{[}BUFFER\_\-LENGTH\mbox{]}}}
\label{main_8c_3b28e2d504920c3fd76418064fa4cc98}


circular buffer for sensor readings 

We store all sequential sensor readings into this buffer.\par
 The buffer resides in XRAM space of the T89C51CC02 (\char`\"{}Externer Datenspeicher\char`\"{}) 

Definition at line 48 of file main.c.

Referenced by main().\hypertarget{main_8c_c91cf940e10a61b95cabc3258a06186b}{
\index{main.c@{main.c}!version@{version}}
\index{version@{version}!main.c@{main.c}}
\subsubsection[version]{\setlength{\rightskip}{0pt plus 5cm}const char \hyperlink{main_8c_c91cf940e10a61b95cabc3258a06186b}{version}\mbox{[}$\,$\mbox{]} = \char`\"{}Sensor Control 07092007 \#1\char`\"{}}}
\label{main_8c_c91cf940e10a61b95cabc3258a06186b}


the version number encodes the current date in DDMMYYYY form and a revision number 

Definition at line 40 of file main.c.