Vous êtes sur la page 1sur 14

Chapter 17

FST IPC TCP/IP driver

This driver allows the IPC to communicate with other PCs and Controllers using the UDP or TCP protocol from the TCP/IP protocol suite. In this document many terms related to TCP/IP are used, for explanation of these no additional information is available at the moment.

17-1

Chapter 17: TCP/IP

Contents 1 Driver overview..................................................................................... 3 2 Configuring the driver and assigning parameters ............................. 4 3 Extended CI commands for TCP/IP..................................................... 6 4 Modules for TCP/IP .............................................................................. 8
4.1 Data received by handlers.........................................................................14 4.2 Error codes...............................................................................................14

17-2

Chapter 17: TCP/IP 1 Driver overview To function properly every TCP/IP participant (host) needs an IP address and netmask. The FST TCP/IP driver allows 3 ways for configuring these: configuration in the Driver configuration screen, using function blocks or dynamically using the BOOTP protocol. If the IP address is 0 (0.0.0.0) either through configuration or change through a function block the BOOTP protocol will be automatically activated. If the IP address is set the BOOTP protocol will be deactivated.

The FST TCP/IP driver implements the following protocols / services for communication and testing:
protocol ICMP UDP UDP UDP UDP UDP TCP port n.a. 7 13 991 992 993 7 port desc. n.a. echo daytime CI CI_EXT CI_BIN echo description used for PING returns all data received returns string with date and time command interpreter extended command interpreter binary data exchange returns all data received

Accessing the command interpreter uses as follows: send an UDP datagram with the CI command (without CR / LF) to the FST controller and port number 991 and the result will be returned. For example DR0 will result in something like =1099. Using the extended command interpreter on port 992 is similar with the following extension, the result will be DR0 NULL charachter =1099. The response will be the original question and the CI reply seperated by a NULL character.

17-3

Chapter 17: TCP/IP 2 Configuring the driver and assigning parameters If you want to use TCP/IP in an FST IPC project, you must enter the TCP/IP driver in the driver configurer and assign the necessary parameters. Destination drive: Specify the drive on which the TCP/IP driver TCPIPDRV.EXE is located or onto which it is to be loaded. Interrupt of CP10 module: The interrupt as configred on the CP10 or CP11 module. Allowed values are 2, 3, 5, 6 and 7. IO port configuration: The IO port (in hexadecimal !) as configured on the CP10 or CP11 module. Allowed values are 300, 320, 340 and 360. Interrupt for packet driver: The software interrupt (in hexadecimal !) to be used by the packet driver. The TCP/IP driver actually consists of 2 parts: a packet driver to communicate with the CP10 or CP11 and the TCP/IP driver itself. The communication between these parts is through a software interrupt. This interrupt is configurable to avoid conflicts with other drivers. Allowed values are 68, 69, 6A, 6B, 6C, 6D, 6E and 6F. IP address: The IP address. Leave the address to 0.0.0.0 if the address is configured through the IP_IP function block or dynamically through the BOOTP protocol. IP netmask: The IP netmask. Leave the mask to 255.255.255.0 if the netmask is configured through the IP_MASK function block or dynamically through the BOOTP protocol. IP address gateway: The IP address for the standard gateway. Leave the address to 0.0.0.0 if there is no gateway or the gateway

17-4

Chapter 17: TCP/IP address is configured through the IP_GATE function block or dynamically through the BOOTP protocol.

Configuration of TCP/IP driver for E.IPC-CP15 For the CP15 the configuration is slightly different. In this case only the interrupt for packet driver and IP configuration are entered. Additonally there is a configuration file PKT.INI (in the FST runtime directory) which must be edited to reflect to settings to be used. Most important parameters are BitRate, Channel, RadioType and SystemId.

17-5

Chapter 17: TCP/IP 3 Extended CI commands for TCP/IP This driver extends the IPC command interpreter with the following commands:

!26

Display version number

Display driver info and version number. This information will also be displayed if an unknown command is entered (for example !26?).

!26Axx

Display ARP resolution table information

Displays information from the Address Resolution Protocol (ARP). The TCP/IP driver holds a table of 16 IP addresses and Ethernet addresses. If the position (xx) is omitted the displayed information will automatically cycle through the used positions.

!26Hxx

Display handler table information

Displays information about currently defined TCP and UDP handlers and their state. If the position (xx) is omitted the displayed information will automatically cycle through the defined handlers.

!26I

Display IP configuration

Displays IP address, IP netmask and IP gateway.

17-6

Chapter 17: TCP/IP

!26SI

Display IP statistics

Displays IP packet statistics: total send, total received, checksum errors, wrong destination address.

!26SP

Display Ethernet statistics

Displays Ethernet packet statistics: total send, total received, overflow, packet too large.

!26ST

Display TCP statistics

Displays IP packet statistics: total send, total received, checksum errors, wrong destination address, no handler for TCP port.

!26SU

Display UDP statistics

Displays IP packet statistics: total send, total received, checksum errors, wrong destination address, no handler for UDP port.

!26Txx

Display IP table contents

Displays the IP addresses currently defined in the IP table. The TCP/IP driver can hold a total of 16 IP addresses for easy reference.

Note: the CI commands are mainly intended for diagnostic purposes.

17-7

Chapter 17: TCP/IP 4 Modules for TCP/IP Overview of modules


