Notes on the documentation

This description is only intended for the use of trained specialists in control and automation engineering who are familiar with the applicable national standards.
It is essential that the following notes and explanations are followed when installing and commissioning these components.

The responsible staff must ensure that the application or use of the products described satisfy all the requirements for safety, including all the relevant laws, regulations, guidelines and standards.

Disclaimer

The documentation has been prepared with care. The products described are, however, constantly under development.
For that reason the documentation is not in every case checked for consistency with performance data, standards or other characteristics.
In the event that it contains technical or editorial errors, we retain the right to make alterations at any time and without warning.
No claims for the modification of products that have already been supplied may be made on the basis of the data, diagrams and descriptions in this documentation.

Trademarks

Beckhoff®, TwinCAT®, EtherCAT®, Safety over EtherCAT®, TwinSAFE® and XFC® are registered trademarks of and licensed by Beckhoff Automation GmbH.
Other designations used in this publication may be trademarks whose use by third parties for their own purposes could violate the rights of the owners.

Patent Pending

The TwinCAT Technology is covered, including but not limited to the following patent applications and patents:
EP0851348, US6167425 with corresponding applications or registrations in various other countries.

Copyright

© Beckhoff Automation GmbH & Co. KG, Germany.
The reproduction, distribution and utilization of this document as well as the communication of its contents to others without express authorization are prohibited.
Offenders will be held liable for the payment of damages. All rights reserved in the event of the grant of a patent, utility model or design.


Overview TcNcCamming.lib

TS5050 | TwinCAT NC Camming

Overview

In many applications it is necessary to synchronise two or more axes. Axes can be coupled together in the TwinCAT NC PTP. A master axis is then actively controlled, and the position of one or more coupled slave axes is synchronously controlled by the NC.

The simplest type of coupling is linear coupling with a fixed ratio of transmission (an electronic gearbox).

Some applications require a more complex coupling of master and slave, one which can not be described by a simple mathematical formula. Such a dependency can be described by means of a table that specifies an associated slave position for every master position.

The TwinCAT NC PTP offers the possibility of coupling a slave axis to a master axis by means of a table (electronic cam plate) Here the table contains a certain number of prescribed reference points, and the NC interpolates position and speed between them.

The TcNcCamming library contains function blocks for handling cam plates. Two types of cam plates are supported.

One option is a cam plate in the form of a 2-column table containing master and slave positions (standard table). The master column defines interpolation points via the travel path of the master, ascending from a minimum position value to a maximum value. The associated slave position is determined from the second column using the interpolation points of the table. Values between these points are interpolated.

Another option is to define a cam plate as a so-called motion function. A motion function is a single-column table of interpolation points. Each interpolation point not only contains a position, but a complete description of the shape of the curve within a section (segment) of the cam plate. In addition to the master and slave position at the start of the segment, the shape of the function for example is specified up to the next interpolation point in the form of a mathematical function. Using this procedure, a motion function requires only very few interpolation points. Despite this, each point between the interpolation points is precisely defined through the mathematical function, and there are no uncertainties due to interpolation.

Unlike a standard table, the points of a motion function can be manipulated at run time. The system ensures that a manipulation only becomes effective once an alteration has no direct influence on the slave. Position jumps are thus avoided.

With the extension of the cam plate functionality towards motion functions, PLCopen-compliant function blocks were introduced. It is recommended to use these blocks (names starting with MC...) instead of the older blocks (names starting with CamTable... ). However, the older blocks still remain functional.

The TwinCAT PLC library TcNcCamming.lib, available as an additional product, provides easy management of table-based axis coupling. Example programs related to cam plates and motion functions use this library.


MC_CamTableSelect

FUNCTION_BLOCK MC_CamTableSelect

With the function block MC_CamTableSelect, a table can be specified and loaded into the NC. The block creates a new table and simultaneously fills it with data provided by the PLC.

MC_CamTableSelect does not have to be used, if a table created with the TwinCAT cam plate editor is to be used. In this case, simple coupling with MC_CamIn is sufficient.

VAR_INPUT

VAR_INPUT
        Execute :       BOOL;
        Periodic :      BOOL;
        MasterAbsoute :         BOOL;
        SlaveAbsoute :  BOOL;
        CamTableID :    MC_CAM_ID;
END_VAR

Execute : The command is executed with rising edge.

Periodic : TRUE = periodic execution, FALSE = no periodic execution

MasterAbsolute : TRUE = master absolute, FALSE = master relative

SlaveAbsolute : TRUE = slave absolute, FALSE = slave relative.

CamTableID : ID of the loaded table.

VAR_OUTPUT

VAR_OUTPUT
        Done :          BOOL;
        Error :                 BOOL;
        ErrorID :       UDINT;
END_VAR

Done : Becomes TRUE, if the function was executed successfully.

Error : Becomes TRUE, as soon as an error occurs.

ErrorID : Supplies the error number when the Error output is set

VAR_IN_OUT

VAR_IN_OUT
        Master :                NCTOPLC_AXLESTRUCT;
        Slave :                 NCTOPLC_AXLESTRUCT;
        CamTable :      MC_CAM_REF;
ND_VAR

Master : Axis structure of the master.

Slave : Axis structure of the slave.

CamTable : Reference to the table (structure).

Development Environment | Target System | PLC Libraries to include
TwinCAT v2.9 | PC (i386) | TcNcCamming.Lib


MC_CamIn

FUNCTION_BLOCK MC_CamIn

The function block MC_CamIn activates master-slave coupling with a certain table.

There is an extended function block MC_CamInExt available.

Important : Detailed information about master-slave coupling with cam tables.

VAR_INPUT

VAR_INPUT
        Execute :         BOOL;
        MasterOffset :    LREAL;
        SlaveOffset :     LREAL;
        MasterScaling :           LREAL;
        SlaveScaling :    LREAL;
        StartMode :       MC_StartMode;
        CamTableID :      MC_CAM_ID;
        InterpolationType:        MC_InterpolationType;
END_VAR

Execute : The command is executed with rising edge.

MasterOffset : Offset for the master positions.

SlaveOffset : Offset for the slave positions.

MasterScaling : Factor for master positions (default 1.0).

SlaveScaling : Factor for slave positions (default 1.0).

StartMode : Starting mode for coupled motion. Valid values are START_ABSOLUTE und START_RELATIVE.

CamTableID : Table ID.

InterpolationType : Interpolation type of the table data. The interpolation type is not used for motion functions.

VAR_OUTPUT

VAR_OUTPUT
        InSync :                BOOL;
        CommandAborted :        BOOL;
        Error :                 BOOL;
        ErrorID :       UDINT;
END_VAR

InSync : Becomes TRUE, if the coupling was successful.

CommandAborted : Becomes TRUE, if the coupling could not be carried out.

Error : Becomes TRUE, as soon as an error occurs.

ErrorID : Supplies the error number when the Error output is set

VAR_IN_OUT

VAR_IN_OUT
        Master :        NCTOPLC_AXLESTRUCT;
        Slave :         NCTOPLC_AXLESTRUCT;
END_VAR

Master : Axis structure of the master.

Slave : Axis structure of the slave.

Development Environment | Target System | PLC Libraries to include
TwinCAT v2.9 | PC (i386) | TcNcCamming.Lib


MC_CamInExt

FUNCTION_BLOCK MC_CamInExt

The function block MC_CamInExt activates master-slave coupling with a certain cam plate. In contrast to the standard block (MC_CamIn), MC_CamInExt enables switching to a new cam plate in coupled state. The switching rules, in particular the time or position, can be specified.

To use the extended capabilities of MC_CamInExt, the block must be used even for the initial coupling. If an axis is coupled with MC_CamIn, it will not be possible to change cam plates later on.

Important :

Detailed information about master-slave coupling with cam tables.

ActivationMode (coupling and switching of cam plates)

StartMode

ScalingMode

VAR_INPUT

VAR_INPUT
        Execute                 : BOOL;
        ActivationMode  : MC_CamActivationMode;
        ActivationPosition      : LREAL;
        MasterScalingMode       : MC_CamScalingMode;
        SlaveScalingMode        : MC_CamScalingMode;
        MasterOffset    : LREAL;
        SlaveOffset     : LREAL;
        MasterScaling   : LREAL := 1.0;
        SlaveScaling    : LREAL := 1.0;
        StartMode       : MC_StartMode := START_ABSOLUTE;
        CamTableID      : MC_CAM_ID;
        InterpolationType       : MC_InterpolationType := MC_InterpolationType_Linear;
END_VAR

Execute : The command is executed with rising edge.

ActivationMode : ActivationMode specifies the switching time or position (only if coupling is already active)

ActivationPosition : Activation position required for position-based activation modes.

MasterScalingMode : Specifies the cam plate scaling type for master scaling (MC_CamScalingMode).

SlaveScalingMode : Specifies the cam plate scaling type for slave scaling (MC_CamScalingMode).

MasterOffset : Offset for the master positions.

SlaveOffset : Offset for the slave positions.

MasterScaling : Factor for master positions (default 1.0).

SlaveScaling : Factor for slave positions (default 1.0).

StartMode : Starting mode for coupled motion.

CamTableID : cam plate ID.

InterpolationType : Interpolation type of the cam plate data.

VAR_OUTPUT

VAR_OUTPUT
        InSync          : BOOL;
        Busy            : BOOL;
        CommandAborted  : BOOL;
        Error           : BOOL;
        ErrorID                 : UDINT;
END_VAR

InSync : Becomes TRUE, if the coupling was successful.

Busy : Becomes TRUE, as soon as the function block gets busy and becomes FALSE when the operation is finished and the block can be triggered again

CommandAborted : Becomes TRUE, if the coupling could not be carried out.

Error : Becomes TRUE, as soon as an error occurs.

ErrorID : Supplies the error number when the Error output is set

VAR_IN_OUT

VAR_IN_OUT
        Master  : NCTOPLC_AXLESTRUCT;
        Slave   : NCTOPLC_AXLESTRUCT;
END_VAR

Master : Axis structure of the master.

Slave : Axis structure of the slave.

Development Environment | Target System | PLC Libraries to include
TwinCAT v2.10 Build 1251 | PC (i386) | TcNcCamming.Lib


