Ethernet-DK
30 Rev. 0.6
7. Example Source Code
The Embedded Ethernet Development Kit includes example source code, libraries, and register definition files for
all MCU devices. These examples are installed by default in the “C:\SiLabs\MCU\Examples” directory during IDE
installation. Inside this directory, an “Ethernet” folder is included within each device family directory supported by
the TCP/IP Configuration Wizard. Each of the examples is described below.

7.1. HTTP Web Server

Three HTTP Web Server examples are included by default in the
C:\SiLabs\MCU\Examples\C8051F12x_13x\Ethernet\HTTP directory. These are the same examples used in the
Embedded Ethernet Demo. The first three examples web-server-1, web-server-2, and web-server3 are under 4kB
and can be compiled using the evaluation version of the Keil C51 compiler. The uWeb server example is larger
than 4 kB and requires the full version of the Keil C51 compiler to build the project. A HEX file containing the
firmware object code is available for users who do not have the full version of the Keil C51 compiler. See Section6
on page 9 for additional information about the HTTP examples.

7.2. SMTP Mail Client

The SMTP Mail Client example shows how to send an e-mail from the embedded system. When run, the example
will send two e-mails to the SMTP server specified by IP_SMTP_ADDR[] in mn_userconst.h. This address should
be set to the address of the SMTP server on the network. Ask your network administrator for the IP address of the
SMTP server on your network. Once the e-mails are received by the mail server, they are forwarded to e-mail
addresses specified by to[] in main.c. The messages can be received by the PC by opening a mail program such
as Outlook. One e-mail will be text based and the other will have a text file attachment.
The SMTP example is located by default in the C:\SiLabs\MCU\Examples\C8051F12x_13x\Ethernet\SMTP
directory. The example can be opened by opening the project file SMTP.wsp in the Silicon Laboratories IDE.

7.3. TCP Echo Client/Server

The TCP Echo Client/Server example shows how to send and receive data using a low level TCP socket. The
same example file can configure the MCU as a client or server based on the value of SERVER_MODE in main.c. Set
SERVER_MODE to 1 for server or 0 for client.
In client mode, the embedded system sends a string to a TCP Echo server, then waits for the string to be received.
Once the string is received from the server, the embedded system repeats the process. The TCP Echo server
application “TCP_SVR.exe” should be started on the PC prior to running code on the embedded system.
In server mode, the embedded system waits for strings to be sent from the PC client application “TCP_CLI.exe”
and echoes them back to the PC. The C8051F120 Echo server should be started prior to starting the PC
application. The PC client application is started with the following syntax:
TCP_CLI 10.10.10.163 (where 10.10.10.163 is the IP Address of the embedded echo server).
The TCP Echo Client/Server example is located by default in the
C:\SiLabs\MCU\Examples\C8051F12x_13x\Ethernet\TCP directory. The example can be opened by opening the
project file TCP.wsp in the Firmware directory in the Silicon Laboratories IDE.

7.4. UDP Echo Client/Server

The UDP Echo Client/Server example shows how to send and receive data using low level UDP socket. This
example is identical to the TCP example, except data is sent in UDP packets. The UDP Echo Client/Server
example is located by default in the C:\SiLabs\MCU\Examples\C8051F12x_13x\Ethernet\UDP directory. The
example can be opened by opening the project file UDP.wsp in the Firmware directory in the Silicon Laboratories
IDE.

7.5. DHCP/BOOTP Examples

Two HTTP web server examples using DHCP and BOOTP are provided in the \C8051F12x_13x\Ethernet\DHCP
and \C8051F12x_13x\Ethernet\BOOTP folders respectively. These servers dynamically obtain their IP address
information from a DHCP or BOOTP server.