The ADS (Automation Device Specification) driver communicates with Beckhoff TwinCAT PLCs and controllers using the ADS protocol over TCP/IP. ADS is the transport layer within the TwinCAT system, enabling data exchange between software modules, PLCs, NCs, and external devices.
The Weble universal gateway ADS driver acts as an ADS client that connects to a Beckhoff controller's AMS router to read and write PLC variables. It supports:
%ads:MAIN.Temperature).
Create a new gateway and select the ADS driver. The key parameters are:
48898 / 0xBF02)..1.1, e.g. 192.168.1.2.1.1)..1.1, e.g. 192.168.1.1.1.1).custom, BK9050, BC9050, CX8091, CX8090, CX9020) to auto-configure advanced options.Before the Weble gateway can connect, an ADS route must be configured on the Beckhoff controller to authorize the gateway as a communication partner. Without this route, the connection will be refused.
WebleGateway)192.168.1.2.1.1)TCP/IP192.168.1.2)Some Beckhoff controllers (CX series) offer a web-based configuration interface where routes can be added without TwinCAT Engineering.
If the connection fails, see 5. Troubleshooting.
Once the gateway is started and connected, there are three ways to import PLC variables:
In the Symbols tab, open the Addresses menu and select Import Symbols. Enter a text to import only the symbols whose comment contains it, or leave the field empty to import all symbols. The driver reads the symbol table directly from the controller.
Imported addresses have no CycleTime: they are not refreshed until you set one. Select the imported addresses, edit them and set CycleTime (for example 1000).
The gateway option Import symbols at startup (off by default) does the same at each start of the gateway for every symbol that has no address yet. On a large PLC this creates thousands of addresses.
Export your TwinCAT project symbols as XML (PlcProjectInfo format). In the Symbols (or Raw) tab, click Import file and select the .xml file. The XML file contains symbol names, types, IndexGroup, and IndexOffset.
Addresses can also be created manually by entering the symbol name or raw IndexGroup/IndexOffset.
ADS addresses are routable like any other protocol. Typical use cases:
| Label | JSON Key | Description |
|---|---|---|
| Name | name | A descriptive name for this ADS gateway instance. |
| Cluster ID | cluster | Cluster identifier. Use 0 for single-gateway setups. |
| Description | description | Optional description. |
| Target device | targetDevice | Device preset: custom, BK9050, BC9050, CX8091, CX8090, or CX9020. Presets adjust advanced options automatically. |
| Host (AMS router) | host | IP address of the Beckhoff controller / AMS router. |
| Port (AMS router) | port | ADS TCP port. Default: 48898 (0xBF02). |
| Source amsNetId | amsNetIdSource | AMSNetId of this gateway. Typically the gateway's local IP extended with .1.1 (e.g. 192.168.1.2.1.1). |
| Source port | amsPortSource | AMS source port. Default: 32905. |
| Target amsNetId | amsNetIdTarget | AMSNetId of the Beckhoff PLC. Typically the PLC's IP extended with .1.1 (e.g. 192.168.1.1.1.1). |
| Target port | amsPortTarget | AMS target port on the PLC. Default: 801. May vary depending on the controller model. |
These parameters are visible depending on the selected Target device.
| Label | JSON Key | Description |
|---|---|---|
| Import symbols at startup | readAndCacheSymbols | If enabled, all PLC symbols are imported automatically when the gateway starts. Available for custom, CX8090, CX8091, CX9020. |
| Parralels read | parralelsRead | If enabled, multiple read requests are sent in parallel for faster polling. Default: enabled. |
| Idletimeout | idleTimeout | Pause in milliseconds between two ADS requests when Parralels read is disabled. Default: 1000. |
| Multiple read | multipleRead | Group the raw reads (IndexGroup / IndexOffset) of the same cycle in a single ADS request. Reads by symbol name are always sent one by one. Editable with custom only. |
| Allow half open | allowHalfOpen | Accept the connection even when the PLC runtime is not running (AMS target and system manager reachable). Useful before the PLC program is loaded. Default: off. Editable with custom only. |
| Bare client | bareClient | Open a bare ADS connection, without querying the system manager or the PLC runtime. Required for bus couplers that have no runtime (BK9050). Default: off. Editable with custom only. |
| Min. CycleTime (ms) | minimumCycleTime | Lowest cycle applied to the CycleTime of every address of this gateway. Default: 1000, minimum: 100. Lower it to refresh addresses faster than once per second. Cron expressions are not affected. |
The Target device preset overrides some of these options:
| Target device | Bare client | Allow half open | Import symbols at startup | How addresses are read |
|---|---|---|---|---|
custom |
as set | as set | as set | notification, cyclic read as fallback |
BK9050 |
on | on | off | as custom |
BC9050 |
off | on | off | as custom |
CX8090, CX8091 |
off | off | as set | cyclic raw reads (except Read mode subscribe) |
CX9020 |
on | on | as set | cyclic raw reads (except Read mode subscribe) |
With the CX presets every address, including symbols, is read through its IndexGroup / IndexOffset unless its Read mode is subscribe: these fields must be correct (they are filled by the symbol import) and no change-of-value notification is used.
{
"host": "192.168.1.1",
"port": 48898,
"amsNetIdSource": "192.168.1.2.1.1",
"amsPortSource": 32905,
"amsNetIdTarget": "192.168.1.1.1.1",
"amsPortTarget": 801,
"targetDevice": "custom",
"readAndCacheSymbols": false,
"parralelsRead": true,
"multipleRead": true,
"allowHalfOpen": false,
"bareClient": false,
"idleTimeout": 1000,
"minimumCycleTime": 1000
}
The driver organizes addresses into two tabs:
Addresses using TwinCAT symbol names. This is the recommended approach.
%ads:<symbolName>%ads:MAIN.Temperature, %ads:GVL.bRunningAddresses using IndexGroup and IndexOffset for direct memory access.
%ads-raw:<indexGroup>-<indexOffset>%ads-raw:16448-0, %ads-raw:0x4020-100IndexGroup can be specified in decimal or hexadecimal (0x prefix).
| Label | JSON Key | Description |
|---|---|---|
| Name | name | The address name (%ads:<symbolName>). |
| Symbol name | name (json) | The TwinCAT symbol name (e.g. MAIN.Temperature). |
| Group index | indexGroup | The ADS IndexGroup (auto-filled when importing symbols). |
| Offset index | indexOffset | The ADS IndexOffset (auto-filled when importing symbols). |
| Type | type | The TwinCAT datatype (see section 3.4). |
| CycleTime | cycleTime | Refresh period in milliseconds, or a cron expression. With a subscription it is the period at which the PLC checks the variable and sends it if it changed; with polling it is the period of the reads. A value lower than the gateway Min. CycleTime (1000 ms by default) is raised to it. Empty or 0: the address is never refreshed. With a cron expression the address is read at each cron tick. Default in the form: 1000. |
| Read mode | readMode | auto (default): ADS notification, with automatic fallback to cyclic reads if the PLC refuses the subscription. subscribe: notification only, no fallback (the address status shows !subscribe not supported: ... on failure). polling: cyclic reads only. |
| Description | description | Optional description. |
| Log | log | Logging mode: never, on update, always, or a duration in ms. |
| Label | JSON Key | Description |
|---|---|---|
| Name | name | The raw address (%ads-raw:<group>-<offset>). |
| Index group | (from name) | The ADS IndexGroup. |
| Index offset | (from name) | The ADS IndexOffset. |
| Type | type | The TwinCAT datatype. |
| CycleTime ms/cron | cycleTime | Polling period in milliseconds or cron expression (raw addresses are always polled). |
| Description | description | Optional description. |
| Log | log | Logging mode. |
| Datatype | Size | Description |
|---|---|---|
BOOL |
1 bit | Boolean (TRUE/FALSE) |
BYTE |
8-bit | Unsigned byte (0-255) |
USINT |
8-bit | Unsigned short integer |
SINT |
8-bit | Signed short integer |
UINT |
16-bit | Unsigned integer |
WORD |
16-bit | Unsigned 16-bit word |
INT |
16-bit | Signed integer |
DWORD |
32-bit | Unsigned 32-bit double word |
UDINT |
32-bit | Unsigned double integer |
DINT |
32-bit | Signed double integer |
REAL |
32-bit | Single-precision float (IEEE 754) |
LREAL |
64-bit | Double-precision float (IEEE 754) |
STRING |
variable | Character string |
TIME |
32-bit | Time duration in milliseconds |
TIME_OF_DAY / TOD |
32-bit | Time of day |
DATE |
32-bit | Date |
DATE_AND_TIME / DT |
32-bit | Date and time combined |
| Property | Value |
|---|---|
| Readable | Yes |
| Writable | Yes |
| Routable | Yes |
| Loggable | Yes |
.1.1 (e.g. IP 192.168.1.2 → AMSNetId 192.168.1.2.1.1), but it can be any unique 6-byte identifier.801 (TC2 PLC Runtime 1), 811 (TC2 Runtime 2), 851 (TC3 PLC Runtime 1), 852 (TC3 Runtime 2).