Y_EC_COE_SdoRead
The function block provides the user program with an accessor to read SDO data from the EtherCAT(CoE) slave or master object dictionary. The data is accessed by object index and sub-index.
Parameters
| * | Parameter | Data Type | Description | Default |
|---|---|---|---|---|
| VAR_IN_OUT | ||||
| E | Record | ANY | Provides the data read. The Length output indicates the number of bytes read. | |
| VAR_INPUT | ||||
| B | Execute | BOOL | Upon the rising edge of the Execute input, all other inputs are read and the function block becomes operational. If an input needs to be modified, the value will have to be changed and the Execute input will have to be re-triggered. | FALSE |
| E | NetworkID | WORD | Network ID of the EtherCATmaster. A value of 0 is not allowed and will be treated as the default (1). | WORD#1 |
| E | StationAddress | WORD | EtherCATstation address of the slave/master. The EtherCATMaster has StationAddress 0. | WORD#0 |
| E | Index | WORD | Index of the object that is to be read | WORD#0 |
| E | Subindex | BYTE | Subindex of the object that is to be read | BYTE#0 |
| E | MaxLength | UDINT | Maximum number of bytes which are to be read from the object. The variable connected to the VAR_IN_OUT Record must have at least this length, otherwise an error message will be generated. If a value of 0 is passed, then the full size of the connected VAR_IN_OUT Record data type is used by default. | UDINT#0 |
| E | Timeout | UINT | Timeout value in ms. A value of 0 is not allowed and will be treated as the default (5000). | UINT#5000 |
| E | CompleteAccess | BOOL | This parameter defines whether only a single sub-index, or the entire object is to be read. | FALSE |
| VAR_OUTPUT | ||||
| B | Done | BOOL | The Done output is set to TRUE when the commanded action has completed successfully. If another function block takes control before the action is completed, the Done output will never become TRUE. This output is reset when Execute becomes FALSE. | |
| B | Busy | BOOL | For function blocks with Execute input, the Busy output is set to TRUE upon the rising edge of the Execute, and set to FALSE when Done, CommandAborted or Error outputs becomes TRUE. In the case of a function block with an Enable input, Busy indicates that the function block is operating, but may not be ready to provide valid outputs. | |
| B | Error | BOOL | The Error output is set to TRUE if an error has occurred during the operation of the function block. The output is cleared when the Execute or Enable input becomes FALSE. | |
| E | ErrorID | UINT | The ErrorID output provides the identifier of the error when there is an active error in the function block execution. The output is cleared when the Execute or Enable input becomes FALSE. | |
| E | Length | UDINT | Length of the read data in number of bytes | |
Notes
- The FB supports a timeout mechanism for SDO access
- The timeout starts when the Execute input'srising edge is triggered
- The timeout can be set via the TimeOut input on the FB
- When the time has elapsed the controller stops trying to perform the read and returns an error code.
- All Input and In-Output values are read in the FB call with the rising edge of Execute. If a command is ongoing a change of the input has no influence.
- Simultaneous read/write commands to the same object results in undefined behaviour. It may be read the old data or the newly written data
- There can be multiple instances of this FB. If the internal queue is full, the ErrorID14319 is returned and the last request must be repeated.
Error Description
See the Function Block ErrorID List.
- Error IDs in the range 14250-14299 indicate errors with the internal function operation.
- Error IDs in the range 14300-14500 indicate errors reported by the underlying EtherCATstack.
- In particular, Error IDs in the range 14364-14394 and 14417-14420 describe SDO abort codes returned by the slave.
Example 1
In the following example we want to read the value of the speed loop gain.
The station address of the device can be found in the settings tab of the servo-node:
The index of the parameter can be found in the CoE Data tab of the servo-node:
The value of 400 is read from the ServoPack:
Example 2
Y_EC_COE_SdoRead can also be helpful to collect monitor information from SERVOPACKs.
Sigma-X has added "Sensing Data Monitor" objects to allow access to information commonly found in the Monitor section of SigmaWin+.
In the Sigma-X manual these new object are found under 2770h, 2771h,2772h.
The example below will show how to monitor the DC Bus Voltage of the SERVOPACK.
In SigmaWin+ the value is currently 343V.
The "Main circuit DC Voltage" is Index 2770h, Subindex 3, and Data Type INT.
Configure the Y_EC_COE_SdoRead with the object information for that monitor and have a variable for the Record that matches the data type of the object.