Function Description

The WRITE_SDO function block writes (explicit exchanges) from the PLC application up to the device (SDO).

This function block provides access to the abort code when the SDO command is not successful (only if the fieldbus is in RUN mode, and only towards the configured devices).

FBD Representation

Representation:

LD Representation

IL Representation

Representation:

CAL WRITE_SDO_Instance (ENABLE := EnableWRITE_SDO, ABORT := AbortWRITE_SDO, ADDR := DataStructureAddress, NODE := NodeNumber, INDEX := SDOIndex, SUBINDEX := SDOSubIndex, OFFSET := FirstSDO, NB_IN := DataNumberIn, DATA_IN := SDODataToWrite, DONE => WriteSDOSuccessful, ACTIVE => WriteSDOActive, ERROR => WriteSDOFaulty, STATUS => ErrorCode, SDOABORTCODE => AbortCode)

ST Representation

Representation:

WRITE_SDO_Instance (ENABLE := EnableWRITE_SDO, ABORT := AbortWRITE_SDO, ADDR := DataStructureAddress, NODE := NodeNumber, INDEX := SDOIndex, SUBINDEX := SDOSubIndex, OFFSET := FirstSDO, NB_IN := DataNumberIn, DATA_IN := SDODataToWrite, DONE => WriteSDOSuccessful, ACTIVE => WriteSDOActive, ERROR => WriteSDOFaulty, STATUS => ErrorCode, SDOABORTCODE => AbortCode)

Parameter Description

The following table describes the input parameters:

Input parameter

Data type

Description

ENABLE

BOOL

ON: the operation is enabled.

ABORT

BOOL

ON: the currently active operation is aborted.

ADDR

ANY_ARRAY_INT

Array containing the address of the destination entity of the read operation, result of ADDMX function.

NODE

BYTE

Byte used to select a particular NMT slave device on the CANopen network (16#01 to 16#7F).

INDEX

INT

Two bytes used to access a particular object in a CANopen SDO server device.

SUBINDEX

BYTE

Byte used to access a particular subobject in a CANopen SDO server device.

OFFSET

INT

Two bytes indicating the starting offset into the selected object. It can be non-zero when performing segmented SDO transfers.

NOTE: Not used when addressing an EtherNet/IP module (address with CIP suffix).

NB_IN

INT

Two bytes providing a count of the desired number of data values to be written (in bytes).

DATA_IN

ANY_ARRAY_BYTE

Data to write.

The following table describes the output parameters:

Output parameter

Data type

Description

DONE

BOOL

ON: the operation concludes successfully.

ACTIVE

BOOL

ON: the operation is active.

ERROR

BOOL

ON: the operation is aborted without success.

STATUS

WORD

Provides the error code if an error is detected by the function block.

SDOABORTCODE

DWORD

SDO abort code when STATUS = 16#4007.