MC_ReadHardwareParameter

MC_ReadHardwareParameter 1:

This function block allows to read parameters from the hardware drive asynchronously via ADS. The function block supports CoE and SoE drives.

Syntax

Definition:

FUNCTION_BLOCK MC_ReadHardwareParameter
VAR_IN_OUT
    Axis               : Reference To AXIS_REF;
END_VAR
VAR_INPUT
    Execute            : BOOL;
    Index              : UINT;
    SubIndex           : USINT;
    DestinationAddress : PVOID;
    DataSize           : UDINT;
END_VAR
VAR_OUTPUT
    Done               : BOOL;
    Busy               : BOOL;
    Active             : BOOL;
    Error              : BOOL;
    ErrorId            : UDINT;
END_VAR

MC_ReadHardwareParameter 2: Inputs

Name

Type

Default

Description

Execute

BOOL

 

Trigger the command with rising edge.

Index

UINT

0

CoE object index or SoE IDN

SubIndex

USINT

0

CoE sub index or SoE element

DestinationAddress

PVOID

0

Contains the address of the destination buffer.

DataSize

UDINT

0

Contains the size of the destination buffer.

MC_ReadHardwareParameter 3: In/Outputs

Name

Type

Description

Axis

Reference To AXIS_REF

Reference to the axis

MC_ReadHardwareParameter 4: Outputs

Name

Type

Description

Done

BOOL

Value is successfully read from the target.

Busy

BOOL

Function block is not finished.

Active

BOOL

Function block is active.

Error

BOOL

Error occurred within function block.

ErrorId

UDINT

Error identifier

Possible error codes

For this function block, the following values, among others, are possible for the ErrorId output:

Error(Hex)

Error(Dec)

Error type

Description

0x8145

33093

Function Block

Mapping of cyclic interface between NC and PLC is missing (e.g., AXIS_REF, AXES_GROUP_REF, ...). A reference used by the function block (e.g., to an axis, group, mover or other motion object) is not linked to the corresponding NC object, or its cyclic mapping is incomplete.

0x8189

33161

Function Block

Invalid reference passed to function block. An invalid reference (or pointer) was used in a function block call. This can happen if a reference type is used before it was initialized.

0x81b1

33201

Function Block

Invalid size passed to function block (e.g., invalid array size or invalid number of elements). An invalid size was passed to the function block (e.g., CamRef.NumberOfPoints less than two on MC_CamTableSelect).

An overview of all NC error codes can be found here:

In conjunction with the hardware, the ADS return code ADSERR_DEVICE_BUSY (0x708; 1800) may also occur if the device is busy.

You can find an overview of all ADS return codes here:

Version information

  • TwinCAT Standard >= v3.1.4026.23.1
  • TF5500 MC3 Base >= v4.0.6