Skip to content

Beckhoff TwinCAT ADS

Reads and writes TwinCAT 2 and 3 symbols (CX, soft-PLC) over ADS. TwinCAT does not have to be installed on the gateway PC.

ParameterExample
AMS Net Id5.78.123.1.1.1
ADS port851
ModeSumCommand (default), OnChange, Cyclic
String encodingLatin1 (default) or Utf8

Signals are addressed by ADS symbol name (MAIN.bStart) and typed by a Beckhoff primitive: BOOL, BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT, REAL, LREAL, STRING(n) and WSTRING(n).

STRING(n) and WSTRING(n) symbols map to text signals in all update modes and in browse. CONNECT takes the length n from the symbol size when it connects and again after every reconnect. If the size cannot be resolved, it assumes STRING(80). A value longer than the symbol is cut on a character boundary. A typical text signal is the barcode or serial number that a BarcodeReader reports.

The String encoding setting of the interface selects how STRING is stored in the PLC:

  • Latin1 (default) – ISO-8859-1, one byte per character.
  • Utf8 – UTF-8 for STRING.

WSTRING is always UCS-2 (UTF-16LE). A character that cannot be represented is written as ?, with one warning per signal. In WSTRING, characters outside the Basic Multilingual Plane and lone surrogates also become ?.

TwinCAT does not have to be installed on the gateway PC. CONNECT starts an embedded ADS router when none is present. It uses the existing TwinCAT installation when that installation already owns the port.

An AMS route is still required on the PLC. This is an ADS protocol requirement: in the target PLC’s route configuration, add a route back to the gateway PC’s IP address and the configured Net Id.

Discovery reads the PLC’s symbol table and derives the direction from the I/O image — symbols on the physical input image become PLCInput (realvirtual supplies them), symbols on the output image become PLCOutput. That is the correct orientation for virtual commissioning.

  • Manually. Enter the ADS symbol name, for example MAIN.bStart, and a Beckhoff primitive type.
  • Browse. Yes. Discovery reads the PLC’s symbol table. Symbols on the physical input image become PLCInput (realvirtual supplies them), symbols on the output image become PLCOutput.
  • File import. No protocol-specific file import. Use Addresses → Import address table… for a prepared list.
  • From the model. When the model already has its PLC signals, Addresses → Fill from controller… in the signal-mapping section of the CONNECT panel previews matches by exact name against what Browse finds and then writes the addresses. Addresses → Import address table… takes a CSV or TSV with name;address[;dataType[;topic]] rows. New signals take direction and type from the same-named model signal; signals that already exist keep their configured type. See Configuring interfaces.

How direction, data types and write access are decided is explained in Common concepts and Configuring interfaces.