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:
- 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.
- 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.
- The value is written only after that, only if it has not changed since, once, within two minutes.
- 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:
- Type the new value as an IEC literal in the form CODESYS reports values (
42,TRUE). An empty value is refused. - 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.
- The write is refused, with nothing written, when CODESYS reports the controller runs another application than the project's.
- 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.
- 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).