Migration from TcMC to TcMC2

The main differences and modifications between the TcMC motion control library and the extended TcMC2 library are listed here, so that the effort for converting an existing project can be estimated.

Axis data structure

In the past an axis required two data structures for cyclic data exchange with the NC.

NcToPlc_Axis1 AT %I* : NCTOPLC_AXLESTRUCT;

PlcToNc_Axis1 AT %Q* : PLCTONC_AXLESTRUCT;

In most function blocks, including MC_MoveAbsolute, the NCTOPLC_AXLESTRUCT data structure was transferresd at the Axis input. Certain function blocks, including MC_Power, expected an additional PLCTONC_AXLESTRUCT structure.

In the TcMC2 environment the axis structure was extended so that all required data are included in a single structure, which is transferred to each MC function block.

Axis1: AXIS_REF;

The structure contains the cyclic input and output data for the NC plus additional status information. An existing project generally accesses the content of the NcToPlc structure. The data are also available in the Axis1 structure and can be used to adapt the application program.

Example:

TcMC : NcToPlc_Axis1.fPosSoll

TcMC2 : Axis1.NcToPlc.SetPos

Please note that the subelements for the NcToPlc and. PlcToNc structures now have English names in view of the international market. For example, the current set position for an axis is no longer referred to as fPosSoll, but as SetPos.

Function blocks

The input and output configuration of the function blocks has changed slightly compared with TcMC. The main new feature is support for MC_BufferMode in Move blocks. In addition, the blocks now also support a Busy and Active output. These modifications generally only require little migration effort. The following table contains a list of function blocks with more extensive modifications.

TcMC

TcMC2

Note

MC_GearInFloat

MC_GearIn

MC_GearIn now accepts the gear ratio as a floating point value

MC_NewPos
MC_NewPosAndVelo

MC_Move...

The new BufferMode enables each Move block to be used to assign a new target for the axis or change the velocity. The NewPos function blocks are therefore no longer required.

MC_MoveAbsoluteOrRestart

MC_Move...

MoveAbsoluteOrRestart can be replaced with two instances of a Move block (see BufferMode).

MC_CamIn
MC_CamInExt

MC_CamIn

The new MC_CamIn function block deals with the function of the extended MC_CamInExt block. The input circuit was adapted accordingly.

MC_SetReferenceFlag

MC_Home

Setting and resetting of the reference flag (axis is referenced) can be achieved with the MC_Home block.

MC_SetPositionOnTheFly

MC_SetPosition

For actual value setting on the fly, MC_SetPosition is used in relative mode (mode=TRUE).

MC_SetActualPosition

MC_SetPosition

MC_SetActualPosition is replaced with MC_SetPosition. The new function block sets the actual and set positions.

MC_GearOutExt

MC_Move...

Travel commands can be applied to coupled slave axes, if this option was explicitly activated in the axis parameters (from TwinCAT 2.11). Travel commands can be applied to coupled slave axes, if this option was explicitly activated in the axis parameters. In this case only Buffer-ModeAborting is possible.

MC_OrientedStop

MC_MoveModulo

MC_MoveModulo can be started from standstill or during motion. In the latter case the block behaves like MC_OrientedStop

MC_Stop

MC_Halt ,
MC_Stop

MC_Halt executes a normal stop during motion. In contrast, MC_Stop locks the axis and prevents further travel commands. It should only be used in special situations.

MC_Home

MC_Home

MC_Home transfers the bCalibrationCam signal of the homing sensor only while the block is active. To execute homing from the System Manager with F9, the signal must be transferred to the NC by other means, e.g. through direct allocation:
Axis.PlcToNc.ControlDword.5 := HomingSensor;


TcNC library

The previous TcMC library required declarations and functions from the TcNC library, so that this was always integrated in a project. The new TcMC2 library no longer has this dependency. All required declarations and functions are now included in TcMC2 library itself, so that the TcNC library is no longer required. Nevertheless, the TcNC library can still be used for compatibility reasons.

Status information

In existing motion applications axis status information was often determined via a function call (AxisHasJob(), AxisIsMoving() etc.). While these functions can still be used if the TcNC library is integrated, we now recommended a different approach:

The complete status information for an axis is included in the above-mentioned axis data structure Axis1:AXIS_REF. However, these data have to be updated cyclically by calling the function block MC_ReadStatus or an Axis1.ReadStatus action at the start of the PLC cycle. Current status information is then available at any point in the program during the PLC cycle.