NC->PLC axis interface (128 bytes)
TYPE NCTOPLC_AXLESTRUCT
TYPE NCTOPLC_AXLESTRUCT
STRUCT
nStateDWord : DWORD; (* Status double word *)
nErrorCode : DWORD; (* Axis error code *)
nAxisState : DWORD; (* Axis moving status *)
nAxisModeCon : DWORD; (* Axis mode confirmation (feedback from NC) *)
nCalibrationState : DWORD; (* State of axis calibration (homing) *)
nCoupleState : DWORD; (* Axis coupling state *)
nSvbEntries : DWORD; (* SVB entries/orders (SVB = Set preparation task) *)
nSafEntries : DWORD; (* SAF entries/orders (SAF = Set execution task *)
nAxisId : DWORD; (* Axis ID *)
nOpModeDWord : DWORD; (* Current operation mode *)
nReserved2_HIDDEN : DWORD; (* reserved *)
fPosIst : LREAL; (* Actual position (absolut value from NC) *)
fModuloPosIst : LREAL; (* Actual position as modulo value (e.g. in degrees) *)
nModuloTurns : DINT; (* Actual modulo turns *)
fVeloIst : LREAL; (* Actual velocity (optional) *)
fPosDiff : LREAL; (* Position difference (lag distance) *)
fPosSoll : LREAL; (* Setpoint position *)
fVeloSoll : LREAL; (* Setpoint velocity *)
fAccSoll : LREAL; (* Setpoint acceleration, OLD: "fReserve1_HIDDEN" *)
fReserve2_HIDDEN : LREAL; (* reserved *)
fReserve3_HIDDEN : LREAL; (* reserved *)
fReserve4_HIDDEN : LREAL; (* reserved *)
END_STRUCT
END_TYPE
TYPE NCTOPLC_AXLESTRUCT2
TYPE NCTOPLC_AXLESTRUCT2
STRUCT
nStateDWord : DWORD; (* Status double word *)
nErrorCode : DWORD; (* Axis error code *)
nAxisState : DWORD; (* Axis moving status *)
nAxisModeCon : DWORD; (* Axis mode confirmation (feedback from NC) *)
nCalibrationState : DWORD; (* State of axis calibration (homing) *)
nCoupleState : DWORD; (* Axis coupling state *)
nSvbEntries : DWORD; (* SVB entries/orders (SVB = Set preparation task) *)
nSafEntries : DWORD; (* SAF entries/orders (SAF = Set execution task *)
nAxisId : DWORD; (* Axis ID *)
nOpModeDWord : DWORD; (* Current operation mode *)
nActiveControlLoopIndex : WORD; (* Active control loop index (equivalent to old variable "nCtrlLoopIndex") *)
nControlLoopIndex : WORD; (* Axis control loop index (0, 1, 2, … when multiple control loops are used) *)
fPosIst : LREAL; (* Actual position (absolut value from NC) *)
fModuloPosIst : LREAL; (* Actual position as modulo value (e.g. in degrees) *)
nModuloTurns : DINT; (* Actual modulo turns *)
fVeloIst : LREAL; (* Actual velocity (optional) *)
fPosDiff : LREAL; (* Position difference (lag distance) *)
fPosSoll : LREAL; (* Setpoint position *)
fVeloSoll : LREAL; (* Setpoint velocity *)
fAccSoll : LREAL; (* Setpoint acceleration, OLD: "fReserve1_HIDDEN" *)
fPosTarget : LREAL; (* Estimated target position *)
fModuloPosSoll : LREAL; (* Setpoint modulo position (e.g. in degrees) *)
nModuloTurnsSoll : DINT; (* Setpoint modulo turns *)
nCmdNo : WORD; (* Continuous actual command number *)
nCmdState : WORD; (* Command state *)
END_STRUCT
END_TYPE
No. | Data type | Byte | Bit | Def.-Range | Variable name | Variable name | Description |
---|---|---|---|---|---|---|---|
1 | UINT32 | 0-3 | - | - | nStateDWord | StateDWord | State double word. |
|
|
| 0 | 0/1 | Operational | Operational | Axis is ready for operation |
|
|
| 1 | 0/1 | Homed | Homed | Axis is referenced ("axis calibrated") |
|
|
| 2 | 0/1 | NotMoving | NotMoving | Axis is logically stationary ("Axis not moving") |
|
|
| 3 | 0/1 | InPositionArea | InPositionArea | Axis is in position window (physical feedback) |
|
|
| 4 | 0/1 | InTargetPosition | InTargetPosition | Axis is at target position (PEH) (physical feedback) |
|
|
| 5 | 0/1 | Protected | Protected | Axis is in protected operation mode (e.g. slave axis) |
|
|
| 6 | 0/1 | ErrorPropagationDelayed | ErrorPropagationDelayed | Axis signals a preliminary error warning (from TC 2.11) |
|
|
| 7 | 0/1 | HasBeenStopped | HasBeenStopped | Axis has been stopped or is presently executing a stop |
|
|
| 8 | 0/1 | HasJob | HasJob | Axis has job, is executing job |
|
|
| 9 | 0/1 | PositiveDirection | PositiveDirection | Axis moving to logically larger values |
|
|
| 10 | 0/1 | NegativeDirection | NegativeDirection | Axis moving to logically smaller values |
|
|
| 11 | 0/1 | HomingBusy | HomingBusy | Axis is referencing ("axis is being calibrated") |
|
|
| 12 | 0/1 | ConstantVelocity | ConstantVelocity | Axis has reached its constant velocity or rotary speed |
|
|
| 13 | 0/1 | Compensating | Compensating | Section compensation passive[0]/active[1] (see MC_MoveSuperImposed) |
|
|
| 14 | 0/1 | ExtSetPointGenEnabled | ExtSetPointGenEnabled | Enable external setpoint generation |
|
|
| 15 | 0/1 |
|
| Operation mode not yet executed (Busy). Not yet released! |
|
|
| 16 | 0/1 | ExternalLatchValid | ExternalLatchValid | External latch value or measuring probe has become valid |
|
|
| 17 | 0/1 | NewTargetPos | NewTargetPos | Axis has received a new end position or a new velocity |
|
|
| 18 | 0/1 |
|
| Axis not in target position or cannot/will not reach it (e.g. axis stop). Not yet released! |
|
|
| 19 | 0/1 | ContinuousMotion | ContinuousMotion | Axis executing endless positioning task |
|
|
| 20 | 0/1 | ControlLoopClosed | ControlLoopClosed | Axis ready to operate and axis control loop closed (e.g. position control) |
|
|
| 21 | 0/1 | CamTableQueued | CamTableQueued | New table ready for "Online Change" and waiting for activation |
|
|
| 22 | 0/1 | CamDataQueued | CamDataQueued | Table data (MF) ready for "Online Change" and waiting for activation |
|
|
| 23 | 0/1 | CamScalingPending | CamScalingPending | Table scalings ready for "Online Change" and waiting for activation |
|
|
| 24 | 0/1 | CmdBuffered | CmdBuffered | Follow-up command is available in the command buffer (see BufferMode) (from TwinCAT V2.10 Build 1311) |
|
|
| 25 | 0/1 | PTPmode | PTPmode | Axis in PTP operating mode (no slave, no NCI axis, no FIFO axis) (from TC 2.10 Build 1326) |
|
|
| 26 | 0/1 | SoftLimitMinExceeded | SoftLimitMinExceeded | Software minimum end position is active/occupied (from TC 2.10 Build 1327) |
|
|
| 27 | 0/1 | SoftLimitMaxExceeded | SoftLimitMaxExceeded | Software maximum end position is active/occupied (from TC 2.10 Build 1327) |
|
|
| 28 | 0/1 | DriveDeviceError | DriveDeviceError | Drive hardware has an error (no warning); interpretation possible only if drive is in I/O data exchange. e.g. EtherCAT "OP" state (from TC 2.10 Build 1326) |
|
|
| 29 | 0/1 | MotionCommandsLocked | MotionCommandsLocked | Axis is blocked for motion commands (TcMc2) |
|
|
| 30 | 0/1 | IoDataInvalid | IoDataInvalid | I/O data invalid (e.g. "WcState" or "CdlState" of the fieldbus) |
|
|
| 31 | 0/1 | Error | Error | Axis is in an error state |
|
|
|
|
|
|
|
|
2 | UINT32 | 4-7 | - | ≥0 | nErrorCode | ErrorCode | Axis error code |
3 | UINT32 | 8-11 | - | ENUM | nAxisState | AxisState | Present state of the axis movement |
4 | UINT32 | 12-15 | - | ENUM | nAxisModeCon | AxisModeConfirmation | Axis operating mode (feedback from the NC) |
5 | UINT32 | 16-19 | - | ENUM | nCalibrationState | HomingState | Reference status of the axis ("calibration status") |
6 | UINT32 | 20-23 | - | ENUM | nCoupleState | CoupleState | Axis coupling state |
7 | UINT32 | 24-27 | - | ≥0 | nSvbEntries | SvbEntries | SPP entries/tasks |
8 | UINT32 | 28-31 | - | ≥0 | nSafEntries | SafEntries | SEC entries/tasks (NC interpreter, FIFO group) |
9 | UINT32 | 32-35 | - | >0 | nAxisId | AxisId | Axis ID |
10 | UINT32 | 36-39 | - | - | nOpModeDWord, | OpModeDWord, | Axis operation mode double word |
|
|
| 0 | 0/1 | PosAreaMonitoring | ...PosAreaMonitoring | Position range monitoring |
|
|
| 1 | 0/1 | TargetPosMonitoring | ...TargetPosMonitoring | Target position window monitoring |
|
|
| 2 | 0/1 | Loop | ...Loop | Looping distance |
|
|
| 3 | 0/1 | MotionMonitoring | ...MotionMonitoring | Physical motion monitoring |
|
|
| 4 | 0/1 | PEHTimeMonitoring | ...PEHTimeMonitoring | PEH time monitoring |
|
|
| 5 | 0/1 | BacklashComp | ...BacklashComp | Backlash compensation |
|
|
| 6 | 0/1 | DelayedErrorReaction | ...DelayedErrorReaction | Delayed error reaction of the NC |
|
|
| 7 | 0/1 | Modulo | ...Modulo | Modulo axis (modulo display) |
|
|
| 8-15 | 0/1 |
|
| RESERVE |
|
|
| 16 | 0/1 | PosLagMonitoring | ...PosLagMonitoring | Lag monitoring - position |
|
|
| 17 | 0/1 | VeloLagMonitoring | ...VeloLagMonitoring | Lag monitoring - velocity |
|
|
| 18 | 0/1 | SoftLimitMinMonitoring | ...SoftLimitMinMonitoring | End position monitoring min. |
|
|
| 19 | 0/1 | SoftLimitMaxMonitoring | ...SoftLimitMaxMonitoring | End position monitoring max. |
|
|
| 20 | 0/1 | PosCorrection | ...PosCorrection | Position correction ("Measuring system error compensation") |
|
|
| 21 | 0/1 | AllowSlaveCommands | ...AllowSlaveCommands | Allow motion commands to slave axes |
|
|
| 22 | 0/1 |
|
| RESERVE |
|
|
| 23 | 0/1 | ApplicationRequest | ApplicationRequest | Request bit for the application software (PLC code), e.g. for an "ApplicationHomingRequest" from TwinCAT V2.11 Build 1546 |
|
|
| 24-31 | 0/1 |
|
| RESERVE |
11 | UINT16 | 40-41 | - | ≥0 | nActiveControlLoopIndex | ActiveControlLoopIndex | Active axis control loop index (identical with old variable "nCtrlLoopIndex") from TwinCAT V2.10 Build 1311 |
12 | UINT16 | 42-43 | - | ≥0 | nControlLoopIndex | ControlLoopIndex | Axis control loop index (0, 1, 2, if more than one axis control loop is used) from TwinCAT V2.10 Build 1311 |
13 | REAL64 | 44-51 | - | ±∞ | fPosIst | ActPos | Actual position (calculated absolute value) |
14 | REAL64 | 52-59 | - | >∞ | fModuloPosIst | ModuloActPos | Modulo actual position (calculate value in, for example, degrees) |
15 | INT32 | 60-63 | - | ±∞ | nModuloTurns | ModuloActTurns | Modulo actual rotations |
16 | REAL64 | 64-71 | - | ±∞ | fVeloIst | ActVelo | Actual velocity (optional) |
17 | REAL64 | 72-79 | - | ±∞ | fPosDiff | PosDiff | Lag error (position) |
18 | REAL64 | 80-87 | - | ±∞ | fPosSoll | SetPos | Set position (calculated absolute value) |
19 | REAL64 | 88-95 | - | ±∞ | fVeloSoll | SetVelo | Set velocity |
20 | REAL64 | 96-103 | - | ±∞ | fAccSoll | SetAcc | Set acceleration |
21 | REAL64 | 104-111 | - | ±∞ | fPosTarget | TargetPos | Estimated target position of the axis from TwinCAT V2.10 Build 1311 |
22 | REAL64 | 112-119 | - | >∞ | fModuloPosSoll | ModuloSetPos | Modulo set position (calculate value in, for example, degrees) from TwinCAT V2.10 Build 1311 |
23 | INT32 | 120-123 | - | ±∞ | nModuloTurnsSoll | ModuloSetTurns | Modulo set rotations from TwinCAT V2.10 Build 1311 |
24 | UINT16 | 124-125 | - | ≥0 | nCmdNo | CmdNo | Command number of the active axis job (see BufferMode) from TwinCAT V2.10 Build 1311 |
25 | UINT16 | 126-127 | - | ≥0 | nCmdState | CmdState | Command status information (see Buffer Mode) from TwinCAT V2.10 Build 1311 |

Description of the contents of the individual fields:
Define | Referencing state of the axis (nCalibrationState or HomingState) |
---|---|
0 | Referencing process completed (READY) |
1 | Continuous start in the direction of the referencing cam. Info: If the cam is occupied at the beginning, then the program starts directly with referencing status 3. |
2 | Wait for positive edge of the referencing cam and initiate axis stop |
3 | Wait until the axis is stopped (check whether cam is still occupied) and then endless start of the referencing cam in the direction of the sync pulse |
4 | Wait for falling edge of the referencing cam |
5 | Activate latch, wait until latch has become valid and then initiate axis stop |
6 | If axis has stopped, then set actual position (actual position = reference position + braking distance) |
See also: Notes on MC_Home
Define | Coupling state of the axis (nCoupleState or CoupleState) |
---|---|
0 | Single axis that is neither a master nor a slave (SINGLE) |
1 | Master axis with any number of slaves (MASTER) |
2 | Slave axis that is the master of another slave (MASTERSLAVE) |
3 | Slave axis only (SLAVE) |
Define | Master: motion state / travel phase of the continuous master axis (servo) (nAxisState or AxisState) |
0 | Setpoint generator not active (INACTIVE) |
1 | Setpoint generator active (RUNNING) |
2 | Velocity override is zero (OVERRIDE_ZERO) |
3 | Constant velocity (PHASE_VELOCONST) |
4 | Acceleration phase (PHASE_ACCPOS) |
5 | Deceleration phase (PHASE_ACCNEG) |
Define | Master: motion state / travel phase of the discrete master axis (rapid/creep) (nAxisState or AxisState) |
0 | Setpoint generator not active |
1 | Travel phase (rapid or slow traverse) |
2 | Switchover delay from rapid to slow traverse |
3 | Creep motion (within the creep distance) |
4 | Deceleration time (starting from the braking distance in front of the target) |
Define | Slave: motion state / travel phase of the continuous slave axis (servo) (nAxisState or AxisState) |
0 | Slave generator not active (INACTIVE) |
11 | Slave is in a movement pre-phase (PRE-PHASE) |
12 | Slave is synchronizing (SYNCHRONIZING) |
13 | Slave is synchronized and moves synchronously (SYNCHRON) |
Requirements
Development environment | Target platform | PLC libraries to include |
---|---|---|
TwinCAT v2.7.0 | PC (i386) | PlcNc.Lib |
TwinCAT v2.8.0 | PC (i386) | TcNC.Lib |