■ FIGURE 4.
■ FIGURE 5.
■ FIGURE 6.
webserver before the files are sent to the browser. This is
fine for relatively static content, but for an interactive
application such as a thermostat, we need something
more. We want to be able to see the temperature change
without having to hit the refresh button on the browser.
This is accomplished via an AJAX interface.
leverage certain browser features for interactive
applications. The AJAX routines communicate with the
corresponding functions in CustomHTTPApp.c which is
part of the TCP/IP stack. A detailed explanation of how
this works would take at least another article on its own.
For now, you’ll have to settle for reading about it in the
documentation and sample code from Microchip. The
sending updates from the web page to the webserver and
retrieving data from the webserver for updating the
■ FIGURE 7.
For example, the
thermostat web page
has a button for
lowering the set
point. Clicking this
button activates a
code that sends a
message to the
server that the
decrease button has
been clicked. On the
server, the set point
value is decremented
and transmitted back
to the web browser
so the new set point
can be displayed.
Another piece of
code updates the
LCD display. Even if
there aren’t any user-initiated changes on
the web page, the
The web page design can be changed and uploaded
to the webserver without making any changes to the
application code. The only time you would need to
change the application and recompile it is if you want to
exchange more data between the web page and the
application. If you don’t like the way the thermostat web
page is laid out, change it and upload it using the
MPFS2.EXE utility. You can even add additional pages, as
long as they fit into the memory.
Figure 4 shows the default thermostat page. Figure 5
shows an alternative page that is accessed by changing
the web address. Figure 6 shows a configuration page that
changes the host name
for the thermostat. Most
allow you to access the
web page by the host
name. Unfortunately, the
browser on my EVO
doesn’t do that and I
have to type in the IP
address and save it as a
■ FIGURE 8.
The hardest part of