C5-E Modbus TCP/USB 在线手册

Configuring the Ethernet interface

Overview

Hardware address

The controller initially has no IP address, but is instead addressed via the printed hardware address (MAC address). This address consists of 6 hexadecimal numbers in form44-AA-E8-xx-xx-xx.

The hardware address is unique and unchangeable and is assigned during production. In general, this is only needed during a firmware update. As soon as the boot loader has ended and the actual firmware begins to operate, subsequent communication takes place via the TCP/IP protocol.

IP address

The controller needs a valid IP address. This can be obtained in the following ways:

  • DHCP: A DHCP server assigns the IP address to the controller (default setting).
  • AutoIP: The controller automatically determines a suitable IP address. The prerequisite here is that the communication partners are in the same physical subnet and also use AutoIP.
  • Static IP address: This is defined by the user.

Which method is used depends on the network environment and is defined by the network administrator.

The IP address can be determined most easily using the ping tool. To do this, the NetBIOS service must be activated on the PC and the MAC address of the controller must be known.

Example

If controller with MAC address 44:AA:E8:00:02:9F is to be addressed, the tool is called in a shell or command line using:

ping MAC-44AAE800029F

Setting the IP address

Each of the connected devices (controller and communication partners) in an Ethernet network or with a point-to-point Ethernet connection requires a unique IP address. This can either be obtained automatically (DHCP) or generated (Auto-IP) or assigned statically. In the following, "communication partner" refers to a PC or laptop.

You can integrate the controller in an existing Ethernet network. To do this, you only need to establish the physical connection with a standard Ethernet cable. Provided DHCP is activated on the controller (factory setting), the controller is also automatically detected on the network and can immediately be operated via a PC located on the network.

Setting DHCP/Auto-IP

IP addresses can be obtained dynamically in a network from a DHCP server or, for example, in the case of a PC direct connection, can be automatically self-generated without DHCP by the two communication devices (e.g., PC and controller). DHCP is preset in the controller at the factory for automatically obtaining an IP address from a DHPC server or for automatic IP address generation.

To establish the connection to the controller, it may only be necessary to make a few settings on the communication partner (e.g., PC or laptop). Settings using the Windows 7 operating system as an example:

  1. Press the Windows Start button and select Control Panel.
  2. Select Network and Sharing Center.
  3. Select Change adapter settings.
  4. A list of the available network adapters is displayed. Open the properties on the adapter to which the controller is connected (e.g., click with the right mouse button).
  5. Select Internet Protocol version 4 (TCP/IPv4) and press the Properties button.
  6. Select the Obtain an IP address automatically option.
  7. Confirm acceptance of the entries with the OK button.

Setting a static IP address

If static addresses are to be assigned to the controller and the communication partner, just a few settings need to be performed on the controller and the communication partner.

The controller can be assigned a static IP address and network mask (each IPv4) through OD entries. The following entries are relevant in the object dictionary:

Index Description
2010h

IP configuration, bit mask with the following meaning:

Bit 0: A static IP address from object 2011h and the network mask from object 2012h are used.

2011h Static IP address, 4 bytes in hex coding
2012h Static IP subnet mask, 4 bytes in hex coding
2013h Gateway address
2014h Active IP address, 4 bytes in hex coding
2015h Active IP subnet mask, 4 bytes in hex coding
2016h Currently used gateway address
200Fh MAC address
Note: You must save the objects 2010h…2013h (category: Ethernet) after making changes (see the chapter Saving objects) by writing the value "65766173h" in 1010h:0Ch. The changes are not taken over until after the controller has been restarted.

Notes:

  • If DHCP was activated and Auto-IP is not active, the controller uses the set static IP address if no address could be assigned via DHCP (e.g., because the DHCP service is temporarily unavailable).
  • If both objects 2010h and 2011h are set to the value "0", an incorrect configuration is assumed and DHCP and Auto-IP are switched on.
  • If bit 0 is set in object 2010h, the static IP address is used. DHCP is not used in this case.
  • If only DHCP is switched on and an IP address assignment did not function, an attempt is made independent of bit 0 to connect using the entered static IP address.
A static IP address is also assigned to the communication partner. Settings using the Windows 7 operating system as an example:
  1. Press the Windows Start button and select Control Panel.
  2. Select Network and Sharing Center.
  3. Select Change adapter settings.
  4. A list of the available network adapters is displayed. Open the properties on the adapter with which the controller is connected (e.g., right-mouse click and select Properties).
  5. Select Internet Protocol version 4 (TCP/IPv4) and press the Properties button.
  6. Select the Use the following IP address: option and enter the desired IP address and network mask in the IP address field.
  7. Confirm acceptance of the entries with the OK button.

REST web services

Introduction

The protocol used by the web server is HTTP/1.0. The architecture here is realized according to REST (Representational State Transfer) which also offers the possibility to access objects/resources. The values in the object dictionary are an example of this.

The operations supported here are:

  • GET: Request a resource
  • POST: Add a new resource

Resource names

The name of a resource is always specified in the URI (Uniform Resource Identifier) notation familiar from the Internet. Via this URI, the controller supports access to the object dictionary. The identifier for this is:

  • Od: Object dictionary

Example

Accessing a value in the object dictionary:

GET /od/6040/00 HTTP/1.0

This string is used to access entry 6040h subindex 00h in the object dictionary.

The reply is made as a JSON string and reflects the content of this object:

HTTP/1.0 200 OK

Server: uip/1.0

Cache-Control: no-cache, no-store, private

Content-type: application/json

"0006"

Writing a value to the object dictionary:

POST /od/6040/00 HTTP/1.0

Content-Type: application/x-www-form-urlencoded

Form item: ""000F"" = ""(Key: "000F", Value:)

This string is used to write value "15(0Fh)" to object 6040h subindex 00h.

The controller receives confirmation with status code 200 OK:

HTTP/1.0 200 OK

Server: uip/1.0

Accessing the object dictionary

The following URIs enable access to the object dictionary:

<IP address>/od/xxxx/yy
Requests entry xxxx subindex yy from the object dictionary.
<IP address>/od/xxxx/data
Requests entry xxxx with all subindices.

Example

Accessing a value in the object dictionary:

http://192.168.2.100/od/6040/00

This string is used to access entry 6040h subindex 00h in the object dictionary.

The reply is made as a JSON string and reflects the content of this object.

▶   下一个

目录