WARNING: This function cannot be used in a task if the co_send_sdo()/co_asw_sdo() functions are also present in the task.
This function is used to perform writing of fieldbus objects. Writing can be done in pass-through mode or in blocking mode (blocking mode can be used only in tasks 1-:-8).
Pass-through mode means that the function must be continuously called and this returns the current state of the operation.
Blocking mode means that the function is invoked and returns only when it has completed the write operation.
The function returns a result on the state of execution.
Syntax |
i32 co_wobj (stru_co_obj stru) |
---|---|
stru |
Structure name of type stru_co_obj |
Result |
Variable of type i32 containing the result. See pass-through mode and/or blocking mode |
Validity |
Rule, Task |
Note |
•Set stru.phase = 1 to initialize the write •The write command is sent to the remote device and a response is expected. The variable stru.phase is changed. •Waiting for response. •Receiving response with positive result. The value read is written to stru.data. RTE changes stru.phase = 4. •Receive response with negative result. RTE changes stru.phase = 0. o-1, illegal parameters(alarm 9900) o-2, communication handler busy o-3, communication handler crash (restart) o-5, command to a device not present(stru.rid) o-6, no operation running. stru.phase not initialized o2, command already received positive response, value available in stru.data o>2, SDO error code, see table below |
•Set stru.phase = -1 to execute the write •The write command is sent to the remote device and a response is expected. The variable stru.phase is changed •Waiting for response. If the response does not arrive within a maximum of 3 seconds, the function exits with an error (timeout, returns -2) •Receiving response with a positive result. The value read is written to stru.data. RTE changes stru.phase = 4. •Receive response with negative result. RTE changes stru.phase = 0. o-1, illegal parameters (alarm 9900) o-2, communication handler busy o-3, communication handler crash (restart) o-4, blocking mode handling not allowed in current task(stru.phase = 1) (rule, ladder). Command not accepted o-5, command to a device not present(stru.rid) o-6, no task running. stru.phase not initialized o2, command already responded to positively, value available in stru.data o>2, SDO error code, see table below |
|