Data type AXIS_REF

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


TYPE AXIS_REF :
VAR_INPUT
PlcToNc    AT %Q* : PLCTONC_AXIS_REF;
END_VAR
VAR_OUTPUT
NcToPlc    AT %I* : NCTOPLC_AXIS_REF;
ADS               : ST_AdsAddress;
Status            : ST_AxisStatus;
END_VAR
END_TYPE

ST_AxisStatus NCTOPLC_AXIS_REF PLCTONC_AXIS_REF

AXIS_REF elements

PlcToNc: PlcToNc is a data structure that is cyclically exchanged between PLC and NC. Via this data structure the MC function blocks communicate with the NC and send control information from the PLC to the NC. This data structure is automatically placed in the output process image of the PLC and must be linked in TwinCAT System Manager with the input process image of an NC axis.

NcToPlc: NcToPlc is a data structure that is cyclically exchanged between PLC and NC. Via this data structure the MC function blocks communicate with the NC and receive status information from the NC. This data structure is automatically placed in the input process image of the PLC and must be linked in TwinCAT System Manager with the output process image of an NC axis.

The NcToPlc 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.

ADS: The ADS data structure contains the ADS communication parameters for an axis that are required for direct ADS communication. Normally this structure does not have to be populated. The user can use it to stored information for controlling an axis on another target system or via a special port number.

Status: The Status data structure contains additional or processed status information for an axis. This data structure is not refreshed cyclically, but has to be updated through the PLC program. The easiest way to achieve this is by calling MC_ReadStatus or, alternatively, by calling the action ReadStatus of AXIS_REF:

Example:


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

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

ReadStatus should be called once at the start 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.