Skip to main content
Version: 3.2

CODESYS V2 Nodes

Read and write the variables of PLCs running a CODESYS V2 runtime from a pipeline, by their names in the PLC program.

Operations
Read Symbol · Read Block · Write Symbol
Types
BOOL, INT, UINT, WORD, DINT, UDINT, DWORD, REAL, LREAL
Writes
Checked against the type first; never buffered

Use CODESYS V2 PLCs in pipelines. Each function authored on a CODESYS V2 connection is available as a matching node in the Pipeline Designer: CODESYS V2 Read Symbol, CODESYS V2 Read Block and CODESYS V2 Write Symbol.

For connection setup, what the PLC needs (its symbol file) and the types, see the CODESYS V2 connection guide.

A CODESYS V2 runtime does not send data on its own, so there is no trigger node: to poll one, drive the reads from a Schedule trigger.

Configuration Quick Reference​

FieldWhat you chooseDetails
ParametersConnection, Function, Function Parameters, Timeout OverrideSelect the CODESYS V2 connection, pick a function, bind parameters with expression support, and optionally override the timeout.
SettingsDescription, Timeout (seconds), Retry on Timeout, Retry on Fail, On ErrorNode description, maximum execution time, retry behaviour and error strategy. All execution settings default to pipeline-level values.

Every node shares the same Parameters: Connection (the CODESYS V2 connection profile), Function (a function of the node's type on that connection), Function Parameters (auto-populated from the function schema, with expression syntax {{ expression }} for dynamic values) and an optional Timeout Override in seconds. Each node receives the output of the previous node as input, which function parameter expressions can reference as $input.

The call's own facts ride along under _metadata next to the four every connected node carries. Every CODESYS V2 node delivers _metadata.method (the operation that ran, e.g. codesys.read.symbol), _metadata.connectionId (the connection it ran over) and _metadata.protocol (codesys).


CODESYS V2 Read Symbol nodeCODESYS V2 Read Symbol node

Read Symbol node

CODESYS V2 Read Symbol Node​

Supported Function Types:

NodeFunctionPurposeCommon Use Cases
CODESYS V2 Read Symbol (connected.codesys.read.symbol)codesys.read.symbolRead one variable by its name in the PLC programA machine state or a count on a schedule

The node reads the variable the function names, as its type in the symbol file. See Read Symbol for the parameters.

Output Structure​

{
"result": {
"symbol": "PLC_PRG.Counter",
"dataType": "DINT",
"value": 1234,
"quality": "good"
}
}
KeyMeaning
result.symbolThe variable read, as the symbol file spells it: plc_prg.counter comes back as PLC_PRG.Counter
result.dataTypeThe variable's type, from the symbol file
result.valueThe decoded value: a number, or true/false for a BOOL
result.qualitygood. A value the runtime marks invalid fails the node instead of storing a value

Read a value with $node["Read Count"].result.value.


CODESYS V2 Read Block nodeCODESYS V2 Read Block node

Read Block node

CODESYS V2 Read Block Node​

Supported Function Types:

NodeFunctionPurposeCommon Use Cases
CODESYS V2 Read Block (connected.codesys.read.block)codesys.read.blockRead many named variables in the fewest requestsA machine's counts, states and setpoints in one node

The node reads every point of the function and returns each value by its name, packed into as few requests as the PLC's buffer takes. A variable that is not in the symbol file, or whose value the runtime marks invalid, is reported by name without failing the others; the node fails only when the link fails. See Read Block.

Output Structure​

When every variable was read:

{
"result": {
"count": 2,
"values": { "Count": 1234, "Running": true },
"quality": "good",
"totalDataPoints": 2,
"totalReads": 1
}
}

When a variable was not read, it is missing from values, its reason is in errors under its name, and quality is bad:

{
"result": {
"count": 1,
"values": { "Count": 1234 },
"errors": {
"Spare": "codesys: no variable PLC_PRG.Spare in the symbol file DOWNLOAD.SDB; names are as the PLC program spells them (PLC_PRG.Counter, .bStart for a global)"
},
"quality": "bad",
"totalDataPoints": 2,
"totalReads": 1
}
}
KeyMeaning
result.valuesEvery variable that was read, by its name
result.errorsThe reason for each variable that was not read, by its name. Present only when one was not read
result.countHow many variables were read
result.totalDataPointsHow many variables were requested
result.totalReadsHow many requests the variables were packed into
result.qualitygood when every variable was read, bad when one was not

Read a variable with $node["Machine"].result.values.Running. Check $node["Machine"].result.errors before relying on every variable being present.


CODESYS V2 Write Symbol nodeCODESYS V2 Write Symbol node

Write Symbol node

CODESYS V2 Write Symbol Node​

Supported Function Types:

NodeFunctionPurposeCommon Use Cases
CODESYS V2 Write Symbol (connected.codesys.write.symbol)codesys.write.symbolWrite one value to a variable by its nameSetpoints, recipe values, command flags

The node writes the function's value as the variable's type. See Write Symbol.

A write happens when the node runs, or not at all

A write is never buffered for later delivery, and it is refused in a run started by a late (replayed) input unless the node allows late input. A value that does not fit the variable's type fails the node before anything is sent to the PLC.

Output Structure​

{
"result": {
"symbol": "PLC_PRG.rSetpoint",
"dataType": "REAL",
"value": "72.5"
}
}
KeyMeaning
result.symbolThe variable written, as the symbol file spells it
result.dataTypeThe variable's type the value was written as
result.valueThe value as given, after parameter substitution
Safety First

Always validate values in a Condition node before writing to a PLC. A setpoint or a flag can move a motor, valve or actuator immediately.


Errors​

ErrorMeaningRetried by the node settings?
the runtime refused service …: status …The runtime refused the requestNo: the result is permanent
A refusal before anything is sent (a variable not in the symbol file, a type this version does not read, a value that does not fit)MaestroHub refused the request; nothing reached the PLCNo
the runtime's project changed since the symbols were loadedA program was downloaded to the PLC; the connection loads the new symbol fileYes
the runtime reported the value as invalidThe runtime marked the value invalidYes
no answer from the runtimeThe request was sent and not answered within the connection's Response TimeoutYes. A write sent again leaves the PLC in the same state as one write of the same value
not connectedThe connection is downYes

The full list of messages, with what to change for each, is in the guide's Troubleshooting.


Settings Tab​

All CODESYS V2 node types share the same Settings tab:

SettingTypeDefaultDescription
DescriptionText-Optional description displayed on the node
Timeout (seconds)NumberPipeline defaultMaximum time the node may run before timing out
Retry on TimeoutTogglePipeline defaultAutomatically retry the node if it times out
Retry on FailTogglePipeline defaultAutomatically retry the node if it fails
On ErrorSelectionPipeline defaultError strategy: Pipeline Default (the pipeline's Error Handling setting), Stop Pipeline or Continue Execution

When left at their defaults, these settings inherit from the pipeline-level execution configuration. The retry settings do not retry a request the runtime refused, or one MaestroHub refused before sending (see Errors).

Test before wiring

Use the Test button in the function form (on the connection page) to run every CODESYS V2 function against the live PLC before wiring it into a pipeline. The Browse Symbols panel beside it lists the variables the PLC's symbol file holds.