Axis control loop

TwinCAT NC Axes

轴控制回路

标准轴控制回路（伺服驱动）

高级轴控制回路（伺服驱动）

带电流/力矩接口的简化位置与速度控制回路（伺服驱动）

带电流/扭矩接口的高级位置与速度控制回路（伺服驱动）


Servo-Achsen

TwinCAT NC Axes

伺服轴

概述

Normal

接口

Normal

组件

Normal

电压输出

Normal

操作模式

Normal


High/low speed axes

The TwinCAT high speed/low speed axis type (two speed) allow the positioning of a high speed/low speed axis. Such a high speed/ low speed axis can be physically made up of a motor with two speeds (switching of the pole pair numbers), or alternatively by a motor that can be driven at two speeds with the help of a frequency converter.

The typical positioning of such an axis is first of all made at high speed up to a parameterization distance away from the target position (creep distance in pos. or neg. direction). From this position you switch to low speed, so that the physical speed (actual speed) is reduced to a slower constant speed. The slow speed is then also switched off at a closer distance from the target (braking distance) and the stop brake is then activated after a parameterized time (delay time for brake incidence).

This particular positioning sequence is for the sole purpose of ensuring that the axis reaches its target position in the most accurate and repeatable way.

In case a positioning inaccuracy occurs depending on the last physical direction of travel (typical effect of a backlash), then a loop movement is activated. This loop movement has the effect that the target position is always approached from the same direction thus reducing the backlash influence. In case of an axis stop basically the same sequence is run through as for positioning without loop movement. However the priority for an axis stop lies on a shorter braking distance or time and not on the positioning accuracy. There is the separate parameter (loop movement for stop) for stopping in the shortest possible distance.

General

  • There are 2 equal possibilities available for the physical control of the axis, in the form of discrete travel signals.
    • Use of the 6 bits in ControlByte
      bMinusHigh | High speed, negative direction
      bMinusLow | Low speed, negative direction
      bPlusHigh | High speed, positive direction
      bPlusLow | Low speed, positive direction
      bBreak | Braking bit
      bBreakInv | Inverted braking bit
    • Use of the 6 bits in ExtControlByte
      bDirectionMinus | Negative direction
      bDirectionPlus | Positive direction
      bVeloLow | Low speed
      bVeloHigh | High speed
      bBreak | Braking bit
      bBreakInv | Inverted braking bit
  • A master-slave coupling is not possible with high/low speed axis.
  • An axis start will only be initiated if the distance from the target point is in fact larger than the parameterised braking distance.

Speed and override

IO configuration: Drive interface for high/low speed axes NC->IO (12 bytes)

高速/低速轴参数

Parameter | Description
Low speed distance, pos. direction | The low speed distance in the positive direction gives the distance to the target position, below which the speed changes from high to low, if the direction of travel is positive. If a loop movement is selected then this distance is based on the movement reversal point. This distance is denoted by Δp1 in positioning example 1.
Low speed distance, neg. direction | The low speed distance in the negative direction gives the distance to the target position, below which the speed changes from high to low, if the direction of travel is negative. If a loop movement is selected then this distance is based on the movement reversal point.
Braking distance, pos. direction | The braking distance in the positive direction gives the distance to the target position, below which the low speed is switched off, if the direction of travel is positive. This distance is denoted by Δp2 in positioning example 1.
Braking distance, neg. direction | The braking distance in the negative direction gives the distance to the target position, below which the low speed is switched off, if the direction of travel is negative.
Brake incidence delay time in pos. direction | This delay time gives the switch-on delay of the brakes after switching off of the low speed, if the direction of travel is positive. In the positioning example 1 this time lies between points T4 and T 5.
Brake incidence delay time in neg. direction | This delay time gives the switch-on delay of the brakes after switching off of the low speed, if the direction of travel is negative.
High-to-low speed delay time | This waiting time is between the switching off of the high speed and switching on of the low speed. In the positioning example 1 this time lies between points T2 and T 3.
Low speed distance for stop | The low speed distance for stop gives the distance that is covered with the low speed after calling up the stop. This low speed distance is usually selected shorter than the low speed distances in positive and negative direction, since the axis should stop as soon as possible and the exact positioning is not a priority. This distance is denoted by Δp1 in positioning example 3.
Brake enable delay | The brake is released immediately the axis is started and after elapse of the brake enable delay either the high or low speed is activated depending on the displacement. In the positioning example 1 this time lies between points T0 and T 1.
Pulse time in positive direction | This parameter is not evaluated at present (TC 2.9, Build 947).
Pulse time in negative direction | This parameter is not evaluated at present (TC 2.9, Build 947).

Parameter | Description
OPERATING MODE: Loop movement | The loop movement can be activated with this flag. The loop movement is for approaching the target position always from the same direction. In the case of a positive (negative) loop movement a target position in the positive (negative) direction is increased by the amount of the loop movement and the target then approached from the opposite direction. Consequently the target position in case of a positive loop movement is always approached with negative speed and a negative loop movement with positive speed.
Loop movement (+ / -) | The amount of loop movement gives the distance, by which the target position is exceeded if necessary so that it is possible to move to the target position from the required direction. This distance is denoted by creep distance (loop movement) in positioning example 2.

Axis movement state (nAxisState in cyclic interface):

nAxisState | Description
0 | Set value generator not active
20 | Axis stopped
21 | Main travel phase: High or low speed travel in relation to the start speed and override
22 | Braking phase: High-to-low speed delay time active
23 | Braking phase: Low speed travel
24 | Braking phase: Delay time for brake incidence active

1) without loop movement

2) with loop movement

Positioning examples:

1) Positioning A → B, without loop movement

2) Positioning A → B, with loop movement > 0.0

3) Stop call up in case of active positioning


Stepper motor axes

The basic version of the 'stepper motor axis' is operated without physical encoder. This means that there is no physical feedback of the actual position. Due to the operating principle of the stepper motor the number of steps made is exactly the same as the pulses output and hence the step counter can be used as a pseudo encoder. When doing so, please be aware that this relationship is lost in case of motor overloading. The diagram below shows the relationship between torque and drift angle.

Diagram 1: Dependency of relative torque (M/Mmax) on drift angle.

Note: The angle details relate to a complete pulse cycle. The area displayed represents 3.6 degrees on the motor shaft for a motor with 200 pulses at full stepping operation.

If the motor has to provide torque when stopped or moving then the rotor is pushed away from the torque-free ideal position by a corresponding angle. This corresponds to the relationship of a non-linear spring in the drive train. Apart from the resulting position deviation of the driven machine part this is unproblematic as long as the upper and lower vertex are not reached. In this case the motor torque drops and the remaining load torque continues to push the motor. The motor is then not able to return to the correct angel and runs through a complete polling cycle. Only then is there a chance that the magnetic fields from rotor and stator interlock solidly. However this only leads to a stable relationship if the load moment at this point in time is significantly below the motor torque. In this case the motor has then moved by complete cycle and has to be re-referenced. However this situation is not recognizable without appropriate sensors.

