AXIS_REF

The AXIS_REF data type contains axis information. AXIS_REF is an interface between the PLC and the DRIVE. It is added to MC function blocks as axis reference.

TYPE AXIS_REF :
VAR_INPUT
    PlcToDrive AT %Q* : PLCTODRIVE_AXIS_REF;
    Parameter         : ST_AxisParameter;
END_VAR
VAR_OUTPUT
    DriveToPlc AT %I* : DRIVETOPLC_AXIS_REF;
    WcState    AT %I* : DRIVETOPLC_WCSTATE;
    InfoData   AT %I* : DRIVETOPLC_IFODATA;
    Status            : ST_AxisStatus;
END_VAR
END_TYPE

AXIS_REF elements

Name

Description

PlcToDrive

Data structure that is cyclically exchanged between PLC and DRIVE. The MC function blocks communicate with the DRIVE via this data structure and send control information and commands from the PLC to the DRIVE. The data structure is automatically placed in the output process image of the PLC and must be connected to the input process image of a DRIVE in the TwinCAT development environment.

Parameter

Data structure for parameterization of the axis (type: ST_AxisParameters).

DriveToPlc

Data structure that is cyclically exchanged between PLC and DRIVE. The MC function blocks communicate with the DRIVE via this data structure and receive status information from the DRIVE. The data structure is automatically placed in the input process image of the PLC and must be connected to the output process image of a DRIVE in the TwinCAT System Manager. The DRIVETOPLC structure contains all main state data for an axis such as position, velocity and instruction state. Since data exchange takes place cyclically, the PLC can access the current axis state at any time without additional communication effort.

WcState

Data structure that is cyclically exchanged between PLC and DRIVE and contains the WcState of the DRIVE. The data structure is automatically placed in the input process image of the PLC and must be connected to the output process image of a DRIVE in the TwinCAT development environment (type: DRIVETOPLC_WCSTATE).

InfoData

Data structure that is cyclically exchanged between PLC and DRIVE and contains ADS information for accessing DRIVE parameters. The data structure is automatically placed in the input process image of the PLC and must be connected to the output process image of a DRIVE in the TwinCAT development environment (type: DRIVETOPLC_INFODATA).

Status

Data structure containing additional or processed status information for an axis (type: ST_AxisStatus). This data structure is not refreshed cyclically, but has to be updated through the PLC program. For this purpose MC_ReadStatus or alternatively the action "ReadStatus" of AXIS_REF can be called (see sample).

Sample:

VAR
 Axis1 : AXIS_REF (* axis data structure for Axis-1 *)
END_VAR

(* program code at the beginning of each PLC cycle *)
Axis1.ReadStatus();

(* alternative program code at the beginning of each PLC cycle *)
Axis1();

The call of "ReadStatus" or "Axis1" should be made once at the beginning of each PLC cycle. The current status information can then be accessed in AXIS_REF from the whole PLC program. Within a cycle the status does not change.