IP_ALIVE IP_GATE IP_IP IP_MASK IP_TABLE TCP_CLOS TCP_HAND TCP_OPEN TCP_RES TCP_SEND TCP_STAT UDP_FW UDP_HAND UDP_SEND Check whether IP address is known Get/set IP address for gateway Get/set our IP address Get/set our IP netmask Get/set IP address from/to table Close TCP connection Activate TCP handler Open TCP connection Reset TCP handler Send a TCP datapacket Status of TCP connection Send a FW block to another IPC Activate UDP handler Send an UDP datapacket

All modules return an error code in FU32, see the table with all errorcodes for an explanation of the individual codes.

IP_ALIVE Checks the ARP table, to see if an IP address is known.


Input parameters Output parameters FU32 FU32 FU33 Index number in IP table 0 if successful, otherwise error 0 if IP address unknown 1 if IP address known 2 if IP address must be reached through a gateway

17-8

Chapter 17: TCP/IP

IP_GATE Set or get the IP address for gateway.


Input parameters FU32 FU33 FU34 FU35 FU36 FU32 FU33 FU34 FU35 FU36 1 to set the IP address 2 to get the IP address IP address IP address IP address IP address 0 if successful, otherwise error IP address IP address IP address IP address

Output parameters

IP_IP Set or get the IP address.


Input parameters FU32 FU33 FU34 FU35 FU36 FU32 FU33 FU34 FU35 FU36 1 to set the IP address 2 to get the IP address IP address IP address IP address IP address 0 if successful, otherwise error IP address IP address IP address IP address

Output parameters

17-9

Chapter 17: TCP/IP

IP_MASK Set or get the IP netmask.


Input parameters FU32 FU33 FU34 FU35 FU36 FU32 FU33 FU34 FU35 FU36 1 to set the IP mask 2 to get the IP mask IP mask IP mask IP mask IP mask 0 if successful, otherwise error IP mask IP mask IP mask IP mask

Output parameters

IP_TABLE Set or get an IP address into or from table.


Input parameters FU32 FU33 FU34 FU35 FU36 FU37 FU32 FU33 FU34 FU35 FU36 FU37 1 to set the IP address 2 to get the IP address index number in IP table IP address IP address IP address IP address 0 if successful, otherwise error index number in IP table IP address IP address IP address IP address

Output parameters

The table holds 16 IP addresses, numbered from 0 to 15.

17-10

Chapter 17: TCP/IP

TCP_CLOS Closes a TCP connection


Input parameters Output parameters FU32 FU32 Index number for handler 0 if successful, otherwise error

TCP_HAND Installs a handler to receive TCP datapackets


Input parameters FU32 FU33 FU32 FU33 local port number to use Number of first flagword to receive data 0 if successful, otherwise error Index number for handler

Output parameters

Some additional data is written if a datapacket is received. See table below for layout. The handler number returned in FU33 must be stored and used to send TCP datapackets.

TCP_OPEN Actively opens a TCP connection


Input parameters FU32 FU33 FU33 FU32 Index number for handler Index number in IP table Destination port number 0 if successful, otherwise error

Output parameters

TCP_RES Resets closed TCP handler to listen state


Input parameters Output parameters FU32 FU32 Index number for handler 0 if successful, otherwise error

17-11

Chapter 17: TCP/IP

TCP_SEND Send a TCP datapacket


Input parameters FU32 FU33 FU34 FU32 Index number for handler number of bytes to send number of first flagword to send 0 if successful, otherwise error

Output parameters

TCP_STAT Returns status of TCP connection


Input parameters Output parameters FU32 FU32 FU33 FU34 Index number for handler 0 if successful, otherwise error 1 if connected (send possible) Extended state

17-12

Chapter 17: TCP/IP

UDP_FW Send a block of flagwords to another IPC.


Input parameters FU32 FU33 FU34 FU35 Output parameters FU32 index number in IP table number of flagwords to send (maximum 256) number of first flagword to send number of first flagword in target IPC 0 if successful, otherwise error

UDP_HAND Installs a handler to receive UDP datapackets


Input parameters FU32 FU33 FU32 local port number to use Number of first flagword to receive data 0 if successful, otherwise error

Output parameters

Some additional data is written if a datapacket is received. See table below for layout. UDP_SEND Send an UDP datapacket
Input parameters FU32 FU33 FU34 FU35 FU36 FU32 local port number to use index number in IP table Destination port number number of bytes to send number of first flagword to send 0 if successful, otherwise error

Output parameters

17-13

Chapter 17: TCP/IP

4.1 Data received by handlers Handlers write data to flagwords if a packet is received. Also written is the IP address, port number of the datapackets sender. The following table lists all data stored (FWx is the installed flagword):

FWx FWx + 1 FWx + 2 FWx + 3 FWx + 4 FWx + 5 FWx + 6 FWx + 10

Number of packets received by handler Sender IP address Sender IP address Sender IP address Sender IP address Sender port number Number of databytes received Start of actual datapacket

Note that the received size is the number of bytes, not the number of words.

4.2 Error codes If FU32 is <> 0 then the function module returned an error, following table lists the error codes:

99 100 101 102 103

Invalid parameter TCP/IP driver not loaded Illegal IP address Illegal table index (> 20) Table position empty

17-14

Vous aimerez peut-être aussi