ADS Overview
TheADS route enables communication with Beckhoff TwinCAT PLCs and systems using the ADS (Automation Device Specification) protocol. It supports automatic symbol discovery, bidirectional communication, and complex data types including arrays and structures.
Basic Syntax
AMS Net ID Basics
ADS communication requires AMS Net IDs for both local and target systems. The AMS Net ID is typically the IP address followed by.1.1.
| Component | Format | Example |
|---|---|---|
| AMS Net ID | x.x.x.x.y.y | 192.168.1.100.1.1 |
| IP portion | First 4 octets | 192.168.1.100 |
| Node portion | Last 2 octets | .1.1 (usually) |
You can find your TwinCAT system’s AMS Net ID in TwinCAT XAE under SYSTEM → Routes or by running
adsInfo on the target.Connection Configuration
ADS_CONFIG Parameters
Local AMS Net ID (format: x.x.x.x.x.x). This is typically your machine’s IP + .1.1.
Route name on local machine to reach the target PLC.
Local host name (optional).
Target PLC’s AMS Net ID (format: x.x.x.x.x.x).
Target PLC’s IP address.
ADS port. Typically 851 for TwinCAT 3, 801 for TwinCAT 2.
Route name on target PLC to reach the local machine.
Username for route creation (typically Administrator).
Password for route creation.
Connection timeout in milliseconds. Default: 5000.
Connection Example
AutoDiscovery
AutoDiscovery automatically finds all PLC symbols and exposes them as MQTT topics.AutoDiscovery Parameters
Enable automatic symbol discovery. Default: false.
Base MQTT topic for discovered symbols. Default: ads/discovery.
Default QoS for discovered symbols (0-2). Default: 0.
Default retain flag for discovered symbols. Default: false.
Default trigger mode:
0- OnStart (read once at connection)1- OnChange (publish on value change)2- Cyclic (poll at interval)
Default polling cycle in milliseconds. Default: 1000.
Include patterns (comma-separated, * wildcard). Default: * (all symbols).
Exclude patterns (comma-separated, * wildcard).
Structure expansion depth. Default: 3.
Enable parallel reading for large projects. Default: false.
Batch size for parallel reading. Default: 50.
AutoDiscovery Example
TwinCAT Data Types
| Data Type | TwinCAT Type | Size | Description |
|---|---|---|---|
BOOL | BOOL | 1 bit | Boolean value |
BYTE | BYTE | 8 bits | Unsigned 8-bit |
SINT | SINT | 8 bits | Signed 8-bit integer |
USINT | USINT | 8 bits | Unsigned 8-bit integer |
WORD | WORD | 16 bits | Unsigned 16-bit |
INT | INT | 16 bits | Signed 16-bit integer |
UINT | UINT | 16 bits | Unsigned 16-bit integer |
DWORD | DWORD | 32 bits | Unsigned 32-bit |
DINT | DINT | 32 bits | Signed 32-bit integer |
UDINT | UDINT | 32 bits | Unsigned 32-bit integer |
LWORD | LWORD | 64 bits | Unsigned 64-bit |
LINT | LINT | 64 bits | Signed 64-bit integer |
ULINT | ULINT | 64 bits | Unsigned 64-bit integer |
REAL | REAL | 32 bits | 32-bit floating point |
LREAL | LREAL | 64 bits | 64-bit floating point |
STRING | STRING | Variable | ASCII string |
ARRAY | ARRAY | Variable | Array of elements |
STRUCT | STRUCT | Variable | User-defined structure |
TAG Configuration
Symbol-Based Addressing
Index-Based Addressing
For direct memory access using index group and offset:Array Handling
Array element type (required for ARRAY): BOOL, INT, REAL, STRING, STRUCT, etc.
Number of elements in the array.
Length of each element in bytes (for STRING/STRUCT arrays).
Offset in bytes to skip before array data. Default: 0.
Header bytes to skip per element. Default: 0.
Structure Handling
Structure field definitions in format:
name:offset:type:size (comma-separated).Complete Examples
- Basic Symbol Reading
- AutoDiscovery
- Bidirectional Control
- Array Data
- Structure Data
Read PLC variables using symbol names:
Route Setup Process
To establish ADS communication, routes must be configured on both sides:1. On TwinCAT System
- Open TwinCAT XAE
- Go to SYSTEM → Routes
- Add a static route:
- Route Name: Match
TARGET_ROUTE_TO_LOCALparameter - AMS Net ID: Your Coreflux machine’s AMS Net ID
- Transport Type: TCP/IP
- Address: Your Coreflux machine’s IP
- Route Name: Match
2. In Coreflux Configuration
The route automatically creates a corresponding route on the local machine using the configured parameters.Troubleshooting
Connection Failed
Connection Failed
- Verify AMS Net IDs are correct on both sides
- Check routes are properly configured in TwinCAT
- Ensure TARGET_PORT is correct (851 for TC3, 801 for TC2)
- Verify firewall allows ADS port (typically 48898)
- Check TARGET_USER/PASSWORD for route creation
Symbol Not Found
Symbol Not Found
- Verify symbol path matches exactly (case-sensitive)
- Check symbol exists in PLC project
- Ensure PLC is in RUN mode
- Use AutoDiscovery to find correct symbol names
AutoDiscovery Issues
AutoDiscovery Issues
- Check DISCOVERY_FILTER_INCLUDES patterns
- Verify DISCOVERY_MAX_DEPTH is sufficient
- For large projects, enable DISCOVERY_PARALLEL_READING
- Check PLC project is compiled and deployed
Write Operations Fail
Write Operations Fail
- Ensure WRITABLE is set to “true”
- Verify PLC variable is not constant
- Check value is within MIN_VALUE/MAX_VALUE
- Verify PLC is in RUN mode
Timeout Errors
Timeout Errors
- Increase TIMEOUT value
- Check network connectivity
- Verify TwinCAT runtime is running
- Reduce DISCOVERY_BATCH_SIZE if using AutoDiscovery

