ECATReadSDO
Description
This function block reads a 32-bit word from I/O nodes using a CANopen SDO read command. Is is typically used to query the status of inputs.
See EtherCAT Library - SDO for some stats about the execution time .
,
State Diagram
Figure 7-192: ECATReadSdo State Diagram
-
-
This function block uses and reserves the EtherCAT SDO Channel. The SDO Channel will remain reserved until the done output is "true". Therefore, this FB should be called at each cycle until the done output is true. If it is not called at each cycle the rest of SDO communication (the AKD GUI"Graphical User Interface" A GUI is a type of user interface which allows people to interact with a computer and computer-controlled devices Views, for example) will be blocked.
Using this FB in SFC"Sequential function chart" It can be used to program processes that can be split into steps. The main components of SFC are: - Steps with associated actions - Transitions with associated logic conditions - Directed links between steps and transitions P0 or P1 steps is not recommended as these steps are executed only once. If this FB is used in P0 or P1 then it must be used in an SFC N step to ensure the FB completes.
Arguments
Input
Execute | Description | On the rising edgeA rising edge is the transition of a digital signal from low to high. It is also called positive edge of Execute, an SDO read command is issued. The function block only handles one SDO command at a time. If Execute is toggled quickly so that another rising edge occurs before the SDO command has completed, the function block does not issue a second SDO command. |
Data type | BOOL | |
Range | 0, 1 | |
Unit | N/A | |
Default | — | |
Index | Description |
The object directory index of the data to be read. For more details, refer to:
To read/write an SDO object with an index greater than 16#7FFF (32767), the value must be entered in the form |
Data type | INT | |
Range | — | |
Unit | N/A | |
Default | — | |
Subindex | Description |
The sub-index of the object directory variable to be read. For more details, refer to:
To read/write an SDO object with an index greater than 16#7FFF (32767), the value must be entered in the form |
Data type | SINT | |
Range | — | |
Unit | N/A | |
Default | — | |
Size | Description | The size (number of bytes) to write. |
Data type | SINT | |
Range | 1 - 4 | |
Unit | N/A | |
Default | — | |
SlaveAddress | Description |
The EtherCAT address of the slave from which data is written to. The first node usually has the value '1001'. The second node usually has the value '1002'. Alternately, you can use the members of the EtherCAT structure to specify a drive's address when you create the variable.
|
Data type | INT | |
Range | — | |
Unit | N/A | |
Default | — |
Output
Done | Description | Indicates whether the SDO call has completed without error. |
Data type | BOOL | |
Unit | N/A | |
Error | Description | Indicates whether the SDO call has completed with error: |
Data type | BOOL | |
Unit | N/A | |
ErrorID | Description |
The SDO call error result, if Error is TRUE (see list of Error Codes in table below). Upon success, Error is set to zero. |
Data type | DINT | |
Unit | N/A | |
Value | Description | The value of the object directory variable being read. Value is only set when an SDO read command has successfully completed. |
Data type | DINT | |
Unit | N/A |
Table 7-47: List of EtherCAT Error Codes
Related Functions
Example
Structured Text
(* Read PL.KP on first AKD Dr ive on EtherC AT network *) Inst_ECATReadSdo( TRUE, 16#3542, 0, 4, 1001 ); PositionProportionalGain := Inst_ECATReadSdo.Value;
(* Read the 4 byte data in SDO index 8321h (33569 decimal), sub-index 1 on the first AKD Drive Inst_ECATReadSdo( TRUE, any_to_int(16#8321), 1, 4, 1001 ); ParamValue := Inst_ECATReadSdo.Value;
FBD
FFLD