Modbus TCP configuration

Description

Modbus is available in masters as an interface with the following features:

  • Read/write process data

  • Port configuration

  • Port/device diagnostics

  • Read/write ISDU data

Access is via the TCP/IP interface using the IP address of the device and Port 502 (example: 192.168.1.1:502). The response time depends on the data written/read.

Structure of a Modbus TCP message

A Modbus TCP message is structured as follows:

Byte 0

Byte 1

Byte 2

Byte 3

Byte 4

Byte 5

Byte 6

Byte x

Transaction ID

Protocol ID

Unit ID

Function Code

Data

MBAP header

PDU

Modbus TCP message

The protocol ID must be 0, as it indicates that the message is a Modbus message.

The unit ID can be arbitrary. It is not used because the IP address already identifies a device.

General

  • All numbers are decimal numbers, unless they are specified with 0x = hexadecimal, e.g.: 0x1B.

  • All data is organized as UINT16 unless otherwise specified.

  • The length is organized in UINT16 by default, unless otherwise specified, e.g. length in [bytes] or bit length.

  • The mapping of the byte sequence uses Big Endianness, see example in Index 10.

The Profile ID

Note

The Register Mapping Version (list of registers and their content) is identified with the Profile ID which is a similar version number to HW or FW version number. Due to the content of the registers may be subject to change in the future, with keeping the compatibility and consistency, this Profile ID should be checked first when a new application is developed.

Index overview

  • Profile ID = 2

  • Available from Firmware 1.3.1

Index (dec.)

Description

Access

0

Profile ID (Register Mapping Version)

RO

1…99

Device (Module) Identification

RO

100

IO-Link ISDU Command Request

RW

300

IO-Link ISDU Command Response

RO

1100…1800

IO-Link Process Data Input/Output

RO/RW

2000

SIO Digital Input State

RO

2001

SIO Digital Output State

RW

2047

Digital Input State (Mirrored to 2000)

RO

2048

Digital Output State (Mirrored to 2001)

RW

3000

Device (Module&Port) Diagnostic

RO

3100…3800

IO-Link Port Diagnostic

RO

9100…9800

Port Configuration

RW

11000

Variable Processdata Register

RW

20000

Module Settings

RW

Identification

Index

Length

Description

Access

Default (example)

0

1

Register Mapping Version (ProfileID)

RO

0x0001

1…9

-

reserved

-

-

10…13

4

Product Order Code (ASCII, 7 chars)

RO

BNI00KH

14…29

16

Product Name (TEXT)

RO

BNI XG5-508-0B5-R067

30…99

-

reserved

-

-

The byte array from/to IO-Link is converted as follows in the MODBUS index:

Note

Please check whether IO-Link is supported by your module before using this function. For more information on product variants that support IO-Link, see Supported product variants

UINT16

LSB

Bit(0…7)

= IO-Link Byte[n]

UINT16

MSB

Bit(8…15)

= IO-Link Byte[n+1]

Example

The ASCII coded text of the manufacturer nameBalluff(length = 7) is converted into four (4) Word UINT16 indices as follows:

Index

0

1

2

3

4

5

6

Byte [0…6]

42h,

41h,

4Ch,

4Ch,

55h,

46h,

46h

Word[0…3]

4142h,

4C4Ch,

4655h,

0046h

Index

0

1

2

3

Read ISDU data

Note

Please check whether IO-Link is supported by your module before using this function. For more information on product variants that support IO-Link, see Supported product variants

  1. Write the port number, index and subindex to the corresponding registers (30,31,32).

  2. Write the selected command to the upper byte of register 33.

Write ISDU data

Note

Please check whether IO-Link is supported by your module before using this function. For more information on product variants that support IO-Link, see Supported product variants

  1. Write the port number, index and subindex to the corresponding registers (30,31,32).

  2. Write data to registers 35…51 and the desired data length.

  3. Write the selected command to the upper byte of register 33.

Function Codes

The following function codes are implemented:

  • Read holding register (0x03)

  • Write several registers (0x10)

Error Responses

The following responses are reported in the event of an error:

Error Code

Description

0x00

No error. Last command successful.

0x01

Bad Function Code

0x02

Wrong Register Address

0x03

Invalid value

0x04

Slave error (IO-Link fails)

Even if the start register is valid, reading too many registers leads to Bad Register Address.

Slave errors occur when the IO-Link interface triggers errors.

Note

Please check whether IO-Link is supported by your module before using this function. For more information on product variants that support IO-Link, see Supported product variants

