ECATWriteSDO
Function Block A function block groups an algorithm and a set of private data. It has inputs and outputs. - Writes a 32-bit word to I/O nodes using a CANopen SDO write command.
Inputs
Input |
Data Type |
Range |
Unit |
Default |
Description |
---|---|---|---|---|---|
Execute |
BOOL |
0, 1 |
N/A |
No default |
On the rising edge A 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 is issued.
|
Index |
INT |
No range |
N/A |
No default |
The object directory index of the data to be written to. For more information, see:
To read/write an SDO object with an index greater than 16#7FFF (32767), the value must be entered in this form: Example: |
SubIndex |
SINT |
No range |
N/A |
No default |
The sub-index of the object directory variable to be written to. For more information, see:
To read/write an SDO object with an index greater than 16#7FFF (32767), the value must be entered in this form: Example: |
Size |
SINT |
1 to 4 |
N/A |
No default |
The size (i.e., number of bytes) to write. |
DeviceAddress |
INT |
No range |
N/A |
No default |
The EtherCAT ***EtherCAT is an open, high-performance Ethernet-based fieldbus system. The development goal of EtherCAT was to apply Ethernet to automation applications which require short data update times (also called cycle times) with low communication jitter (for synchronization purposes) and low hardware costs address of the device from which data is written to.
|
Value |
DINT |
-2147483648 to 2147483647 |
N/A |
No default |
The value to write to the object directory variable. |
Outputs
Output |
Data Type |
Range |
Unit |
Description |
---|---|---|---|---|
Done |
BOOL |
No range |
N/A |
Indicates whether this function block has completed without error. |
Error |
BOOL |
No range |
N/A |
Indicates whether this function block has completed with error. |
ErrorID |
DINT |
No range |
N/A |
The SDO call error result, if Error is TRUE.
|
Remarks
-
-
This function block uses and reserves the EtherCAT SDO Channel.
The SDO Channel remains reserved until the done output is TRUE.
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 (e.g., 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) is 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 because 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.
- See the FAQ to set the update rate for SDO communication.
- See EtherCAT Function Blocks that Work with SDOs for information about function blocks which are used to work with drive or remote I/O parameters that are not supported by ML and MC function blocks.
State Diagram
Figure 6-79: ECATWriteSDO State Diagram
EtherCATError Codes
Value Dec (hex) |
Error Code |
Description |
---|---|---|
0 |
ECERR_OK |
The SDO call succeeded. |
1792 (0x700) |
ECERR_DEVICE_ERROR |
EtherCAT device is not accessible. |
1794 (0x702) |
ECERR_DEVICE_INVALIDCMD |
Invalid mailbox command. |
1795 (0x703) |
ECERR_DEVICE_INVALIDINDEX |
An invalid value for the Index input was specified. |
1796 (0x704) |
ECERR_DEVICE_INVALIDACCESS |
Reading of the variable is not permitted. |
1797 (0x705) |
ECERR_DEVICE_INVALIDSIZE |
An invalid size for the parameter was specified. |
1798 (0x706) |
ECERR_DEVICE_INVALIDDATA |
Invalid parameter value(s) in SDO index and/or sub-index. |
1799 (0x707) |
ECERR_DEVICE_NOTREADY |
Device is not in a ready state. The network is not in operational. |
1800 (0x708) |
ECERR_DEVICE_BUSY |
Device is not available to respond. |
1801 (0x709) |
ECERR_DEVICE_INVALIDCONTEXT |
Device responded with an illegal error code, indicating the command is not allowed under the present conditions. |
1802 (0x70A) |
ECERR_DEVICE_NOMEMORY |
EtherCAT mailbox is out of memory or device is out of disk space. |
1803 (0x70B) |
ECERR_DEVICE_INVALIDPARM |
EtherCAT mailbox request was not valid. |
1804 (0x70C) |
ECERR_DEVICE_NOTFOUND |
EtherCAT device not found. |
1805 (0x70D) |
ECERR_DEVICE_SYNTAX |
An unexpected error occurred. |
1810 (0x712) |
ECERR_DEVICE_INVALIDSTATE |
The EtherCAT device is in an invalid state. |
1817 (0x719) |
ECERR_DEVICE_TIMEOUT |
|
1826 (0x722) |
ECERR_DEVICE_INSERTMAILBOX |
Error while inserting the mailbox command into internal FIFO. |
1827 (0x723) |
ECERR_DEVICE_INVALIDOFFSET |
An invalid value for the SubIndex input was specified. |
1828 (0x724) |
ECERR_DEVICE_UNKNOWNMAILBOXCMD |
The master sent an unknown mailbox command to the slave. |
1829 (0x725) |
ECERR_DEVICE_ACCESSDENIED |
Device responded with an invalid access error code, indicating the command is not allowed. |
1832 (0x728) |
ECERR_DEVICE_INVALIDADDR |
The specified EtherCAT node address is invalid. |
1836 (0x72c) |
ECERR_DEVICE_NOT_A_FSOE_MASTER |
Device is not a FSoE master. |
1920 (0x780) |
ECERR_DEVICE_PARAM_ACCESS_ERROR |
Unknown error occurred while accessing parameter. |
1921 (0x781) |
ECERR_DEVICE_PARAM_NOT_FOUND |
Parameter was not found. |
1922 (0x782) |
ECERR_DEVICE_PARAM_NOT_INTEGER |
Parameter is a floating-point value. Integer value required. |
1923 (0x783) |
ECERR_DEVICE_VALUE_IS_NEGATIVE |
No negative values allowed. Value specified was negative. |
1924 (0x784) |
ECERR_DEVICE_VALUE_OUT_OF_RANGE |
Value is out of data-range. |
1925 (0x785) |
ECERR_DEVICE_VALUE_GREATER_THAN_MAX |
Value bigger than maximum. |
1926 (0x786) |
ECERR_DEVICE_VALUE_LOWER_THAN_MIN |
Value lower than minimum. |
2048 (0x800) |
ECERR_CLIENT_ERROR |
Error in Mailbox response to a previously sent mailbox command. |
2049 (0x801) |
ECERR_CLIENT_TIMEOUT |
The SDO command timed out. |
2050 (0x802) |
ECERR_CLIENT_ INVALIDPARM |
An invalid value was specified. |
2051 (0x803) |
ECERR_CLIENT_ INVALIDSIZE |
An invalid value for the size input was specified. |
Figure 6-80: ECATWriteSDO
FBD Language Example
FFLD Language Example
IL Language Example
Not available.
ST Language Example
(* 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 );
See Also