Instructions
395 C-Control Pro IDE
© 2013 Conrad Electronic
5.27 Webserver (AVR32Bit)
The web server of the C-Control Pro AVR32Bit is started with WEB_StartServer. Any TCP/IP port
may be selected for this. When the web server starts the number of dynamic variables is defined
with whom you want to work. The dynamic variables take the values of the URL variables in the URL,
and you can use dynamic variables to output values within web pages.
All web pages that are returned by the server must be located in the root directory on the SD card
that is inserted into the C-Control Pro Unit. Since the SDCard library does not support long file
names, file names of all websites must be available in DOS format (8.3). Therefore the main page
has the file name "index.htm". Note the shortened ending.
HTTP Header
For files with a known extension (see Table), an HTTP header is automatically generated, which is
placed in front of the file's contents. The header
HTTP/1.1 200 OK\r\n
Connection: close\r\n
Content-Type: Type\r\n
\r\n
is always prepended. There "\r\n" means carriage return line feed, and Type the corresponding con-
tent type from the table. E.g. for the extension ".htm" a "Content-Type: text/html" is generated in the
header.
File Extension
Type
.htm
text/html
.js
application/x-javascript
.txt
text/plain
.css
text/css
.gif
image/gif
.ico
image/x-icon
.jpg
image/jpeg
.bmp
image/bmp
.png
image/png
If the file extension is not present in the table, the header must be set manually at the beginning
of the file on the SD card.
Dynamic Variables
With the function WEB_SetDynVar() the web server is given the address and type of a normal pro-
gram variable. If for example an integer variable "int a;" is defined, a call to "WEB_SetDynVar (0, a,
DYN_INT, 0);" would define the variable a as a dynamic variable with index 0. If some text inside a
web page is $var0$, then $var0$ is replaced by the numeric value of a. The number after $var is the
index of the dynamic variable.