Modbus TCP configurations

Digital Input / Output State

When a port (X01…X08) is configured as SIO mode (Standard Input or Output) following Digital Input / Output State can be accessed.

Registers 2000, 2001 and 2047, 2048 – Digital Input / Output State

There are two register locations which can be used for Digital Input and Output. Those are working completly the same and are just mirrored location for compatibility.

Index

Byte

Bit

Name

Data Type

Access

Value

2000 (2047)

-

0…7

Digital Input Port n Pin 4

BOOL

RO

0 = off, 1 = on

8…13

Digital Input Port n Pin 2

BOOL

RO

0 = off, 1 = on

2001 (2048)

-

0…7

Digital Output Port n Pin 4

BOOL

R/W

0 = off, 1 = on

8…13

Digital Output Port n Pin 2

BOOL

R/W

0 = off, 1 = on

The digital output works if the port is configured as an output.

Values – Digital Input / Output State (data)

Value

Description

0

off, de-energized, 0 V

1

on, under power, 24 V

Bits – Digital Input / Output State (data)

Bit

Port n

0, 8

X01

1, 9

X02

2, 10

X03

3, 11

X04

4, 12

X05

5, 13

X06

6, 14

X07

7, 15

X08

Detailed view – Digital Input / Output State (data)

Index

Byte

Bit

Name

Data Type

Access

Value

2000 (2047)

0

0

X01 Pin4 Digital Input State

BOOL

RO

0 = off, 1 = on

1

X02 Pin4 Digital Input State

BOOL

RO

0 = off, 1 = on

2

X03 Pin4 Digital Input State

BOOL

RO

0 = off, 1 = on

3

X04 Pin4 Digital Input State

BOOL

RO

0 = off, 1 = on

4

X05 Pin4 Digital Input State

BOOL

RO

0 = off, 1 = on

5

X06 Pin4 Digital Input State

BOOL

RO

0 = off, 1 = on

6

X07 Pin4 Digital Input State

BOOL

RO

0 = off, 1 = on

7

X08 Pin4 Digital Input State

BOOL

RO

0 = off, 1 = on

1

0

X01 Pin2 Digital Input State

BOOL

RO

0 = off, 1 = on

1

X02 Pin2 Digital Input State

BOOL

RO

0 = off, 1 = on

2

X03 Pin2 Digital Input State

BOOL

RO

0 = off, 1 = on

3

X04 Pin2 Digital Input State

BOOL

RO

0 = off, 1 = on

4

X05 Pin2 Digital Input State

BOOL

RO

0 = off, 1 = on

5

X06 Pin2 Digital Input State

BOOL

RO

0 = off, 1 = on

6

X07 Pin2 Digital Input State

BOOL

RO

0 = off, 1 = on

7

X08 Pin2 Digital Input State

BOOL

RO

0 = off, 1 = on

2001 (2048)

0

0

X01 Pin4 Digital Output State

BOOL

RW

0 = off, 1 = on

1

X02 Pin4 Digital Output State

BOOL

RW

0 = off, 1 = on

2

X03 Pin4 Digital Output State

BOOL

RW

0 = off, 1 = on

3

X04 Pin4 Digital Output State

BOOL

RW

0 = off, 1 = on

4

X05 Pin4 Digital Output State

BOOL

RW

0 = off, 1 = on

5

X06 Pin4 Digital Output State

BOOL

RW

0 = off, 1 = on

6

X07 Pin4 Digital Output State

BOOL

RW

0 = off, 1 = on

7

X08 Pin4 Digital Output State

BOOL

RW

0 = off, 1 = on

1

0

X01 Pin2 Digital Output State

BOOL

RW

0 = off, 1 = on

1

X02 Pin2 Digital Output State

BOOL

RW

0 = off, 1 = on

2

X03 Pin2 Digital Output State

BOOL

RW

0 = off, 1 = on

3

X04 Pin2 Digital Output State

BOOL

RW

0 = off, 1 = on

4

X05 Pin2 Digital Output State

BOOL

RW

0 = off, 1 = on

5

X06 Pin2 Digital Output State

BOOL

RW

0 = off, 1 = on

6

X07 Pin2 Digital Output State

BOOL

RW

0 = off, 1 = on

7

X08 Pin2 Digital Output State

BOOL

RW

0 = off, 1 = on

When a port (X01…X08) is configured as IO-Link mode following Process Data Input and Output can be accessed.

