Skip to Content
On this page

Beckhoff ADS

This plugin reads and writes TwinCAT variables by symbol, memory area, or explicit ADS index-group address. It is named Beckhoff ADS in the device selector.

See Collection Configuration for common channel, device, variable, and data-format settings. This page covers only AMS/ADS routing, addresses, and debug.

Compatible devices and models

Device series / model examplesConnection requirements
Beckhoff controllers or industrial PCs running a TwinCAT 2/3 PLC runtimeThe target must run ADS and have an ADS route to the gateway. Match AMS Net ID, PLC runtime port and symbol access permissions. An Ethernet-equipped controller does not necessarily have a running PLC runtime.

Prepare the TwinCAT target

This example uses gateway IP 192.168.1.10, PLC IP 192.168.1.40, and the first TwinCAT 3 PLC Runtime. Connect their Ethernet interfaces, configure reachable IP networks, download the PLC project and start the required Runtime before collecting program variables.

Keep these three addresses separate:

ItemExampleWhere to obtain it
PLC TCP endpoint192.168.1.40:48898PLC interface IP and ADS/TCP listening port. Enter this in the channel’s remote address.
PLC AMS Net ID192.168.1.40.1.1TwinCAT target information or route list. Read the actual six-part ID rather than deriving it from the IP.
PLC Runtime ADS port851Selected Runtime. The first TwinCAT 3 PLC Runtime commonly uses 851; the first TwinCAT 2 PLC Runtime commonly uses 801. Other Runtimes have their own ports.

Add the gateway route on the PLC

On the PLC system, open the TwinCAT tray menu Router → Edit Routes, or connect to the target and add a static route under SYSTEM → Routes. Register the gateway’s AMS Net ID and reachable IP. A route created only from the engineering PC to the PLC does not register the gateway as a client.

TwinCAT route fieldExample and purpose
Route NameFor example TGateway, to identify the client.
AmsNetId192.168.1.10.1.1, exactly matching the gateway’s Source AMS Net ID. Each of the six parts is 0–255.
Transport TypeTCP_IP.
Address Info / IP Address192.168.1.10, the gateway interface reachable from the PLC. Select the correct interface on a multihomed gateway.
Target RouteStatic retains this system’s route after restarting; Temporary lasts until restart.
Remote RouteFor the standalone ADS client, use None / Server as in Beckhoff’s client example. The gateway does not require a TwinCAT Router installation.
UnidirectionalLeave unchecked for the ordinary request/response route.

The official TwinCAT 3 Add Route window below identifies these fields. Its names and addresses are vendor examples; enter your own client information from the table above.

Official TwinCAT 3 Add Route window: AMS Net ID, IP and static routes

View original image

When adding a route remotely from an engineering PC, supply an account permitted to manage the target’s routes, then inspect the resulting route on the PLC.

TwinCAT remote-route login window

View original image

This plugin connects to ordinary ADS/TCP endpoints. Secure ADS is a separate protocol capability; the channel’s SSL switch does not convert ordinary ADS into Secure ADS. Determine a suitable connection scheme for targets that accept only Secure ADS. See Beckhoff’s Add Route reference  and standalone ADS client example .

Configure the gateway channel and device

  1. Open Development Configuration → Collection Configuration. Create channel Collect_BeckhoffADS_TCP, choose TcpClient, and set the remote address to 192.168.1.40:48898. Normally leave the bind address empty; use a gateway interface address when a specific outgoing interface is required. Keep maximum concurrency at 1. The ADS logical port 851 does not belong in the TCP endpoint.

Beckhoff ADS channel with TCP endpoint 192.168.1.40:48898

View original image

  1. Create a device using Beckhoff ADS, select this channel, and use an execution interval such as 1000 ms. Finish the route and variable configuration before enabling the channel and device.

Beckhoff ADS device, channel and execution interval

View original image

  1. Open Plugin Properties and enter both AMS identities and logical ports. They are not inferred from the channel IP.
PropertyConfiguration and behavior
Source AMS Net IDGateway client ID, for example 192.168.1.10.1.1. Match the client ID registered in the PLC route. Initially empty. Recheck the route after changing the gateway interface or IP.
Source ADS portGateway logical port, 1–65535; this example uses 32905. It identifies the sender and is separate from TCP. Replace the initial 0 with a valid value.
Target AMS Net IDActual PLC ID, for example 192.168.1.40.1.1. Initially empty. A valid TCP connection cannot compensate for an incorrect target ID.
Target ADS portRuntime logical port, 1–65535; use 851 for this example. Replace the initial 0 with the actual PLC Runtime port, not a router or another ADS service port.
Maximum pack sizeDefault 1024 data bytes. Limits combined reads of contiguous index addresses in the same collection group; symbols are read separately. Check valid memory ranges and separate groups before increasing it.
Data formatDefault DCBA, the usual ADS little-endian numeric layout. Map REAL to Float and LREAL to Double; byte swapping cannot correct the wrong data type.
Reverse string byte/wordOff by default. Leave off for ordinary TwinCAT ASCII strings; enable only for source storage that swaps character bytes within words.
Read/write timeoutDefault 3000 ms per request. Correct route and Runtime errors before increasing it.
Send delayDefault 0 ms before transmitting. Increase only when the target requires slower requests.
Retry countDefault 3. Retries lengthen the time spent on a failed request and affect the effective scan interval.
Duty cycle / write priorityDefaults 3 and off. The former schedules a read after consecutive writes; the latter cancels an active read when writing. Keep defaults for read-only collection; see Collection Configuration for write-heavy workloads.