A totally different situation occurs if the load torque does not go down almost immediately due to the polling cycle shift. This is usually the case if the load torque results from the acceleration. Now the motor does not engage at the next stable point with a polling cycle shift, but rather runs through these points. It loses more and more speed in comparison with the distinct stator field and runs through each further pulse cycle without creating a net torque. This means that the motor coasts down due to excessively high noise development. At the end the travel profile runs through an area of decreasing pulse frequencies. Depending on the load moment the motor is more or less rapidly accelerated just before the end of the profile and follow the rest of the profile. Finally it has more or less not made most of the profile and hence the route. This is also not recognizable without appropriate sensors.

When designing a stepper motor particular attention is to be given to fact that the speed has a strong influence on the available torque. The diagram below shows the relationship for a typical motor.

Diagram 2: Dependency of torque (Nm) on speed (RPM) for a typical stepper motor.

Apart from the load torque the motor also has to achieve the torque from the processes that result from the dynamics of the travel profile. If the total torque as shown in the example marked in red is 0.3 Nm then this motor may be run with a max speed of 1200 RPM. In practice however it is essential to plan in a suitable torque reserve.

Configuration of the stepper motor axis

Axis type: 'Continuous axis (incl. SERCOS)'

Encoder type: 'Encoder on KL5051/KL2502-30K/KL2521'

Controller type: e.g. 'position controller P'

Drive type: 'Drive on KL4XXX/KL2502-30K/KL2521'

Referencing

As usual, the digital referencing cam signal has to be mirrored into the axis interface to the NC (PlcToNc axis structure) via the PLC. The usual procedure for referencing an axis applies, but the hardware feature "latching of a position", initiated by a sync impulse, is not available. Instead, the falling edge is used as local event for determining a reference position during ramp-down from the referencing cam. The accuracy of the referencing process can be increased as required through a reduction in velocity during ramp-down from the cam (the maximum possible precision is one motor step).

Commissioning instructions

In comparison with the axis with analog set value output e.g. via a KL4032 the operation of a stepper motor power section on a KL2502-0010 or -3020 or KL2521 the terminal has to be parameterised depending on the application.

Parameterization of the KL2502-0010 or -3020

Note: These versions of the KL2502 have different hardware from the basic one. The resulting increase of all internal working frequencies makes an expanded work area accessible. However this is not taken into account in the KS2000 software at present.

Example: Typical setting of a KL2502-0010 or -3020.

Parameterization of the KL2521

The 'base frequency 1' is to be set so that the terminal creates the maximum frequency when fully driven for the application concerned. If too low a value is entered here then the axis does not reach the foreseen velocity. If the setting is too high the resolution is worse than it was possible with the high resolution terminal. If this is acceptable then at least limits have to be ensured with by corresponding settings, so that the axis does not travel at too high velocity.

The terminal’s operating mode is to be set as per the signal definition of the power section. In this example, a direction signal and a pulse is expected.

The reference frequency for the example shown in diagram 2 is calculated with the formula BF = N * S / 60. Here BF is the frequency in Hertz, N the speed in RPM and S the step number of the motor in the selected operating mode.

Sample calculation:

BF = 1200 [RPM] * 200 [1/R] / 60 [s/min] = 4000 Hz

The following example shows the correct setting for this example.

Example: Typical setting of a KL2521.

Settings in TwinCAT NC

The scaling factor of the encoder (Sf) is to be calculated from the feed per motor rotation (VU) and the step number (S) of the motor in the selected operating mode:

Sf = VU / S

If a KL2521 is used the reference velocity (Vref) of the drive is to be calculated from the reference frequency (BF) and the scalings factor (Sf) of the encoder. The reference output is to be set to 1.0 when doing so. If the reference frequency of the terminal is set as per the maximum usable frequency then the 'maximum allowed speed' and the 'high speed (G0)' in the global axis data can be set to a max of about 90 % of the reference speed. If a higher reference frequency is selected then a maximum of about 90 % of the speed may be entered, that would result in case the reference frequency is set exactly.

Vref = BF * Sf

If a KL2502-0010 or -3020 is used then the reference velocity of the drive can be entered in two alternative formats. The first one uses an extrapolation of the output frequency on the full value range of the set value, even if this frequency can not be displayed by the terminal. Here the S shows the step number of the motor in the selected operating mode. Here the reference frequency (BF) is the product of the maximum output value and the frequency scaling and results in 32768*8=262144.

Vref = BF * S = 262144 * S

Alternatively the reference velocity of the drive at the max selected velocity can be specified. For this the max corresponding frequency (Fmax) and the step number (S) of the motor are to be calculated in the selected operating mode.

Vref = Fmax * S

The associated relative control factor (A) is to be given as the reference output.

A = Fmax / BF = Fmax / 262144

All other axis parameters are to be set in the same way as for a servo axis. Here in particular empirical tests for the setting of the acceleration, delay and max jerk are to be carried out with the maximum expected mass to be moved in operation. Here it may not happen that the axis leaves out part of the movement due to overload.

Note: Stepper motors have a more or less distinctive natural resonance. This can lead to problems in the case of very flat ramps or unfavorably selected velocity settings. The axis will then generate significant noise and can then be shifted and lose its correct reference by one or more polling cycles due to superposition of the travel movement with a low frequency jitter movement caused by brief overloading.


"Low Cost" stepper motor axes with digital control (24V / 2A)

The basic version of the 'low cost stepper motor axis' is operated without physical encoder (hence simulation encoder). This means that there is no actual physical feedback between set values and actual values, and therefore the axis is not operated with closed-loop control, but only with open-loop control. It is assumed that there is no slippage in the drive, and that the axis can accurately follow the specified step pattern (set value profile). Notwithstanding this constraint imposed for cost reasons, the stepper motor axis can be referenced physically, since the simulation encoder is implemented as an incremental encoder and supports virtually all features.

Configuration of the "low cost" stepper motor axis

Axis type: 'low cost stepper motor axis' (dig. I/O)'

Encoder type: 'simulation encoder'

Controller type: 'stepper motor controller'

Drive type: 'stepper motor drive'

Referencing

As usual, the digital referencing cam signal has to be mirrored into the axis interface to the NC (PlcToNc axis structure) via the PLC. The usual procedure for referencing an axis applies, but the hardware feature "latching of a position", initiated by a sync impulse, is not available. Instead, the falling edge is used as local event for determining a reference position during ramp-down from the referencing cam. The accuracy of the referencing process can be increased as required through a reduction in velocity during ramp-down from the cam (the maximum possible precision is one motor step).

Commissioning instructions

At this point, it is worth mentioning some technical restrictions of stepper motors. Note that all recommended tests have to be carried out under load.

  1. The maximum permitted limit frequency f_v_max [kHz] of the stepper motor in motion must not be exceeded, since otherwise the linear range of the drive would be exceeded and the drive limit approached.
  2. The maximum start and stop frequency f_start_stop_max [kHz] during starting and stopping of the axis must not be exceeded, since otherwise the stepper motor could "lose steps" during this positioning start and end phase.
  3. The maximum acceleration and deceleration a_max / d_max [kHz/s] must not be exceeded during the start and stop phase of the motion, since otherwise steps could be "lost" here too.
  4. In the event of the stepper motor not being able to cope, the contact to the driving electromagnetic field is interrupted, and the motor comes to a halt (with a chaotic jitter). For commissioning, the motor should therefore be brought up to the desired set velocity (1st test parameter) with slowly and constantly increasing speed during a first test series with slight ramps (low acceleration and deceleration), in order to ensure that the motor can follow. In a second test series - with fixed set velocity - the ramps should be increased slowly and constantly to the desired acceleration/deceleration (2nd test parameter).

