ADS access of a higher-level controller

The building automation room controller supports the Beckhoff ADS and Modbus TCP protocols.
The TCP port number for the ADS protocol is 48898. The UDP port number for the ADS protocol is 48899.
The TCP port number of Modbus TCP has been standardized to the value 502

Access via the Beckhoff ADS protocol is described in this part of the documentation. ADS is the abbreviation for Automation Device Specification and describes a device and fieldbus independent interface. The Beckhoff ADS protocol is based on the TCP/IP or UDP/IP protocol. It allows the user within the Beckhoff system to use almost any connecting route to communicate with all the connected devices and to parameterize them. ADS function blocks can be used in TwinCAT PLC Control for this. The function blocks are contained in the TcSystem.lib library.

ADS access of a higher-level controller 1:
TcSystem.lib library

Structure of the ADS protocol

ADS access of a higher-level controller 2:
Structure of the ADS protocol

AMSNetID

The AMSNetID provides a reference to the device that is to be addressed. This is created from the set TCP/IP address and an additional 2 bytes. These additional 2 bytes consist of "1.1" and cannot be changed.
Example from a BC9191:

IP address 172.16.21.10
AMSNetID 172.16.21.10.1.1

Port number

The port number distinguishes sub-elements in the connected device.
Port 800: local process data (e.g. BC9191)

Index group

The index group distinguishes different data within a port.
0x4020 flag
0x4021 flag bit

Index offset (value range)

Indicates the offset, from which reading or writing the byte is to start.
Flag 0...4095
Flag bit 0...32760

Sample flag: Port 800 / Index Group 16#4020 / Byte Offset 100

ADS access of a higher-level controller 3:
Sample: writing flags with the FB ADSWrite

Sample Flag Bit: Port 800 / Index Group 16#4021 / Bit Offset 792

ADS access of a higher-level controller 4:
Sample: writing flag bits with the FB ADSWrite