ChipCenter Questlink
SEARCH CHIPCENTER
Search Type:
Search for:




Knowledge Centers
Product Reviews
Data Sheets
Guides & Experts
News
International
Ask Us
Circuit Cellar Online
App Notes
NetSeminars
Careers
Resources
FAQ
EE Times Network
Electronics Group Sites

Software Development


Circuit Cellar Online
THE MAGAZINE FOR COMPUTER APPLICATIONS
Circuit Cellar Online offers articles illustrating creative solutions
and unique applications through complete projects, practical
tutorials, and useful design techniques.

Archive

A $25 WEB SERVER

by Steve Freyder, David Helland, Bruce Lightner

StartNetwork AdapterFirmware DescriptionSoftware DevelopmentFirmware Development EnvironmentThe Next Generation And BeyondSources

SOFTWARE DEVELOPMENT

You’re probably wondering: "How does all of this fit in an 8-KB microprocessor?" The answer: "Very carefully!" We wrote the software to efficiently implement the necessary network protocol layers by using a p-code technique to conserve code space in exchange for somewhat reduced execution speed.

Time-critical network code is left in native Atmel RISC code. As a result, the actual space used by the PicoWeb server demo firmware is under 7000 bytes, including debugging code. Therefore, space remains for developers to roll their own code and add even more functionality to the PicoWeb server.

Because p-code can be run from the serial EEPROM chip (at a greatly reduced execution rate), a substantial amount of added functionality is possible. The present development environment allows custom application development without the need for access to the underlying real-time networking kernel source code. The source code for the PicoWeb server real-time networking kernel is available for license by serious developers.

The software development environment used for the project made use of the Atmel free assembler, which can be downloaded from Atmel’s web site.

To enhance the capabilities of the assembler, a Windows version of the GNU C preprocessor was used to add certain macro/include file capabilities that were conspicuously missing from the Atmel product. Atmel sells a $49 development kit for the AT90S8515 that enables users to quickly get up to speed and download programs into the AT90S8515’s flash memory.

The AT90S8515 processor allows in-circuit programming of its flash memory via a four-wire SPI interface. To eliminate the need for the $49 development kit, a C program was written to enable a PC to program the Atmel microprocessor on our breadboard in-circuit via a cable attached to a PC parallel port.

`t<html>
<head><title>WebLED</title></head>
<body text=#000000 bgcolor=#c0c0c0>
<center>
<h2>Frey 'n Hell Light <font color="red">WebLED</font> v1.26</h2>
<FORM name=mfrm method=GET action="/x">
<`100radio NAME=4 VALUE=0 `001CHECKED{}>on<br>
<`100radio NAME=4 VALUE=1 `001{CHECKED}>off<br>
<`100submit VALUE="Set LED">
</FORM>
ý;1998-1999 Freyder, Helland & Lightner
<br><br>
<img src="ii03.jpg" width=64 height=100 alt="Frey">&nbsp&nbsp
<img src="ii02.jpg" width=64 height=100 alt="Hell">&nbsp&nbsp
<img src="ii01.jpg" width=64 height=100 alt="Light">
<br><br>
The current temperature reading is `701
ý;F

</center>

Listing 1—This HTML-like code delivered the web page shown in Photo 2. The special tags beginning with a back-tick (`) activate PicoWeb firmware routines that insert text into the HTML document stream when the page is retrieved by a web browser.

 

The HTML-like code in Listing 1 displays a web page that provides the status of the breadboard’s onboard LED and provides an HTML form that enables the user to control the LED.

Special tags beginning with a back-tick (`) are embedded in standard HTML code. These tags invoke firmware routines when a web page containing them is returned to the requestor. The tags can be used to dynamically insert variable data and text into a web page when referenced. Table 4 shows a number of the tags implemented in the PicoWeb server demonstration firmware.

Tag Meaning
`t Emit HTML header string
`0hh If port bit hh is low; emit HTML text from stream up to ‘{‘, then skip text up to next ‘}’. If port bit hh high, skip HTML text up to next ‘{‘, then emit text up to next ‘}’.
`1hh Emit string number hh.
`7hh Invoke "user p-code" routine number hh.

Table 4—Special tags embedded in PicoWeb web pages invoke firmware routines that can insert text into a dynamic HTML code stream. These tags can be used to do things like take a temperature reading and return a text string with the current temperature.

 

The tag "`t" outputs a standard HTML "text header". The tag "`100" outputs the string "input type=" and is used as an example of how to save EEPROM storage space. "`001" is an example of a dynamic tag. It is part of a kind of "if-then-else" construct. In Listing 1, if the value of output bit 1 is zero (i.e., the LED is on), the first radio button on the web page will include the "CHECKED" string; otherwise the string is omitted. If the output bit 1 is one (i.e., LED is off), then the second ratio button will include the "CHECKED" string.

An example of how to extend the functionality of the PicoWeb server is shown at the end of Listing 1. In this case we hooked up a Dallas DS1621 two-wire digital thermometer chip to our breadboard. The tag `701 invokes a p-code routine stored in serial EEPROM that takes a reading from the Dallas chip and returns a text string with the decimal temperature reading converted to degrees Fahrenheit. The resulting real-time temperature can be seen in Photo 2.

Another way to add features to the returned web page is by using the serial port to talk to an external device that supports serial communications (e.g., a test instrument). A p-code routine triggered by a special tag can send a command out the serial port to the external device. The external device can then interpret the command and send data back to the PicoWeb server over the serial port. That data can be inserted directly into the returned HTML web page or additional p-code can be executed to format the data before insertion in the returned web page.

Note in Listing 1 that three JPEG images (ii01.jpg, ii02.jpg, and ii02.jpg) are referenced by the demo web page. These JPEG images are supplied by the PicoWeb server from the breadboard’s serial EEPROM.


Circuit Cellar provides up-to-date information for engineers. Visit www.circuitcellar.com for more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com or subscribe online. ýCircuit Cellar, the Magazine for Computer Applications. Posted with permission.

 

Click here to get your listing up.

Copyright © 2003 ChipCenter-QuestLink
About ChipCenter-Questlink  Contact Us  Privacy Statement   Advertising Information  FAQ