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.

Index overview

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

3000

Device (Module&Port) Diagnostic

RO

3100…3800

IO-Link Port Diagnostic

RO

9100…9800

Port Configuration

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 indexes 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

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

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 toBad 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

SIO Input Output data

Index Byte Bit Name Data Type Access Value
2000 - 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 - 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 – SIO Input Output data

Value

Description

0

off, de-energized, 0 V

1

on, under power, 24 V

Bits – SIO Input Output 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

Indexes 2000, 2001 – SIO Input Output data

Index Byte Bit Name Data Type Access Value
2000 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 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

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

Indexes 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 – Indexes 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]

-

Indexes 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 errorother 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

Indexes 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 – Indexes 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 – Indexes 3010…3080

Bit

Description

0…2

Instance

3

Source

4…5

Type

6, 7

Mode

Configuration

Indexes 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 – Indexes 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