Function Description
The WRITE_REMOTE
function is used
to write the value of remote variables that are then exchanged between
PLC applications.
When the EN
input value is TRUE
:
The
WRITE_REMOTE
communication function block allows to exchange the variable value between PLCs. Both located and unlocated variables can be writtenIt is possible to write any type of a named remote variable (located and unlocated) based on the variable name
The number of pins related to variables selection is fixed and cannot be modified by the user: 14 pins to specify local variables and 14 pins to specify remote variables. It is not required to connect all input and output pins.
R_VAR_x
parameter can be modified during the
runtime. This lead to relaunch the data verification process between
the local and the remote PLCs.The additional parameters EN
and ENO
can be configured.
CPU Firmware Limitation
The WRITE_REMOTE
block is supported
by:
M580 CPU with OS version V3.20 or later
M340 CPU with OS version V3.30 or later
To allow type verification based on checksum comparison (refer to Data Type Control), remote CPU must have following minimum firmware version:
M580 CPU with OS version V3.20 or later
M340 CPU with OS version V3.30 or later
FBD Representation
Representation:

LD Representation
Representation:

IL Representation
Representation:
CAL WRITE_REMOTE_Instance CTRL:=WriteRemote_Control,
ENABLE:=WriteRemote_Enable, ADDR:=Address, ABORT:=WriteRemote_Abort,
R_VAR_1:=RemoteVariable_1, ..., R_VAR_14:=RemoteVariable_14, L_VAR_1=>LocalVariable_1,
..., L_VAR_14=>LocalVariable_14, DONE=>WriteRemote_Done, ACTIVE=>WriteRemote_Active,
ERROR=>WriteRemote_ExecutionError, STATUS=>ErrorCode, EXT_STATUS=>ExtendedErrorCode)
ST Representation
Representation:
CAL WRITE_REMOTE_Instance (CTRL:=WriteRemote_Control,
ENABLE:=WriteRemote_Enable, ADDR:=Address, ABORT:=WriteRemote_Abort,
R_VAR_1:=RemoteVariable_1, ..., R_VAR_14:=RemoteVariable_14, L_VAR_1=>LocalVariable_1,
..., L_VAR_14=>LocalVariable_14, DONE=>WriteRemote_Done, ACTIVE=>WriteRemote_Active,
ERROR=>WriteRemote_ExecutionError, STATUS=>ErrorCode, EXT_STATUS=>ExtendedErrorCode);
Parameter Description
The following table describes the input parameters:
Parameter |
Type |
Comment |
---|---|---|
|
|
NOTE: The type verification via the type checksum
is not done in case of INT [1]. This verification only relies on the
type length (for example, types of local and remote variables are
considered as consistent if they have the same size in bytes).
|
|
|
The function is performed when
this parameter is |
|
|
The function is not performed (aborted)
when this parameter is |
|
|
Array containing the PLC address, result of:
|
|
|
Identification (symbolic name) of a remote variable. |
|
|
A local variable which is used to write the value to the remote device. NOTE: The
type of a local variable must match the type of a remote variable
(see Data Type Control below).
|
The following table describes the output parameters:
Parameter |
Type |
Comment |
---|---|---|
|
|
The requested function is properly performed and validated. |
|
|
|
|
|
A new non-zero status is received. |
|
|
Provides the error code if an error is detected by the function block. NOTE: The value of the
STATUS parameter is 0 only if the value of
the EXT_STATUS parameter is 0 for
each variable access. |
|
|
Provides the extended error code if an error is detected by the function block: one status for each variable access. |
Rules of Use
The following remote data are supported by this function:
Elementary variables
Arrays (tables)
DDT instances without references (indirection kind
=1
)
The following types of syntax are supported:
MyVar
MyArray[2]
MyDdtArray[4].elem1
Array
index
must be an immediate value.MyVar[2].elem1
.The WRITE_REMOTE
communication function block
writes first the definition, address and type of remote variables,
and only then it writes variables themselves. This rule also applies
to online modifications of the PLC server data, such as removing a
variable or an FB instance.
The
function must be activated both by a client PLC and by a server PLC.The WRITE_REMOTE
communication function block must be called
and executed from the MAST, FAST, AUX0, or AUX1 task.
The allowed character set for a remote variable is Standard. If an Extended or Unicode character is used for a remote variable, then an error is detected and the “Variable is not found” message appears in the OFS server.
If the WRITE_REMOTE
function block.
This is done either in a local application, or in a remote application.
Data Type Control
CAUTION | |
---|---|
The WRITE_REMOTE
communication function block writes variables with identical data
types.
The Data Type control between local and remote variables is performed by default and applies to:
EDT
DDT
DDT ARRAY
Anonymous ARRAY
The control for User Type is done by the identical type checksum and by the type length.
Exported attributes of the defined source format are checked in the course of the identical type checksum control.
A minimum control for consistency based on the type length is always performed, while local and remote variables must have the same size in bytes.
The control by the type name is not performed due to the difference in definitions used by the client PLC and the PLC server.
To deactivate the Data Type control, use the CTRL
parameter. Only the Data Type control
based on the identical type checksum can be deactivated via the CTRL
parameter.
STRING
and STRING[n]
Data Types are considered identical even if the string size is different.
Only characters corresponding to the minimum length of local and remote
variables are exchanged. The string truncation is performed only for
string variables (STRING
or STRING[n]
). This rule does not apply for string
variables inside DDTs.EXT_STATUS
field. In order to avoid incorrect
data exchange, DDT type in Premium or Quantum have to be modified.
For more explanation refer to chapter DDT: Mapping Rules. Control Expert may indicates at build
time where the alignment seems to be different. To enable this option,
modify the property in .Hot Standby Mode Behavior
In the Hot Standby mode, WRITE_REMOTE
performs the same way as other communication function blocks. Same
programming rule should be followed as described in Asynchronous Communication
Function Block.
When a switchover occurs, the IP address of the PLC target
is switched over in the PLC server while the ongoing request is restarted
in the Standby mode. Thus, the communication with the WRITE_REMOTE
function block is restored and
continues in a normal way.
WRITE_REMOTE
communication function block.PLC Simulator
The WRITE_REMOTE
communication function block
can be used with the PLC simulator of ongoing communication requests.
Refer to EcoStruxure™ Control Expert, PLC Simulator for details.
Limitations
The following data mapped on ANY data type are not supported by this function:
IODDT instances
Device DDT instances containing EBOOL
DDT instances with a reference (indirection kind
=1
)Arrays of EBOOL, EFB, and DFB
Other limitations:
The maximum number of variables is 14
The request size must not exceed 1 Kb. This means:
The total size of exchanged data must be less than 1 Kb
The sum of all strings described in all variable paths must be less than 1010 Bytes
If the request size is > 1 Kb, a status error is raised
The response time depends on the PLC cycle time and it is limited to the timeout value specified in the first word of the
CTRL
parameter.