Skip to content

SDO_WRITE


The SDO_WRITE function is used in the CANopen protocol to write data to a specific object in the Object Dictionary of a target node (server). It requires inputs such as INTERFACEID (identifier of the interface), NODEID (identifier of the target node), INDEX (index of the object in the Object Dictionary), SUBINDEX (sub-index of the object, if applicable), DATA (data to be written), DATASIZE (size of the data being written), TIMEINTERVAL (time-related parameter for waiting or timing purposes), and EVENTINPUT (input for triggering the function). The function writes the specified data to the target object in the Object Dictionary and provides outputs such as ERROR (indicating any error condition that may occur during the operation) and STATE (representing the current state of the function block, such as “Completed” or “Success”).

INPUTS

INTERFACE_ID: This input represents the identifier of the interface used in the CANopen network. In CANopen protocol, systems that use multiple interfaces can specify which interface to operate on using the INTERFACE_ID input.

NODE_ID: This input represents the identifier of the target node (server) to which the data will be written. In a CANopen network, each device (sensor, actuator, controller, etc.) has a unique identifier, and the NODEID input determines which node the SDOWRITE command will be sent to.

INDEX: This input represents the index of the object in the Object Dictionary of the target node where the data will be written. The Object Dictionary is a standardized data structure used in CANopen to organize and store objects (such as variables, parameters, or configuration data) in a device.

SUB_INDEX: This input represents the sub-index of the object in the Object Dictionary of the target node, if applicable. Some objects in the Object Dictionary may have sub-indices to further specify a specific part or element of the object.

DATA: This input represents the data that will be written to the specified object in the Object Dictionary of the target node. The format and size of the data depend on the object being written and its definition in the Object Dictionary.

DATA_SIZE: This input represents the size or length of the data being written. It is usually expressed in bytes or bits, depending on the specific CANopen implementation or device.

TIME_INTERVAL: This input represents a time-related parameter and can be used for waiting or timing purposes for a specific duration. For example, if the SDOWRITE command needs to be sent after a certain time interval, the TIMEINTERVAL input can be used to specify that time interval.

EVENT_INPUT: This input represents the status of an object or an event. For example, in case of detecting an error condition or when an event occurs, the EVENTINPUT input can be triggered and used to initiate the SDOWRITE operation.

OUTPUTS

ERROR: This output represents the error condition of the SDOWRITE function. For example, in case of a communication error, object not found, or other errors, the ERROR output may become active to indicate the failure of the SDOWRITE operation.

STATE: This output represents the current state of the function block. For example, in case of successful completion of the SDO_WRITE operation, the STATE output may represent a specific state such as “Completed” or “Success”.