READ_SDO: Reading Service Data Object
Original instructions
Function Description
The READ_SDO function block reads (explicit exchange) 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 READ_SDO_Instance (ENABLE := EnableREAD_SDO, ABORT := AbortREAD_SDO, ADDR := DataStructureAddress, NODE := NodeNumber, INDEX := SDOIndex, SUBINDEX := SDOSubIndex, OFFSET := FirstSDO, NB_IN := DataNumberIn, DONE => ReadSDOSuccessful, ACTIVE => ReadSDOActive, ERROR => ReadSDOFaulty, STATUS => ErrorCode, SDOABORTCODE => AbortCode, NB_OUT => DataNumberOut, DATA => SDODataToRead)
ST Representation
Representation:
READ_SDO_Instance (ENABLE := EnableREAD_SDO, ABORT := AbortREAD_SDO, ADDR := DataStructureAddress, NODE := NodeNumber, INDEX := SDOIndex, SUBINDEX := SDOSubIndex, OFFSET := FirstSDO, NB_IN := DataNumberIn, DONE => ReadSDOSuccessful, ACTIVE => ReadSDOActive, ERROR => ReadSDOFaulty, STATUS => ErrorCode, SDOABORTCODE => AbortCode, NB_OUT => DataNumberOut, DATA => SDODataToRead)
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 read (in bytes).
NOTE:
  • If set to 0, the number of data to read is set to the size of the variable associated to the output parameter DATA.
  • When used with the BMECXM0100 module, this input parameter equal 0 whatever the value you set.
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
NB_OUT
INT
Size of data (in BYTES) actually returned in the output parameter DATA.
DATA
ANY_ARRAY_BYTE
Read data.