User manual

LPCXpresso Experiment Kit - User’s Guide
Page 129
Copyright 2013 © Embedded Artists AB
7.20 Extra: Work with Ethernet Interface
In this experiment you will learn how to work with the Ethernet interface and TCP/IP. This experiment
requires the LPCXpresso LPC1769 board, which has an Ethernet interface.
7.20.1 Lab 19a: easyWeb Web Server
This experiment will demonstrate a very basic web server that is a part of the software package
distributed with the LPCXpresso IDE. The web server returns the same web page regardless of which
URL is requested. For example http://192.168.5.200 returns the same page as
http://192.168.5.200/test/a_page.html .
This experiment is based on the code examples that are delivered with the LPCXpresso IDE. The code
is structured very differently (none of the code from the previous exercises is used). You have to create
a new workspace in LPCXpresso and then import the projects from Lab19a.zip.
Connect an Ethernet cable between the J4 connector on the experiment board and a network
hub/switch/router depending on the network you are connected to.
The project needs a couple of small changes to work. Start by creating a unique Ethernet address
(MAC address) by opening ethmac.h and modifying these lines:
#define MYMAC_1 1 // our ethernet (MAC) address
#define MYMAC_2 2 // (MUST be unique in LAN!)
#define MYMAC_3 3
#define MYMAC_4 4
#define MYMAC_5 5
#define MYMAC_6 8
The address must be unique on the network. If you are doing these labs with other students/colleagues
then you must all agree on which addresses to use to avoid name conflicts.
After selecting an Ethernet address it is time to select a fixed IP address. This is set in tcpip.h like this:
#define MYIP_1 192 // our internet protocol (IP) address
#define MYIP_2 168
#define MYIP_3 5
#define MYIP_4 200
This address also has to be unique within your network.
Compile and run the code. To see if everything works, open a command prompt and run ping to see if
your board responds (make sure to use the ip address you entered in tcpip.h):
Figure 70 PING Screenshot