Skip to main content

Beckhoff ADS/TwinCAT

Device Production Ethernet

Beckhoff ADS/TwinCAT via the Site Runtime ads (AMS/TCP indexGroup,indexOffset).

PropertyValue
Console protocol idbeckhoff-ads
Site Runtime pluginads
TransportEthernet (TCP/UDP)
Readyes
Writeyes — through approved writes
Subscribe—
Device familiesTwinCAT
Default group interval100 ms
MaturityProduction: complete driver (connection handling, address forms, batching, read and write)

Create the device​

  1. Open Connectivity → Devices and click Add device.
  2. Pick Beckhoff ADS/TwinCAT in the protocol list.
  3. Choose the Site Runtime that can reach the device, fill the connection parameters below and click Create & connect.
  4. 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.

ParameterTypeDefaultRange / optionsRequiredDescription
Target PLC IP Address
host
string—max 30 charsyes
Target PLC Port
port
int488981 – 65535yes
Source AdsAmsNetId
src-ams-net-id
string—max 30 charsyesSource AMS Net ID. Example: 192.168.1.152.1.1
Source AdsPortNr
src-ads-port
int8511 – 65535yesSource ADS port number
Target AdsAmsNetId
dst-ams-net-id
string—max 30 charsyesTarget AMS Net ID. Example: 192.168.1.157.1.1
Target AdsPortNr
dst-ads-port
int8511 – 65535yesTarget 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 typesAddress 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.

AddressTypeMeaning
0x4020,0INT16Group 0x4020 (PLC memory area), byte offset 0
0x4020,100FLOATFour bytes at offset 100
0x4020,104UINT32Four bytes at offset 104
0x4020,200.20STRING20 bytes at offset 200
16416,0UINT16The same as 0x4020,0 in decimal
0xF020,0BOOLA 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​

SettingTypicalNote
Target PLC IP Address, Target PLC PortIP of the TwinCAT system, 48898The ADS port over TCP.
Source AdsAmsNetIdAn AMS net id of the Site Runtime, for example 192.168.1.50.1.1Must be added as a route on the PLC.
Source AdsPortNr851
Target AdsAmsNetIdThe PLC's AMS net id, for example 192.168.1.10.1.1Shown in the TwinCAT system.
Target AdsPortNr851The 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​

SymptomCauseFix
Connects, no dataNo route on the PLC for the source AMS net id.Add a static route in TwinCAT.
Address refusedIndex 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 groupGroups such as 0x4025 need offset 0.Use offset 0.
Write refusedRead-only group.Use a writable group.
Wrong valueWrong offset or type size.Compare with the byte layout in TwinCAT.
Port mismatchPLC runtime is not on 851.Use the AMS port of your runtime.