MC_CamIn Appendix

Axis coupling with cam plates

The function block MC_CamIn can be used to establish a cam plate coupling (or table coupling) between a master axis and a slave axis. Note that prior to the coupling the slave axis has to be at a position defined by the cam plate. After the coupling and once the master has been started, the slave position is calculated directly from the cam plate. The slave axis is therefore not slowly synchronised with the cam plate, but it will jump if it is not already at the table position.

In practice the question arises what position the slave should be in prior to the coupling, and how this is calculated. The following figures illustrate the procedure.

Notes : For all subsequent calculations only axis set positions are used. The actual positions are not used in the calculations, since they would lead to calculation errors, particularly with cyclic cam plates.

Only absolute table couplings are considered. For relative couplings, the coupling position of the master or slave axis is considered in the calculations as an additional offset.

Linear cam plates

A linear cam plate is only defined via a limited master position range. Outside this range the slave position is defined by the first or last table position. The slave therefore stops at the table edges as soon as the master leaves the defined range.

The diagram shows that the absolute axis coordinate system (blue) does not have to be identical to the cam plate coordinate system (red). The cam plate coordinate system may be offset by a master offset or a slave offset. Scaling is also possible.

The slave position relating to a certain master position can be determined via the function block MC_ReadCamTableSlaveDynamics. The block refers to the raw table data, which means that offsets and scaling factors have to be considered via the PLC program itself. Initially, the master offset is added to the current master position. If the cam plate is to be scaled, it is divided by this scaling factor.

MasterTablePos := (MasterPosition + MasterOffset) / MasterScale;

The master table position is used as input parameter for the function block MC_ReadCamTableSlaveDynamics. The result is converted to an absolute slave position with slave offset and scaling, if necessary.

SlaveTablePosition := ReadSlaveDynamics.SlavePosition;

SlavePosition := (SlaveTablePosition * SlaveScale) + SlaveOffset;

The slave is moved to this position prior to the coupling. Alternatively, the master may be moved to a position that corresponds to the current slave position. However, generally this position cannot be determined from the cam plate, since the cam plate may be ambiguous.

Note : Since the master offset is added in the first formula, a positive offset leads to the cam plate coordinate system being shifted to the left in negative direction. Accordingly, the master offset in the diagram is negative. A positive slave offset leads to the cam plate coordinate system being shifted upwards in positive direction.

Cyclic cam plates without stroke

A cyclic cam plate without stroke is characterised by the fact that the slave start and end positions in the table are identical. The slave therefore moves cyclically within a defined range, without changing its position permanently in a particular direction.

For these cam plate types, master/slave coupling requires the same preparation as for a linear cam plate. The starting position of the slave can therefore be calculated as described above. It is not necessary to use the modulo position of the master for the calculation, since the absolute position is already correctly taken into account via the coupling command.

Cyclic cam plates with stroke

The stroke of a cyclic cam plate is the difference between the last and the first table position of the slave.

Such a cam plate is continued cyclically at the end of the table. The slave position does not jump back to the initial table value. Instead, the motion continues steadily. With each new cycle, the stroke is therefore added as an additional internal slave offset or subtracted if the motion is reversed.

Uncoupling and re-coupling for cyclic cam plates with stroke

If a slave is coupled to a cam plate with stroke, the coupling is always done in the basic cycle (red coordinate system). If the slave is uncoupled after a few cycles and then re-coupled, the slave position returns to the basic cycle. If necessary, this behaviour has to be taken into account and compensated by re-calculating the slave offset.

MasterTablePos := (MasterPosition + MasterOffset) / MasterScale;

The master table position is used as input parameter for the function block MC_ReadCamTableSlaveDynamics. The result is converted to an absolute slave position with slave offset and scaling, if necessary. In addition, the number of pending strokes must be calculated and added to the slave position.

SlaveTablePosition := ReadSlaveDynamics.SlavePosition;

NumberOfStrokes := MODTURNS( (SlavePosition - SlaveOffset), SlaveStroke );

NewSlaveOffset := SlaveOffset + (SlaveStroke * NumberOfStrokes );

SlavePosition := (SlaveTablePosition * SlaveScale) + NewSlaveOffset;


MC_CamOut

FUNCTION_BLOCK MC_CamOut

The function block MC_CamOut deactivates a master-slave coupling.

Remark: If the Set Point Generator Type is set to '7 Phases (optimized)', the slave axis will reduce its acceleration to zero after it is being decoupled and it will then continue moving endless at constant velocity. The decoupled axis will not be positioned to any target position. The behavior is comparable to a move commanded by MC_MoveVelocity. With TwinCAT 2.10 the set point generator type is selectable. From TwinCAT 2.11 the setting is fixed to '7 Phases (optimized)'. If a project is upgraded from TwinCAT 2.10 to TwinCAT 2.11, the behavior will be as described here. After updating an existing application to TwinCAT 2.11, it might be necessary to adapt the PLC program.

VAR_INPUT

VAR_INPUT
        Execute : BOOL;
END_VAR

Execute : The command is executed with rising edge.

VAR_OUTPUT

VAR_OUTPUT
        Done :          BOOL;
        Error :                 BOOL;
        ErrorID :               UDINT;
END_VAR

Done : Becomes TRUE, if decoupling was successful.

Error : Becomes TRUE, as soon as an error occurs.

ErrorID : Supplies the error number when the Error output is set

VAR_IN_OUT

VAR_IN_OUT
        Slave : NCTOPLC_AXLESTRUCT;
END_VAR

Slave : Axis structure of the slave.

Development Environment | Target System | PLC Libraries to include
TwinCAT v2.9 | PC (i386) | TcNcCamming.Lib


MC_CamScaling

FUNCTION_BLOCK MC_CamScaling

A cam plate coupling can be scaled with the function block MC_CamScaling. The raw table data of the cam plate are not affected - the scaling refers to an existing master/slave coupling. The following parameters can be modified: scaling factors for master and slave, and offsets for the cam plate within the coordinate system.

Optionally, the modification will only take effect from a certain master position, enabling precise scaling during the motion. Caution when scaling during motion! The slave position at the time of scaling should only be affected slightly by the change.

VAR_INPUT

VAR_INPUT
        Execute : BOOL;
        ActivationMode : MC_CamActivationMode;
        ActivationPosition : LREAL;
        MasterScalingMode: MC_CamScalingMode;
        SlaveScalingMode: MC_CamScalingMode;
        MasterOffset : LREAL;
        SlaveOffset : LREAL;
        MasterScaling : LREAL := 1.0;
        SlaveScaling : LREAL := 1.0;
END_VAR

Execute : The command is executed with rising edge.

ActivationMode : defines when and how the cam table is scaled. (MC_CamActivationMode)

ActivationPosition : optional master position where the table is scaled (depending on ActivationMode).

MasterScalingMode : Type of master scaling. (MC_CamScalingMode)

SlaveScalingMode : Type of slave scaling. (MC_CamScalingMode)

MasterOffset : Offset for the master positions.

SlaveOffset : Offset for the slave positions.

MasterScaling : Factor for master positions (default 1.0).

SlaveScaling : Factor for slave positions (default 1.0).

VAR_OUTPUT

VAR_OUTPUT
        Done    : BOOL;
        Error   : BOOL;
        ErrorID         : UDINT;
END_VAR

Done : Becomes TRUE if scaling was successful.

Busy : Becomes TRUE, as soon as the function block gets busy and becomes FALSE when the operation is finished and the block can be triggered again

Error : Becomes TRUE, as soon as an error occurs.

ErrorID : Supplies the error number when the Error output is set

VAR_IN_OUT

VAR_IN_OUT
        Slave :         NCTOPLC_AXLESTRUCT;
END_VAR

Slave : Axis structure of the slave.

Development environment | Target system type | PLC libraries to be linked
TwinCAT v2.9 Build 1001 | PC (i386) | TcNcCamming.Lib


MC_ReadCamTableSlaveDynamics

FUNCTION_BLOCK MC_ReadCamTableSlaveDynamics

The function block MC_ReadCamTableSlaveDynamics can be used to determine the slave dynamics at a certain point of a cam plate table. The function evaluates the raw table data. Any scaling of the cam plate is not taken into account.

For older cam plate table types, not all dynamic parameters can be determined. The following overview shows the expected result:

MC_TableType_TABULARTYPE_MOTIONFUNC : slave position, velocity and acceleration are determined.

MC_TableType_TABULARTYPE_EQUIDIST : slave position and velocity are determined. The acceleration is always 0.

MC_TableType_TABULARTYPE_NONEQUIDIST : the slave position is determined. Velocity and acceleration are always 0.

VAR_INPUT

VAR_INPUT
        Execute                 : BOOL;
        CamTableID      : MC_CAM_ID;
        MasterPosition  : LREAL;
END_VAR

Execute : The command is executed with rising edge.

CamTableID : Table ID.

MasterPosition : Master position within the table for which the slave dynamics is to be determined.

VAR_OUTPUT

VAR_OUTPUT
        Done            : BOOL;
        SlavePosition   : LREAL;
        SlaveVelocity   : LREAL;
        SlaveAcceleration       : LREAL;
        Error           : BOOL;
        ErrorID                 : UDINT;
END_VAR

Done : Becomes TRUE, if the command was executed successfully.

SlavePosition : Position of the slave within the cam plate table at the specified master position.

SlaveVelocity : Velocity of the slave within the cam plate table at the specified master position.

SlaveAcceleration : Acceleration of the slave within the cam plate table at the specified master position.

Error : Becomes TRUE, as soon as an error occurs.

ErrorID : Supplies the error number when the Error output is set

Development environment | Target system type | PLC libraries to be linked
TwinCAT v2.9 | PC (i386) | TcNcCamming.Lib


MC_ReadMotionFunction

FUNCTION_BLOCK MC_ReadMotionFunction

The function block MC_ReadMotionFunction can be used to read the data of a motion function. Either the complete function with all interpolation points or only a part can be read. The data are stored within the PLC in the structure described by CamTable.

VAR_INPUT

VAR_INPUT
        Execute                 : BOOL;
        CamTableID      : MC_CAM_ID;
        PointID                 : MC_MotionFunctionPoint_ID;
        NumPoints       : UDINT; (* 0 = fill MFsize *)