There are two ways of handling the Process Data

  • Using fixed length 32 Bytes, accessing port-by-port allows simple, port organized access, however it requires multiple commands to perform

  • Using customizable variable lenght provides accessing content in one step, but pre-configuration is required

Note

Please check whether IO-Link is supported by your module before using this function. For more information on product variants that support IO-Link, see Supported product variants

Read out an IO-Link port once.

Reading back the process data output is used for feedback (control).

Index

Length

Description

Access

1100

34

Port X01 IO-Link Process Data Input/Output

RO

1200

34

Port X02 IO-Link Process Data Input/Output

RO

1300

34

Port X03 IO-Link Process Data Input/Output

RO

1400

34

Port X04 IO-Link Process Data Input/Output

RO

1500

34

Port X05 IO-Link Process Data Input/Output

RO

1600

34

Port X06 IO-Link Process Data Input/Output

RO

1700

34

Port X07 IO-Link Process Data Input/Output

RO

1800

34

Port X08 IO-Link Process Data Input/Output

RO

Index

Length

Description

Access

Value

1n01 [5]

1

Port n IO-Link Process Data Input Valid

RO

0 = invalid, 1 = valid

1n01…1n16 [5]

16

Port n IO-Link Process Data Input (Byte 1…32)

RO

1n17 [5]

1

Port n IO-Link Process Data Output Valid

RW

0 = invalid, 1 = valid

1n18…1n33 [5]

16

Port n IO-Link Process Data Output (Byte 1…32)

RW

n [5]

Port

1

X01

2

X02

3

X03

4

X04

5

X05

6

X06

7

X07

8

X08

Registers 11000…11257 - Variable Processdata Registers

The registers mirror the registers 1100…1800. While the standard processdata registers are always 32-Bytes long for input and output processdata the variable processdata register adapt to the configured length.

Index

Byte

Name

DataType

Access

Value / Description

Note

11000

0

IO-Link Process Data Input Valid

UINT16

RO

Each bit represents a port (Bit 0 → Port 1, etc.)

1

Reserved

UINT16

RO

Always zero

11001

0

IO-Link Process Data Output Valid

UINT16

RW

Each bit represents a port (Bit 0 → Port 1, etc.)

1

Reserved

UINT16

RW

Write zero

11002…11257

Variable Processdata Input/Output

RW

See port configuration for size and layout

See blow for Layout

  • The variable processdata registers mirror the standard processdata registers (1100…1800), but adapt to the configured input/output length per port.

  • Input and output data lengths are defined by the port configuration.

  • Reserved bytes must be zero when written and will always read as zero.

  • If a port is not configured to IO-Link the complete processdata will be omitted in this registers (see example).

Variable Processdata Layout

The variable processdata registers are organized as follows:

  1. Input Processdata for Ports 1–8 (read-only)

  2. Output Processdata for Ports 1–8 (read/write)

If the configured processdata length for a port does not align to a full word (2 bytes), a padding byte is added to ensure the next port’s processdata starts at the correct word boundary.

Note:

  • The Input Processdata section is read-only. Any write attempt will result in an error.

Section

Port Number

Access

Input Processdata

1

Read-only

Input Processdata

2

Read-only

Input Processdata

3

Read-only

Input Processdata

4

Read-only

Input Processdata

5

Read-only

Input Processdata

6

Read-only

Input Processdata

7

Read-only

Input Processdata

8

Read-only

Output Processdata

1

Read/Write

Output Processdata

2

Read/Write

Output Processdata

3

Read/Write

Output Processdata

4

Read/Write

Output Processdata

5

Read/Write

Output Processdata

6

Read/Write

Output Processdata

7

Read/Write

Output Processdata

8

Read/Write

Example

Suppose the following configuration:

  • Port 1 Input: 3 bytes

  • Port 3 Input: 2 bytes

  • Port 4 Input: 5 bytes

  • Port 1 Output: 4 bytes

  • Port 3 Output: 1 byte

The layout will be:

Address

Section

Port

Data Length

Padding

Word Boundary

11002 + 0

Input Processdata

1

3 bytes

1 byte

2 words

11002 + 2

Input Processdata

3

2 bytes

0

1 word

11002 + 3

Input Processdata

4

5 bytes

1 byte

3 words

11002 + 6

Output Processdata

1

4 bytes

0

2 words

11002 + 8

Output Processdata

3

1 byte

1 byte

1 word

This ensures each port’s processdata starts at a word boundary, with padding bytes added as needed. Ports which have zero length configured or are not in IO-Link mode will not reserve space in the register.

