DriveParamRead

PLCopen motion icon Pipe Network motion icon

 Function Block - Reads a drive parameter by sending an ASCII command to a drive.

Inputs

Input

Data Type

Range

Unit

Default

Description

Execute

BOOL

FALSE, TRUE

N/A

No default

On the rising edge of Execute, a drive parameter is read.

  • The function block processes only 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.

Drive

INT

-32768 to +32767

N/A

No default

The address of the drive where data is read.

  • The first node usually has the value 1001.
  • The second node usually has the value 1002.

  • Use the members of the EtherCAT structure to specify a device's address to Create Variables.
       

Param

STRING

No range

N/A

No default

The parameter to read.

Outputs

Output

Data Type

Range

Unit

Description

Done

BOOL

FALSE, TRUE

N/A

Indicates whether this function block has completed without error.

Error

BOOL

FALSE, TRUE

N/A

Indicates whether this function block has completed with error.

ErrorID

DINT

No range

N/A

The DriveParamRead error result if Error is TRUE.

Value

LREAL

No range

N/A

The value of the drive parameter.

Value is only set when the function block has successfully completed.

Units

STRING

No range

N/A

The value of the drive parameter.

Value is only set when the function block has successfully completed.

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 either the Done or Error output is TRUE.
    If it is not called at each cycle, the rest of SDO communication (e.g., the AKD GUI Views) is blocked.
    Using this FB in SFC 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.

Usage

Use this function block to read drive parameters that are not supported by other function blocks.

Examples include:

  • Drive bus voltage
  • Drive display
  • Fault history
  • Motor temperature
  • Present drive limit settings
  • Present regeneration loading
  • 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 if multiple times is required, add code that waits for this function block to complete (e.g., Done bit = 1) before executing it again.
  • See EtherCAT Function Blocks that Work with Drive Parameters about function blocks not supported by ML and MC function blocks.

Figure 1: DriveParamRead

EtherCAT Error Codes

FBD Language Example

FFLD Language Example

IL Language Example

Not available.

ST Language Example

(* 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;

See Also

DriveParamWrite