MC_ReadStatus

MC_ReadStatus 1:

MC_ReadStatus determines the current operating state of an axis and signals it at the function block outputs.

The updated operating state is additionally stored in the Status output data structure and in the Axis.Status axis data structure. This means the operating state only has to be read once at the start of each PLC cycle and can then be accessed via Axis.Status.

MC_ReadStatus 2:

The Axis variable (type AXIS_REF) already includes an instance of the function block MC_ReadStatus. This means that the operating state of an axis can be updated at the start of a PLC cycle by calling up Axis.ReadStatus.

Sample:


PROGRAM MAIN
VAR
Axis1   : AXIS_REF
END_VAR

(* call the read status function *)
Axis1.ReadStatus;

Inputs


VAR_INPUT
Enable  : BOOL;
END_VAR

Enable

As long as Enable = TRUE, the axis operating state is updated with each call of the function block.

General rules for MC function blocks

Outputs


VAR_OUTPUT
Valid               : BOOL;
Busy                : BOOL;
Error               : BOOL;
ErrorId             : UDINT;
(* motion control statemachine states: *)
ErrorStop           : BOOL;
Disabled            : BOOL;
Stopping            : BOOL;
StandStill          : BOOL;
DiscreteMotion      : BOOL;
ContinuousMotion    : BOOL;
SynchronizedMotion  : BOOL;
Homing              : BOOL;
(* additional status *)
ConstantVelocity    : BOOL;
Accelerating        : BOOL;
Decelerating        : BOOL;
(* status data structure *)
Status              : ST_AxisStatus;
END_VAR

Valid

Indicates that the axis operating state indicated at the other outputs is valid.

Busy

Indicates that the function block is active.

Error

Becomes TRUE if an error occurs.

ErrorID

If the error output is set, this parameter supplies the error number

ErrorStop

Axis status according to the PlcOpen state diagram

Disabled

Axis status according to the PlcOpen state diagram

Stopping

Axis status according to the PlcOpen state diagram

StandStill

Axis status according to the PlcOpen state diagram

DiscreteMotion

Axis status according to the PlcOpen state diagram

ContinousMotion

Axis status according to the PlcOpen state diagram

SynchronizedMotion

Axis status according to the PlcOpen state diagram

Homing

Axis status according to the PlcOpen state diagram

ConstantVelocity

The axis is moving with constant velocity

Acceleration

The axis accelerates.

Decelerating

The axis decelerates.

Status

Extended status data structure with additional status information.

General rules for MC function blocks

Inputs/outputs


VAR_IN_OUT
Axis    : AXIS_REF;
END_VAR

Axis

Axis data structure

The axis data structure of type AXIS_REF addresses an axis unambiguously within the system. Among other parameters it contains the current axis status, including position, velocity or error state.