Registers 100, 300 – Acyclic Command Channel (including ISDU Read/Write Request)

Note

Please check whether IO-Link is supported by your module before using this function. For more information on product variants that support IO-Link, see Supported product variants

Index

Length

Description

Access

Default

100

4…121

IO-Link ISDU Command Request

RW

-

300

5…122

IO-Link ISDU Command Response

RO

-

Details – Registers 100…220 Command Request Channel = ISDU Read/Write Request

Index

Byte

Name

Data Type

Access

Needed?

Value

100

-

Command

UINT16

RW

M [1]

1 =  read, 2 =  write

101

-

Port No.

UINT16

RW

M [1]

1…8

102

-

Index

UINT16

RW

M [1]

0…0xFFFF

103

-

Subindex

UINT16

RW

M [1]

0…255

104 [3]

-

Data Length [Byte]

UINT16

RW

O [2]

1…232

105…220 [4]

0

Data Byte n

UINT8

RW

O [2]

-

105…220 [4]

1

Data byte n1

UINT8

RW

O [2]

-

Details - Registers 300…421 Command Response Channel = ISDU Read/Write Response

Index

Byte

Bit

Name

Data Type

Access

Value

300

-

-

Command (last sent)

UINT16

RO

1 = read, 2 = write

301

-

-

Port No.

UINT16

RO

1…8

302

-

-

Index

UINT16

RO

0…0xFFFF

303

-

-

Subindex

UINT16

RO

0…255

304

-

-

Error Code

UINT16

RO

0 = no error other values = see Tab. 6-15

305

-

Data Length [Bytes]

UINT16

RO

1…232

306…421

0

-

Data Byte n

UINT8

RO

-

306…421

1

-

Data Byte n+1

UINT8

RO

-

Error codes

Error Code

Description

0x0000

No error, command was successful

0x4001

ARGBLOCK_NOT_SUPPORTED

0x4002

ARGBLOCK_INCONSISTENT

0x4003

DEVICE_NOT_SUPPORTED

0x4004

SERVICE_NOT_AVAILABLE

0x4005

DEVICE_NOT_IN_OPERATE

0x4006

MEMORY_OVERRUN

0x4011

PORT_NUM_INVALID

0x4034

ARGBLOCK_LENGTH_INVALID

0x4036

SERVICE_TEMP_UNAVAILABLE

0x8000…0x80FF

IO-Link error code from the connected device, see IO-Link specification

Diagnostic

Note

Please check whether IO-Link is supported by your module before using this function. For more information on product variants that support IO-Link, see Supported product variants

Index

Length

Description

Access

3000

10

Module and Port Diagnostic

RO

3100

10

X01 IO-Link Info & Events

RO

3200

10

X02 IO-Link Info & Events

RO

3300

10

X03 IO-Link Info & Events

RO

3400

10

X04 IO-Link Info & Events

RO

3500

10

X05 IO-Link Info & Events

RO

3600

10

X06 IO-Link Info & Events

RO

3700

10

X07 IO-Link Info & Events

RO

3800

10

X08 IO-Link Info & Events

RO

Details – Diagnostic

Registers 3000…3009 – Module and Port Diagnostic

Index

Byte

Bit

Name

Data Type

Access

Value

3000

0

0…3

reserved

RO

3000

0

4

Sensor Voltage Short Circuit

BOOL

RO

3000

0

5

Actuator Short Circuit

BOOL

RO

3000

0

6

Actuator Warning

BOOL

RO

3000

0

7

IO-Link Short Circuit

BOOL

RO

3001

0

0…7

Port n: IO-Link Communication Established

BOOL

RO

3001

1

8…15

Port n: IO-Link PD Input Valid

BOOL

RO

3002

0

0…7

Port n: IO-Link Valid Device Connected

3002

1

8…15

reserved

3003

reserved

3004

0

0…7

Port n: Actuator shutdown (Pin 2)

BOOL

RO

3004

1

8…15

Port n: Actuator shutdown (Pin 4)

BOOL

R

3005

0

0…7

Port n: Actuator Warning (Pin 2)

BOOL

RO

3005

1

8…15

Port n: Actuator Warning (Pin 4)

BOOL

RO

3006

reserved

3007

reserved

3008

reserved

3009

reserved

BOOL value

Meaning

0

false, status not available

1

true, status available

Bit

Port n

0, 8

X01

1, 9

X02

2, 10

X03

3, 11

X04

4, 12

X05

5, 13

X06

6, 14

X07

7, 15

X08

Note

