\documentclass{article} \usepackage{listings} \usepackage{color} \definecolor{dkgreen}{rgb}{0,0.6,0} \definecolor{gray}{rgb}{0.5,0.5,0.5} \definecolor{mauve}{rgb}{0.58,0,0.82} \lstset{ % language=C++, % the language of the code basicstyle=\footnotesize, % the size of the fonts that are used for the code numbers=left, % where to put the line-numbers numberstyle=\tiny\color{gray}, % the style that is used for the line-numbers stepnumber=2, % the step between two line-numbers. If it's 1, each line % will be numbered numbersep=5pt, % how far the line-numbers are from the code backgroundcolor=\color{white}, % choose the background color. You must add \usepackage{color} showspaces=false, % show spaces adding particular underscores showstringspaces=false, % underline spaces within strings showtabs=false, % show tabs within strings adding particular underscores frame=single, % adds a frame around the code rulecolor=\color{black}, % if not set, the frame-color may be changed on line-breaks within not-black text (e.g. commens (green here)) tabsize=2, % sets default tabsize to 2 spaces captionpos=b, % sets the caption-position to bottom breaklines=true, % sets automatic line breaking breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace title=\lstname, % show the filename of files included with \lstinputlisting; % also try caption instead of title keywordstyle=\color{blue}, % keyword style commentstyle=\color{dkgreen}, % comment style stringstyle=\color{mauve}, % string literal style escapeinside={\%*}{*)}, % if you want to add a comment within your code morekeywords={*,...} % if you want to add more keywords to the set } \begin{document} \title{FACT Arduino ethernet communication Interface } \author{D.Neise} \maketitle \tableofcontents \newpage \section{Introduction} Arduino is the name of a series of open source microcontroller equipped boards. The microcontroller in use is out of Atmels ATmega family. The FACT telescope uses mostly the Arduino Ethernet board to monitor and control certain auxiliary systems like the motors of the camera shutter. This board was chosen since the needed hardware for ethernet access, like a dedicated ethernet controller (Wiznet W5100) and the jack, are already in place. In addition the programming of the board as comparably easy. Setting up a TCP/IP server (using either a fix IP or a DHCP server) as well as raw byte-stream communication with clients is handled by the Ethernet library, which comes with the Arduino IDE. There is a variety of open source extension boards available for the Arduino, both from the Arduino group as well as from unrelated developers. These extension boards are usually called shields. The shields can be connected to the ATmega port pins via 100mil headers, which can be used to quickly connect custom peripherals as well. Typical ATmega digital outputs can drive up to 10mA at 5.0V and thus allow for quick connection of LEDs for software tests or similar quick hacks. There exists an open source C cross compiler for ATmega MCUs as well a std-lib implementation. The Arduino group created not only a user friendly (maybe not power user friendly) IDE but also supplies the beginner with a bunch of useful libraries from serial communication to LCD interfacing. \newpage \subsection{std C vs. Arduinos C++ dialect} The Arduino IDE provides the beginner with a simple programming enviroment. While a standard microcontroller program usually is composed of an init section and a never ending while loop which contains the actual job of the microcontroller, e.g. like this: \begin{lstlisting} void main (void){ // set up peripherals and I/O pins // e.g: DDRD |= 1<