\hypertarget{timer_8h}{
\section{timer.h File Reference}
\label{timer_8h}\index{timer.h@{timer.h}}
}
{\tt \#include \char`\"{}t89c51cc02.h\char`\"{}}\par
{\tt \#include \char`\"{}datatypes.h\char`\"{}}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define \hyperlink{timer_8h_cfcd36f8bce43ccc2d7ee9618059cf74}{TIMER\_\-RELOAD\_\-H}~0x\-FA
\item 
\#define \hyperlink{timer_8h_32a320142a813d608541d8b6848c6bb8}{TIMER\_\-RELOAD\_\-L}~0x\-CB
\item 
\#define \hyperlink{timer_8h_8e55f91cfa8205d17106d5e6504dd4eb}{TIMER\_\-MILLISECONDS}~62
\begin{CompactList}\small\item\em length of sampling intervalls in milliseconds \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void \hyperlink{timer_8h_ce12508d33b354c0194b6f72cfc3bf12}{Timer\_\-init} (void)
\begin{CompactList}\small\item\em activate main timing interrupt to achieve a 1ms timing \item\end{CompactList}\item 
void \hyperlink{timer_8h_57fa1368b48ffe9dfe0d287ba1a57279}{Timer\_\-interrupt} (void) interrupt 1 using 2
\begin{CompactList}\small\item\em keeps time frames for measurements and signals pending measurements in 62ms ticks \item\end{CompactList}\end{CompactItemize}
\subsection*{Variables}
\begin{CompactItemize}
\item 
volatile bit \hyperlink{timer_8h_cf12e58ce91bcc74fb87aee3c9f9f6c5}{measurement\_\-task}
\begin{CompactList}\small\item\em semaphore to signal a pending sensor measurement \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}


Definition in file \hyperlink{timer_8h-source}{timer.h}.

\subsection{Define Documentation}
\hypertarget{timer_8h_8e55f91cfa8205d17106d5e6504dd4eb}{
\index{timer.h@{timer.h}!TIMER_MILLISECONDS@{TIMER\_\-MILLISECONDS}}
\index{TIMER_MILLISECONDS@{TIMER\_\-MILLISECONDS}!timer.h@{timer.h}}
\subsubsection[TIMER\_\-MILLISECONDS]{\setlength{\rightskip}{0pt plus 5cm}\#define TIMER\_\-MILLISECONDS~62}}
\label{timer_8h_8e55f91cfa8205d17106d5e6504dd4eb}


length of sampling intervalls in milliseconds 

This intervall includes sampling \_\-and\_\- reporting of its values according to the monitoring conditions. 

Definition at line 16 of file timer.h.

Referenced by Timer\_\-init(), and Timer\_\-interrupt().\hypertarget{timer_8h_cfcd36f8bce43ccc2d7ee9618059cf74}{
\index{timer.h@{timer.h}!TIMER_RELOAD_H@{TIMER\_\-RELOAD\_\-H}}
\index{TIMER_RELOAD_H@{TIMER\_\-RELOAD\_\-H}!timer.h@{timer.h}}
\subsubsection[TIMER\_\-RELOAD\_\-H]{\setlength{\rightskip}{0pt plus 5cm}\#define TIMER\_\-RELOAD\_\-H~0x\-FA}}
\label{timer_8h_cfcd36f8bce43ccc2d7ee9618059cf74}


reload values to get approx. 1ms timing @ 16MHz: 0x10000 - 0x0535 = 0xfacb - HIBYTE 

Definition at line 7 of file timer.h.

Referenced by Timer\_\-init(), and Timer\_\-interrupt().\hypertarget{timer_8h_32a320142a813d608541d8b6848c6bb8}{
\index{timer.h@{timer.h}!TIMER_RELOAD_L@{TIMER\_\-RELOAD\_\-L}}
\index{TIMER_RELOAD_L@{TIMER\_\-RELOAD\_\-L}!timer.h@{timer.h}}
\subsubsection[TIMER\_\-RELOAD\_\-L]{\setlength{\rightskip}{0pt plus 5cm}\#define TIMER\_\-RELOAD\_\-L~0x\-CB}}
\label{timer_8h_32a320142a813d608541d8b6848c6bb8}


reload values to get approx. 1ms timing @ 16MHz: 0x10000 - 0x0535 = 0xfacb - LOBYTE 

Definition at line 9 of file timer.h.

Referenced by Timer\_\-init(), and Timer\_\-interrupt().

\subsection{Function Documentation}
\hypertarget{timer_8h_ce12508d33b354c0194b6f72cfc3bf12}{
\index{timer.h@{timer.h}!Timer_init@{Timer\_\-init}}
\index{Timer_init@{Timer\_\-init}!timer.h@{timer.h}}
\subsubsection[Timer\_\-init]{\setlength{\rightskip}{0pt plus 5cm}void Timer\_\-init (void)}}
\label{timer_8h_ce12508d33b354c0194b6f72cfc3bf12}


activate main timing interrupt to achieve a 1ms timing 

Timer 0 of the T89C51CC02 is used to maintain the timing. 

Definition at line 32 of file timer.c.

References measurement\_\-task, timekeeper, TIMER\_\-MILLISECONDS, TIMER\_\-RELOAD\_\-H, and TIMER\_\-RELOAD\_\-L.

Referenced by main().\hypertarget{timer_8h_57fa1368b48ffe9dfe0d287ba1a57279}{
\index{timer.h@{timer.h}!Timer_interrupt@{Timer\_\-interrupt}}
\index{Timer_interrupt@{Timer\_\-interrupt}!timer.h@{timer.h}}
\subsubsection[Timer\_\-interrupt]{\setlength{\rightskip}{0pt plus 5cm}void Timer\_\-interrupt (void)}}
\label{timer_8h_57fa1368b48ffe9dfe0d287ba1a57279}


keeps time frames for measurements and signals pending measurements in 62ms ticks 

\hyperlink{timer_8h_cf12e58ce91bcc74fb87aee3c9f9f6c5}{measurement\_\-task} is set after the amount of ms specified in \hyperlink{timer_8h_8e55f91cfa8205d17106d5e6504dd4eb}{TIMER\_\-MILLISECONDS} have passed.\par
 The timer keeps running for the whole duty cycle of the sensor measurement. 

Definition at line 56 of file timer.c.

References measurement\_\-task, timekeeper, TIMER\_\-MILLISECONDS, TIMER\_\-RELOAD\_\-H, and TIMER\_\-RELOAD\_\-L.

\subsection{Variable Documentation}
\hypertarget{timer_8h_cf12e58ce91bcc74fb87aee3c9f9f6c5}{
\index{timer.h@{timer.h}!measurement_task@{measurement\_\-task}}
\index{measurement_task@{measurement\_\-task}!timer.h@{timer.h}}
\subsubsection[measurement\_\-task]{\setlength{\rightskip}{0pt plus 5cm}volatile bit \hyperlink{timer_8h_cf12e58ce91bcc74fb87aee3c9f9f6c5}{measurement\_\-task}}}
\label{timer_8h_cf12e58ce91bcc74fb87aee3c9f9f6c5}


semaphore to signal a pending sensor measurement 

The semaphore is to be set from the main Timer ISR exclusively.\par
 It is cleared after sampling all sensors. 

Definition at line 22 of file timer.c.

Referenced by main(), Timer\_\-init(), and Timer\_\-interrupt().