Smart Star
User's Manual
PREV NEXT INDEX



5. Using the TCP/IP Features

Chapter 5 discusses using the TCP/IP features on the CPU cards. Note that the TCP/IP feature is available only on the SR9150 CPU card.

5.1 Ethernet 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. Install the CPU card on the backplane, and connect the power supply and the programming cable as shown in Chapter 2, "Getting Started."

  2. Ethernet Connections

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

  4. If you have an Ethernet connection, use a straight-through Ethernet cable to establish an Ethernet connection to the installed CPU card from an Ethernet hub. These connections are shown in Figure 18.


Figure 18. Ethernet Connections

  1. Apply Power

Plug in the power supply. The Smart Star is now ready to be used.

NOTE A hardware RESET is accomplished by unplugging the power supply, then plugging it back in.

The green LNK light is on the CPU card is on when the Smart Star 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 Smart Star 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 CPU card and the IP address of the gateway, if there is a gateway.

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

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 OP6800 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, 2000, or XP.

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 CPU card's RJ-45 Ethernet connector. When the program starts running, the green LNK light on the CPU card should be on to indicate that 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:

or by Start > Run

and typing the command

Notice that the orange ACT light flashes on the CPU card 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 Additional Demo Programs

The program SMTP.C (SAMPLES\SMRTSTAR\TCPIP\) demonstrates a basic Smart Star system using the SMTP library to send an e-mail when a keypress is detected on an LCD/keypad module. In order to run this sample program, edit the IP address as for the pingme program, edit the "mail to" e-mail address, compile the program, and start it executing. An e-mail corresponding to the keypad button that was pressed is sent.

The program SSI.C (SAMPLES\SMRTSTAR\TCPIP\) demonstrates how to make the Smart Star CPU card a Web server. This program allows you to turn the LEDs on an attached LCD/keypad module 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 program SSI2.C (SAMPLES\SMRTSTAR\TCPIP\) demonstrates the use of I/O cards via instructions sent from a Web browser. You will need an A/D converter I/O card, a D/A converter I/O card, or a relay I/O card installed on the backplane in order for the Web browser to be able to initiate changes on one or more of these I/O cards. Before you run this sample program, edit the IP address as for the pingme program, compile the program, and start it executing. The analog outputs will change or the relays will open and close in response to instructions sent from the Web browser.

5.2.5 LCD/Keypad Sample Programs Showing TCP/IP Features

The following sample programs, found in the TCPIP subdirectory in SAMPLES/LCD_Keypad/122x32_1x7, are demonstrate the features of the LCD/keypad module connected to the backplane. Remember to configure the IP address, netmask, and gateway as indicated in the sample programs.

When using TCPSEND.C and TCP_RESPOND.C, connect the CPU card and the other single-board computer to an Ethernet. If you connect the them directly, be sure to use a crossover Ethernet cable; straight-through Ethernet cables and a hub may be used instead.

5.3 Where Do I Go From Here?

NOTE If you purchased your Smart Star through a distributor or Z-World partner, contact the distributor or Z-World partner first for technical support.

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.


PREV NEXT INDEX


Z-World
http://www.zworld.com
Voice: (530) 757-3737
FAX: (530) 757-3792
sales@zworld.com