2001 Microchip Technology Inc. DS39563A
PICDEM.netTM
USER’S GUIDE
DS39563A - page ii 2001 Microchip Technology Inc.
“All rights reserved. Copyright © 2001, Microchip Technology
Incorporated, USA. Information contained in this publication
regarding device applications and the like is i ntended t hrough
suggestion only and may be superseded by updates. No rep-
resentation or warranty is given and no liability is assumed by
Microchip Technology Incorporated with respect t o the accu-
racy or use of s uch information, or infringement of patents or
other intellectual property rights arising from s uch us e or oth-
erwise. Use of M icrochip’s products as c ritical components in
life support systems is not authorized except with express
written approval by Microchip. No licenses are conveyed,
implicitly or otherwise, under any intellectual property rights.
The Microchip logo and name are registered trademarks of
Microchip Technology Inc. in the U.S.A. and ot her countries.
All rights reserved. All other trademarks mentioned herein are
the property of their respective companies. No licenses are
conveyed, implicitly or otherwise, under any intellectual prop-
erty rights.”
Trademarks
The Microchip name, logo, PIC, PICmicro, PICMASTER, PIC-
START, PRO MATE, KEELOQ, SEEVAL, MPLAB and The
Embedded Control Solutions Company are registered trade-
marks of Microchip Technology Incorporated in the U.S.A. and
other countries.
Total Endurance, I CSP, In-Circuit S erial Programming, Filter-
Lab, MXDEV, microID, FlexROM, fuzzyLAB, MPASM,
MPLINK, MPLIB, PICDEM, PICDEM.net, ICEPIC, Migratable
Memory, FanSense, ECONOMONITOR, Select Mode and
microPort are trademarks of Microchip Technology Incorpo-
rated in the U.S.A.
Serialized Quick Term Programming (SQTP) is a service mark
of Microchip Technology Incorpora ted in the U.S.A.
All other trademarks mentioned herein are property of their
respective companies.
© 2001, Microchip Technology Incorporated, Printed in the
U.S.A., All Rights Reserved.
Microchip received QS-9000 quality system
certification for its worldwide headquarters,
design and wafer fabrication facilities in
Chandler and T empe, Arizona in July 1999. The
Company’s quality system processes and
procedures are QS-9000 compliant for its
PICmicro® 8-bit MCUs, KEELOQ® code ho pp in g
devices, Serial EEPROMs and microperipheral
products. In addition, Microchips quality
system for the design and manufacture of
development systems is ISO 9001 certified.
Iosoft S peci al Software License Agre ement
The software supplied as part of the PICDEM.net board is Copyright © 2001 by Iosoft, Ltd. All rights are reserved. This software is
owned by Iosoft, and is only licensed for distribution with the book 'TCP/IP Lean' and the PICDEM.net board, and may only be used
for personal experimentation by the purchaser of that book or the PICDEM.net kit, on condition that this copyright notice is retained.
Any use in violation of the foregoing restrictions may subject the user to criminal sanctions under applicable laws, as well as to civil
liability for the breach of the terms and conditions of this license. For commercial licensing, contact license@iosoft.co.uk
THIS IS EXPERIMENTAL SOFTWARE, PROVIDED IN AN AS IS CONDITION. NO WARRANTIES, WHETHER EXPRESS,
IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
NESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. IOSOFT SHALL NOT, IN ANY CIRCUMSTANCES, BE
LIABLE FOR SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
2001 Microchip Technology Inc. DS39563A-page iii
PICDEM.netTM USERS GUIDE
Table of Contents
Table of Contents
General I nformation
Introduction................................................................................................ 1
Highlights................................................................................................... 1
About This Guide....................................................................................... 1
Warranty Registration................................................................................ 3
Recommended Reading............................................................................ 3
Troubleshooting .........................................................................................4
The Microchip Internet Web Site............................................................... 4
Development Systems Customer Notification Service.............................. 5
Customer Suppo rt.............. .............. ..... .............. ..... .............. .... .............. . 6
Chapter 1. Introduction to the PICDEM.net Board
1.1 Introduction..................................................................................... 7
1.2 Highlights........................................................................................ 7
1.3 The Demonstration Kit: What’s In The Box..................................... 7
1.4 The PICDEM.net Demonstration Board.......................................... 8
1.5 The Developmen t Manual.. .... ..... ..... .............. .... ..... .............. ..... ... 10
1.6 The Internet Solutions CD ............................................................ 10
Chapter 2. Getting Started with the PICDEM.net Board
2.1 Highlights............. .... ..... ..... .............. .... .............. ..... .............. ..... ... 11
2.2 Limitations on Networking............................................................. 11
2.3 Host Computer Requirements...................................................... 12
2.4 Setting Up the Test System.......................................................... 12
2.5 Establishing Communications....................................................... 18
Chapter 3. Exploring The ChipWebTM Page
3.1 Highlights.......................................................................................21
3.2 Structure of the Page.................................................................... 21
PICDEM.netTM Users Guide
DS39563A-page iv 2001 Microchip Technology Inc.
Chapter 4. Reconfiguring and Restoring the Firmware
4.1 Highlights ...................................................................................... 23
4.2 Reconfiguring the PICDEM.net Hardware .................................... 23
4.3 Reconfiguring the PICDEM.net Firmware..................................... 23
4.4 Clearing the Controller Firmware.......... .... ..... ..... .... .............. ..... ... 26
Chapter 5. ChipWeb, the Miniature Ethernet Server
5.1 Overview....................................................................................... 27
5.2 Hardware....................................................................................... 27
5.3 Ethernet Driver........................ .... .............. ..... .............. ..... .... ........ 34
5.4 LCD Driver ................ .... ..... .............. ..... .............. .... .............. ..... ... 41
5.5 Other Drivers................................................................................. 43
5.6 Protocols....................................................................................... 44
5.7 User Interface................................................................................ 54
5.8 Configuration................................................................................. 58
5.9 Source Code................................................................................. 63
Chapter 6. Troubleshooting
6.1 Highlights ...................................................................................... 65
6.2 Common Issues............................................................................ 65
Appendix A. PICDEM.net Board Schematics
A.1 PICDEM.net Board Schematics.................................................... 69
Appendix B. PICDEM.net Internet Solutions CD
B.1 Highlights ...................................................................................... 71
B.2 Whats on the CD.......................................................................... 71
Index......................................................................................................... 73
Worldwide S al e s a nd Se rvice . .. ........ .. .. ........ .. .. ........ .. .. ........ .. .. ........ .. .. .. 76
2001 Microchip Technology Inc. DS39563A-page 1
PICDEM.netTM USERS GUIDE
General Information
Introduction
This chapter contains general information about this manual and contacting
customer support.
Highlights
Topics covered in this chapter:
About this Guide
Recommended Reading
W arranty Registration
Troubleshooting
The Microchip Internet Web Site
Development Systems Customer Notification Service
Customer Support
About This Guide
Document Layout
This document describes how to use PICDEM.net as an evaluat ion tool for
embedded connectivity solutions using PICmicro® devices. The manual
layout is as follows:
Chapter 1: Introduction to the PICDEM.net Board What
PICDEM.net is, and what features are available on the board.
Chapter 2: Getting Started with the PICDEM.net Board Describes
how to connect and begin to use the PICDEM.net board.
Chapter 3: Exploring The ChipW ebTM Page Describes the demon-
stration Web page provided with the PICDEM.net firmwar e.
Chapter 4: Reconfiguring and Restoring the Firmware Provides
instructions on loading a Web page into the on-board EEPROM, and
reconfiguring the network settings.
Chapter 5: ChipWeb, the Miniature Ethernet Server Provid es an
introduction to EthernetTM communications and TCP/IP, and an over-
view of how the custom TCP/IP stack firmware is implemented.
Chapter 6: Troubleshooting Provides information on solving
common problems.
PICDEM.netTM Users Guide
DS39563A-page 2 2001 Microchip Technology Inc.
Appendix A: PICDEM.net Board Schematics Provides schematic
diagrams of the PICDEM.net board.
Appendix B: PICDEM.net Internet Solutions CD Provides a sum-
mary of the software solutions on the accompanying CD-ROM.
Worldwide Sales an d Service Lists Microchip Sales and Service
locations and telephone numbers, worldwide.
Conventions Used in this Guide
This manual us es the fol lowi ng docum entatio n conventions:
Documentation Conventions
Description Represents Examples
Code (Courier font):
Plain characters Sample code
Filenames and paths #define START
c:\autoexec.bat
Angl e br ack ets: < > Variables <label>, <exp>
Square br ackets [ ] Optiona l arguments MPASMWIN
[main.asm]
Curly brackets and
pipe character: { | } Choice of mutually exclusive
arguments
An OR selection
errorlevel {0|1}
Lower case charac-
ters in quotes Type of data “filename”
Ellipses... Used to imply (but not show)
additional text that is not
relevant to the example
list
[“list_option...
, “list_option”]
0xnnn A hexadecimal number where
n is a hexadecimal digit 0xFFFF, 0x007A
Italic characters A variable argument; it can be
either a type of data (in lower
case characters), or a specific
example (in uppercase
characters)
char isascii
(char ch);
Interface (Arial font):
Underlined, italic
text with right arrow A menu selection from the
menu bar File > Sa ve
Bold ch arac ters A window or dialo g button to
click OK, Cancel
Char acters in angle
bracke ts < > A key on the keyboard <Tab>, <Ctrl-C>
Documents (Arial font):
Italic characters Referenced books MPLAB ® IDE Users
Guide
2001 Microchip Technology Inc. DS39563A-page 3
General Information
Documentation Updates
All documentation becomes dated, and this users guide is no excepti on.
Since MPLAB IDE, MPLAB C1X and other Microchip tools are constantly
evolving to meet customer needs, some actual dialogs and/or tool
descriptions may differ from those in this document. Please refer to our web
site to obtain the latest documentation available.
Documentat ion Numbering Conve ntions
Documents are number ed with a DS number. The number is located on the
bottom of each page, in front of the page number. The numbering convention
for the DS Number is: DSXXXXXA,
where:
Warranty Registration
Please complete the enclosed Warranty Registration Card and mail it
promptly. Sending in your Warranty Registration Card entitles you to receive
new product updates. Interim software releases are available at the Microchip
web site.
Recom mended Re ading
This users guide describ es how to use the PICDEM. net Ethernet/I nterne t
Demonstration Kit. The data sheets contain current information on
programming the specific microcontroller devices.
MPLAB® IDE, Simulator, Editor Users Guide (DS5102 5)
Comprehensive guide that describes installation and features of Microchips
MPLAB Integrated Development Environment (IDE), as well as the editor and
simulator functions in the MPLAB environment.
MPASM Users Guide with MPLINK and MPLIB (DS33014)
Describes how to use Microchip Universal PICmicro Microcontroller
Assembler (MPASM), Linker (MPLINK), and Librarian (MPLIB).
Technical Library CD-ROM (DS00161)
This CD-ROM contains comprehensive data sheets for Microchip PICmicro®
MCU devices available at the time of print. To obtain this disk, contact the
nearest Microchip Sales and Service location (see back page), or
download individual data sheet files from the Microchip web site
(http://www.microchip.com).
XXXXX = The document number.
A = The revi sion level of the docum ent.
PICDEM.netTM Users Guide
DS39563A-page 4 2001 Microchip Technology Inc.
Embedded Control Handbook (DS00711)
This handbook consists of several documents that contain a wealth of
information about microcontroller applications. To obtain these documents,
contact the nearest Microchip Sales and Service location (see back page).
The application notes described in these manuals are also obtainable from
Microchip Sales and Service locations, or from the Microchip web site
(http://www.microchip.com).
PICmicro Mid-Range MCU Family Reference Manual (DS33023) and
PICmicro 18C MCU Family Reference Manual (DS39500)
These manuals explain the general details and operation of the mid-range
and advanced MCU family architecture and peripheral modules. They are
designed to complement the device data sheets.
Microsoft® Windows® Manuals
This manual assumes that users are familiar with Microsoft Windows
operating system. Many excellent references exist for this software program,
and should be consulted for general operation of Windows.
Troubleshooting
See Chapter 6 for information on common problems.
The Microchip Internet Web Site
Microchip provides online support on the Microchip World Wide Web (WWW)
site.
The web site is used by Microchip as a means to make files and information
easily available to customers. To view the site, the user must have access to
the Internet and a web browser, such as Netscape® Communicator or
Microsoft® Internet Explorer®. Files are also available for FTP download from
our FTP site.
Connecting to the Microchip Internet Website
The Microchip web site is available by using your favorite Internet browser
to attach to:
http://www.microchip.com
The file transfer site is available by using an FTP program/client to connect to:
ftp://ftp.microchip.com
2001 Microchip Technology Inc. DS39563A-page 5
General Information
The web site and file transfer site provide a variety of services. Users may
download files for the latest Development Tools, Data Sheets, Application
Notes, Users Guides, Articles, and Sample Programs. A variety of Microchip
specific business information is also available, including listings of Microchip
sales offices, distributors and factory representatives. Other data available for
consideration is:
Latest Microchip Press Releases
Technical Support Section with Frequently Asked Questions
Design Tips
Device Errata
Job Postings
Microchip Consultant Program Member Listing
Links to other useful web sites related to Microchip Products
Conferences for products, Development Systems, technical information
and more
Listing of seminars and events
Development Systems Customer Notification Service
Microchip started the customer notification service to help our customers
keep current on Microchip products with the least amount of effort. Once you
subscribe, you will receive email notification whenever we change, update,
revise or have errata related to your specified product family, or development
tool of interest.
Go to the Microchip WWW web page (http://www .microchip.com) and click on
Customer Change Notification under Items of Interest. Follow the instructions
to register.
The Development Systems product group categories are:
Compilers
Emulators
In-Circuit Debuggers
MPLAB IDE
Programmers
Here is a description of these categories:
Compilers - The latest information on Microchip C compilers, linkers and
assemblers. These include MPLAB C17 C compiler, MPLAB C18 C compiler,
MPLINK Object Linker (as well as the MPLIB Object Librarian) and MPASM
Assembler.
Emulators - The latest information on Microchip in-circuit emulators. These
include the MPLAB ICE 2000 and PICMASTER® Emulator.
PICDEM.netTM Users Guide
DS39563A-page 6 2001 Microchip Technology Inc.
In-Circuit Debuggers - The latest information on Microchip in-circuit
debuggers. This includes the MPLAB ICD.
MPLAB - The latest information on Microchip MPLAB IDE, the Windows
Integrated Development Environment for development systems tools. This list
is focused on the MPLAB IDE, MPLAB SIM simulator, MPLAB IDE Project
Manager and general editing and debugging features.
Programmers - The latest information on Microchip PICmicro device
programmers. These include the PRO MATE® II device programmer and
PICSTART® Plus development programmer.
Customer Support
Users of Microchip products can receive assistance through several
channels:
Distributor or Representative
Local Sales Office
Field Application Engineer (FAE)
Corporate Applications Engineer (CAE)
Hotline
Customers should call their distributor, representative, or field application
engineer (FAE) for support. Local sales offices are also available to help
customers. See the back cover for a listing of sales offices and locations.
Corporate applications engineers (CAEs) may be contacted at
(480) 792-7627.
In addition, there is a Systems Information and Upgrade Line. This line
provides system users a listing of the latest versions of all of Microchip's
development systems software products. Plus, this line provides information
on how customers can receive any currently available upgrade kits.
The Hotline Numbers are:
1-800-755-2345 for U.S. and most of Canada, and
1-480-792-7302 for the rest of the world.
2001 Microchip Technology Inc. DS39563A-page 7
PICDEM.netTM USERS GUIDE
Chapter 1. Introduction to the PICDEM.net Board
1.1 Intr oduction
The PICDEM.net Demonstration Board Kit has been created to allow
developers to examine the possibilities of embedded connectivity solutions for
Ethernet and Internet. Using the custom-developed Iosoft TCP/IP stack,
developers can experiment with the simple Web page-based server. Users
can explore even more possibilities with the solutions offered by other
vendors.
1.2 Highlights
This chapter covers the following:
PICDEM.net Demonstration Kit contents
PICDEM.net Demonstration Board features
The Development Manual
The Internet Solutions CD
1.3 The Demonstration Kit: Whats In The Box
Your Demonstration Kit contains the following items:
1. The PICDEM.net Embedded Internet/Ethernet Demonstration Board
2. A universal power supply (110-230 VAC input, 9 VDC output) for the
Demonstration Board
3. A serial cable (DB9, M/F connectors) for use in programming the board
4. A CAT5 crossover network cable (RJ45 connectors) for networking the
board
5. T he m anual TCP/I P Lean: Web Servers for Emb edded Sys tems, with
accompanying software on CD-ROM
6. The PICDEM .net Inte rnet Sol utions CD-ROM, which c ontains various
connectivity solutions provided by Microchips partners
7. This manual
8. A Warranty Registratio n card
PICDEM.netTM Users Guide
DS39563A-page 8 2001 Microchip Technology Inc.
1.4 The PICDEM.net Demonstration Board
The PICDEM.net board has all the features to begin developing Internet
connectivity applications over an Ethernet connection. The pre-programmed
firmware allows users to begin investigating and developing applications right
out of the box, with no additional programming or configuration. All that is
required to begin exploring the board is a PC-compatible computer with an
Ethernet card and Internet browser software. (See the Getting Started
chapter for more specific information.)
Figure 1.1: PICDEM.net Board
Features on the PICDEM.net board include:
1. MICR OCONTROLLER SOCKET: A 40-pin DIP socket (600 mil) is pro-
vided for the u ser s choi ce of M icroc hip PI Cmicro m icr ocontrol lers. T he
board i s equip ped fr om th e fac tory wi th a P IC16F 877 m id-rang e micr o-
controller, clocked at 19.6608 MHz and pre-programmed with custom
TCP/IP stack firmware.
The board also supports other Microchip pin-compatible controllers,
such as the PIC18C452 and PIC18F452.
2. MEMORY: A Microchip 24LC256 serial EEPROM provides 256 Kbit
(32 Kbyte) of storage for Web pages. The 24LC256 is programmable via
a two-wire serial I2CTM interface.
1
2
3
4
5
67
10
8
9
11
12
13
14
15
6a
16
2001 Microchip Technology Inc. DS39563A-page 9
Introduction to the PICDEM.net Board
3. LCD DISPLAY: This two-line by 16-character dot matrix display shows
diagnostic and error messages with the factory programmed firmware. It
may be used for other applications with appropriate re-programming.
4. ET HERNET CONTROLLER: T he PICDEM.net b oard uses the Real tek
RTL8019AS single chip Ethernet controller and transceiver to provide
network co nnec tivi ty.
5. STATUS LEDs: Four LEDs are provided:
SYSTEM flashes to show the board is powered up and connected correctly .
LINK STATUS flashes to indicate a Collision Detect state on Revision
4 versions of the board. On Revision 5 and later versions, this LED
lights to show that the Ethernet connection is active.
XMIT and RX when the board is connected correctly, these are nor-
mally lit, and flash OFF (inverted logic), when the board is transmitting
or receiving a packet (respectively).
6. USER-DEFINED LEDs: These two LEDs are driven by digital I/O pins of
the controller , and may be used to simulate a digital output to an embed-
ded devic e. They ma y also be ena bled or disab led by jump er selectio n
on the board (located at 6a).
7. US ER-DEFINED PUSH BUTTON: Thi s switch is connec ted to a digital
I/O pin on the microcontroller , and may be used to simulate a digital input
in an embedded application.
8. USER-DEFINED POTENTIOMETERS: Two 10 kOhm potentiometers
are connected to analog I/O pins of the microcontroller. These can be
used to simulate analog inputs in an embedded application.
9. RESET PUSH BUTTON: This switch is tied to the MCLR pin on the con-
troller, and is used to reset the board.
10. RJ-45 (10-Base T) MODULAR CONNECTOR: This provides standard
Ethernet connectivity.
1 1. RJ-1 1 (SIX-WIRE) MODULAR CONNECTOR: This allows the demonstra-
tion board to be connected to Microchip MPLAB ICD (In-Circuit Debugger)
systems for advanced microcontroller emulation and debugging.
1 2. RS-232 (DB9M) CONNECTOR: This allows the demonstration board to be
configured for IP and Ethernet address through a standard serial connection.
This interface also allows users to download new Web pages to the EEPROM.
13. PROTOTYPE AREA: A 24x27 grid is p rovided for users to breadboard addi-
tional circuitry for development. Connections are provided for +5 VDC, ground,
and fo ur dif ferent I/O por ts (RA <5:0>, R B<4:0>, RC <7:0> an d RD<7:0>) .
14. ON-BOARD POWER: An on-board full-wave bridge allows for AC or DC
power input. An on-board regulator provides 5 VDC at 1 A.
15. ETHERN ET ID: This u nique serial number repre sent s the t wo least signif -
icant bytes of the Media Access Control (MAC), which is used by the
Ethern et transce iver to iden tify and f ilter pa ckets. Th e Ethernet ID bytes of
the PICDEM.net board can be changed in firmware.
16. REVISION LEVEL INDICA T OR (BACK SIDE): The silk-screened text on
the reverse (trace) side of the board, directly beneath the Prototype
Area, indicates the hardware revision level.
PICDEM.netTM Users Guide
DS39563A-page 10 2001 Microchip Technology Inc.
1.5 The Development Manual
Also included in this kit is the book TCP/IP Lean: Web Servers for Embedded
System. Written by Jeremy Bentham of Iosoft, Ltd., TCP/IP Lean provides a
comprehensive introduction to the many protocols embedded in TCP/IP, and
how to custom tailor the stack for specific microcontroller based connectivity
applications.
In addition to the manual, Mr. Bentham has also provided an overview of the
custom TCP/IP stack and software already programmed on the PICDEM.net
board. The discussion is in Chapter 5 of this Users Manual.
1.6 The Internet Solutions CD
Although the Iosoft TCP/IP firmware has been provided with the board, it is
important to note that Iosoft is just one of several companies that support
Internet connectivity solutions with Microchip components. This is why
Microchip has also provided the Internet Solutions CD with the PICDEM.net
kit.
The CD provides sample software solutions and additional information for
several different vendors. Specifically included are examples from
LiveDevices and Y ipee, which may used in exploring connectivity solutions for
both the PIC16C and PIC18C families of microcontrollers. Additional details
are provided in Appendix B.
More information on these and other solution providers is available from the
Design Center at the Microchip Web site. The address for the PICDEM.net
Connectiv i ty Sol uti on s page is
http://www.microchip.com/internet.
2001 Microchip Technology Inc. DS39563A-page 11
PICDEM.netTM USERS GUIDE
Chapter 2. Getting Started with the PICDEM.net Board
2.1 Highlights
This chapter will cover the following topics:
Limitations on Networking the PICDEM.net Board
Hardware and Software Requirements for the Host Computer
Setting Up the Test System
Establishing Communications
2.2 Limitations on Networking
The PICDEM.net board provided in your kit has been designed to
demonstrate the possibilities of networking with embedded Microchip
controllers over Ethernet and the Internet. As with any custom TCP/IP
implementation, however, some precautions are in order.
Whenever new hardware or software is added to a network, it is always
advisable to create a separate test network, isolated from the LAN. This
allows testing the new system in a controlled atmosphere, and minimizes the
possibilities of network interference from the new equipment. The major
sources include:
ADDRESSING Each device on the network must have a unique
address. Networks using Dynamic Host Configuration Protocol (DCHP)
may not permit single devices with fixed IP addresses without major
configuration changes.
TRAFFIC LEVELS While the Ethernet transceiver hardware will filter
out unwanted messages, a highly loaded network with many broadcast
messages may place a sizable burden on the PICDEM.net board.
DATA SECURITY Although it is unlikely that the addition of a single
device will compromise the integrity or privacy of sensitive information,
it is always a good idea to perform extensive testing with new equip-
ment before adding it to a secure network.
EXPERIMENTATION Even as a simple microcontroller based device,
the PICDEM.net board is capable of generating a high volume of net-
work traffic, which may severely disrupt normal network operations.
For these rea sons , it is recomm end ed that the PICDEM.net evaluation board
be used only in one of two controlled configurations:
connected directly to a dedicated host system, using the supplied
cros so ver cable ; or
connected via a standard Ethernet cable to a single Ethernet hub,
which has no connections to any other LAN.
PICDEM.netTM Users Guide
DS39563A-page 12 2001 Microchip Technology Inc.
2.3 Host Computer Requirements
To configure and communicate with the PICDEM.net card, you must have a
system that meets the following hardware and software requirements:
PC-compatible system with an Intel Pentium® class, or highe r
processor, or equivalent
4 MB RAM (16 MB or more, recommended)
CD-ROM drive (for use with the accompanying CD)
Standard Ethernet card (10 Mbps) with RJ45 (10-Base T) connector
One available standard serial port, with a matching COM port available
through the operating system
Microsoft Windows 95, Windows 98, Windows NT 4.0 or Windows 2000
Professional Desktop (any version)
Microsoft Internet Explorer, or Netscape Navigator (version 3.0 or
higher for either)
Any terminal emulation package, such as HyperTerminal® (for optional
serial programming of the PICDEM.net board)
2.4 Setting Up the Test System
For evaluating the PICDEM.net board, the simplest configuration uses a
single host computer connected directly to the board using a crossover cable.
Creating this isolated test system involves the following steps:
1. Hooking up the PICDEM.net board to the host system
2. Obtaining (or configuring) the host IP address
3. Configuring the PICDEM.net IP address
Note: This section assumes that an Ethernet card has already been
installed and is working properly, and that the TCP/IP protocol has
been installed and bound to the card. If this has not been done, or
if you are uncertain if this has been done, please contact your Infor-
mation Systems support person for further assistance.
2001 Microchip Technology Inc. DS39563A-page 13
Getting Started with the PICDEM.net Board
2. 4.1 Hookin g U p the Boa r d
The basic connections are shown in Figure 2.1.
Figure 2.1: Connections between the PICDEM.net Board and the Host Computer
1. Power down the host system. If it currently connected to a LAN, discon-
nect the network cable.
2. Unbox and unwrap the board, and set it on a non-conductive surface
near the host compute r.
3. Connect the serial cable (supplied in the kit) to the board, then to the
open serial port on your computer.
Host Computer
Ethernet
Card
Serial Port
(CO M1 or
COM2)
9 VDC from
Power Supply
PICDEM.net Board
Serial Cable
Network Cable
Serial Port
(DB 9 to D B 9)
(10-Base T)
Ethernet Port
Crossover
Note: Most PC-compatible desktop computers have two serial ports: one
is a DB9 male (pin) connector , while the other may be either a DB9
male, or DB25 male connector. If your available serial port is the
latter, you will ne ed to u se a DB 25 F-to -D B9M po rt ada pter, some-
times known as an external modem adapter. Check with your
local electronics parts store or your Information Services provider
for additional information.
PICDEM.netTM Users Guide
DS39563A-page 14 2001 Microchip Technology Inc.
4. Con nec t the 10- B as e T Et her ne t cr oss ov er ca bl e (su ppl ied in the k i t) to
the board, then to the computer.
5. Con nect th e bar rel plu g of the power supp ly to the Power Input jack on
the board.
6. Plug the power adapter into your wall socket or power strip.
7. Check the PICDEM.net board. You should verify all of the following:
The System LED is blinking
The User LEDs are dark
In Rev 4 boards, the LINK LED is dark; in later revisions, the LINK LED
is lit
The XMIT and RX LEDS should be solidly lit or flickering
The LCD display shows the message:
ChipWeb v1.03
10.10.5.15
If your PICDEM.net board does not show all of these things, check all
connections with the power supply and the board. For additional assistance,
refer to Chapter 6 ("Troubleshooting").
8. Power up the host system.
2.4.2 Obtaining (or Configuring) the Host IP Address
The process in this section varies, depending on the operating system used
on the host system and the absence or presence of DHCP configuration on
the host system. If you are unsure if your LAN uses DHCP to assign individual
machine IP addresses, contact your network support group.
These steps only need to be done once, before using the PICDEM.net card
for the first time.
Note: The Revision Label is on the reverse (trace) side of the board,
directly underneath the Prototype Area grid (see Figure 1.1, item
16). For additional information on the LINK Led, refer to Chapter 6
("Troubleshooting").
Note 1: The actual version of the firmware will be reflected in the first
line of the LCD display. Version 1.03 is the revision available at
the time this manual was prepared. Your display may differ.
2: The IP address 10.10.5.15 is valid when the board is first
unboxed and configured. After that, the IP address displayed
will be the address you have reprogrammed into the board (see
the following sections for more de tails).
2001 Microchip Technology Inc. DS39563A-page 15
Getting Started with the PICDEM.net Board
Obtaining Host IP Address (Windows 95:)
1. Fro m the Start menu, se lect Run, then type the command winipcfg.
Press <ENTER>. The IP Configuration window will appear with the IP
Configuration of the host system (Figure 2.2).
If the IP address is 0.0.0.0, or if the system is using DCHP:
Continue with Step 2.
If the IP address is anything except 0.0.0.0: Make a note of the IP
address, and continue with the procedure for "Configuring the
PICDEM.net IP Address" (page 17).
.
Figure 2.2: IP Configuration Window (Windows 95)
2. Click Release. The IP Address and Subnet mask are both now
"0.0.0.0". Close the IP Configuration dialog.
3. F rom the Start menu, selec t Settings>Co ntrol Panel. Click on the Net-
work applet icon.
4. At the Network dialog box, select the "Configuration" tab.
5. Select "TCP/IP" from the list of installed components. Click "Properties".
6. Select the "xxx" tab. Select the "Specify an IP Address" option.
7. Enter "10.10.5.1" for the IP Address, and "255.255.255.0" for the Subnet
Mask. Click "Ap ply".
8. Close the Network dialog box, and reboot the system.
9. Close the dialog box, then re-run the winipcfg command. The IP
address is now a non-zero address; make a note of it.
PICDEM.netTM Users Guide
DS39563A-page 16 2001 Microchip Technology Inc.
Obtaining Host IP Address (Windows 98 and NT):
1. Open a DOSTM (or command prompt) window. From the Start menu,
select Programs>Accessories>MS-DOS Prompt (Windows 98) or
Progra ms>Ac cessor ies>C omma nd Prompt (W indows NT 4.0 and 200 0
Professional).
2. At the DOS win dow, type t he command ipconfig. This will re turn the
IP Configuration for the host system, including the IP address tied to the
Ethernet card (Figure 2.3).
If the IP address is 0.0.0.0, or the system is configured for DHCP:
Continue with Step 3.
If the IP address is anything except 0.0.0.0: Make a note of the IP
address, and continue with the procedure for "Configuring the
PICDEM.net IP Address" (page 17).
3. Type the command ipconfig/release, and press <ENTER>. You
may receive a message that addresses were automatically configured
and cannot be released; this is normal.
4. Type the command ipconfig/renew, and press <ENTER>. Wait for
about one minute for the system to return a command prompt. You may
receive a message that the DHCP server was unavailable; this is also
normal.
5. Close the DOS window, then open a new DOS window.
6. Type the command ipconfig, and press <ENTER>. The new IP
address is now a non-zero address. Make a note of this.
Figure 2.3: The ipconfig Screen (Windows 2000)
2001 Microchip Technology Inc. DS39563A-page 17
Getting Started with the PICDEM.net Board
2.4.3 Conf iguri n g the PICDEM.n et IP Address
1. From the Start menu, select Programs>Accessories>Com-
munications>HyperTerminal (for some operating systems,
Programs>Accessories>HyperTerminal).
2. At the initial Connection Description dialog box, enter a name for the
connection. You may call the terminal session any name that you will
easily remember. Click OK.
3. At the Connect To dialog box that follows, choose the appropriate COM
port from the drop-down menu. Click OK.
4. At the COM Properties dialog box that follows, select the settings:
Bits per second: 9600
Data bits: 8
Parity: none
Stop bits: 1
Flow Control: none
Click OK. The terminal window opens with a flashing cursor. The
message Connected appears in the status bar at the bottom of the
terminal window, along with an elapsed time display.
5. Press and hold button RB5 on the PICDEM.net board. While holding
RB5, press and release the MCLR button. The terminal responds with:
ChipWeb v1.0.3
Config
Serial num?
The LCD also displays ChipWeb v1.0.3 Config.
Note: The example shown in Figure 2.3 is specific to Windows 2000. The
prompts and command responses shown differ slightly for other
Windows operating syste ms; however, the IP Address wil l always
be clearly identified as such.
Note: These instructions are written specifically for use with the Hyper-
Terminal emulator package that ships with Windows operating sys-
tems. If you are using another terminal emulation package, the
procedure you use to configure a terminal session may vary
slightly. Please consult the documentation for the terminal software
for additional information.
PICDEM.netTM Users Guide
DS39563A-page 18 2001 Microchip Technology Inc.
6. En ter the seri al number (Eth ernet ID number) printed on the sticker on
the board. Press <ENTER>.
7. At the response IP addr?, enter your host systems IP address,
INCREMENTED BY ONE IN THE FINAL POSITION. For example, if the
original host IP address is 169.225.150.10, enter 169.225.150.11.
Press <ENTER>.
8. The terminal responds with XMODEM?, followed by a series of characters
appearing approximately once per second. Press and release the MCLR
button. The terminal res ponds with ChipWeb v1.0.3 an d the new IP
address entered in Step 7.
The LCD also displays ChipWeb v1.0.3 and the new IP address.
9. Close the terminal session. For your convenience, you may save the
terminal session when prompted.
2.5 Establishing Communications
Your PICDEM.net board has already been programmed with the custom TCP/
IP stack and a special interactive page written in HTML. Once it is hooked up,
it is ready to go no further software programming is required. At this point,
all that remains is to log on.
With your host system disconnected from a LAN, however, it will be
necessary to make some minor changes to your browsers configuration.
1. Access the browsers configuration settings in one of two ways:
From the Start menu, select S ett ing s>C on trol Pan e l, then click on the
Internet Options applet; or
Launch the browser, then select Tools>Internet Options from the menu.
2. Select the Connections tab, then click on the LAN Settings button.
3. Verify that the Use a Proxy Server box is deselected.
4. Click OK, then OK to close the Internet Properties dialog box.
Note: The actu al versio n of the firmwar e will be re flected in the first li ne
of the display. Version 1.03 is the revision available at the time this
manual was prepared. Your display may differ.
Note: These instructions are written specifically for use with Internet
Explorer. If you are using Netscape Navigator, or another Web
browser, the procedure you use will vary. Please consult the docu-
mentation for your browser for additional information.
2001 Microchip Technology Inc. DS39563A-page 19
Getting Started with the PICDEM.net Board
5. Launch the Web browser (if not running already).
6. At the URL address line, enter http://, and the IP a ddress of the
PICDEM.net board. Press <Enter>.
7. After several seconds, the ChipWeb page appears:
You are now ready to experiment with PICDEM.net.
Note: For users of later versions of Internet Explorer, the message will
begin with No c on nectio n to th e Inte rn et i s curre ntl y avai la bl e.....
There will be a choice of two buttons, Work Offline or Try Again.
Always choos e Try Ag ain . If you choose Wor k O ffli ne , you will
not be able to establish an external connection, and will need to
close and restart Explorer.
PICDEM.netTM Users Guide
DS39563A-page 20 2001 Microchip Technology Inc.
NOTES:
2001 Microchip Technology Inc. DS39563A-page 21
PICDEM.netTM USERS GUIDE
Chapter 3. Exploring The ChipWebTM Page
3.1 Highlights
This chapter will cover the following topics:
Structure of the ChipWeb page
Contents of the Center Frame
Contents of the Left Frame
Contents of the Right Frame
3.2 Structure of the Page
Its nice to know that the PICDEM.net evaluation board can send a real Web
page to your computer. But the important question needs to be, What can
this page do in the real world?
The ChipWeb page is not meant to demonstrate a typical Internet-type Web
application looking up information, buying something, checking a bank
account balance, what have you. The idea is to show how an embedded
system can send device-state and control information over an Ethernet
connection information that is useful to other systems, as well as human
users. The ChipWeb page provides a simple demonstration of several
important concepts for an embedded control system:
Display of analog and digital information
Real-time control of remote devices
Use r-fr ie ndl y inf or mati on .
The initial ChipWeb "home page" is actually an HTML "frameset"; this is a
common technique where two or more pages are displayed simultaneously to
give the appearance of a single page. The ChipWeb page is really three
different frames: center, left and right. Each one is implemented using
simple HTML, and demonstrates a different concept.
Additional details on the construction of the ChipWeb pages individual
elements are provided in Chapter 5 (ChipWeb, the Miniature Ethernet
Server).
3.2.1 The Center Frame
The largest area of the page is devoted entirely to displaying graphics and
fixed content text, describing one of four general topics related to the
ChipWeb server. The actual contents shown here are selected by the user by
clicking on one of the four hyperlinks in the upper area of the left frame (see
Section 3.2.2). When the PICDEM.net board is initialized, the Home content
page is displayed as the default.
PICDEM.netTM Users Guide
DS39563A-page 22 2001 Microchip Technology Inc.
3.2.2 The Left Frame
This area demonstrates real-time interactive control of the PICDEM.net
board. It has two functional groups:
1. HYPERLINKS: As already discussed, these are conventional HTML
hyperlinks that select one of four pages of information for the center
pane. The options are Home (default), Analog(ue), Digital, and Software.
2. VIRTUAL SWITCHES: This group shows a representation of two toggle
switches and associated pilot lights, representing digital inputs. Clicking
on either switch will change its state (Up or Down), while turning its light
On or Off. At the same time, clicking a switch will also turn the appropri-
ate User LED On or Off.
3.2.3 The Right Frame
This area demonstrates the feedback of analog and digital data from the
board, which is updated about every five seconds. It has three areas:
1. ANALOG INPUT: Two vertical sliding scales are displayed, along with a
digital translation of their values. These scales represent the current set-
tings of the user potentiometers, displaying the voltage across each
(range of 0 to 5V). As the setting of the potentiometers changes, the dis-
played value is updated.
2. DIGITAL OUTPUT: This area ha s two numeric displays, each showing
the value of eit her 0 or 1. As th e user chan ges t he vi rtual s witch es i n
the left pane, the state of the matching digit display changes.
3. DIG ITAL INPUT: Thi s area has a single nume ric displ ay, as above, th e
value of which is linked to the User push button on the board. When the
button is pushed, the value is 1; when it is rel eased, the value retur ns
to the default of 0.
2001 Microchip Technology Inc. DS39563A-page 23
PICDEM.netTM USERS GUIDE
Chapter 4. Reconfiguring and Restoring the Firmware
4.1 Highlights
This chapter covers the following:
Reconfiguring the PICDEM.net hardware
Reconfiguring t he PICDEM.net firmware
Entering Configuration mode
Changing the Network Configuration
Loading (or Reloading) the Web Page into EEPROM
Changing the Contr olle r Firmwa re
4.2 Reconfiguring the PICDEM.net Hardware
The basic hardware of the PICDEM.net board, as shipped from Microchip, is
a fixed configuration. Outside of disabling the User LEDs by removing the
associated jumper , there are no features on the board that can be changed by
the user.
4.3 Reconfiguring the PICDEM.net Firmware
To be ready for use out of the box, the PICDEM.net board is shipped with pre-
loaded firmware. The firmware has three different components:
The ChipWeb page, written in compiled HTML and stored in the
EEPROM
The Network Configuration, written in binary and stored in Data EEPROM
memory on the PIC16F877 controller
The PICDEM.net operating firmware (including the TCP/IP stack), stored
in the Program Memory of the microcontroller.
The Web page can be reloaded, or a new page loaded in its place, without
affecting the operating firmware on the microcontroller. Reloading the
Network Configuration, however, requires that the Web page be reloaded.
Note: These instructions are valid only with the ChipWeb firmware pro-
vided by Iosoft Ltd., as originally configured on the PICDEM.net
board. If you have si nce loaded a di fferent firm war e package fr om
another vendor, consult that vendors instructions for how to
proceed.
PICDEM.netTM Users Guide
DS39563A-page 24 2001 Microchip Technology Inc.
4.3.1 Entering Configuration Mode
In order to change the Web page or the network settings, it is necessary to
first put the board into Configuration mode. To do this, connect the board to
the host system as described in Chapter 2. Then:
1. Press and hold the User push button (RB5).
2. While holding RB5, press and release the MCLR push button.
The terminal responds with:
ChipWeb v1.0.3
Config
Serial num?
The LCD also displays ChipWeb v1.0.3 Config.
The PICDEM.net board will also enter the Configuration mode automatically,
whenever an EEPROM checksum failure occurs (e.g., when the EEPROM is
cleared or its contents are corrupted).
4.3.2 Changing the Network Configuration
At this point, the PICDEM.net boards network configuration can be changed.
1. At the Serial num? prompt, enter the serial number from the Ethernet
ID sticker on the board, or a new Ethernet ID number . Alternatively , press
<ESC> to leave the ID unchanged.
2. At the IP addr? prompt, enter the new IP address in dotted-decimal
notation. Alternatively, press <ESC> to leave the IP address unchanged.
The factory default address is 10.10.5.15. For peer-to-peer connections
as described in Chapter 2, the address is a single increment from the
host systems IP address. In other settings, the IP address must be
unique within the local domain.
3. Press <ENTER>. The new network configuration is now programmed
into the controllers EEPROM .
4. The terminal responds with XMODEM?. To continue configuration by load-
ing a new Web page, go to step 3 of "To Load a Web Page" (page 25).
To return to normal PICDEM.net operation, briefly press and release the
MCLR button. The terminal and LCD returns with "ChipWeb v1.0.3" and
the IP address.
2001 Microchip Technology Inc. DS39563A-page 25
Reconfiguring and Restoring the Firmware
NOTES ON IP ADDRESS CONFIGURATION:
If more than one PICDEM.net board is being evaluated, give each
board a different IP address even if one is connected at a time. The
system may become confused with different Ethernet IDs being linked
to a single IP address.
Rapid changes in Ethernet IDs and/or IP addresses, especially when
more than one PICDEM.net board is being evaluated, may cause a sit-
uation where the boards respond erratically. This is likely due to ARP
caching by the host system, where it retains a mapping of MACs and IP
addresses.
For experienced users: the configuration of the PICDEM.net board
does not include either a net mask, or gateway IP address. This is
because the current implementation of ChipWeb does not include rout-
ing capabilities; all responses are returned directly to the IP and MAC of
the sender. Routing capabilities will be added to subsequent versions.
4.3.3 Loading (or Reloading) the Web Page
Before loading the Web page, the HTML file(s) must be translated into the
appropriate binary format using the Webpage tool. The software is included
with the CD accompanying the book TCP/IP Lean. In general, creating a
new Web page involves the following:
1. Create the HTML or GIF files using the appropriate software tools.
Remember that the total size of any single file (including HTML header)
must be no more than 1460 bytes.
2. Place the files into a single directory.
3. Merge the files with the WEBROMTM tool (see Chapters 5 and 11 of
"TCP/IP Lean").
4. Verify that the size of the finished file is within the capacity of the
EEPROM (32 Kbyte).
If you are reloading the original ChipWeb page, it is available in the proper
format on the PICDEM.net Internet Solutions CD. The path is
/iosoft/chipweb/pcm/webpage.rom..
Note: Your terminal emulation software must support the standard
XMODEM protocol. Variants such as XMODEM-1K or any of the
CRC variants will not work. HyperTerminal supports both XMODEM
and XMODEM-1K.
PICDEM.netTM Users Guide
DS39563A-page 26 2001 Microchip Technology Inc.
To Load a Web Page:
1. Enter Configuration mode (Section 4.3.1, page 24).
2. Change the Ethernet ID and IP address as needed (Section 4.3.2,
page 24), or press <ESC> twice to bypass changes.
3. At the XMODEM? prom pt, select Transfer>Send File from the ma in menu
for HyperTerminal (the "Send File" command for other terminal emula-
tors). Specify the location of the file, and select "XMODEM" for the
Transfer Protocol.
4. When the transfer has finished, the PICDEM.net board will return to
normal operation automatically. The terminal and LCD return with
"ChipWeb v1.0.3" and the IP address.
If the t rans fer did not com pl ete su cc ess full y, the PICDEM .ne t bo ar d will
return to Configuration mode. There may also be an error message from
the termi nal e mulato r, no ting t hat the file tr ansf er di d not com plete su c-
cessfu lly. It is also po ssible that the con troller EE PROM check sum has
failed, and the network configuration needs to be reloaded.
4.4 Clearing the Controller Firmware
After investigating the PICDEM.net board and the ChipWeb server, you may
be ready to design your own embedded application. To do this, it will be
necessary to clear the existing TCP/IP stack in FLASH Program Memory of
the PIC16F877 microcontroller.
The PICDEM.net. Ethernet/Internet Demonstration Board does not include
the tools for clearing and reprogramming the microprocessor. To do this, you
must use an appropriate device programmer. You may also use the MPLAB
ICD Development System, which provides a complete development suite for
device emulation and programming.
If you already have the development tools, you have everything you need to
begin immediately . The PICDEM.net Internet Solutions CD, enclosed with the
PICDEM.net Development kit, includes sample software to assist you in
developing embedded Ethernet solutions.
Note: The MPLAB Development System and the PICDEM.net Internet
Solution s CD c on tain too ls a nd sol uti ons f or both the P IC1 6C a nd
PIC18C famil ies of m icrocontr ollers . You wil l need to ob tain a pin-
compatible P ICm ic ro 18 C or 18 F de vi ce (su ch as th e PI C1 8C 45 2)
to evaluate the full range of these Ethernet solutions.
2001 Microchip Technology Inc. DS39563A-page 27
PICDEM.netTM USERS GUIDE
Chapter 5. Chip Web, the Miniature Ethernet Serve r
5.1 Overview
In the book TCP/IP Lean: Web Servers for Embedded Systems, I describe
software techniques to create small Web servers. To show how small these
can get, I conclude by implementing a complete Web server on a PICmicro®
PIC16C76 microcontroller.
This miniature server uses dynamic Web pages to display the current
temperature, time and digital input status, and allows the user to control the
digital outputs and set a real-time clock. In many ways, it is a useful little
system; the only bar to its use in a Local Area Network (LAN) environment is
that it only communicates using a serial (SLIP) link.
The next step is to adapt the server for use with Ethernet, and this chapter
describes those adaptations. As a hardware plat form, I will be using the
Microchip PICDEM.net board, which has a small amount of analog and digital
I/O, an LCD display, and the all-important Ethernet interface.
5.2 Hardware
5.2.1 Ethernet Interface
Ethernet allows a large number of computers to be connected together, so
that a transmission from one computer is received by all the others. Early
Ethernet implementations tended to use a single backbone cable linking the
systems together, in a bus topology. This has largely been replaced by the
star topology, where each computer is connected to an electronic repeater
(hub), and several hubs can be interconnected to form a large Local Area
Network, or LAN (see Figure 5.1).
Fortunately, we can ignore the differences between these topologies, since a
hub usually retransmits the message from one computer to all others in a
relatively unintelligent manner. The hardware arbitrates between the
compu t ers o n t h e net w or k (nodes) so they can transmit when necessary, with
a high probability that the message will be received by all the other nodes.
Note: The following chapter has been provided by Jeremy Bentham,
author of the ac companyin g book TCP/IP Le an: Web Serv ers for
Embedded Systems. All material in this chapter is copyright
© 2000 by