IO configuration of the drive

The link (mapping) of the logical NC axis outputs (drive output structure, 'nCtrl' byte or 'nExtCtrl' byte) with the physical digital IO outputs (24V / 2A) still has to be carried out manually in the TwinCAT System Manager. Individual bits from the 'nCtrl byte' or 'nExtCtrl byte' are linked with the respective digital outputs. In order to select an individual bit from a byte (8 bit), a byte offset in the range between 0 and 7 should be entered. If, for example, the second bit of a byte is to be addressed, a value of 1 has to be entered as byte offset.

Configuration parameters

Data type Byte Bit

Def.-Range Variable Name Description
1 INT32 0 – 3 __ __ nOutData1 Drive output data 1 (NC®IO)
2 INT32 4 – 7 __ __ nOutData2 Drive output data 2 (NC®IO)
3 UINT8 8 __ __ nControlByte Control byte
3.0 | BOOL | 8 | 0 | 0 / 1 | bPhaseA | Phase A
3.1 | BOOL | 8 | 1 | 0 / 1 | bPhaseAInv | Phase A inverse
3.2 | BOOL | 8 | 2 | 0 / 1 | bPhaseB | Phase B
3.3 | BOOL | 8 | 3 | 0 / 1 | bPhaseBInv | Phase B inverse
3.4 BOOL 8 4 0 / 1 __ RESERVED
3.5 BOOL 8 5 0 / 1 __ RESERVED
3.6 | BOOL | 8 | 6 | 0 / 1 | bBreakInv | Inverse braking bit (0 ºACTIVE, 1 º PASSIVE)
3.7 | BOOL | 8 | 7 | 0 / 1 | bBreak | Braking bit (0 ºPASSIVE, 1 º ACTIVE)
4 UINT8 9 __ __ nExtControlByte Extended control byte
4.0 | BOOL | 9 | 0 | 0 / 1 | bFrequency | Frequency (square wave signal)
4.1 | BOOL | 9 | 1 | 0 / 1 | bDirectionPlus | Direction positive
4.2 BOOL 9 2 0 / 1 __ RESERVED
4.3 BOOL 9 3 0 / 1 __ RESERVED
4.4 BOOL 9 4 0 / 1 __ RESERVED
4.5 BOOL 9 5 0 / 1 __ RESERVED
4.6 BOOL 9 6 0 / 1 __ RESERVED
4.7 BOOL 9 7 0 / 1 __ RESERVED
5 UINT16 10 -11 __ __ nReserved Reserved bytes

Stepper motor parameters

Motor parameters

Parameters | Description
Stepper motor operating mode | The stepper motor can be operated in different operating modes through the type of control used. The period at which various step pattern combinations are output can thus be set. The step size (full step or half step) and the motor torque can thus be influenced. The available operating modes are described in the "stepper motor operating mode" table below.
Displacement per step dSStep | Physical scaling of a motor step (step change) according to the mechanical conditions such as gearbox, etc. Unit: [mm/INC]
Minimum velocity for velocity profile Vmin | For generating the velocity profile, this minimum velocity Vmin is used as the start and end velocity of the calculated velocity profile, provided the required set velocity can be reached on the travel path. Obviously, due to the time discretisation (cycle time) not every velocity level can be reached. Only a certain number of discrete velocity levels is available (proportional to 1/(n*dT) with n=1,2,3... and dT axis cycle time in seconds). The value is rounded, and the next possible velocity level is used. Unit: [mm/s]
Number of steps per velocity level >Nlevel | According to the boundary conditions (minimum velocity, target velocity, travel path), a velocity profile with discrete velocity levels (proportional to the step frequency) is calculated. Maintaining of a certain velocity level in the range between 0 to 100 relative to the motor steps can be set via this parameter. The parameter Nlevel can therefore be used for scaling (extending or reducing) the velocity ramp. For the limit case of Nlevel = 0, no ramped velocity profile is generated, but the required set velocity is kept constant for the entire travel path. Unit: 1

Stepper motor operating modes

Motor modes