Beckhoff ADS properties: AMS identities, logical ports and pack size

View original image

Map TwinCAT variables to gateway addresses

Symbol addresses

Prepare observable variables in TwinCAT’s MAIN program, build and download the project, start the Runtime, and inspect the online values:

PROGRAM MAIN VAR TestWord : INT := 1234; TestReady : BOOL := TRUE; TestArray : ARRAY[0..2] OF INT := [1234, 5678, 90]; TestText : STRING(20) := 'ADS-DEMO'; END_VAR

Create gateway variable TestWord with address s=MAIN.TestWord, type Int16, array length 1, and initially read-only permission. Include MAIN. in the symbol path. IEC INT is a 16-bit signed value.

Beckhoff ADS variable: s=MAIN.TestWord, Int16, length 1

View original image

In Field Editor, select Symbol, enable Symbol name, enter MAIN.TestWord, leave Null unchecked, and apply the address. The s= prefix denotes a symbol rather than a station number.

Beckhoff ADS Symbol address editor

View original image

TwinCAT declarationGateway address, type and lengthValue represented
TestWord : INTs=MAIN.TestWord, Int16, 1One signed 16-bit value, 1234 in the example.
TestReady : BOOLs=MAIN.TestReady, Boolean, 1One Boolean, true in the example. Do not append .0 to the symbol.
TestArray : ARRAY[0..2] OF INTs=MAIN.TestArray, Int16, 3Three elements [1234,5678,90]. Length counts elements.
TestText : STRING(20)s=MAIN.TestText;len=21;encoding=ASCII, String, 1Storage for up to 20 single-byte characters plus the terminating zero byte; the example text is ADS-DEMO.

Use the full path from the downloaded project. Global variable lists, function-block instances and different Runtimes can have different paths. For other encodings, WSTRING, or structures, determine the actual byte layout instead of copying the 21-byte STRING(20) example. Field Editor conversion overrides—byte order, encoding, string byte length, BCD and variable-length strings—apply only to that variable; unchecked overrides retain the device/type defaults.

Memory bytes and bits

For an established PLC memory map, select Absolute, choose M, I, or Q, and enter a byte offset. An INT located at memory byte 100 uses M100, Int16, length 1, consuming bytes 100 and 101. The next adjacent INT begins at M102.

Beckhoff ADS Absolute addressing: M area, byte offset 100

View original image

AddressMeaning
M100 / I100 / Q100, non-BooleanByte100 of memory, input image, or output image. Type size and element count determine the read length.
M100.3, Boolean, length 1Bit 3 of byte 100; bit range 0–7. The bit field is shown only for Boolean.
M100, BooleanStarts at bit 0 of byte 100. Select Byte to read the whole byte as a number.
M100.3, Boolean, length 3Three consecutive Boolean values starting at bit 3, rather than three numeric bytes.

Absolute offsets are decimal. Non-Boolean addresses cannot include a bit suffix. Treat the input image as read-only observation; the PLC program and device state can overwrite output-image writes.

Explicit index group and offset

Select Explicit when the point list provides ADS IndexGroup and IndexOffset. Raw addresses accept decimal values or 0x hexadecimal values. The numerical fields use values such as group 16416 (0x4020) and offset 100, producing ig=0x4020;io=100.

Beckhoff ADS Explicit addressing: IndexGroup 16416, IndexOffset 100

View original image

AreaByte group / offsetBit group / offset
M memory0x4020, byte offset0x4021, absolute bit offset
I input image0xF020, byte offset0xF021, absolute bit offset
Q output image0xF030, byte offset0xF031, absolute bit offset

Thus a byte-based M100 read can use ig=0x4020;io=100. Boolean M100.3 can use ig=0x4021;io=803 (100×8+3). Supply both ig and io; do not mix them with s= or an absolute address. Both fields are unsigned 32-bit numbers; the PLC determines the accessible range of each index group.

Read and troubleshoot

Enable the channel, device and variable, then compare s=MAIN.TestWord in Real-time Variables or Details with the TwinCAT online value 1234. Check Boolean, array and string values individually against their declarations. For a manual read, open Protocol Debug → Read/Write and enter the same address, type and length. Messages shows requests and ADS return codes. Ordinary variables do not require an additional special method.

SymptomWhat to check
TCP connection failsRemote endpoint, listening TCP port 48898, firewall and PLC interface.
TCP connects but ADS times out or routing failsGateway IP/source Net ID registered on the PLC, target Net ID and actual Runtime port. Changing the channel IP does not update AMS identities.
Symbol lookup failsFull path, case, selected Runtime, download status, and whether the symbol still exists and is accessible.
Wrong value or response lengthINT→Int16, DINT→Int32, REAL→Float, LREAL→Double; array count, string storage bytes and DCBA.
Absolute address is outside the valid rangeByte/bit offset, actual memory map and inaccessible gaps crossed by a packed read.
A written value immediately changes backPLC logic may assign it every scan. Check program ownership and write permission before selecting a writable point.

See Collection Configuration for expression chains, RPC writes, initial values, collection groups and alarms. These settings do not create TwinCAT variables or ADS routes.