END_VAR

Execute : The command is executed with rising edge.

CamTableID : ID of the loaded table.

PointID : Point ID of the first point of the motion function to be read.

NumPoints : Number of motion function points to be read. For reading all points, 0 can be specified here, in which case the number that is actually read is returned in the output variable NumPointsRead.

VAR_OUTPUT

VAR_OUTPUT
        Done            : BOOL;
        NumPointsRead   : UDINT; (* return value <= NumPoints *)
        Error           : BOOL;
        ErrorID                 : UDINT;
END_VAR

Done : Becomes TRUE, if the data were read successfully.

NumPointsRead : The number of points that were actually read. The number may be less or equal NumPoints.

Error : Becomes TRUE, as soon as an error occurs.

ErrorID : Supplies the error number when the Error output is set

VAR_IN_OUT

VAR_IN_OUT
        CamTable :      MC_CAM_REF;
ND_VAR

CamTable : Reference to the table (structure).

Development Environment | Target System | PLC Libraries to include
TwinCAT v2.9 | PC (i386) | TcNcCamming.Lib


MC_WriteMotionFunction

FUNCTION_BLOCK MC_WriteMotionFunction

The function block MC_WriteMotionFunction can be used to write the data of a motion function into the NC. Either the complete function with all interpolation points or only a part can be written. First, the data are stored within the PLC in the structure described by CamTable.

The function block MC_SetCamOnlineChangeMode can be used to specify when the data are read into the cam plate. If activation of the data is to be delayed until the master reaches a certain position, the system will initially queue the written data and activate them at the master position. The function AxisCamDataQueued can be used to check whether data have been queued (i.e. written but not yet activated).

VAR_INPUT

VAR_INPUT
        Execute                 : BOOL;
        CamTableID      : MC_CAM_ID;
        PointID                 : MC_MotionFunctionPoint_ID;
        NumPoints       : UDINT;
END_VAR

Execute: The command is executed with rising edge.

CamTableID: ID of the loaded table.

PointID: Point ID of the first point of the motion function to be written.

NumPoints: Number of motion function points to be written.

VAR_OUTPUT

VAR_OUTPUT
        Done            : BOOL;
        Error           : BOOL;
        ErrorID                 : UDINT;
END_VAR

Done: Becomes TRUE, if the data were read successfully.

Error: Becomes TRUE, as soon as an error occurs.

ErrorID: Supplies the error number when the Error output is set

VAR_IN_OUT

VAR_IN_OUT
        CamTable :      MC_CAM_REF;
ND_VAR

CamTable: Reference to the table (structure). The start address CamTable.pArray must address to the first point to be written.

Development Environment | Target System | PLC Libraries to include
TwinCAT v2.9 | PC (i386) | TcNcCamming.Lib


MC_ReadMotionFunctionPoint

FUNCTION_BLOCK MC_ReadMotionFunctionPoint

The function block MC_ReadMotionFunctionPoint can be used to read the data of a motion function interpolation point.

VAR_INPUT

VAR_INPUT
        Execute                 : BOOL;
        CamTableID      : MC_CAM_ID;
        PointID                 : MC_MotionFunctionPoint_ID;
END_VAR

Execute : The command is executed with rising edge.

CamTableID : ID of the loaded table.

PointID : Point ID of the first point of the motion function to be read.

VAR_OUTPUT

VAR_OUTPUT
        Done            : BOOL;
        Error           : BOOL;
        ErrorID                 : UDINT;
END_VAR

Done : Becomes TRUE, if the data were read successfully.

Error : Becomes TRUE, as soon as an error occurs.

ErrorID : Supplies the error number when the Error output is set

VAR_IN_OUT

VAR_IN_OUT
        Point : MC_MotionFunctionPoint;
ND_VAR

Point : Data structure containing the data of a motion function interpolation point

Development Environment | Target System | PLC Libraries to include
TwinCAT v2.9 | PC (i386) | TcNcCamming.Lib


MC_WriteMotionFunctionPoint

FUNCTION_BLOCK MC_WriteMotionFunctionPoint

The function block MC_WriteMotionFunctionPoint can be used to write the data of a motion function interpolation point.

The function block MC_SetCamOnlineChangeMode can be used to specify when the data are read into the cam plate. If activation of the data is to be delayed until the master reaches a certain position, the system will initially queue the written data and activate them at the master position. The function AxisCamDataQueued can be used to check whether data have been queued (i.e. written but not yet activated).

VAR_INPUT

VAR_INPUT
        Execute                 : BOOL;
        CamTableID      : MC_CAM_ID;
        PointID                 : MC_MotionFunctionPoint_ID;
END_VAR

Execute: The command is executed with rising edge.

CamTableID: ID of the loaded table.

PointID: Point ID of the first point of the motion function to be written.

VAR_OUTPUT

VAR_OUTPUT
        Done            : BOOL;
        Error           : BOOL;
        ErrorID                 : UDINT;
END_VAR

Done: Becomes TRUE, if the data were written successfully.

Error: Becomes TRUE, as soon as an error occurs.

ErrorID: Supplies the error number when the Error output is set

VAR_IN_OUT

VAR_IN_OUT
        Point : MC_MotionFunctionPoint;
ND_VAR

Point: Data structure containing the data of a motion function interpolation point

Development Environment | Target System | PLC Libraries to include
TwinCAT v2.9 | PC (i386) | TcNcCamming.Lib


MC_SetCamOnlineChangeMode

FUNCTION_BLOCK MC_SetCamOnlineChangeMode

Cam plate data can be modified at run time via the PLC (see MC_WriteMotionFunction, C_WMriteMotionFunctionPoint). The function block MC_SetCamOnlineChangeMode is used to specify when and how these changes take effect.

This function specifies the activation mode for modifications but does not affect a change or change-over of cam plates.

VAR_INPUT

VAR_INPUT
        Execute                 : BOOL;
        ActivationMode  : MC_CamActivationMode;
        ActivationPosition      : LREAL;
        MasterScalingMode       : MC_CamScalingMode;
        SlaveScalingMode        : MC_CamScalingMode;
        CamTableID      : MC_CAM_ID;
END_VAR

Execute : The command is executed with rising edge.

ActivationMode: defines when and how the cam table is scaled. (MC_CamActivationMode)

ActivationPosition: optional master position where the table is scaled (depending on ActivationMode).

MasterScalingMode: Type of master scaling. (MC_CamScalingMode)

SlaveScalingMode: Type of slave scaling. (MC_CamScalingMode)

CamTableID: Table ID.

VAR_OUTPUT

VAR_OUTPUT
        Done    : BOOL;
        Busy    : BOOL;
        Error   : BOOL;
        ErrorID         : UDINT;
END_VAR

Done: Becomes TRUE if scaling was successful.

Busy: Becomes TRUE, as soon as the function block gets busy and becomes FALSE when the operation is finished and the block can be triggered again

Error: Becomes TRUE, as soon as an error occurs.

ErrorID: Supplies the error number when the Error output is set

Development Environment | Target System | PLC Libraries to include
TwinCAT v2.9 Build 1001 | PC (i386) | TcNcCamming.Lib


MC_ReadCamTableCharacteristics

FUNCTION_BLOCK MC_ReadCamTableCharacteristics

The function block MC_ReadCamTableCharacteristics is used to calculate and read the characteristic parameters of a motion function.

VAR_INPUT

VAR_INPUT
        Execute :       BOOL;
        CamTableID :    MC_CAM_ID;
END_VAR

Execute : The command is executed with rising edge.

CamTableID : Table ID.

VAR_OUTPUT

VAR_OUTPUT
        Done :          BOOL;
        Error :                 BOOL;
        ErrorID :       UDINT;
END_VAR

Done : Becomes TRUE, if the calculation was carried out successfully.

Error : Becomes TRUE, as soon as an error occurs.

ErrorID : Supplies the error number when the Error output is set

VAR_IN_OUT

VAR_IN_OUT
        CamTableCharac : MC_TableCharacValues;
END_VAR

CamTableCharac: Data structure with characteristic parameters of the motion function

Development Environment | Target System | PLC Libraries to include
TwinCAT v2.7.0 & TwinCAT v2.8 | PC (i386) | TcNcCamming.Lib


MC_ReadMotionFunctionValues

FUNCTION_BLOCK MC_ReadMotionFunctionValues

The function block MC_ReadMotionFunctionValues can be used to read the interpolated data of a motion function in the form of a table.

VAR_INPUT

VAR_INPUT
        Execute                 : BOOL;
        CamTableID      : MC_CAM_ID;
        ValueSelectMask         : UINT;  (* MC_ValueSelectType; position, velocity, acceleration, jerk… *)
        StartPosMaster  : LREAL; (* master position of first point *)
        EndPosMaster    : LREAL; (* master position of last point *)
        Increment       : LREAL; (* increment of master position *)
END_VAR

Execute : The command is executed with rising edge.

CamTableID : ID of the loaded table (motion function type).

ValueSelectMask : The selection mask can be used to specify which data are to be interpolated and returned. The number of columns of the data structure described by CamTable must match the number of columns defined by ValueSelectMask. If, for example, only position data are read, the number of columns is 2 (master and slave position). With each further derivative (speed, acceleration, jerk), the number of columns increases by 1.

StartPosMaster : Position value of the master axis of the first interpolated point

EndPosMaster : Position value of the master axis of the last interpolated point

Increment : Interpolation step size

VAR_OUTPUT

VAR_OUTPUT
        Done            : BOOL;
        Error           : BOOL;
        ErrorID                 : UDINT;
END_VAR

Done : Becomes TRUE, if the data were read successfully.

Error : Becomes TRUE, as soon as an error occurs.

ErrorID : Supplies the error number when the Error output is set

VAR_IN_OUT

VAR_IN_OUT
        CamTable :      MC_CAM_REF;
ND_VAR

CamTable : Reference to the table (structure).

Development Environment | Target System | PLC Libraries to include
TwinCAT v2.9 | PC (i386) | TcNcCamming.Lib


MC_CamInfo

FUNCTION_BLOCK MC_CamInfo