Stepper motor mode | Description
1 PHASE | 1-phase excitation (step pattern periodicity: modulo 4) (STANDARD)
2 PHASE | 2-phase excitation (step pattern periodicity: modulo 4)
12 PHASE | 1-2-phase excitation (step pattern periodicity: modulo 8)
DRIVER | Control via power section (specification of direction and frequency

Formula for calculating the discrete travel frequencies

Formula for calculating the discrete velocity levels

Stepper motor parameters of the drive

Depending on the type and operating mode of the stepper motor, up to 8 byte masks for the drive output pattern can be parameterised in the "stepper motor" drive tab of the System Manager. Depending on the operating mode of the axis, these patterns are cyclically output during active positioning and are repeated periodically. With the axis at standstill (no active travel), the last bit pattern to be output is linked to the holding current mask as a logical AND operation. This holding current mask is intended to reduce the motor current and therefore the motor temperature of the axis at standstill.

Example of velocity and position profile

The graph shows a typical velocity and position profile for a 'low cost' stepper motor axis vs. time [s]. The blue curve shows the velocity [mm/s], and the green curve the position [mm]. The set values and actual values are identical, because a simulation encoder was used, not a real encoder. The discrete velocity levels are noteworthy. Their value, starting from the start velocity, rises to the required set velocity, and falls again to the stop level towards the end of the target position.


Encoder-Achsen

TwinCAT NC Axes

编码器轴

概述

Normal

接口

Normal

元件

Normal

编码器滤波器

Normal

操作模式

Normal

正处于编写准备之中……


Simulations-Achsen

TwinCAT NC Axes

仿真轴

概述

Normal

接口

Normal

编码器

Normal

驱动器

Normal

控制器

Normal

设定值与实际值

Normal

正处于编写准备之中……


NC

TwinCAT NC Process Image

Process image of an NC axis

An axis is connected to different drive components via its process image. In the simplest case, a link is established between the axis and the drive and the necessary links between the process images are made automatically. In individual cases, in particular when unknown hardware components are integrated in the system, these links must be established manually. To this end, the process image of an NC axis is described in the following.

Note: The data structures described here form an internal interface between NC drivers and connected drive hardware. This interface is constantly under development and can change in the future.

Encoder process image of an axis

Various encoder hardware or the corresponding Bus Terminals for detecting the position of an axis are connected via the encoder process image (cyclic data exchange). Insofar as this hardware is directly supported by the system, no manual configuration of individual variables is necessary.

Input data to the encoder process image of an axis

I/O variable | Description | Remark
nInData1 | Current actual position of the encoder or the drive in increments. The incremental value is processed by the NC and converted to the actual position in physical units, e.g. mm or degrees. Overflows of the incremental values are also counted by the NC. The system normally makes no distinction between incremental and absolute encoders (see also encoder parameter Reference System INC/ABS). | Unit: increments [INC] Data type: DINT (32 bit). sometimes also INT (16 bit)
nInData2 | Optional actual latch position of the encoder or the drive in increments. The incremental value is processed by the NC and converted to the actual position in physical units, e.g. mm or degrees. (see also function block MC_TouchProbe from the Motion Control Libary TcMc.lib). | Unit: increments [INC] Data type: DINT (32 bit). sometimes also INT (16 bit)
nStatus1 | Optional status information e.g.: Participant in Data Exchange, Encoder Error, communication to Position Latch or Register Communication. | This information depends on the type of encoder or drive.
nStatus2 | Additional optional status information e.g.: Communication to Position Latch, communication Encoder Reset, communication to Read an Absolute Position | This information depends on the type of encoder or drive.
nStatus3 | reserved |
nStatus4 | Optional field bus-dependent IO status such as WcState (Working Counter) in the case of EtherCAT or CdIState in the case of Beckhoff Lightbus. | Meaning: 0 = I/O data valid 1 = I/O data invalid

Output data from the encoder process image of an axis

I/O variable | Description | Remark
nOutData1 | Current actual position of the encoder or drive in increments, which the NC copies directly from the input variable nInData1 to the output variable nOutData1. | Unit: increments [INC] Data type: DINT
nOutData2 | reserved |
nCtrl1 | Optional control information e.g.: Communication to Position Latch, communication Encoder Reset, Register Communication | This information depends on the type of encoder or drive.
nCtrl2 | Additional optional control information e.g.: Communication to Position Latch, communication Encoder Reset, communication to Read an Absolute Position | This information depends on the type of encoder or drive.
nCtrl3 | reserved |
nCtrl4 | reserved |

Drive process image of an axis

Various drive hardware or the corresponding Bus Terminals (+/- 10V, PWM etc.) are connected via the drive process image. Insofar as this hardware is directly supported by the system, no manual configuration is necessary.

Input data to the drive process image of an axis

I/O variable | Description | Remark
nInData1 | reserved |
nInData2 | reserved |
nStatus1 | Optional status information e.g.: Drive Error, Drive Enable/Disable, Communication Drive State Machine (e.g. EtherCAT, SERCOS, CANopen, Profibus), Register Communication. | This information depends on the type of drive.
nStatus2 | Additional optional status information e.g.: Drive Error, Drive Enable/Disable, Communication Drive State Machine (e.g. EtherCAT, SERCOS, CANopen, Profibus), Register Communication. | This information depends on the type of drive.
nStatus3 | reserved |
nStatus4 | Optional field bus-dependent IO status such as WcState (Working Counter) in the case of EtherCAT or CdIState in the case of Beckhoff Lightbus. | Meaning: 0 = I/O data valid 1 = I/O data invalid

Output data from the drive process image of an axis

I/O variable | Description | Remark
nOutData1

Current set velocity or current set position in increments.

The set velocity or set position of the NC in physical units, e.g. mm or degrees, is mathematically converted back to an incremental value by the NC and transferred to the drive. Overflows of the incremental value are hereby taken into account by the NC in the set position.

Depending on the type of drive, a standardisation of the set velocity or set position is carried out in increments.

If the drive type Universal Drive has been selected, nOutData1 contains the overall velocity (incl. position control part) with sign. 		This information depends on the type of drive.
nOutData2

Current set velocity or current set position in increments.

The set velocity or set position of the NC in physical units, e.g. mm or degrees, is mathematically converted back to an incremental value by the NC and transferred to the drive. Overflows of the incremental value are hereby taken into account by the NC in the set position.

Depending on the type of drive, a standardisation of the set velocity or set position is carried out in increments.

If the drive type Universal Drive has been selected, nOutData2 contains the value of the overall velocity (incl. position control part, without sign). 		This information depends on the type of drive.
nCtrl1

Optional control information:

e.g.: Drive Reset, Drive Enable/Disable, Communication Drive State Machine (e.g. EtherCAT, SERCOS, CANopen, Profibus), Register Communication. 		This information depends on the type of drive.
nCtrl2

Additional optional control information:

Digital direction output of the setpoint generator (corresponds to the sign of the set velocity, hence without position controller)

Digital Outputs Setpoint Generator:
0x41 (0100 0001) = Minus
0x42 (0100 0010) = Plus
0x80 (1000 0000) = Stop

The only exception to this is the AX2xxx-B200/B900 drive. In this case, communication takes place with the Drive State Machine. 		This information depends on the type of drive
(except for AX2xxx B200 and B900)
nCtrl3

Additional optional control information:

Digital direction output or drive stages of the overall output (sum of the setpoint generator and the position controller)

Digital Outputs (Setpoint Generator + Position Controller):
0x41 (0100 0001) = Minus
0x42 (0100 0010) = Plus
0x80 (1000 0000) = Stop
nCtrl4 | reserved


NC->PLC axis interface (128 bytes)

TwinCAT PLC Libraries: NC

NC->PLC 轴接口（128个字节）

NCTOPLC_AXLESTRUCT 类型

TYPE NCTOPLC_AXLESTRUCT
STRUCT
    nStateDWord 		: DWORD; (* 状态变量，双字 *)
    nErrorCode 		: DWORD; (* 轴错误代码变量 *)
    nAxisState 		: DWORD; (* 轴运动状态变量 *)
    nAxisModeCon 		: DWORD; (* 轴模式确认（从 NC 反馈获得） *)
    nCalibrationState		: DWORD; (* 轴校准状态（回参考点） *)
    nCoupleState 		: DWORD; (* 轴耦合状态 *)
    nSvbEntries 		: DWORD; (* SVB 入口/命令（SVB = 设置准备任务） *)
    nSafEntries 		: DWORD; (* SAF 入口/命令（SAF = 设置执行任务 *)
    nAxisId 			: DWORD; (* 轴ID号 *)
    nOpModeDWord 		: DWORD; (* 当前的操作模式 *)
    nReserved2_HIDDEN 		: DWORD; (* 保留 *)
    fPosIst 			: LREAL; (* 当前位置（从 NC 获得的绝对值） *)
    fModuloPosIst 		: LREAL; (* 实际位置作为模数值（例如：用度数表示） *)
    nModuloTurns 		: DINT; 	(* 模数转换 *)
    fVeloIst 			: LREAL; (* 当前速度（可选项） *)
    fPosDiff 			: LREAL; (* 位置偏差（滞后距离） *)
    fPosSoll 			: LREAL; (* 设定点位置 *)
    fVeloSoll 		: LREAL; (* 设定点速度 *)
    fAccSoll			: LREAL; (* 设定点加速度，以前版本为: "fReserve1_HIDDEN" *)
    fReserve2_HIDDEN 		: LREAL; (* 保留 *)
    fReserve3_HIDDEN 		: LREAL; (* 保留 *)
    fReserve4_HIDDEN 		: LREAL; (* 保留 *)
END_STRUCT
END_TYPE

NCTOPLC_AXLESTRUCT2类型

TYPE NCTOPLC_AXLESTRUCT2
STRUCT
    nStateDWord 		: DWORD; (* 状态变量，双字 *)
    nErrorCode 		: DWORD; (* 轴错误代码变量 *)
    nAxisState 		: DWORD; (* 轴运动状态变量 *)
    nAxisModeCon 		: DWORD; (* 轴模式确认（从NC反馈获得） *)
    nCalibrationState		: DWORD; (* 轴校准状态(回参考点) *)
    nCoupleState 		: DWORD; (* 轴耦合状态 *)
    nSvbEntries 		: DWORD; (* SVB 入口/命令(SVB = 设置准备任务) *)
    nSafEntries 		: DWORD; (* SAF入口/命令(SAF = 设置执行任务 *)
    nAxisId 			: DWORD; (* 轴ID号 *)
    nOpModeDWord 		: DWORD; (* 当前的操作模式 *)
    nActiveControlLoopIndex	: WORD;	(* 主动控制循环索引(相当于原来的变量"nCtrlLoopIndex") *)
    nControlLoopIndex 		: WORD;	(* 轴控制循环索引 (0, 1, 2, … 当使用多个控制循环时) *)
    fPosIst 			: LREAL; (* 实际的位置(从NC获得的绝对值) *)
    fModuloPosIst 		: LREAL; (* 实际位置作为模数值（例如：用度数表示） *)
    nModuloTurns 		: DINT; 	(* 实际求模变换 *)
    fVeloIst 			: LREAL; (* 实际速度（任选项） *)
    fPosDiff 			: LREAL; (* 位置偏差(滞后距离) *)
    fPosSoll 			: LREAL; (* 设置点位置 *)
    fVeloSoll 		: LREAL; (* 设置点速度 *)
    fAccSoll			: LREAL; (* 设置点加速度, 以前版本为: "fReserve1_HIDDEN" *)
    fPosTarget 		: LREAL; (* 估计的目标位置 *)
    fModuloPosSoll 		: LREAL; (* 设置点位置求模值(例如：用度数表示)  *)
    nModuloTurnsSoll 		: DINT; 	(* 设置点求模变换 *)
    nCmdNo	 		: WORD;	(* 连续的实际命令数目 *)
    nCmdState 		: WORD;	(* 命令状态 *)
END_STRUCT
END_TYPE

序号 | 数据类型 | 字节 | 位 | 取值范围 | 变量名 | 变量名 (从版本： 2.11 resp. TcMc2 开始) | 描述
1 | UINT32 | 0-3 | - | - | nStateDWord | StateDWord | 状态变量，双字 见详细描述
 |  |  | 0 | 0/1 | Operational | Operational | 轴已准备好操作
 |  |  | 1 | 0/1 | Homed | Homed | 轴已回参考点（“已经校准的轴”）
 |  |  | 2 | 0/1 | NotMoving | NotMoving | 轴逻辑上静止（“轴不在运动”）
 |  |  | 3 | 0/1 | InPositionArea | InPositionArea | 轴处于位置窗口（物理反馈）
 |  |  | 4 | 0/1 | InTargetPosition | InTargetPosition | 轴处于目标位置（PEH）（物理反馈）
 |  |  | 5 | 0/1 | Protected | Protected | 轴处于保护操作模式（例如：作为一个从动轴）
 |  |  | 6 | 0/1 | ErrorPropagationDelayed | ErrorPropagationDelayed | 轴发出预警错误信号 (从 TC 2.11版本开始)
 |  |  | 7 | 0/1 | HasBeenStopped | HasBeenStopped | 轴被停止或者正在执行停止命令
 |  |  | 8 | 0/1 | HasJob | HasJob | 轴拥有指令，或者正在执行指令
 |  |  | 9 | 0/1 | PositiveDirection | PositiveDirection | 轴正朝逻辑上更大的值运动
 |  |  | 10 | 0/1 | NegativeDirection | NegativeDirection | 轴正向逻辑上更小的值运动
 |  |  | 11 | 0/1 | HomingBusy | HomingBusy | 轴回参考点（“轴正在被校准”）
 |  |  | 12 | 0/1 | ConstantVelocity | ConstantVelocity | 轴已经达到了恒定速度或者旋转速度
 |  |  | 13 | 0/1 | Compensating | Compensating | 块补偿，被动[0]/主动[1](s. "MC_MoveSuperImposed")
 |  |  | 14 | 0/1 | ExtSetPointGenEnabled | ExtSetPointGenEnabled | 开始启用的外部设定点生成器
 |  |  | 15 | 0/1 |  |  | 还没有执行的操作模式（忙）。尚未实现！
 |  |  | 16 | 0/1 | ExternalLatchValid | ExternalLatchValid | 外部锁存值或传感开关变成有效
 |  |  | 17 | 0/1 | NewTargetPos | NewTargetPos | 轴具有新的目标位置或者新的速度
 |  |  | 18 | 0/1 |  |  | 轴不在目标位置或者不能达到目标位置（例如，停止状态）。尚未实现！
 |  |  | 19 | 0/1 | ContinuousMotion | ContinuousMotion | 轴的目标位置在(±)无限远
 |  |  | 20 | 0/1 | ControlLoopClosed | ControlLoopClosed | 轴已经准备好进行操作并且轴控制回路已闭环（例如：位置控制）
 |  |  | 21 | 0/1 | CamTableQueued | CamTableQueued | 凸轮表被排入“在线改变”队列并等待激活
 |  |  | 22 | 0/1 | CamDataQueued | CamDataQueued | 凸轮数据（仅仅 MF）被排入“在线改变”队列并等待激活
 |  |  | 23 | 0/1 | CamScalingPending | CamScalingPending | 凸轮缩放比例被排入“在线改变”队列并等待激活
 |  |  | 24 | 0/1 | CmdBuffered | CmdBuffered | 下面的命令在命令缓冲区中命令排队等候（例如，缓冲器模式）（从系统版本：winCAT V2.10 Build 1311开始）
 |  |  | 25 | 0/1 | PTPmode | PTPmode | 轴处于PTP模式(无从动轴，无NCI轴，无FIFO轴） （从 TC 2.10 Build 1326版本开始）
 |  |  | 26 | 0/1 | SoftLimitMinExceeded | SoftLimitMinExceeded | 软件中的位置极限转换最小值被超出（从TC 2.10 Build 1327版本开始）
 |  |  | 27 | 0/1 | SoftLimitMaxExceeded | SoftLimitMaxExceeded | 软件中的位置极限转换最大值被超出 （从TC 2.10 Build 1327版本开始）
 |  |  | 28 | 0/1 | DriveDeviceError | DriveDeviceError | 硬件驱动设备错误（无警告），只有当驱动器进行数据交换时才有可能判读该错误， 例如： EtherCAT "OP"-状态 （从 TC 2.10 Build 1326版本开始）
 |  |  | 29 | 0/1 | MotionCommandsLocked | MotionCommandsLocked | 轴因为运动命令被锁定(TcMc2)
 |  |  | 30 | 0/1 | IoDataInvalid | IoDataInvalid | IO数据无效（例如'WcState' 或者 'CdlState' ）
 |  |  | 31 | 0/1 | Error | Error | 轴处于故障状态
2 | UINT32 | 4-7 | - | ³0 | nErrorCode | ErrorCode | 轴错误代码
3 | UINT32 | 8-11 | - | ENUM | nAxisState | AxisState | 轴的当前运动状态
4 | UINT32 | 12-15 | - | ENUM | nAxisModeCon | nAxisModeConfirmation | 轴操作模式（从 NC 传输来的反馈）
5 | UINT32 | 16-19 | - | ENUM | nCalibrationState | HomingState | 轴回参考点状态（“校准状态”）
6 | UINT32 | 20-23 | - | ENUM | nCoupleState | CoupleState | 轴耦合状态
7 | UINT32 | 24-27 | - | ³0 | nSvbEntries | SvbEntries | SVB 入口/任务
8 | UINT32 | 28-31 | - | ³0 | nSafEntries | SafEntries | SAF 入口/任务（NC 解释器，FIFO 组）
9 | UINT32 | 32-35 | - | >0 | nAxisId | AxisId | 轴 ID 号
10 | DWORD | 36-39 | - | 0/1 | nOpModeDWord, bOpMode... | OpModeDWord, OpMode... | 轴运行模式，双字
 |  |  | 0 | 0/1 | ...PosAreaMonitoring | ...PosAreaMonitoring | 位置范围监控
 |  |  | 1 | 0/1 | ...TargetPosMonitoring | ...TargetPosMonitoring | 目标位置窗口监控
 |  |  | 2 | 0/1 | ...Loop | ...Loop | 循环运动
 |  |  | 3 | 0/1 | ...MotionMonitoring | ...MotionMonitoring | 物理运动监控
 |  |  | 4 | 0/1 | ...PEHTimeMonitoring | ...PEHTimeMonitoring | PEH 时间监控
 |  |  | 5 | 0/1 | ...BacklashComp | ...BacklashComp | 后冲补偿
 |  |  | 6 | 0/1 | ...DelayedErrorReaction | ...DelayedErrorReaction | 延时的NC错误响应
 |  |  | 7 | 0/1 | ...Modulo | ...Modulo | 模轴 （显示的模式值）
 |  |  | 8-15 | 0/1 |  |  | 保留
 |  |  | 16 | 0/1 | ...PosLagMonitoring | ...PosLagMonitoring | 跟随误差：监控位置
 |  |  | 17 | 0/1 | ...VeloLagMonitoring | ...VeloLagMonitoring | 跟随误差：监控速度
 |  |  | 18 | 0/1 | ...SoftLimitMinMonitoring | ...SoftLimitMinMonitoring | 终点位置监控，最小
 |  |  | 19 | 0/1 | ...SoftLimitMaxMonitoring | ...SoftLimitMaxMonitoring | 终点位置监控，最大
 |  |  | 20 | 0/1 | ...PosCorrection | ...PosCorrection | 位置补偿 （位置修正）
 |  |  | 21 | 0/1 | ...AllowSlaveCommands | ...AllowSlaveCommands | 允许对从动轴进行运动命令控制
 |  |  | 22-31 | 0/1 |  |  | 保留
11 | UINT16 | 40-41 | - | ≥0 | nActiveControlLoopIndex | ActiveControlLoopIndex | 主动轴控制循环索引（相当于旧变量“nCtrlLoopIndex”），从版本：TwinCAT V2.10 Build 1311开始
12 | UINT16 | 42-43 | - | ≥0 | nControlLoopIndex | ControlLoopIndex | 轴控制索引（0, 1, 2, …当使用多个控制循环时）从版本：TwinCAT V2.10 Build 1311开始
13 | REAL64 | 44-51 | - | ±¥ | fPosIst | ActPos | 实际位置（计算绝对值）
14 | REAL64 | 52-59 | - | >¥ | fModuloPosIst | ModuloActPos | 实际位置求模（例如采用度为单位计算位置值）
15 | INT32 | 60-63 | - | ±¥ | nModuloTurns | ModuloActTurns | 实际旋转求模
16 | REAL64 | 64-71 | - | ±¥ | fVeloIst | ActVelo | 实际速度（可选项）
17 | REAL64 | 72-79 | - | ±¥ | fPosDiff | PosDiff | 跟随误差（位置）
18 | REAL64 | 80-87 | - | ±¥ | fPosSoll | SetPos | 设置位置（计算绝对值）
19 | REAL64 | 88-95 | - | ±¥ | fVeloSoll | SetVelo | 设置速度
20 | REAL64 | 96-103 | - | ±¥ | fAccSoll | SetAcc | 设置加速度
21 | REAL64 | 104-111 | - | ±¥ | fPosTarget | TargetPos | 估计的目标位置 从TwinCAT V2.10 Build 1311开始
22 | REAL64 | 112-119 | - | >¥ | fModuloPosSoll | ModuloSetPos | 设置点位置求模（例如采用度为单位计算位置值）从版本：TwinCAT V2.10 Build 1311开始
23 | INT32 | 120-123 | - | ±¥ | nModuloTurnsSoll | ModuloSetTurns | 设置点旋转值求模，从版本：TwinCAT V2.10 Build 1311开始
24 | UINT16 | 124-125 | - | ≥0 | nCmdNo | CmdNo | 从当前的命令开始，连续的命令数目（缓冲模式）。从版本：TwinCAT V2.10 Build 1311开始。
25 | UINT16 | 126-127 | - | ≥0 | nCmdState | CmdState | 命令状态（缓冲模式）。从版本：TwinCAT V2.10 Build 1311开始

每个字段内容描述：

定义 | 轴回参考点状态 (nCalibrationState resp. HomingState)
0 | 完成了回参考点过程（已经准备好）
1 | 以回参考点挡块方向连续启动（注意：如果回参考点挡块从一开始就已激活，则回参考点状态将立即从 3开始）
2 | 等待从回参考点挡块来的上升沿，并且开始停止轴的运动
3 | 保持等待直到轴停止，检查回参考点挡块是否仍然保持激活，然后从回参考点挡块开始启动，朝同步脉冲的方向运动。
4 | 等待回参考点挡块的下降沿
5 | 激活锁存值，当锁存信号有效时，停止轴的运动。
6 | 当轴处于静止状态时，设置计算的实际位置（实际位置＝参考位置＋制动距离）

也可参看MC_Home的注释

定义 | 轴耦合状态(nCoupleState resp. CoupleState)
0 | 单独轴，既不是主动轴也不是从动轴（SINGLE）
1 | 主动轴，具有任意数目的从动轴（MASTER）
2 | 从动轴，作为其它从动轴的主动轴（MASTERSLAVE）
3 | 仅仅作为从动轴（SLAVE）

定义 | 主动轴：轴运动的当前状态/连续主动轴的运动阶段（伺服轴） (nAxisState resp. AxisState)
0 | 设定值生成器关闭（INACTIVE）
1 | 设定值生成器激活（RUNNING）
2 | 速度超调为0(OVERRIDE_ZERO)
3 | 恒定速度（PHASE_VELOCONST）
4 | 加速阶段（PHASE_ACCPOS）
5 | 减速阶段（PHASE_ACCNEG）

定义 | 主动轴：轴运动的当前状态/离散主动轴的运动阶段（高速/低速主轴） (nAxisState resp. AxisState)
0 | 设定值生成器关闭
1 | 运动阶段（快速或者慢速运动）
2 | 从快速运动到慢速运动的转换延迟
3 | 慢速运动（在慢速区域）
4 | 制动时间（从目标位置前的制动距离开始）

定义 | 从动轴：轴运动的当前状态/连续从动轴的运动阶段（伺服轴） (nAxisState resp. AxisState) 注释：仅对于同步生成器的从动轴！
0 | 从动轴生成器关闭
11 | 从动轴处于准备运动阶段(PREPHASE)
12 | 从动轴正处于同步过程中(SYNCHRONIZING)
13 | 从动轴被同步并且同步运动（SYNCHRON）

开发环境 | 目标系统类型 | 包括的 PLC 库
TwinCAT v2.7.0 | PC (i386) | PlcNc.Lib
TwinCAT v2.8.0 | PC (i386) | TcNC.Lib


StateDWord

TwinCAT PLC Libraries: NC

Description of StateDWord

The StateDWord is a 32 bit data word in the axis interface NC->SPS. The detailed function of each status bit is described in the table below.

Bit | Variable-Name | Description
0 | Operational | Axis is ready for operation
1 | Homed | Axis has been referenced/ homed ("Axis calibrated")
2 | NotMoving | Axis is logically stationary ("Axis not moving")
3 | InPositionArea | Axis is in position window (physical feedback)
4 | InTargetPosition | Axis is at target position (PEH) (physical feedback)
5 | Protected | Axis is in a protected operating mode (e.g. as a slave axis)
6 | ErrorPropagationDelayed | Axis signals an error pre warning (from TC 2.11)
7 | HasBeenStopped | Axis has been stopped or is presently executing a stop
8 | HasJob | Axis has instructions, is carrying instructions out
9 | PositiveDirection | Axis moving to logically larger values
10 | NegativeDirection | Axis moving to logically smaller values
11 | HomingBusy | Axis referenced ("Axis being calibrated")
12 | ConstantVelocity | Axis has reached its constant velocity or rotary speed
13 | Compensating | Section compensation passive[0]/active[1] (s. "MC_MoveSuperImposed")
14 | ExtSetPointGenEnabled | External setpoint generator enabled
15 |  | Operating mode not yet executed (Busy). Not implemented yet!
16 | ExternalLatchValid | External latch value or sensing switch has become valid
17 | NewTargetPos | Axis has a new target position or a new velocity
18 |  | Axis is not at target position or cannot reach the target position (e.g. stop). Not implemented yet!
19 | ContinuousMotion | Axis has target position (±) endless
20 | ControlLoopClosed | Axis is ready for operation and axis control loop is closed (e.g. position control)
21 | CamTableQueued | CAM table is queued for "Online Change" and waiting for activation
22 | CamDataQueued | CAM data (only MF) are queued for "Online Change" and waiting for activation
23 | CamScalingPending | CAM scaling are queued for "Online Change" and waiting for activation
24 | CmdBuffered | Following command is queued in then command buffer (s. Buffer Mode) (from TwinCAT V2.10 Build 1311)
25 | PTPmode | Axis in PTP mode (no slave, no NCI axis, no FIFO axis) (from TC 2.10 Build 1326)
26 | SoftLimitMinExceeded | Position software limit switch minimum is exceeded (from TC 2.10 Build 1327)
27 | SoftLimitMaxExceeded | Position software limit switch maximum is exceeded (from TC 2.10 Build 1327)
28 | DriveDeviceError | Hardware drive device error (no warning), interpretation only possible when drive is data exchanging, e.g. EtherCAT "OP"-state (from TC 2.10 Build 1326)
29 | MotionCommandsLocked | Axis is locked for motion commands (TcMc2)
30 | IoDataInvalid | IO data invalid (e.g. 'WcState' or 'CdlState')
31 | Error | Axis is in a fault state


PLC->NC axis interface (128 bytes)

TwinCAT PLC Libraries: NC

PLC->NC 轴接口 (128 个字节)

PLCTONC_AXLESTRUCT 类型

TYPE PLCTONC_AXLESTRUCT
STRUCT
    nDeCtrlDWord 	: DWORD; (* 控制变量，双字 *)
    nOverride 	: DWORD; (* 速度超调 *)
    nAxisModeReq 	: DWORD; (* 轴操作模式（PLC 请求） *)
    nAxisModeDWord 	: DWORD; (* *)
    fAxisModeLReal 	: LREAL; (* *)
    fActPosCorrection 	: LREAL; (* 当前位置的修正值 *)
    fExtSetPos 	: LREAL; (* 外部位置设定点 *)
    fExtSetVelo 	: LREAL; (* 外部速度设定点 *)
    fExtSetAcc 	: LREAL; (* 外部加速度设定点 *)
    nExtSetDirection 	: DINT; 	(* 外部方向设定点 *)
    nReserved1 	: DWORD; (* 保留 *)
    fExtCtrlOutput 	: LREAL; (* 外部控制器输出 *)
    nReserved_HIDDEN 	: ARRAY [72..127] OF BYTE;
END_STRUCT
END_TYPE

每根轴都具有 128 个字节的数据块用来实现从 NC 到 PLC 的数据传输，同时也拥有另外一个 128 个字节的数据，用来实现从 PLC 到 NC 的数据传输。PLC 的程序员必须为每个方向以及每根轴都创建一个变量。通过 AT 指令将这些在 PLC I/O 区域的变量传输到相应的的输入与输出区域。通过 TwinCAT 系统管理器来完成 NC 变量到 PLC 变量的分配工作。

序号 | 数据类型 | 字节 | 位 | 取值范围 | 变量名 | 变量名 (从版本： 2.11 resp. TcMc2开始) | 描述
1 | UINT32 | 0-3 | - | 0/1 | nDeCtrlDWord | ControlDWord | 控制变量，双字
 |  |  | 0 | 0/1 | Enable | Enable | 控制器激活
 |  |  | 1 | 0/1 | FeedEnablePlus | FeedEnablePlus | 正向进给激活
 |  |  | 2 | 0/1 | FeedEnableMinus | FeedEnableMinus | 负向进给激活
 |  |  | 3 | 0/1 | - | - | 保留
 |  |  | 4 | 0/1 | - | - | 保留
 |  |  | 5 | 0/1 | HomingSensor | HomingSensor | 回参考点挡块信或回参考点传感器
 |  |  | 6 | 0/1 | - | - | 保留
 |  |  | 7 | 0/1 | - | - | 保留
 |  |  | 8 | 0/1 | AcceptBlockedDrive | AcceptBlockedDrive | 接受驱动器设定点限制 （例如硬件位置极限） 从版本：TwinCAT V2.10 Build 1311开始
 |  |  | 9 | 0/1 | BlockedDriveDetected | BlockedDriveDetected | 轴被阻止（例如机械限制） 尚未实现！
 |  |  | 10-29 | 0/1 | - | - | 保留
 |  |  | 30 | 0/1 | PlcDebugFlag | PlcDebugFlag | PLC调试功能。仅用于内部使用！
 |  |  | 31 | 0/1 | NcDebugFlag | NcDebugFlag | NC调试功能。仅用于内部使用！
2 | UINT32 | 4-7 | - | 0...1000000 | nOverride | Override | 速度超调（0% 到 100%）
3 | UINT32 | 8-11 | - |  | nAxisModeReq | AxisModeRequest | 轴操作模式，仅用于内部使用
4 | UINT32 | 12-15 | - |  | nAxisModeDWord | AxisModeDWord | 仅用于内部使用！
5 | REAL64 | 16-23 | - |  | fAxisModeLReal | AxisModeLReal | 仅用于内部使用！
6 | REAL64 | 24-31 | - |  | fActPosCorrection | PositionCorrection | 实际位置的修正值
7 | REAL64 | 32-39 | - |  | fExtSetPos | ExtSetPos | 外部的位置设定点
8 | REAL64 | 40-47 | - |  | fExtSetVelo | ExtSetVelo | 外部的速度设定点
9 | REAL64 | 48-55 | - |  | fExtSetAcc | ExtSetAcc | 外部的加速度设定点
10 | INT32 | 56-59 | - |  | nExtSetDirection | ExtSetDirection | 外部的方向设定点[-1, 0, 1]
11 | UINT32 | 60-63 | - |  | nReserved1 | - | 保留
12 | REAL64 | 64-71 | - |  | fExtCtrlOutput | ExtControllerOutput | 外部的控制器输出。尚未实现！
13 | REAL64 | 72-79 | - | ±¥ | - | GearRatio1 | 齿轮比（耦合因数） 1
14 | REAL64 | 80-87 | - | ±¥ | - | GearRatio2 | 齿轮比（耦合因数） 2
15 | REAL64 | 88-95 | - | ±¥ | - | GearRatio3 | 齿轮比（耦合因数） 3
16 | REAL64 | 96-103 | - | ±¥ | - | GearRatio4 | 齿轮比（耦合因数） 4
17 | - | 104-127 | - | - | nReserved |  | 保留

开发环境 | 目标系统类型 | 包含的PLC库
TwinCAT v2.7.0 | PC (i386) | PlcNc.Lib
TwinCAT v2.8.0 | PC (i386) | TcNC.Lib


Discrete high/low speed axis (two speed)

TwinCAT PLC Libraries: NC

离散的高速/低速轴（两种速度）

启动速度值范围 V | 带有 100％ 超调的启动速度含义（需要运行速度/运行阶段）
V > 50 | 快速运动距离
0 < V£ 50 | 低速运动距离
V £ 0 | 错误

超调值范围 X | 超调值含义 （100% º 1.000.000 ）
X > 50% (500000) | 快速运动距离
0% < X £ 50% (500000) | 低速运动距离
X = 0% | 静止（公差范围：<100 º <0.01%）


Drive interface for high/low speed axes NC->IO (12 bytes)

TwinCAT PLC Libraries: NC

高速/低速轴的驱动器接口 NC->IO（12 个字节）

序号 | 数据类型 | 字节 | 位 | 取值范围 | 变量名 | 描述
1 | UINT32 | 0-3 | - | - | nOutData1 | 驱动器输出数据 1(NC->IO)
2 | UINT32 | 4-7 | - | - | nOutData2 | 驱动器输出数据 2 (NC->IO)
3 | UINT8 | 8 | - | - | nControlByte | 控制字节
 |  |  | 0 | 0/1 | bMinusHigh | 方向：负方向速度：快速
 |  |  | 1 | 0/1 | bMinusLow | 方向：负方向速度：慢速
 |  |  | 2 | 0/1 | bPlusLow | 方向：正方向速度：慢速
 |  |  | 3 | 0/1 | bPlusHigh | 方向：正方向速度：快速
 |  |  | 4 | 0/1 | - | 保留
 |  |  | 5 | 0/1 | - | 保留
 |  |  | 6 | 0/1 | bBreakInv | 反向制动位 (0 º ACTIVE, 1 º PASSIVE)
 |  |  | 7 | 0/1 | bBreak | 制动位 (0 º PASSIVE, 1 º ACTIVE)
4 | UINT8 | 9 | - | - | nExtControlByte | 扩展的控制字节
 |  |  | 0 | 0/1 | bDirectionMinus | 方向：负向
 |  |  | 1 | 0/1 | bDirectionPlus | 方向：正向
 |  |  | 2 | 0/1 | bVeloLow | 速度：慢速
 |  |  | 3 | 0/1 | bVeloHigh | 速度：快速
 |  |  | 4 | 0/1 | - | 保留
 |  |  | 5 | 0/1 | - | 保留
 |  |  | 6 | 0/1 | bBreakInv | 反向制动位 (0 º ACTIVE, 1 º PASSIVE)
 |  |  | 7 | 0/1 | bBreak | 制动位 (0 º PASSIVE, 1 º ACTIVE)
5 | UINT16 | 10-11 | - | - | nReserved | 保留字节

app_interface.gif (1102 Byte)

备注：

仅仅在离目标点位置距离比参数设置的制动距离要大时才能够初始化轴的启动。


"Low Cost" stepper motor axis with digital control (stepper)

TwinCAT PLC Libraries: NC

带数字控制的“低成本”步进电机轴（步进）

“低成本”步进电机轴的驱动器接口 NC->IO（12 个字节）

序号 | 数据类型 | 字节 | 位 | 取值范围 | 变量名 | 描述
1 | INT32 | 0-3 | - | - | nOutData1 | 驱动器输出数据 1（NC->IO）
2 | INT32 | 4-7 | - | - | nOutData2 | 驱动器输出数据 2（NC->IO）
3 | UINT8 | 8 | - | - | nControlByte | 控制字节
3.0 | ... | 8 | 0 | 0/1 | bPhaseA | A 相
3.1 | ... | 8 | 1 | 0/1 | bPhaseAInv | 逆A相
3.2 | ... | 8 | 2 | 0/1 | bPhaseB | B相
3.3 | ... | 8 | 3 | 0/1 | bPhaseBInv | 逆B相
3.4 | ... | 8 | 4 | 0/1 | - | 保留
3.5 | ... | 8 | 5 | 0/1 | - | 保留
3.6 | ... | 8 | 6 | 0/1 | bBreakInv | 反向制动位（0 º 主动, 1 º 被动）
3.7 | ... | 8 | 7 |  | bBreak | 制动位（1 º 主动, 0 º 被动）
4 | UINT8 | 9 | - | - | nExtControlByte | 扩展的控制字节
4.0 | ... | 9 | 0 | 0/1 | bFrequency | 频率（方波信号）
4.1 | ... | 9 | 1 | 0/1 | bDirectionPlus | 方向：正向
4.2 | ... | 9 | 2 | 0/1 | - | 保留
4.3 | ... | 9 | 3 | 0/1 | - | 保留
4.4 | ... | 9 | 4 | 0/1 | - | 保留
4.5 | ... | 9 | 5 | 0/1 | - | 保留
4.6 | ... | 9 | 6 | 0/1 | - | 保留
4.7 | ... | 9 | 7 | 0/1 | - | 保留
5 | UINT16 | 10-11 | - | - | nReserved | 保留字节