Beckhoff ADS/TwinCAT
Beckhoff ADS/TwinCAT via the Site Runtime ads (AMS/TCP indexGroup,indexOffset).
| Property | Value |
|---|---|
| Console protocol id | beckhoff-ads |
| Site Runtime plugin | ads |
| Transport | Ethernet (TCP/UDP) |
| Read | yes |
| Write | yes — through approved writes |
| Subscribe | — |
| Device families | TwinCAT |
| Default group interval | 100 ms |
| Maturity | Production: complete driver (connection handling, address forms, batching, read and write) |
Create the device
- Open Connectivity → Devices and click Add device.
- Pick Beckhoff ADS/TwinCAT in the protocol list.
- Choose the Site Runtime that can reach the device, fill the connection parameters below and click Create & connect.
- Add a group (poll interval) and tags with the address formats below. See Devices and Groups and tags for the full walk-through.
Connection parameters
Every field the Console shows for this protocol. Required fields must be set before the device can be saved.
| Parameter | Type | Default | Range / options | Required | Description |
|---|---|---|---|---|---|
Target PLC IP Addresshost | string | — | max 30 chars | yes | |
Target PLC Portport | int | 48898 | 1 – 65535 | yes | |
Source AdsAmsNetIdsrc-ams-net-id | string | — | max 30 chars | yes | Source AMS Net ID. Example: 192.168.1.152.1.1 |
Source AdsPortNrsrc-ads-port | int | 851 | 1 – 65535 | yes | Source ADS port number |
Target AdsAmsNetIddst-ams-net-id | string | — | max 30 chars | yes | Target AMS Net ID. Example: 192.168.1.157.1.1 |
Target AdsPortNrdst-ads-port | int | 851 | 1 – 65535 | yes | Target ADS port number |
Tag addresses and data types
Supported data types: INT8, UINT8, INT16, UINT16, INT32, UINT32, INT64, UINT64, FLOAT, DOUBLE, BOOL, STRING. The Console validates each tag address against the pattern for its data type before it is saved:
| Data types | Address pattern (regular expression) |
|---|---|
INT8 UINT8 INT16 UINT16 INT32 UINT32 INT64 UINT64 FLOAT DOUBLE BOOL | ^((0[xX][0-9a-fA-F]+)|\d+),((0[xX][0-9a-fA-F]+)|\d+)$ |
STRING | ^((0[xX][0-9a-fA-F]+)|\d+),((0[xX][0-9a-fA-F]+)|\d+).\d+$ |
Addressing and notes
Address syntax and examples
<indexGroup>,<indexOffset>
<indexGroup>,<indexOffset>.<length> STRING, length in bytes (1 to 255)
Both numbers may be decimal or hexadecimal with 0x. The index group must be in the range 0x4020 to 0x4045 or 0xF000 to 0xF0FF. Symbolic names such as MAIN.Counter are not supported.
| Address | Type | Meaning |
|---|---|---|
0x4020,0 | INT16 | Group 0x4020 (PLC memory area), byte offset 0 |
0x4020,100 | FLOAT | Four bytes at offset 100 |
0x4020,104 | UINT32 | Four bytes at offset 104 |
0x4020,200.20 | STRING | 20 bytes at offset 200 |
16416,0 | UINT16 | The same as 0x4020,0 in decimal |
0xF020,0 | BOOL | A group of the 0xF000 range (I/O image) |
Special groups: 0x4025, 0xF025 and 0xF035 are read only, and 0xF006 is write only. The size of a value follows its type: 2 bytes for INT16, 4 for FLOAT, 8 for DOUBLE.
To get the index group and offset of a variable, read them from the TwinCAT project (the address of an AT %M* variable, or the symbol table).
Endianness
ADS data is little endian. The runtime decodes it as the PLC stores it. There are no byte order suffixes.
Typical settings
| Setting | Typical | Note |
|---|---|---|
| Target PLC IP Address, Target PLC Port | IP of the TwinCAT system, 48898 | The ADS port over TCP. |
| Source AdsAmsNetId | An AMS net id of the Site Runtime, for example 192.168.1.50.1.1 | Must be added as a route on the PLC. |
| Source AdsPortNr | 851 | |
| Target AdsAmsNetId | The PLC's AMS net id, for example 192.168.1.10.1.1 | Shown in the TwinCAT system. |
| Target AdsPortNr | 851 | The TwinCAT 3 PLC runtime is port 851. |
In TwinCAT add a static route on the PLC for the Source AMS net id and the IP of the Site Runtime host. Without a route the PLC ignores the connection.
Poll group interval: 1000 ms.
Common errors
| Symptom | Cause | Fix |
|---|---|---|
| Connects, no data | No route on the PLC for the source AMS net id. | Add a static route in TwinCAT. |
| Address refused | Index group outside the allowed ranges, or symbolic name. | Use group,offset with a group in 0x4020..0x4045 or 0xF000..0xF0FF. |
| Offset refused for a special group | Groups such as 0x4025 need offset 0. | Use offset 0. |
| Write refused | Read-only group. | Use a writable group. |
| Wrong value | Wrong offset or type size. | Compare with the byte layout in TwinCAT. |
| Port mismatch | PLC runtime is not on 851. | Use the AMS port of your runtime. |