The MC_CamInfo function block obtains data relating to the current state and current parameterisation of a cam plate coupling. The command assumes that the slave axis is coupled by a cam plate. If the AtMasterPosition input is TRUE the state is determined with reference to the quoted master position instead of the current state. The data obtained is placed into the CamInfo data structure.

Note : If the coupled group of axes gets into an error situation (e.g. emergency off), the function block will return the most recent valid state of the coupling. The function block must be called before decoupling the slave. The data that has been obtained can be used to restore the coupling to the original axis position.

VAR_INPUT

VAR_INPUT
        Execute         : BOOL;
        AtMasterPosition        : BOOL;
        MasterPosition  : LREAL;
END_VAR

Execute: The command is executed with rising edge.

AtMasterPosition: If AtMasterPosition is TRUE the data is determined with reference to the quoted MasterPosition. Otherwise the data refers to the current master position.

MasterPosition : Master position to which the data that is determined refers. This input parameter is not necessary if AtMasterPosition is FALSE.

VAR_OUTPUT

VAR_OUTPUT
        Done    : BOOL;
        Busy    : BOOL;
        Error   : BOOL;
        ErrorID         : UDINT;
        CamInfo         : MC_CamInfoData;
END_VAR

Done: Becomes TRUE when the function has been successfully executed.

Busy: Becomes TRUE as soon as the function block is active, and becomes FALSE again as soon as the function has been completed and is ready to be retriggered.

Error: Becomes TRUE, as soon as an error occurs.

ErrorID: If the error output is set, this parameter supplies the error number.

CamInfo: The data structure CamInfo contains data that has been obtained of the cam plate coupling.

VAR_IN_OUT

VAR_IN_OUT
        Slave   : NCTOPLC_AXLESTRUCT;
END_VAR

Slave: Axis structure of the slave.

Development environment | Target system type | PLC libraries to be linked
TwinCAT v2.9, build 1026 onwards | PC (i386) | TcNcCamming.Lib


MC_CAM_ID

TYPE MC_CAM_ID

TYPE
    MC_CAM_ID : UDINT;
END_TYPE

Type declaration for table ID.

Development Environment | Target System | PLC Libraries to include
TwinCAT v2.9 | PC (i386) | TcNcCamming.Lib


MC_CAM_REF

TYPE MC_CAM_REF

TYPE MC_CAM_REF :
STRUCT
    pArray        : UDINT;
    nArraySize    : UDINT;     (* size of data in bytes *)
    nTableType    : MC_TableType;
    nNoOfRows     : UDINT;
    nNoOfCols     : UDINT;
END_STRUCT
END_TYPE

Table structure definition. The first parameter pArray is a pointer to a data structure containing the table data. The data structure depends on the table type nTableType. The number of rows is entered in the component nNoOfRows, the number of columns in nNoOfCols (usually 1 or 2).

Example 1: Structure description of a point table

pArray: Address of a two-dimensional array. The first column contains an ascending list of master positions. The second column contains the associated slave positions.

nArraySize: Size of the array which can be calculated with SIZEOF(Array).

nTableType: The table type is TABULARTYPE_EQUIDIST, if the master positions have the same distance, or TABULARTYPE_NONEQUIDIST it the distance is variable.

nNoOfRows: The number or rows corresponds to the number of table points.

nNoOfCols: The number of columns is 2.

Example 2: Structure description of a motion function

pArray: Address of a one-dimensional array of type MC_MotionFunctionPoint. Each array element contains a description of a cam plate interpolation point.

nArraySize: Size of the array which can be calculated with SIZEOF(Array).

nTableType: The table type is TABULARTYPE_MOTIONFUNC.

nNoOfRows: The number or rows corresponds to the number of table points.

nNoOfCols: The number of columns is 1.

Development Environment | Target System | PLC Libraries to include
TwinCAT v2.9 | PC (i386) | TcNcCamming.Lib


MC_StartMode

TYPE MC_StartMode

TYPE
 (
    MC_STARTMODE_ABSOLUTE := 1,      (* cam table is absolute for
master and slave *)
    MC_STARTMODE_RELATIVE,           (* cam table is relative for
master and slave *)
    MC_STARTMODE_MASTERABS_SLAVEREL, (* cam table is absolute for
master and relative for slave *)
    MC_STARTMODE_MASTERREL_SLAVEABS  (* cam table is relative for
master and absolute for slave *)
);
END_TYPE

Remark: MC_STARTMODE_RELATIVE and MC_STARTMODE_MASTERREL_SLAVEABS cannot be used in cmbination with automatic offset calculation (MC_CamScalingMode).

Development Environment | Target System | PLC Libraries to include
TwinCAT v2.10 Build 1329 | PC (i386) | TcNcCamming.Lib


MC_TableType

TYPE MC_TableType

TYPE MC_TableType :
(
    (* n*m tabular with equidistant ascending master values
*)
    MC_TableType_TABULARTYPE_EQUIDIST := 10,
    (* n*m tabular with strictly monotone ascending master
values
    (not imperative equidistant) *)
    MC_TableType_TABULARTYPE_NONEQUIDIST := 11,
    (* motion function calculated in runtime *)
    MC_TableType_TABULARTYPE_MOTIONFUNC := 22 );
END_TYPE
Development Environment | Target System | PLC Libraries to include
TwinCAT v2.9 | PC (i386) | TcNcCamming.Lib


MC_InterpolationType

TYPE MC_InterpolationType

TYPE MC_InterpolationType :
(
    MC_InterpolationType_Linear := 0, (* linear 2 point
interpolation *)
    MC_InterpolationType_4Point := 1, (* 4 point
interpolation
                                         (for equidistant tables
only) *)
    MC_InterpolationType_Spline := 2  (* spline interpolation
(tangential
                                         or cyclic, depending on
table)*)
);
END_TYPE

Interpolation type for table data.

Development Environement | Target System | PLC Libraries to include
TwinCAT v2.9 | PC (i386) | TcNcCamming.Lib


MC_MotionFunctionPoint

TYPE MC_MotionFunctionPoint

