\hypertarget{eeprom_8h}{
\section{eeprom.h File Reference}
\label{eeprom_8h}\index{eeprom.h@{eeprom.h}}
}
{\tt \#include \char`\"{}t89c51cc02.h\char`\"{}}\par
{\tt \#include \char`\"{}datatypes.h\char`\"{}}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define \hyperlink{eeprom_8h_11ca86fa26d7b5057b9520b8cf043885}{EEPROM\_\-CANID\_\-RECV}~0
\item 
\#define \hyperlink{eeprom_8h_3f5ebf97c07a164113b82053ed2b5ebe}{EEPROM}~CANID\_\-SEND 2
\item 
\#define \hyperlink{eeprom_8h_21cde5b634313537d87d1b98de1cda47}{EEPROM\_\-MONITOR}~4
\item 
\#define \hyperlink{eeprom_8h_7f0e289eab66714f0f607d8bd3436077}{EEPROM\_\-DIRECTION}~8
\item 
\#define \hyperlink{eeprom_8h_50b6b0be80c746959b99f19e088bdac0}{EEPROM\_\-BOUNDARY}~12
\item 
\#define \hyperlink{eeprom_8h_51687ea236e531297762db5c88c021be}{EEPROM\_\-CHECKSUM}~48
\item 
\#define \hyperlink{eeprom_8h_663164e61de0b03e395a84fa48b570f9}{EEPROM\_\-wait}()~while((EECON\&MSK\_\-EECON\_\-EEBUSY)!=0)
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
\hyperlink{datatypes_8h_92076741b75a8c2bdc5c24049c253d9a}{BYTE} \hyperlink{eeprom_8h_a18d4156c1c7a8e033d9ca83c462ad34}{EEPROM\_\-read} (\hyperlink{datatypes_8h_92076741b75a8c2bdc5c24049c253d9a}{BYTE})
\begin{CompactList}\small\item\em read a byte from the EEPROM \item\end{CompactList}\item 
void \hyperlink{eeprom_8h_4a6ad7034dbd88f379ff5bc21389dabf}{EEPROM\_\-write} (\hyperlink{datatypes_8h_92076741b75a8c2bdc5c24049c253d9a}{BYTE}, \hyperlink{datatypes_8h_92076741b75a8c2bdc5c24049c253d9a}{BYTE})
\begin{CompactList}\small\item\em write a byte into the EEPROM latches \item\end{CompactList}\item 
void \hyperlink{eeprom_8h_4e7413148b211505d8b8e9a897444c90}{EEPROM\_\-flush} (void)
\begin{CompactList}\small\item\em writes latched EEPROM contents to the EEPROM \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}


Definition in file \hyperlink{eeprom_8h-source}{eeprom.h}.

\subsection{Define Documentation}
\hypertarget{eeprom_8h_3f5ebf97c07a164113b82053ed2b5ebe}{
\index{eeprom.h@{eeprom.h}!EEPROM@{EEPROM}}
\index{EEPROM@{EEPROM}!eeprom.h@{eeprom.h}}
\subsubsection[EEPROM]{\setlength{\rightskip}{0pt plus 5cm}\#define EEPROM~CANID\_\-SEND 2}}
\label{eeprom_8h_3f5ebf97c07a164113b82053ed2b5ebe}


offset address for CAN sending ID inside of EEPROM 

Definition at line 17 of file eeprom.h.\hypertarget{eeprom_8h_50b6b0be80c746959b99f19e088bdac0}{
\index{eeprom.h@{eeprom.h}!EEPROM_BOUNDARY@{EEPROM\_\-BOUNDARY}}
\index{EEPROM_BOUNDARY@{EEPROM\_\-BOUNDARY}!eeprom.h@{eeprom.h}}
\subsubsection[EEPROM\_\-BOUNDARY]{\setlength{\rightskip}{0pt plus 5cm}\#define EEPROM\_\-BOUNDARY~12}}
\label{eeprom_8h_50b6b0be80c746959b99f19e088bdac0}


offset address into EEPROM for storing boundary values for all sensors 

Definition at line 23 of file eeprom.h.

Referenced by Command\_\-Read\-Default\-Configuration().\hypertarget{eeprom_8h_11ca86fa26d7b5057b9520b8cf043885}{
\index{eeprom.h@{eeprom.h}!EEPROM_CANID_RECV@{EEPROM\_\-CANID\_\-RECV}}
\index{EEPROM_CANID_RECV@{EEPROM\_\-CANID\_\-RECV}!eeprom.h@{eeprom.h}}
\subsubsection[EEPROM\_\-CANID\_\-RECV]{\setlength{\rightskip}{0pt plus 5cm}\#define EEPROM\_\-CANID\_\-RECV~0}}
\label{eeprom_8h_11ca86fa26d7b5057b9520b8cf043885}


offset address for CAN reception ID inside of EEPROM 

Definition at line 15 of file eeprom.h.\hypertarget{eeprom_8h_51687ea236e531297762db5c88c021be}{
\index{eeprom.h@{eeprom.h}!EEPROM_CHECKSUM@{EEPROM\_\-CHECKSUM}}
\index{EEPROM_CHECKSUM@{EEPROM\_\-CHECKSUM}!eeprom.h@{eeprom.h}}
\subsubsection[EEPROM\_\-CHECKSUM]{\setlength{\rightskip}{0pt plus 5cm}\#define EEPROM\_\-CHECKSUM~48}}
\label{eeprom_8h_51687ea236e531297762db5c88c021be}


offset address into EEPROM to store the checksum 

Definition at line 25 of file eeprom.h.

Referenced by Command\_\-Read\-Default\-Configuration().\hypertarget{eeprom_8h_7f0e289eab66714f0f607d8bd3436077}{
\index{eeprom.h@{eeprom.h}!EEPROM_DIRECTION@{EEPROM\_\-DIRECTION}}
\index{EEPROM_DIRECTION@{EEPROM\_\-DIRECTION}!eeprom.h@{eeprom.h}}
\subsubsection[EEPROM\_\-DIRECTION]{\setlength{\rightskip}{0pt plus 5cm}\#define EEPROM\_\-DIRECTION~8}}
\label{eeprom_8h_7f0e289eab66714f0f607d8bd3436077}


offset address into EEPROM to store monitoring direction bits 

Definition at line 21 of file eeprom.h.

Referenced by Command\_\-Read\-Default\-Configuration().\hypertarget{eeprom_8h_21cde5b634313537d87d1b98de1cda47}{
\index{eeprom.h@{eeprom.h}!EEPROM_MONITOR@{EEPROM\_\-MONITOR}}
\index{EEPROM_MONITOR@{EEPROM\_\-MONITOR}!eeprom.h@{eeprom.h}}
\subsubsection[EEPROM\_\-MONITOR]{\setlength{\rightskip}{0pt plus 5cm}\#define EEPROM\_\-MONITOR~4}}
\label{eeprom_8h_21cde5b634313537d87d1b98de1cda47}


offset address into EEPROM to store monitor flags 

Definition at line 19 of file eeprom.h.

Referenced by Command\_\-Read\-Default\-Configuration().\hypertarget{eeprom_8h_663164e61de0b03e395a84fa48b570f9}{
\index{eeprom.h@{eeprom.h}!EEPROM_wait@{EEPROM\_\-wait}}
\index{EEPROM_wait@{EEPROM\_\-wait}!eeprom.h@{eeprom.h}}
\subsubsection[EEPROM\_\-wait]{\setlength{\rightskip}{0pt plus 5cm}\#define EEPROM\_\-wait()~while((EECON\&MSK\_\-EECON\_\-EEBUSY)!=0)}}
\label{eeprom_8h_663164e61de0b03e395a84fa48b570f9}


waits while the EEPROM is busy 

Definition at line 27 of file eeprom.h.

Referenced by EEPROM\_\-flush(), EEPROM\_\-read(), and EEPROM\_\-write().

\subsection{Function Documentation}
\hypertarget{eeprom_8h_4e7413148b211505d8b8e9a897444c90}{
\index{eeprom.h@{eeprom.h}!EEPROM_flush@{EEPROM\_\-flush}}
\index{EEPROM_flush@{EEPROM\_\-flush}!eeprom.h@{eeprom.h}}
\subsubsection[EEPROM\_\-flush]{\setlength{\rightskip}{0pt plus 5cm}void EEPROM\_\-flush (void)}}
\label{eeprom_8h_4e7413148b211505d8b8e9a897444c90}


writes latched EEPROM contents to the EEPROM 

Prepare the new contents with \hyperlink{eeprom_8h_4a6ad7034dbd88f379ff5bc21389dabf}{EEPROM\_\-write} before writing them to the EEPROM.\par
 Interrupts are disabled (and restored afterwards) during the actual EEPROM write. 

Definition at line 77 of file eeprom.c.

References EEPROM\_\-wait.\hypertarget{eeprom_8h_a18d4156c1c7a8e033d9ca83c462ad34}{
\index{eeprom.h@{eeprom.h}!EEPROM_read@{EEPROM\_\-read}}
\index{EEPROM_read@{EEPROM\_\-read}!eeprom.h@{eeprom.h}}
\subsubsection[EEPROM\_\-read]{\setlength{\rightskip}{0pt plus 5cm}\hyperlink{datatypes_8h_92076741b75a8c2bdc5c24049c253d9a}{BYTE} EEPROM\_\-read (\hyperlink{datatypes_8h_92076741b75a8c2bdc5c24049c253d9a}{BYTE} {\em address})}}
\label{eeprom_8h_a18d4156c1c7a8e033d9ca83c462ad34}


read a byte from the EEPROM 

A byte is read from the EEPROM at the given EEPROM address.\par
 This routine is limited for reading the first 256 Bytes of the EEPROM memory.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em address}]address offset into EEPROM to read from \end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]value of EEPROM at the given address \end{Desc}


Definition at line 23 of file eeprom.c.

References EEPROM\_\-wait, and eepromptr.

Referenced by Command\_\-Read\-Default\-Configuration().\hypertarget{eeprom_8h_4a6ad7034dbd88f379ff5bc21389dabf}{
\index{eeprom.h@{eeprom.h}!EEPROM_write@{EEPROM\_\-write}}
\index{EEPROM_write@{EEPROM\_\-write}!eeprom.h@{eeprom.h}}
\subsubsection[EEPROM\_\-write]{\setlength{\rightskip}{0pt plus 5cm}void EEPROM\_\-write (\hyperlink{datatypes_8h_92076741b75a8c2bdc5c24049c253d9a}{BYTE} {\em d}, \hyperlink{datatypes_8h_92076741b75a8c2bdc5c24049c253d9a}{BYTE} {\em address})}}
\label{eeprom_8h_4a6ad7034dbd88f379ff5bc21389dabf}


write a byte into the EEPROM latches 

This function only latches data but the data is not written to the EEPROM.\par
 Execute \hyperlink{eeprom_8h_4e7413148b211505d8b8e9a897444c90}{EEPROM\_\-flush} to actually write the new contents into the EEPROM.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em d}]data byte to write \item[{\em address}]address of EEPROM cell \end{description}
\end{Desc}


Definition at line 54 of file eeprom.c.

References EEPROM\_\-wait, and eepromptr.