Please check whether IO-Link is supported by your module before using this function. For more information on product variants that support IO-Link, see Supported product variants

Detailed information about the connected IO-Link device.

Index

Byte

Bit

Name

Data Type

Access

Value

3n00 [6]

0

0

IO-Link Mode

BOOL

RO

1

Device Connected

BOOL

RO

2

Valid PD IN Data

BOOL

RO

3

Wrong Vendor ID or Device ID

BOOL

RO

4

Wrong Cycle Time

BOOL

RO

5

Wrong Length PD IN

BOOL

RO

6

Wrong Length PD OUT

BOOL

RO

7

reserved

RO

1

reserved

RO

3n01 [6]

Vendor ID

UINT16

RO

3n02 [6]

0

Device ID (MSB)

UINT8

RO

1

reserved

RO

3n03 [6]

Device ID (LSB)

UINT16

RO

3n04 [6]

0

Entry #1 Event Qualifier

IOL coded

RO

IOL coded

1

reserved

RO

3n05 [6]

Entry #1 Event Code

UINT16

RO

IOL coded

3n06 [6]

0

Entry #2 Event Qualifier

Enum

RO

IOL coded

1

reserved

RO

3n07 [6]

Entry #2 Event Code

UINT16

RO

IOL coded

3n08 [6]

0

Entry #3 Event Qualifier

Enum

RO

IOL coded

1

reserved

RO

3n09 [6]

Entry #3 Event Code

UINT16

RO

IOL coded

Port numbers – Registers 3010…3080

n [5]

Port

1

X01

2

X02

3

X03

4

X04

5

X05

6

X06

7

X07

8

X08

IOL coded Event Qualifier – Registers 3010…3080

Bit

Description

0…2

Instance

3

Source

4…5

Type

6, 7

Mode

Configuration

Registers 9100…9800 – Port Configuration

Note

Please check whether IO-Link is supported by your module before using this function. For more information on product variants that support IO-Link, see Supported product variants

Index

Length

Name

9100

7

X01 Port Configuration

9200

7

X02 Port Configuration

9300

7

X03 Port Configuration

9400

7

X04 Port Configuration

9500

7

X05 Port Configuration

9600

7

X06 Port Configuration

9700

7

X07 Port Configuration

9800

7

X08 Port Configuration

Please see the following tables for information on the structure of the port configuration.

Index

Byte

Bit

Name

Data Type

Access

Value

9n00 [5]

0

-

Master Cycle Time

UINT8

RW

IO-Link coded

1

-

reserved

-

-

9n01 [5]

0

-

Pin 2 Port Mode

UINT8

RW

0 = deactivated 1 = Digital Input 2 = Digital Output

1

-

Pin 4 Port Mode

UINT8

RW

0 = deactivated 1 = IOL Manual 2 = IOL Autostart 3 = Digital input
4 = Digital Output

9n02 [5]

0

-

Validation ID

UINT8

RW

0 = No device check 1 = Compatible V1.0 2 = Compatible V1.1 3 = Backup
Restore 4 = Restore

1

-

reserved

-

-

-

9n03 [5]

-

-

Vendor ID

UINT16

RW

-

9n04 [5]

0

-

Device ID (MSB)

UINT8

RW

-

1

-

reserved

-

-

-

9n05 [5]

-

-

Device ID (LSB)

UINT16

RW

-

Port numbers – Registers 9100…9800

n [5]

Port

1

X01

2

X02

3

X03

4

X04

5

X05

6

X06

7

X07

8

X08

Coding of the master cycle time of the IO-Link specification

Note

Please check whether IO-Link is supported by your module before using this function. For more information on product variants that support IO-Link, see Supported product variants

Time Base Encoding

Time Base Value

Calculation

Cycle Time

0

0.1 ms

Multiplier × Time base

0.4…6.3 ms

1

0.4 ms

6.4 ms + Multiplier × Time Base

6.4…31.6 ms

10

1.6 ms

32.0 ms + Multiplier × Time Base

32.0…132.8 ms

11

reserved

reserved

reserved

Register 20000 - Module Settings

Global configuration registers for the Module (Device).

Index

Byte

Bit

Name

DataType

Access

Value

Note

20000

Output Powerloss Behavior

UINT16

RW

See table below

(1)

(1) Only available for the XG5-538 Variants

Value

Description

0

Default. The Network Module will imitate the behavior of a XGx-508 master.

If UA is lost/ not connected also the US powered outputs will be deactivated by software

1

No Software Handling enabled. Powerloss behavior is defined by the hardware.