TYPE MC_MotionFunctionPoint :
STRUCT
    PointIndex        : MC_MotionFunctionPoint_ID;

    FunctionType      : MC_MotionFunctionType;

    PointType         : MC_MotionPointType;

    RelIndexNextPoint : MC_MotionFunctionPoint_ID;

    MasterPos         : LREAL; (* X *)
    SlavePos          : LREAL; (* Y *)
    SlaveVelo         : LREAL; (* Y' *)
    SlaveAcc          : LREAL; (* Y'' *)
    SlaveJerk         : LREAL; (* Y''' *)
END_STRUCT
END_TYPE

The data structure MC_MotionFunctionPoint describes a interpolation point of a motion function. A motion function is a one-dimensional list (array) of type MC_MotionFunctionPoint.

PointIndex: Absolute index of this interpolation point within the motion function. The point index of all interpolation points must increase strictly monotonously and must have no gaps and be greater than 0.

FunctionType: Type MC_MotionFunctionType of the mathematical function between this and the subsequent interpolation point

PointType: Type MC_MotionPointType of this interpolation point.

RelIndexNextPoint: Relative reference to the subsequent interpolation point (usually 1).

MasterPos: Position of the master axis at this interpolation point

SlavePos: Position of the slave axis at this interpolation point

SlaveVelo: Velocity of the slave axis at this interpolation point

SlaveAcc: Acceleration of the slave axis at this interpolation point

SlaveJerk: Jerk of the slave axis at this interpolation point

Remark:

Some motion laws (MC_MotionFunctionType ) allow a symmetry adjustment. As at all these functions the jerk at the boundary points is 0, the jerk parameter SlaveJerk can be used for the adjustemnt of the symmetry ( in these cases). The value 0 matters a symmetry of 50 %. The value can be set in the range +/- 0.5 for the following functions:

POLYNOM3
POLYNOM5
POLYNOM8
POLYNOM11
SINUSLINIE
MODSINUSLINIE
BESTEHORN
BESCHLTRAPEZ
SINUS_GERADE_KOMBI

Development Environment | Target System | PLC Libraries to include
TwinCAT v2.9 | PC (i386) | TcNcCamming.Lib


MC_MotionFunctionPoint_ID

TYPE MC_MotionFunctionPoint_ID

TYPE
    MC_MotionFunctionPoint_ID : UDINT;
END_TYPE

Type declaration for the point ID of the motion function points

Development Environment | Target System | PLC Libraries to include
TwinCAT v2.9 | PC (i386) | TcNcCamming.Lib


MC_MotionPointType

TYPE MC_MotionPointType

TYPE MC_MotionPointType :
(
    MOTIONPOINTTYPE_IGNORE,                (* Ignore point *)
    MOTIONPOINTTYPE_REST       := 16#0001, (* Restpoint - Rastpunkt
*)
    MOTIONPOINTTYPE_VELOCITY   := 16#0002, (* Velocity Point -
Geschwindigkeitspunkt *)
    MOTIONPOINTTYPE_TURN       := 16#0004, (* Turn Point -
Umkehrpunkt *)
    MOTIONPOINTTYPE_MOTION     := 16#0008, (* Motion Point -
Bewegungspunkt *)
    MOTIONPOINTTYPE_ADD        := 16#0F00, (* Addieren von
Segmenten *)
    MOTIONPOINTTYPE_ACTIVATION := 16#2000  (* 1: activation point
*)
);
END_TYPE

Type declaration for table ID.

Development Environment | Target System | PLC Libraries to include
TwinCAT v2.9 | PC (i386) | TcNcCamming.Lib


MC_MotionFunctionType

TYPE MC_MotionFunctionType

TYPE MC_MotionFunctionType :
(
    MOTIONFUNCTYPE_NOTDEF,
    MOTIONFUNCTYPE_POLYNOM1 := 1,         (* 1: polynom with order
1 *)
    MOTIONFUNCTYPE_POLYNOM3 := 3,         (* 3: polynom with order
3 (rest <-> rest) *)
    MOTIONFUNCTYPE_POLYNOM5 := 5,         (* 5: polynom with order
5 (rest <-> rest) *)
    MOTIONFUNCTYPE_POLYNOM8 := 8,         (* 8: polynom with order
8 (rest <-> rest) *)
    MOTIONFUNCTYPE_SINUSLINIE := 10,
    MOTIONFUNCTYPE_MODSINUSLINIE := 11,
    MOTIONFUNCTYPE_BESTEHORN := 12,
    MOTIONFUNCTYPE_BESCHLTRAPEZ := 13,    (* 13:
Beschleunigungstrapez *)
    MOTIONFUNCTYPE_POLYNOM5_MM := 15,     (* 15: polynom with order
5 (motion <-> motion) *)
    MOTIONFUNCTYPE_SINUS_GERADE_KOMBI := 16,
    MOTIONFUNCTYPE_HARMONIC_KOMBI_RT := 17,
    MOTIONFUNCTYPE_HARMONIC_KOMBI_TR := 18,
    MOTIONFUNCTYPE_HARMONIC_KOMBI_VT := 19,
    MOTIONFUNCTYPE_HARMONIC_KOMBI_TV := 20,
    MOTIONFUNCTYPE_BESCHLTRAPEZ_RT := 21, (* 21:
Beschleunigungstrapez (rest <-> turn) *)
    MOTIONFUNCTYPE_BESCHLTRAPEZ_TR := 22, (* 22:
Beschleunigungstrapez (turn <-> rest) *)
    MOTIONFUNCTYPE_MODSINUSLINIE_VV := 23,
    MOTIONFUNCTYPE_POLYNOM7_MM := 24,     (* 24: polynom with order
7 (motion <-> motion) *)
    MOTIONFUNCTYPE_POLYNOM6STP := 27,     (* 27: polynom with order
6 *)
    MOTIONFUNCTYPE_POLYNOM6WDP := 28,     (* 28: polynom with order
6 *)
    MOTIONFUNCTYPE_STEPFUNCTION := 99
);
END_TYPE

Type declaration for motion functions

Note: The TwinCAT Cam Design Editor uses a motion function type Automatic which corresponds to MOTIONFUNCTYPE_POLYNOM5_MM.

Development Environment | Target System | PLC Libraries to include
TwinCAT v2.9 | PC (i386) | TcNcCamming.Lib


MC_TableCharacValues

TYPE MC_TableCharacValues

TYPE MC_TableCharacValues :
STRUCT
    (* Master Velocity*)
    fMasterVeloNom : LREAL; (* 1. master nominal velocity (normed:
=> 1.0) *)
    (* characteristic slave data *)
    (*===========================*)
    (* Start of cam table *)
    fMasterPosStart : LREAL;    (* 2. master start position
*)
    fSlavePosStart : LREAL;     (* 3. slave start position *)
    fSlaveVeloStart : LREAL;    (* 4. slave start velocity *)
    fSlaveAccStart : LREAL;     (* 5. slave start acceleration
*)
    fSlaveJerkStart : LREAL;    (* 6. slave start jerk *)
    (* End of cam table*)
    fMasterPosEnd : LREAL;      (* 7. master end position *)
    fSlavePosEnd : LREAL;       (* 8. slave end position *)
    fSlaveVeloEnd : LREAL;      (* 9. slave end velocity *)
    fSlaveAccEnd : LREAL;       (* 10. slave end acceleration
*)
    fSlaveJerkEnd : LREAL;      (* 11. slave end jerk *)
    (* minimum slave position *)
    fMPosAtSPosMin : LREAL;     (* 12. master position AT slave
minimum position *)
    fSlavePosMin : LREAL;       (* 13. slave minimum position
*)
    (* minimum Slave velocity *)
    fMPosAtSVeloMin : LREAL;    (* 14. master position AT slave
minimum velocity *)
    fSlaveVeloMin : LREAL;      (* 15. slave minimum velocity
*)
    (* minimum slave acceleration *)
    fMPosAtSAccMin : LREAL;     (* 16. master position AT slave
minimum acceleration *)
    fSlaveAccMin : LREAL;       (* 17. slave minimum acceleration
*)
    fSVeloAtSAccMin : LREAL;    (* 18. slave velocity AT slave
minimum acceleration *)
    (* minimum slave jerk and dynamic momentum *)
    fSlaveJerkMin : LREAL;      (* 19. slave minimum jerk *)
    fSlaveDynMomMin : LREAL;    (* 20. slave minimum dynamic
momentum (NOT SUPPORTED YET !) *)
    (* maximum slave position *)
    fMPosAtSPosMax : LREAL;     (* 21. master position AT slave
maximum position *)
    fSlavePosMax : LREAL;       (* 22. slave maximum position
*)
    (* maximum Slave velocity *)
    fMPosAtSVeloMax : LREAL;    (* 23. master position AT slave
maximum velocity *)
    fSlaveVeloMax : LREAL;      (* 24. slave maximum velocity
*)
    (* maximum slave acceleration *)
    fMPosAtSAccMax : LREAL;     (* 25. master position AT slave
maximum acceleration *)
    fSlaveAccMax : LREAL;       (* 26. slave maximum acceleration
*)
    fSVeloAtSAccMax : LREAL;    (* 27. slave velocity AT slave
maximum acceleration *)
    (* maximum Slave slave jerk and dynamic momentum *)
    fSlaveJerkMax : LREAL;      (* 28. slave maximum jerk *)
    fSlaveDynMomMax : LREAL;    (* 29. slave maximum dynamic
momentum (NOT SUPPORTED YET !) *)
    (* mean and effective values *)
    fSlaveVeloMean : LREAL;     (* 30. slave mean absolute velocity
(NOT SUPPORTED YET !) *)
    fSlaveAccEff : LREAL;       (* 31. slave effective acceleration
(NOT SUPPORTED YET !) *)
    (* reserved space for future extension *)
    reserved : ARRAY[32..47] OF LREAL;
    (* organization structure of the cam table *)
    CamTableID : UDINT;
    NumberOfRows : UDINT;       (* number of cam table entries, e.
g. number of points *)
    NumberOfColumns : UDINT;    (* number of table columns,
typically 1 or 2 *)
    TableType : UINT;           (* MC_TableType *)
    Periodic : BOOL;
    reserved2 : ARRAY[1..121] OF BYTE;
END_STRUCT
END_TYPE

Type declaration for the characteristic values of a motion function.

Development Environment | Target System | PLC Libraries to include
TwinCAT v2.9 | PC (i386) | TcNcCamming.Lib


MC_ValueSelectType

TYPE MC_ValueSelectType

TYPE MC_ValueSelectType :
(
    (* a bitmask can be created by adding the following values
*)
    MC_VALUETYPE_POSITION     := 1,
    MC_VALUETYPE_VELOCITY     := 2,
    MC_VALUETYPE_ACCELERATION := 4,
    MC_VALUETYPE_JERK         := 8
);
END_TYPE

Type declaration for access to value tables with the functionblock MC_ReadMotionFunctionValues.

Development Environment | Target System | PLC Libraries to include
TwinCAT v2.9 | PC (i386) | TcNcCamming.Lib


MC_TableErrorCodes

TYPE MC_TableErrorCodes

TYPE
    (* Cam Table Error Codes *)
    MC_ERROR_POINTER_INVALID     := 16#4B30, (* invalid pointer
(address) value *)
    MC_ERROR_ARRAYSIZE_INVALID   := 16#4B31, (* invalid size of
data structure *)
    MC_ERROR_CAMTABLEID_INVALID  := 16#4B32, (* invalid cam table
ID (not [1..255]) *)
    MC_ERROR_POINTID_INVALID     := 16#4B33, (* invalid point ID
*)
    MC_ERROR_NUMPOINTS_INVALID   := 16#4B34,
    MC_ERROR_MCTABLETYPE_INVALID := 16#4B35,
    MC_ERROR_NUMROWS_INVALID     := 16#4B36,
    MC_ERROR_NUMCOLUMNS_INVALID  := 16#4B37,
    MC_ERROR_INCREMENT_INVALID   := 16#4B38
END_TYPE
Development Environment | Target System | PLC Libraries to include
TwinCAT v2.9 | PC (i386) | TcNcCamming.Lib


MC_CamActivationMode

TYPE MC_CamActivationMode

      TYPE
MC_CamActivationMode :

(

    MC_CAMACTIVATION_INSTANTANEOUS,     (* instantaneous change
*)

    MC_CAMACTIVATION_ATMASTERCAMPOS,    (* modify the data at a
defined master

                                           position referring to
the cam tables

                                    1      master position *)

    MC_CAMACTIVATION_ATMASTERAXISPOS,   (* modify the data at a
defined master

                                           position referring to
the absolute

                                           master axis position
*)

    MC_CAMACTIVATION_NEXTCYCLE,         (* modify the data at the
beginning of

                                           the next cam table cycle
*)
    MC_CAMACTIVATION_NEXTCYCLEONCE,     (* not
yet implemented!

                                           modify the data at the
beginning of

                                           the next cam table
cycle, activation

                                           is valid for one cycle
only *)

    MC_CAMACTIVATION_ASSOONASPOSSIBLE,  (* modify the data as soon
as the

                                           cam table is in a safe
state to

                                           change its data *)

    MC_CAMACTIVATION_OFF,               (* don't accept any
modification *)

    MC_CAMACTIVATION_DELETEQUEUEDDATA   (* delete all data which
was written

                                           to modify the cam table
but is

                                           still not activated
*)

);

END_TYPE

MC_CamActivationMode specifies the timing and type of change for a cam plate. Changes can be affected through scaling or through modification of the cam plate data. In either case, not all modes are available.

Following modes are available:

Scaling of cam plates

Cam plates can be scaled with the function block MC_CamScaling. The following activation modes are available.

MC_CAMACTIVATION_INSTANTANEOUS | Scaling takes effect immediately.
MC_CAMACTIVATION_ATMASTERCAMPOS | Scaling takes effect at a certain master position within the cam plate. The scaling command must be issued ahead of this position.
MC_CAMACTIVATION_ATMASTERAXISPOS | Scaling takes effect at a certain absolute position of the master axis. The scaling command must be issued ahead of this position.
MC_CAMACTIVATION_NEXTCYCLE | For a cyclic cam plate, scaling takes effect at the transition to the next period.
MC_CAMACTIVATION_OFF | No scaling will be done

Setting the mode for changing a cam plate online (Writing of point data)

Function block MC_SetCamOnlineChangeMode is used to specify when modified cam plate data become active. The PLC uses separate commands for writing the modified data (see WriteMotionFunction and MC_WriteMotionFunctionPoint).

MC_CAMACTIVATION_INSTANTANEOUS | The modified cam plate data take effect as soon as they are written by the PLC.
MC_CAMACTIVATION_ATMASTERCAMPOS | The modified cam plate data take effect at a certain master position within the cam plate. The command for writing the data must be issued ahead of this position.
MC_CAMACTIVATION_ATMASTERAXISPOS | The modified cam plate data take effect at a certain absolute master axis position. The command for writing the data must be issued ahead of this position.
MC_CAMACTIVATION_NEXTCYCLE | For a cyclic cam plate, the modified cam plate data take effect at the transition to the next period.
MC_CAMACTIVATION_ASSOONASPOSSIBLE | The modified cam plate data take effect as soon system dynamics allow.
MC_CAMACTIVATION_OFF | Changes in cam plate data are ignored.
MC_CAMACTIVATION_DELETEQUEUEDDATA | Queued cam plate data are deleted. Data are queued if the change was requested at a certain master position or at the end of the cycle, for example.

Coupling with cam plates

Axes can be coupled with cam plates using the function block MC_CamInExt .ActivationMode defines the coupling position.

MC_CAMACTIVATION_INSTANTANEOUS | The cam plate gets active instantaneously.
MC_CAMACTIVATION_ATMASTERCAMPOS | The cam plate will be pending active until a certain master cam plate position is reached. The slave starts moving after the master reached the defined position. This ActivationMode cannot be used in combination with MC_StartMode = MC_STARTMODE_RELATIVE or MC_STARTMODE_MASTERREL_SLAVEABS.
MC_CAMACTIVATION_ATMASTERAXISPOS | The cam plate will be pending active until a certain absolute master position is reached. The slave starts moving after the master reached the defined position.
MC_CAMACTIVATION_NEXTCYCLE | The cam plate will be pending active until the master reaches the next cam plate cycle. The slave starts moving after the master reached the defined position. This ActivationMode cannot be used in combination with MC_StartMode = MC_STARTMODE_RELATIVE or MC_STARTMODE_MASTERREL_SLAVEABS.

Switching cam plates

Cam plates can be switched using MC_CamInExt. The ActivationMode defines the exact master switching position.

MC_CAMACTIVATION_INSTANTANEOUS | Cam plates will be switched instantaneously.
MC_CAMACTIVATION_ATMASTERCAMPOS | Cam plates will be switched at a certain master cam plate position.
MC_CAMACTIVATION_ATMASTERAXISPOS | Cam plates will be switched at a certain absolute master position.
MC_CAMACTIVATION_NEXTCYCLE | Cam plates will be switched at the next cam plate cycle.
MC_CAMACTIVATION_DELETEQUEUEDDATA | A pending switching operation will be cancled.

Development Environment | Target System | PLC Libraries to include
TwinCAT v2.10 Build 1329 | PC (i386) | TcNcCamming.Lib


MC_CamScalingMode

TYPE MC_CamScalingMode

TYPE MC_CamScalingMode :
(
    MC_CAMSCALING_USERDEFINED, (* user defines scaling parameters -
slope and offset *)
    MC_CAMSCALING_AUTOOFFSET,  (* offset is calculated
automatically for best result *)
    MC_CAMSCALING_OFF          (* no modification accepted *)
);
END_TYPE

Type and scope of the scaling of a cam plate coupling via function block MC_CamScaling.

MC_CAMSCALING_USERDEFINED: The scaling and offset are retained unchanged. The user has to calculate the scaling and offset such that a jump in the position is avoided.

MC_CAMSCALING_AUTOOFFSET: The scaling takes effect and the system adjusts the offset such that a jump in the position is avoided. Scaling should nevertheless occur during a phase with slave velocity 0, since otherwise a jump in velocity cannot be avoided.

MC_CAMSCALING_OFF: The scaling and offset are ignored. This mode is used when only slave scaling (i.e. without master scaling) is to be implemented.

Autooffset

Autooffset adjusts the cam plate offsets automatically. Autooffset can be used independently for master or slave and is available for switching and scaling of cam plates.

Master-Autooffset

Master-Autooffset adjusts the master position of a cam plate when switching between cam plates with different cycle or when changing the MasterScaling of a cam plate. This function is useful to hold the relative position of a cam plate in the absolute axis coordinate system which depends on the master cycle of a cam plate.

Master-Autooffset calculates the master offset of a cam plate so that the position, relative to the cam plate, does not change. In case the master cycle is changed when switching cam plates or by changing the master scaling, the proportional position relative to the cam cycle will be fixed.

Example: A cam plate with a master cycle of 360° will be scaled by a factor of 2 to a new cycle of 720°. The scaling operation takes place at 90° of the cam plate, which means at 25% from the beginning of the cam cycle. After the scaling operation has been executed, the relative master cam plate position is still at 25% from the beginning of the new master cycle which is at 180° now.

When switching cam plates at the beginning or end of a cam plate cycle (see MC_CamActivationMode MC_CAMACTIVATION_NEXTCYCLE), Master-Autooffset will adjust the cam plates to be executed in sequence.

Master-Autooffset cannot be used in combination with a relative coupling mode. There are even more restrictions when coupling master and slave initially because some combinations do not have a unique solution.

Slave-Autooffset

Slave-Autooffset adjusts the slave offset of a cam plate so that the slave position does not change due to a switching or scaling operation. If Master-Autooffset and Slave-Autooffset are used at the same time, the master offset will be calculated first and the slave position will then be adjusted with a slave offset.

Development Environment/th> | Target System | PLC Libraries to include
TTwinCAT v2.10 Build 1329 | PC (i386) | TcNcCamming.Lib


MC_CamInfoData

TYPE MC_CamInfoData

TYPE MC_CamInfoData :
STRUCT
    CamTableID                    : MC_CAM_ID;
    TableType                     : MC_TableType;
    Periodic                      : BOOL;
    InterpolationType             : MC_InterpolationType;

    NumberOfRows                  : UDINT; (* number of cam table
entries, e. g. number of points *)
    NumberOfColumns               : UDINT; (* number of table
columns, typically 1 or 2 *)
    MasterCamStartPos             : LREAL; (* Master position of
the first cam table point *)
    SlaveCamStartPos              : LREAL; (* Slave position of the
first cam table point *)
    RawMasterPeriod               : LREAL;
    RawSlaveStroke                : LREAL;
    MasterAxisCouplingPos         : LREAL; (* Master axis position
when slave has been coupled *)
    SlaveAxisCouplingPos          : LREAL; (* Slave axis position
when slave has been coupled *)
    MasterAbsolute                : BOOL; (* raw unscaled distance
from first to last master cam table position *)
    SlaveAbsolute                 : BOOL; (* raw unscaled distance
from first to last slave cam table position *)
    MasterOffset                  : LREAL; (* total master offset
*)
    SlaveOffset                   : LREAL; (* total slave offset
*)
    MasterScaling                 : LREAL; (* total master scaling
factor *)
    SlaveScaling                  : LREAL; (* total slave scaling
factor *)
    SumOfSlaveStrokes             : LREAL; (* sum OF the slave
strokes up TO ActualMasterAxisPos *)
    SumOfSuperpositionDistance    : LREAL; (* sum of additional
moves through MC_MoveSuperimposed *)
    ActualMasterAxisPos           : LREAL; (* absolute set position
of the master axis *)
    ActualSlaveAxisPos            : LREAL; (* absolute set position
of the slave axis *)
    ActualMasterCamPos            : LREAL; (* absolute cam table
position of the master *)
    ActualSlaveCamPos             : LREAL; (* absolute cam table
position of the slave *)
    (* mode for the scaling of cam tables *)
    ScalingPending                : BOOL; (* a change is currently
pending *)
    ScalingActivationMode         : MC_CamActivationMode;

    ScalingActivationPos          : LREAL;
    ScalingMasterScalingMode      : MC_CamScalingMode;

    ScalingSlaveScalingMode       : MC_CamScalingMode;
    (* mode for online changes of cam table data *)
    CamDataQueued                 : BOOL; (* a change is currently
pending *)
    OnlineChangeActivationMode    : MC_CamActivationMode;

    OnlineChangeActivationPos     : LREAL;
    OnlineChangeMasterScalingMode : MC_CamScalingMode;

    OnlineChangeSlaveScalingMode  : MC_CamScalingMode;
   (* mode for exchanging cam tables with MC_CamIn *)
    CamTableQueued                : BOOL; (* a change is currently
pending *)
    CamExchangeCamTableID         : MC_CAM_ID;
    CamExchangeActivationMode     : MC_CamActivationMode;

    CamExchangeActivationPos      : LREAL;
    CamExchangeMasterScalingMode  : MC_CamScalingMode;

    CamExchangeSlaveScalingMode   : MC_CamScalingMode;
END_STRUCT
END_TYPE

The data structure MC_CamInfoData contains data referring to the current state of a cam plate coupling. The data can be determinded using the MC_CamInfo function block.

Development Environment | Target System | PLC Libraries to include
TwinCAT v2.9 from build 1026 | PC (i386) | TcNcCamming.Lib


CamTableGenerator

CamTableGenerate creates a new table in the TwinCAT NC context and fills it with data. If any table exists with the same ID, it will be deleted.

Interface

VAR_INPUT
    iTableId : INT;
    iTableType : UDINT;
    AdrDataArray : POINTER TO LREAL; (* PLC: ARRAY[ ROWS, COLUMNS ] OF LREAL *)
    iSizeOfDataArray : UDINT;
    iColDim : UDINT; (* second array dimension (COLUMNS) *)
    iRowsToWrite : UDINT; (* number of rows to write <= RowDim *)
    iBlockSize : UDINT; (* number of bytes to write in one internal step *)
    bExecute : BOOL;
    tTimeout : TIME;
END_VAR
VAR_OUTPUT
    bBusy : BOOL;
    bErr : BOOL;
    iErrId : UDINT;
END_VAR

iTableID: Table ID which will in future be used to address the table.

iTableType: The table type

(* (n*m) tabular with equidistant ascending master values *)
NC_TABULARTYPE_EQUIDIST_LINEAR : UDINT := 1;

(* same but cyclic *)
NC_TABULARTYPE_EQUIDIST_CYCLE : UDINT := 2;

(* (n*m) tabular with strictly monotone ascending master values (not imperative equidistant) *)
NC_TABULARTYPE_NONEQUIDIST_LINEAR : UDINT := 3;

(* same but cyclic *)
NC_TABULARTYPE_NONEQUIDIST_CYCLE : UDINT := 4;

AdrDataArray: The address of a data field containing position data for the master and slave axes. The first of the field's dimensions describes the table lines, and the second dimension describes the columns.

iSizeOfDataArray: Total size of the data field in bytes.

iColDim: Number of columns in the data field. This value must correspond to the actual size of the second field dimension.

iRowsToWrite: Number of table lines. This value may be less than or equal to the size of the first field dimension.

iBlockSize: The number of data bytes that the function block will transfer in a continuous block into the table in the NC context. If iBlockSize=0 a default value is used, and this is recommended in the majority of cases. Only if the internal processes are understood in detail should a figure for iBlockSize>0 be given.

bExecute: Edge-triggered signal for execution of the command.

tTimeout: ADS timeout (about 1 second).

bBusy: Becomes TRUE with a rising edge at bExecute, and remains TRUE until the block has executed the command.

bErr: Becomes TRUE if an error occurs while executing the command.

bErrId: Error number (ADS or NC error number).


CamTableCreate

CamTableCreate creates a new table, initially empty, in the TwinCAT NC context.

Interface

VAR_INPUT
    iTableId : INT;
    iTableType : UDINT; (* table type *)
    iNrOfRows : UDINT; (* number of table lines (n) *)
    iNrOfColumns : UDINT; (* number of table columns (m) *)
    bExecute : BOOL;
    tTimeout : TIME;
END_VAR
VAR_OUTPUT
    bBusy : BOOL;
    bErr : BOOL;
    iErrId : UDINT;
END_VAR

iTableID: Table ID which will in future be used to address the table.

iTableType: The table type

(* (n*m) tabular with equidistant ascending master values *)
NC_TABULARTYPE_EQUIDIST_LINEAR : UDINT := 1;

(* same but cyclic *)
NC_TABULARTYPE_EQUIDIST_CYCLE : UDINT := 2;

(* (n*m) tabular with strictly monotone ascending master values (not imperative equidistant) *)
NC_TABULARTYPE_NONEQUIDIST_LINEAR : UDINT := 3;

(* same but cyclic *)
NC_TABULARTYPE_NONEQUIDIST_CYCLE : UDINT := 4;

iNrOfRows: Number of table lines.

iNrOfColumns: Number of table columns.

bExecute: Edge-triggered signal for execution of the command.

tTimeout: ADS timeout (about 1 second).

bBusy: Becomes TRUE with a rising edge at bExecute, and remains TRUE until the block has executed the command.

bErr: Becomes TRUE if an error occurs while executing the command.

bErrId: Error number (ADS or NC error number).


CamTableDelete

CamTableDelete deletes a table from the NC context.

Interface

VAR_INPUT
    iTableId : INT;
    bExecute : BOOL;
    tTimeout : TIME;
END_VAR
VAR_OUTPUT
    bBusy : BOOL;
    bErr : BOOL;
    iErrId : UDINT;
END_VAR

iTableID: Table ID of the table that is to be deleted.

bExecute: Edge-triggered signal for execution of the command.

tTimeout: ADS timeout (about 1 second).

bBusy: Becomes TRUE with a rising edge at bExecute, and remains TRUE until the block has executed the command.

bErr: Becomes TRUE if an error occurs while executing the command.

bErrId: Error number (ADS or NC error number).


CamTableWriteData

CamTableWriteData writes table data from a PLC variable into a table in the NC context.

Interface

VAR_INPUT
    iTableId : INT;
    AdrDataArray : POINTER TO LREAL; (* PLC: ARRAY[ ROWS, COLUMNS ] OF LREAL *)
    iSizeOfDataArray : UDINT;
    iColDim : UDINT; (* second array dimension (COLUMNS) *)
    iRowsToWrite : UDINT; (* number of rows to write <= RowDim *)
    iBlockSize : UDINT; (* number of bytes to write in one internal step *)
    bExecute : BOOL;
    tTimeout : TIME;
END_VAR
VAR_OUTPUT
    bBusy : BOOL;
    bErr : BOOL;
    iErrId : UDINT;
END_VAR

iTableID: Table ID of the table from which the data is to be read.

AdrDataArray: The address of a data field containing position data for the master and slave axes. The first of the field's dimensions describes the table lines, and the second dimension describes the columns.

iSizeOfDataArray: Total size of the data field in bytes.

iColDim: Number of columns in the data field. This value must correspond to the actual size of the second field dimension.

iRowsToWrite: Number of table lines. This value may be less than or equal to the size of the first field dimension.

iBlockSize: The number of data bytes that the function block will transfer in a continuous block into the table in the NC context. If iBlockSize=0 a default value is used, and this is recommended in the majority of cases. Only if the internal processes are understood in detail should a figure for iBlockSize>0 be given.

bExecute: Edge-triggered signal for execution of the command.

tTimeout: ADS timeout (about 1 second).

bBusy: Becomes TRUE with a rising edge at bExecute, and remains TRUE until the block has executed the command.

bErr: Becomes TRUE if an error occurs while executing the command.

bErrId: Error number (ADS or NC error number).


CamTableReadData

CamTableReadData reads the table data from a table in the NC context and places it into a PLC variable.

Interface

VAR_INPUT
    iTableId : INT;
    AdrDataArray : POINTER TO LREAL; (* PLC: ARRAY[ ROWS, COLUMNS ] OF LREAL *)
    iSizeOfDataArray : UDINT;
    iColDim : UDINT; (* second array dimension (COLUMNS) *)
    iRowsToRead : UDINT; (* number of rows to read <= RowDim *)
    iBlockSize : UDINT; (* number of bytes to read in one internal step *)
    bExecute : BOOL;
    tTimeout : TIME;
END_VAR
VAR_OUTPUT
    bBusy : BOOL;
    bErr : BOOL;
    iErrId : UDINT;
END_VAR

iTableID: Table ID of the table from which the data is to be read.

AdrDataArray: The address of a data field that is to receive position data for the master and slave axes. The first of the field's dimensions describes the table lines, and the second dimension describes the columns.

iSizeOfDataArray: Total size of the data field in bytes.

iColDim: Number of columns in the data field. This value must correspond to the actual size of the second field dimension.

iRowsToRead: Number of table lines. This value may be less than or equal to the size of the first field dimension.

iBlockSize: The number of data bytes that the function block will transfer in a continuous block into the table in the NC context. If iBlockSize=0 a default value is used, and this is recommended in the majority of cases. Only if the internal processes are understood in detail should a figure for iBlockSize>0 be given.

bExecute: Edge-triggered signal for execution of the command.

tTimeout: ADS timeout (about 1 second).

bBusy: Becomes TRUE with a rising edge at bExecute, and remains TRUE until the block has executed the command.

bErr: Becomes TRUE if an error occurs while executing the command.

bErrId: Error number (ADS or NC error number).


CamTableReadSlavePos

CamTableReadSlavePos reads the slave position defined by the table corresponding to the table position of a master axis. In some cases this will involve interpolation of the slave axis position data, if the master position does not correspond exactly to a table entry.

Interface

VAR_INPUT
    iTableId : INT;
    fMasterPos : LREAL;
    bExecute : BOOL;
    tTimeout : TIME;
END_VAR
VAR_OUTPUT
    bBusy : BOOL;
    bErr : BOOL;
    iErrId : UDINT;
    fSlavePos : LREAL;
END_VAR

iTableID: Table ID which will in future be used to address the table.

fMasterPos: Position of the master axis.

bExecute: Edge-triggered signal for execution of the command.

tTimeout: ADS timeout (about 1 second).

bBusy: Becomes TRUE with a rising edge at bExecute, and remains TRUE until the block has executed the command.

bErr: Becomes TRUE if an error occurs while executing the command.

bErrId: Error number (ADS or NC error number).

fSlavePos: Position determined for the slave axis.


CamTableCoupleAxes

CamTableCoupleAxes couples a slave axis to a master axis by way of an existing table.

Interface

VAR_INPUT
    iSlaveId : INT;
    iMasterId : INT;
    fMasterPositionOffset : LREAL;
    fSlavePositionOffset : LREAL;
    bMasterAbsolut : BOOL;
    bSlaveAbsolut : BOOL;
    iTableId : INT;
    bCoupleOn : BOOL;
    bCoupleOff : BOOL;
    tTimeout : TIME;
END_VAR
VAR_OUTPUT
    bBusy : BOOL;
    bErr : BOOL;
    iErrId : UDINT;
END_VAR

iSlaveId: Axis ID of the slave axis that is to be coupled.

iMasterId: Axis ID of the master axis that is to be coupled to.

fMasterPositionOffset: Master position offset in the table data.

fSlavePositionOffset: Slave position offset in the table data.

bMasterAbsolut: Table data for the master as absolute position values.

bSlaveAbsolut: Table data for the slave as absolute position values.

iTableId: Table ID of the table to be used for the coupling.

bCoupleOn: Edge-triggered signal for execution of the axis coupling.

bCoupleOff: Edge-triggered signal for uncoupling the axes.

tTimeout: ADS timeout (about 1 second).

bBusy: Becomes TRUE with a rising edge at bCoupleOn or bCoupleOff, and remains TRUE until the block has executed the command.

bErr: Becomes TRUE if an error occurs while executing the command.

bErrId: Error number (ADS or NC error number).


CamTableCoupleAxesIpol

CamTableCoupleAxes couples a slave axis to a master axis by way of an existing table. Furthermore the type of interpolation between two table entries can be defined

Interface

VAR_INPUT
    iSlaveId : INT;
    iMasterId : INT;
    fMasterPositionOffset : LREAL;
    fSlavePositionOffset : LREAL;
    bMasterAbsolut : BOOL;
    bSlaveAbsolut : BOOL;
    iTableId : INT;
    iIpolType : INT;
    bCoupleOn : BOOL;
    bCoupleOff : BOOL;
    tTimeout : TIME;
END_VAR
VAR_OUTPUT
    bBusy : BOOL;
    bErr : BOOL;
    iErrId : UDINT;
END_VAR

iSlaveId: Axis ID of the slave axis that is to be coupled.

iMasterId: Axis ID of the master axis that is to be coupled to.

fMasterPositionOffset: Master position offset in the table data.

fSlavePositionOffset: Slave position offset in the table data.

bMasterAbsolut: Table data for the master as absolute position values.

bSlaveAbsolut: Table data for the slave as absolute position values.

iTableId: Table ID of the table to be used for the coupling.

iIpolType : Type of interpolation between two table entries. Valid values are:

 NC_INTERPOLATIONTYPE_LINEAR : UINT := 0; (* standard, uses 2 points *)
        NC_INTERPOLATIONTYPE_4POINT : UINT := 1; (* uses 4 points *)
        NC_INTERPOLATIONTYPE_SPLINE : UINT := 2; (* spline interpolation *)

bCoupleOn: Edge-triggered signal for execution of the axis coupling.

bCoupleOff: Edge-triggered signal for uncoupling the axes.

tTimeout: ADS timeout (about 1 second).

bBusy: Becomes TRUE with a rising edge at bCoupleOn or bCoupleOff, and remains TRUE until the block has executed the command.

bErr: Becomes TRUE if an error occurs while executing the command.

bErrId: Error number (ADS or NC error number).


CamTableOffsetChange

CamTableOffsetChange changes the master and slave offsets in the table online, i.e. while the master and slave axes are coupled through the table.

Interface

VAR_INPUT
    iSlaveAxisId : UINT;
    fMasterPositionOffset : LREAL;
    fSlavePositionOffset : LREAL;
    bExecute : BOOL;
    tTimeout : TIME;
END_VAR
VAR_OUTPUT
    bBusy : BOOL;
    bErr : BOOL;
    iErrId : UDINT;
END_VAR

iSlaveAxisId: Axis Id of the slave axis. The corresponding master is known from the existing axis coupling.

fMasterPositionOffset: Position offset in the master position data.

fSlavePositionOffset: Position offset in the slave position data.

bExecute: Edge-triggered signal for execution of the command.

tTimeout: ADS timeout (about 1 second).

bBusy: Becomes TRUE with a rising edge at bExecute, and remains TRUE until the block has executed the command.

bErr: Becomes TRUE if an error occurs while executing the command.

bErrId: Error number (ADS or NC error number).


CamTableSetSlaveScale

CamTableSetSlaveScale scales a table's slave column for an existing master slave table coupling.

Interface

VAR_INPUT
    iSlaveAxisId : UINT;
    fSlaveScale : LREAL;
   bExecute : BOOL;
    tTimeout : TIME;
END_VAR
VAR_OUTPUT
    bBusy : BOOL;
    bErr : BOOL;
    iErrId : UDINT;
END_VAR

iSlaveId: Axis ID of the slave axis that is coupled to a master axis through a table.

fSlaveScale: Scaling factor for the table's slave column.

bExecute: Edge-triggered signal for execution of the command.

tTimeout: ADS timeout (about 1 second).

bBusy: Becomes TRUE with a rising edge at bExecute, and remains TRUE until the block has executed the command.

bErr: Becomes TRUE if an error occurs while executing the command.

bErrId: Error number (ADS or NC error number).


CamTableSetMasterSlaveScale

CamTableSetMasterSlaveScale scales a table's master and slave columns for an existing master-slave table coupling.

Interface

VAR_INPUT
    iSlaveAxisId : UINT;
    fMasterPositionOffset : LREAL;
    fSlavePositionOffset : LREAL;
    fMasterSlope : LREAL;
    fSlaveSlope : LREAL;
    bExecute : BOOL;
    tTimeout : TIME;
END_VAR
VAR_OUTPUT
    bBusy : BOOL;
    bErr : BOOL;
    iErrId : UDINT;
END_VAR

iSlaveId: Axis ID of the slave axis that is coupled to a master axis through a table.

fMasterOffset : Master position offset for the table

fSlaveOffset : Slave position offset for the table

fMasterSlope : Master scaling for the table

fSlaveSlope : Slave scaling for the table

bExecute: Edge-triggered signal for execution of the command.

tTimeout: ADS timeout (about 1 second).

bBusy: Becomes TRUE with a rising edge at bExecute, and remains TRUE until the block has executed the command.

bErr: Becomes TRUE if an error occurs while executing the command.

bErrId: Error number (ADS or NC error number).


CamTableSetWeight

(only for multi-tables)

CamTableSetWeight sets the scaling parameter of a scalable multi-table.

Interface

VAR_INPUT
    iTableId        : INT;
    fOriginalWeight : LREAL;
    fMasterOffset   : LREAL;
    fMasterSlope    : LREAL;
    fSlaveOffset    : LREAL;
    fSlaveSlope     : LREAL;
    fRangeLow       : LREAL;
    fRangeHigh      : LREAL;
    bExecute        : BOOL;
    tTimeout        : TIME;
END_VAR
VAR_OUTPUT
    bBusy : BOOL;
    bErr  : BOOL;
    iErrId : UDINT;
END_VAR

iTableID: Table ID which will in future be used to address the table.

fOriginalWeight : Original table weighting
fMasterOffset : Master position offset for the table
fMasterSlope : Master scaling for the table
fSlaveOffset : Slave position offset for the table
fSlaveSlope : Slave scaling for the table
fRangeLow : lower range limit for which the table is valid
fRangeHigh : upper range limit for which the table is valid

bExecute: Edge-triggered signal for execution of the command.

tTimeout: ADS timeout (about 1 second).

bBusy: Becomes TRUE with a rising edge at bExecute, and remains TRUE until the block has executed the command.

bErr: Becomes TRUE if an error occurs while executing the command.

bErrId: Error number (ADS or NC error number).


CamTableCoupleAxesMultiTables

(only for multi-tables)

CamTableCoupleAxesMultiTables couples a slave axis to a master axis via a number of existing tables (multi-table coupling).

Interface

VAR_INPUT
    iSlaveId            : INT;
    iMasterId           : INT;
    iNrOfMultiTables    : INT;
    iNrOfProfileTables  : INT;
    iTableId1           : INT;
    iTableId2           : INT;
    iTableId3           : INT;
    iTableId4           : INT;
    iTableId5           : INT;
    iTableId6           : INT;
    iTableId7           : INT;
    iTableId8           : INT;
    bCoupleOn           : BOOL;
    bCoupleOff          : BOOL;
    tTimeout            : TIME;
END_VAR
VAR_OUTPUT
    bBusy               : BOOL;
    bErr                : BOOL;
    iErrId              : UDINT;
END_VAR

iSlaveId: Axis ID of the slave axis that is to be coupled.

iMasterId: Axis ID of the master axis that is to be coupled to.

iNrOfMultiTables : Total number of tables actually used (1 to 8)

iNrOfProfileTables : Number of profile tables (1 to iNrOfMultiTables). Other tables are correction tables that may be switched in.

iTableId1 : Table index for the first table

iTableId2 : Table index for the second table

iTableId3 : Table index for the third table

iTableId4 : Table index for the fourth table

iTableId5 : Table index for the fifth table

iTableId6 : Table index for the sixth table

iTableId7 : Table index for the seventh table

iTableId8 : Table index for the eight table

bCoupleOn: Edge-triggered signal for execution of the axis coupling.

bCoupleOff: Edge-triggered signal for uncoupling the axes.

tTimeout: ADS timeout (about 1 second).

bBusy: Becomes TRUE with a rising edge at bCoupleOn or bCoupleOff, and remains TRUE until the block has executed the command.

bErr: Becomes TRUE if an error occurs while executing the command.

bErrId: Error number (ADS or NC error number).


CamTableEnableCorrectionTable

(only for multi-tables)

CamTableEnableCorrectionTable activates a correction table in multi-table applications.

Interface

VAR_INPUT
    iSlaveId    : INT;
    iTableId    : INT;
    bExecute    : BOOL;
    tTimeout    : TIME;
END_VAR
VAR_OUTPUT
    bBusy       : BOOL;
    bErr        : BOOL;
    iErrId      : UDINT;
END_VAR

iSlaveAxisId: Axis Id of the slave axis. The corresponding master is known from the existing axis coupling.

iTableID: Table ID of the table from which the data is to be read.

bExecute: Edge-triggered signal for execution of the command.

tTimeout: ADS timeout (about 1 second).

bBusy: Becomes TRUE with a rising edge at bExecute, and remains TRUE until the block has executed the command.

bErr: Becomes TRUE if an error occurs while executing the command.

bErrId: Error number (ADS or NC error number).


CamTableDeactivateCyclicTable

(only for multi-tables)

CamTableDeactivateCyclicTable switches an active cyclical multi-table off at the end of the cycle.

Interface

VAR_INPUT
    iSlaveId    : INT;
    iTableId    : INT;
    bExecute    : BOOL;
    tTimeout    : TIME;
END_VAR
VAR_OUTPUT
    bBusy       : BOOL;
    bErr        : BOOL;
    iErrId      : UDINT;
END_VAR

iSlaveAxisId: Axis Id of the slave axis. The corresponding master is known from the existing axis coupling.

iTableID: Table ID of the table from which the data is to be read.

bExecute: Edge-triggered signal for execution of the command.

tTimeout: ADS timeout (about 1 second).

bBusy: Becomes TRUE with a rising edge at bExecute, and remains TRUE until the block has executed the command.

bErr: Becomes TRUE if an error occurs while executing the command.

bErrId: Error number (ADS or NC error number).


Get_TcNcCamming_Version

Get_TcNcCamming_Version determines the version number of the PLC library TcNcCamming.lib. The function returns the version number in a string.

Interface

FUNCTION Get_TcNcCamming_Version : STRING(20)
VAR_INPUT
    bGet : BOOL;
END_VAR

bGet: Signal for execution of the command.