Smartcat (BL2100)
User's Manual
PREV NEXT INDEX



5. Using the TCP/IP Features

Chapter 5 discusses using the TCP/IP features on the BL2100 and BL2110 boards. The TCP/IP feature is not available on BL2120 and BL2130 versions.

5.1 TCP/IP Connections

Before proceeding you will need to have the following items.

The Ethernet cables and Ethernet hub are available from Z-World in a TCP/IP tool kit. More information is available at www.zworld.com.

1. Connect the AC adapter and the programming cable as shown in Chapter 2, "Getting Started."
2. Ethernet Connections

If you do not have access to an Ethernet network, use a crossover Ethernet cable to connect the BL2100 to a PC that at least has a 10Base-T Ethernet card.

If you have Ethernet access, use a straight through Ethernet cable to establish an Ethernet connection to the BL2100 from an Ethernet hub. These connections are shown in Figure 22.



Figure 22. Ethernet Connections

The PC running Dynamic C through the serial programming port on the BL2100 does not need to be the PC with the Ethernet card.

3. Apply Power

Plug in the AC adapter. The BL2100 is now ready to be used.

NOTE A hardware RESET is accomplished by unplugging the AC adapter, then plugging it back in, or by momentarily grounding the board reset input at pin 9 on screw terminal header J2.

When working with the BL2100, the green LNK light is on when a program is running and the board is properly connected either to an Ethernet hub or to an active Ethernet card. The orange ACT light flashes each time a packet is received.

5.2 TCP/IP Sample Programs

We have provided a number of sample programs demonstrating various uses of TCP/IP for networking embedded systems. These programs require that you connect your PC and the BL2100 together on the same network. This network can be a local private network (preferred for initial experimentation and debugging), or a connection via the Internet.

5.2.1 How to Set IP Addresses in the Sample Programs

Most of the sample programs use macros to define the IP address assigned to the board and the IP address of the gateway, if there is a gateway.


#define MY_IP_ADDRESS "216.112.116.155"

#define MY_NETMASK "255.255.255.248"

#define MY_GATEWAY "216.112.116.153"

In order to do a direct connection, the following IP addresses can be used for the BL2100:


#define MY_IP_ADDRESS "10.1.1.2"

#define MY_NETMASK "255.255.255.248"

// #define MY_GATEWAY "216.112.116.153"

In this case, the gateway is not used and is commented out. The IP address of the board is defined to be 10.1.1.2. The IP address of your PC can be defined as 10.1.1.1.

5.2.2 How to Set Up your Computer's IP Address for a Direct Connection

When your computer is connected directly to the BL2100 via an Ethernet connection, you need to assign an IP address to your computer. To assign the PC the address 10.1.1.1 with the subnetmask 255.255.255.248 under Windows 98, do the following.

Click on Start > Settings > Control Panel to bring up the Control Panel, and then double-click the Network icon. In the window find the line of the form TCP/IP > Ethernet adapter name. Double-click on this line to bring up the TCP/IP properties dialog box. You can edit the IP address directly and the subnet mask. (Disable "obtain an IP address automatically.") You may want to write down the existing values in case you have to restore them later. It is not necessary to edit the gateway address since the gateway is not used with direct connect.

The method of setting the IP address may differ for different versions of Windows, such as 95, NT or 2000.

5.2.3 Run the PINGME.C Demo

In order to run this program, edit the IP address and netmask in the PINGME.C program (SAMPLES\TCPIP\ICMP) to the values given above (10.1.1.2 and 255.255.255.248). Compile the program and start it running under Dynamic C. The crossover cable is connected from your computer's Ethernet adapter to the BL2100's RJ-45 Ethernet connector. When the program starts running, the green LNK light on the BL2100 should be on to indicate an Ethernet connection is made. (Note: If the LNK light does not light, you may not have a crossover cable, or if you are using a hub perhaps the power is off on the hub.)

The next step is to ping the board from your PC. This can be done by bringing up the MS-DOS window and running the ping program:


ping 10.1.1.2

or by Start > Run

and typing the command


ping 10.1.1.2

Notice that the orange ACT light flashes on the BL2100 while the ping is taking place, and indicates the transfer of data. The ping routine will ping the board four times and write a summary message on the screen describing the operation.

5.2.4 Running More Demo Programs With a Direct Connection

The program SSI.C (SAMPLES\BL2100\TCPIP\) demonstrates how to make the BL2100 a Web server. This program allows you to turn the LEDs on an attached Demonstration Board from the Tool Kit on and off from a remote Web browser. In order to run these sample programs, edit the IP address as for the pingme program, compile the program and start it executing. Then bring up your Web browser and enter the following server address: http://10.1.1.2.

This should bring up the Web page served by the sample program.

The sample program SMTP.C (SAMPLES\BL2100\TCPIP\) allows you to send an E-mail when a switch on the Demonstartion Board is pressed. Follow the instructions included with the sample program.

The sample program TELNET.C (SAMPLES\BL2100\TCPIP\) allows you to communicate with the BL2100 using the Telnet protocol. To run this program, edit the IP address, compile the program, and start it running. Run the Telnet program on your PC (Start > Run telnet 10.1.1.2). Each character you type will be printed in Dynamic C's STDIO window, indicating that the board is receiving the characters typed via TCP/IP.

5.3 Where Do I Go From Here?

If there are any problems at this point:

If the sample programs ran fine, you are now ready to go on.

Additional sample programs are described in the Dynamic C TCP/IP User's Manual.

Refer to the Dynamic C TCP/IP User's Manual to develop your own applications. An Introduction to TCP/IP provides background information on TCP/IP, and is available on Z-World's Web site.


Z-World
http://www.zworld.com
Voice: (530) 753-3737
FAX: (530) 753-5141
sales@zworld.com
PREV NEXT INDEX