DriveParamRead
Description
This function block reads a drive parameter by sending an ASCII command to a drive.
See EtherCAT Function Blocks That Work With Drive Parameters for information about function blocks which work with drive parameters that are not supported by ML and MC function blocks.
It takes multiple cycles to complete this function block. Typically only one DriveParamRead or DriveParamWrite function should be active for each axis at one time. If executing this function block continuously or multiple times is required, add code that waits for this function block to complete (Done bit = 1) before executing it again, as shown in the example below.
See also some stats about the Execution Time.
-
-
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 edge A rising edge is the transition of a digital signal from low to high. It is also called positive edge of Execute, a drive parameter is read. The function block only handles one request at a time. If Execute is toggled quickly so that another rising edge occurs before the function block has completed, the function block does not issue a second read command. |
Data type |
BOOL |
|
Range |
0, 1 |
|
Unit |
N/A |
|
Default |
— |
|
Drive |
Description |
The address of the drive from which data is read. 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 |
— |
|
Param |
Description |
The parameter to read. |
Data type |
STRING |
|
Range |
— |
|
Unit |
N/A |
|
Default |
— |
Output
Done |
Description |
Indicates whether the DriveParamRead function block has completed without error. |
Data type |
BOOL |
|
Unit |
N/A |
|
Error |
Description |
Indicates whether the DriveParamRead function block call has completed with error: |
Data type |
BOOL |
|
Unit |
N/A |
|
ErrorID |
Description |
The DriveParamRead 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 drive parameter. Value is only set when the function block has successfully completed. |
Data type |
LREAL |
|
Unit |
N/A |
|
Units |
Description |
The units of the drive parameter. Value is only set when the function block has successfully completed. |
Data type |
STRING |
|
Unit |
N/A |
Table 7-45: List of EtherCAT Error Codes
Usage
Use this FB to read drive parameters that are not supported by other function blocks. Examples would be motor temperature, drive bus voltage, Present drive limit settings, present regen loading, drive display, and fault history.
Related Functions
Example
Structured Text
(* Read PL.KP on first AKD Drive on EtherCAT network *)
(* The code continually calls the FB (without re-executing it) until the first execution is done, then reads the returned value from the drive and reset the FB *)
IF ReadPropGain then
Inst_DriveParamRead1( 1, 1001, 'PL.KP' );
End_If;
On Inst_DriveParamRead1.Done do
Inst_DriveParamRead1( 0, 1001, 'PL.KP' );
PositionProportionalGain := Inst_DriveParamRead1.Value; (* Reads the returned value from the drive *)
ReadPropGain := 0; (* Reset the FB *)
End_DO;
FBD
FFLD