ECATWriteSDO
Description
This function block writes a 32-bit word to I/O nodes using a CANopen SDO write command.
See EtherCAT Library - SDO for some stats about the execution time .
Manufacturer specific SDOs, Object Dictionary
State Diagram
Figure 8-193: ECATWriteSdo 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 write command will be issued. The function block will only handle 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 will 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 written to. 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 written to. 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 will be 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 | — | |
Value | Description | The value to write to the object directory variable. |
Data type | DINT | |
Range | [-2147483648, 2147483648] | |
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 |
Data type | DINT | |
Unit | N/A |
Table 8-48: List of EtherCAT Error Codes
Related Functions
Example
Structured Text
(* Write 58.000 to PL.KP of first AKD D rive on Ethe rCAT network *) Inst_ECATWriteSdo( TRUE, 16#3542, 0, 4, 1001, 58000 );
(* Write a value of 246 to the 4 byte data in SDO index 8321h (33569 decimal), sub-index 1 on the first AKD Drive *) Inst_ECATWriteSdo( TRUE, any_to_int(16#8321), 1, 4, 1001, 246 );
FBD
FFLD
See also the FAQ to set the update rate for SDO communication.