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 reading of fieldbus objects. The read can be done in pass-through mode or in blocking mode (usable only in tasks 1-:-8).
Pass-through mode means that the function must be continuously called and simultaneously tested the current status of the task.
Blocking mode means that the function is invoked and returns only when it has completed the read operation.
The function returns a result on the state of execution.
Syntax |
i32 co_robj (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 management |
Validity |
Task, Rule (pass-through only) |
Note |
•Set stru.phase = 1 to initialize the read •The read command is sent to the remote device and a response is expected. The variable stru.phase is changed. •Waiting for response. •Receives 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 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 on date o>2, SDO error code, see table below |
•Set stru.phase = -1 to initialize the read •The read 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) •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 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 |
Example of use:
|