PLC
Documentation

Version Latest

Write values

Write one value to a TwinCAT symbol over ADS or to a CODESYS variable through the scripting engine, after a confirmation that names the controller, the variable and both values.

State: TwinCAT kit shipped (ADS, against a router model). CODESYS modelled (against a model of the engineering host). Nothing writes to an S7-1500. Bench controllers only.

A write is not a force. It sets the value once; the program may overwrite it on its next cycle. No command forces a value from the Editor.

Write a TwinCAT value

Run Write Value from the Command Palette or a Watch row's context menu:

  1. Pick a symbol and type the value. It is checked as you type: BOOL takes TRUE or FALSE, integers and REAL/LREAL in range, STRING and WSTRING within their length, enumerations by member name or number, TIME types as their raw number.
  2. The Editor reads the current value and asks, naming the target, host, AMS Net ID, port, symbol, type, current and new value. The button is Write Value.
  3. The value is written only after that, only if it has not changed since, once, within two minutes.
  4. The write and its outcome are logged in the PLC output with both values and the times.

Structs and arrays are not written as a whole; write their members.

Write a CODESYS value

Run Write CODESYS Value... on a watched expression in the Watch view, or from the Command Palette for an expression you type:

  1. Type the new value as an IEC literal in the form CODESYS reports values (42, TRUE). An empty value is refused.
  2. The Editor reads the current value through the scripting session and asks, naming the device with its address and gateway, the application, the variable, the value read just now and the new value, and that it is a write, not a force. The button is Write Value.
  3. The write is refused, with nothing written, when CODESYS reports the controller runs another application than the project's.
  4. The engineering host writes only while the variable still has the value shown, once, with no other value prepared, and reads it back until it shows the new one.
  5. The outcome and both values are in the PLC log.

Not verified

  • Any write against a real TwinCAT runtime or CODESYS controller; whether CODESYS raises after writing (the read-back decides).

Last reviewed 17 October 2026View as Markdown

Write values · Docs · Neural Inverse