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

In many applications it is necessary to synchronize 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 camshaft). Here the table contains a certain number of prescribed reference points, and the NC interpolates position and speed between them.

FIFO axes are here collected into a FIFO group. These extend the table concept for any number of sequences that do not usually recur cyclically. In this case, rather than having one master-slave table prescribed in advance, the latest axis positions are constantly "topped up" by a PLC program. Because the FIFO axes are combined into a FIFO group, synchronised axis motions can be implemented.

The present document describes the FIFO groups with the aid of a PLC program that is explained step by step.

NC FIFO axis group

If one or more axes are to be operated in a FIFO group, certain preparatory steps are necessary:

  • All axes must be taken to a base position in PTP mode.
  • The axes are collected into the FIFO group.
  • The FIFO memory is fully or partially filled with axis position data.
  • The FIFO group is started, and works through the positions that have so far been entered into to the table, taking them from the FIFO memory.
  • While this is taking place the PLC is constantly topping up the FIFO memory with further FIFO data, until the positioning comes to a logical end.

There is more information about this in the TwinCAT FIFO chapter.


Installing and Running

The FIFO Axes example program reads in the position data for a FIFO group from a file, feeding it to the group’s FIFO memory. The FIFO group is started, continuing until the data stream comes to an end. The data stream can only come to an end if the logical end of the positioning process has been reached, or if the "topping up" data rate is not adequate.

  • Download FIFO Axes example program

The example program uses the library TcNcFifoAxis.lib which can be ordered as an additional product. It uses simulation axes (axes with simulated encoders), and can thus be run on any Windows NT PC without additional hardware. The file TcNcFifoAxisSample.wsm is loaded into the TwinCAT System Manager, and the system is started with this setting.

The NC configuration contains a PTP channel with four PTP axes and a FIFO channel that does not initially contain any axes. The FIFO group is configured under the FIFO channel. The FIFO memory has room for 250 position entries for four axes.

The FIFO store’s timebase is 2 ms. In this case the timebase is synchronous with the NC timebase, but this does not have to be the case. The timebase for the FIFO entries determines the interval at which a new axis positioning value is taken out of the FIFO memory. There is more information about this in the TwinCAT FIFO chapter.

The axis speed results from the difference in position of two neighbouring FIFO entries divided by the FIFO timebase. This speed can be affected by altering the channel override. The override can be varied between 0% and 100% during the positioning. A value of 0% brings the axis to a stop, yet without halting the positioning task. The override types are described in the "Override" section.

The example program assumes that a file with position data exists in the directory C:\CamDesign, although the directory can nevertheless be changed as described further below.

  • FifoTableBig5.Bin

The example program, TcNcFifoAxisSample.pro, is loaded into TwinCAT PLC Control, compiled and run.

TwinCAT Scope is used in order to be able to examine the result. The supplied setting, TcNcFifoAxisSample.scp, allows the axis movements to be recorded.


Program Structure

The Main module calls the AxisEnable and Sequence blocks. The AxisEnable block activates all the necessary enable signals for the axes, and will not be described in any more detail at this point.

The Sequence program module controls the procedure for configuration of the FIFO group, topping up of the FIFO data and driving of the axes.


Global Variables

The position data file that is to be used is specified in the global variables. The filename, including the path to the file, can be altered here. The axis and channel interfaces are also declared here, and data buffers for reading the FIFO data out of a file are created.


Function Block Sequence

The Sequence function block controls the sequence of events.

  • In the step ReadDimStep, the dimensions configured in the TwinCAT System Manager, i.e. the number of axes and the number of lines in the FIFO memory, are read.
  • After this, the position file is opened, and the file header read. The file header contains the number of columns and rows in the file.
  • The most important step is StepReadTable. Here the data is read from the file into two alternately written buffers, each of about 64 kbytes in size (action ReadFile). The FIFO memory is continuously refilled from this intermediate buffer, keeping it as full as possible (action FillFifo). When the FIFO memory has been filled for the first time, the axes are started (action RunTable).
  • After all the positions have been worked through, the FIFO group stops, and the group is dissolved by StepConfigPTP.
  • Finally, the file is closed.

For the purposes of demonstration, this program reads the axis positions out of a file. The position data can of course be made available by quite different methods. They can, for example, also be directly calculated at run-time, or acquired by a measurement system.

The running of the program should not be interrupted at unsuitable times, for instance in order to load a new program version into the TwinCAT run-time system. This can lead to files remaining open, with a following inability to re-open them when the PLC next starts. In such cases the sequence will stop with an error message in one of the steps. If that happens, start the TwinCAT System again by means of the TwinCAT icon in task bar.


External Set value generator

TwinCAT NC PTP offers the possibility to program own Set value generators to move axes. This example shows, how an PLC set value generator can be integrated in the system.
The program realises a 3-phasis generator with rectangular acceleration profile.

Further Information about External set value generator.

The procedure for saving and installing the example program is similar to the example move axis . The program runs under TwinCAT Version 2.9.

  • Example program external set value generator 1

  • Example program external set value generator 2


Drive Controlled Homing (SERCOS)

A SERCOS drive provides the Homing function as drive controlled flow. In this case the referencing results from the drive itself, not from the TwinCAT NC.
The example shows how the drive controlled homing is initialized and activated by TwinCAT PLC.

The procedure to store and install the example program is similar to the Example Moving Axis

  • Sample program for Drive Controlled Homing (SERCOS)

The sample program uses the following special error codes:

16#FFFFFFFF - The sample program does not support parameter scaling in S-0-0044

16#FFFFFFFE - The SERCOS drive aborted the homing sequence with an error.

16#FFFFFFFD - The homing procedure has been finished but the drive did not set the 'referenced' flag in S-0-0403


Install and Start the Example Program

TwinCAT NC PTP offers the PLC programmer simple function blocks for the operation of NC axes. This example describes the integration and operation of an axis within the TwinCAT system.

  • Saving the example Program NC PTP

The example program uses simulation axes (axes with simulated encoders), and can thus be run on any Windows NT PC without additional hardware. The file TcNcsample PTPmove.wsm is loaded into the TwinCAT System Manager, and the system is started with these settings.

  • Load the WSM file
  • Register the setting via the menu Actions - Save To Registry
  • Start the TwinCAT system via the gear wheel symbol

TwinCAT Scope is used in order to be able to examine the result. The supplied setting, TcNcsample PTPmove.scp , allows the axis motion to be recorded.

  • Load the SCP file into TwinCAT ScopeView
  • Start recording via the menu or via the F5 key. (The Score configuration contains a trigger condition so that, after starting the process with F5, recording will only commence once the axis has started)

Finally, the example program TcNcsample PTPmove.pro is loaded into TwinCAT PLC Control, compiled and started.

  • Load the PRO file
  • Compile the PLC project via the menu Project - Rebuild All.
  • Load the PLC project via the menu Online - Login into the runtime system
  • Start the program via the menu Online - Run

Once the program has started, the axis is moved in simulation mode, and recording commences. The image shows position, velocity and acceleration of the axis.


Axis coupling with gearing factor

TwinCAT NC PTP offers the PLC programmer simple function blocks for the operation of NC axes. This example demonstrates coupling of a slave axis to a master axis via a fixed gearing factor.

The procedure for saving and installing the example program is similar to the Axis movement example. The program runs starting from TwinCAT version 2.8.

  • Example program "Axis Coupling"

In addition to the axis coupling with a fixed gearing factor, it is possible to adjust the gearing facor cyclically.

This sample demonstrates dynamic master slave couplings. The velocity of the slave is controlled by the PLC.

  • Example program "Axis Coupling" with dynamic gear ratio


ASCII Table Format

All the numerical values in the columns of the table are separated in the text file by tab characters. A new table line begins in a new line of the file.

This example table covers a travel region of the master axis of from 0 to 14 mm. The data can be interpreted absolutely or relatively.

The first column in the table file contains master positions selected from the whole of the travel region (reference points). Each associated slave position is entered in the second column.

Please note that the table must include the first and last axis positions, since the extent of the axis travel is given by the last value minus the first value. For example, for an equidistant table from 0° to 360° with a resolution of 0.1°, precisely 3601 value pairs are needed. In that case, the master positions 0° and 360° must be contained explicitly in the table!


Binary Table Format

The binary file format contains first a version number and two more 4-byte long integer values that define the number of lines and columns in the table (the header). After this comes the necessary number of numerical values in 8-byte long real (double) format. All numbers are stored in "little endian" byte (Intel) sequence.

In contrast to the ASCII format, the header is needed in binary format, since otherwise only the number of values can be determined, but not the number of rows and columns they constitute.

The format of the header has changed in comparison with an earlier format. Binary files in this earlier format are recognised, and can be converted, by the conversion program ASCII2BIN described below.


Function Block Sequence

The function block Sequence controls the sequence of events from the reading in and generation of a table up to operation of the axes.

  • With the start signal, the step Init switches to the next table file to be read. With each pass through Init one of four tables is cyclically worked through. The Start transition is true immediately after the PLC has started. Start can be set to false manually in order to halt the sequence at a defined location.
  • The step ReadTableStep reads one of the four tables, using the function block TableCreate described further below.
  • In the next step the master and slave axes are each taken to the positions defined for them by the table. In this case, these are the positions defined in the first line of the table, since no offsets are being used and the table data is absolute. At this stage, the axes are not yet coupled, and so move independently of one another.
  • When both axes are at their destination, they are coupled through the current table, in the step CoupleStep. The block CamTableCoupleAxes is used for coupling the axes.
  • After this, the master axis is taken to a new target position and then back again to a position near to the start. The slave axis is not actively started, but is now positioned according to the slave position defined in the table as corresponding to the position of the master axis.
  • In the last step, DecoupleStep, master and slave are decoupled. The next cycle is operated with another table.

In this program, for the purposes of demonstration, a table is read out of a file every time the slave is coupled to the master. It is of course possible to couple the slave to the master and to decouple the axes again any number of times, without destroying the table in the NC. Normally therefore it is only necessary to read a table from a file once during initialisation. It is also possible to couple a slave to a master using various tables one after another, without having to read them in again. The different tables are then identified in the NC by means of their table ID.

In this context, reference should be made to the TwinCAT Cam plate Editor, with which cam plates may be graphically generated directly in the TwinCAT environment. If this editor is used, it is no longer necessary to take the route via an external table file. The step of reading in and generating a table is then omitted.

The running of the program should not be interrupted at unsuitable times, for instance in order to load a new program version into the TwinCAT run-time system. This can lead to files remaining open, with a following inability to re-open them when the PLC next starts. In such cases the sequence will stop with an error message in one of the steps. If that happens, start the TwinCAT System again by means of the TwinCAT icon in task bar. In order to stop the process at a defined point, set the variable Start in the transition after the Init step manually to FALSE, and wait until the Init step is reached. After this you can load a new or altered program into the run-time system and start it. Independently of this, online change is possible at any time.


Function Block Table_FB

TwinCAT NC: Camshaft Example

Function Block TableCreate

The function block TableCreate contains all the necessary functions for reading table values out of a file and preparing them for the NC.

  • The file is read after the initialisation. A distinction is made between binary and ASCII files.
  • In the StepGenerateTable, the table will be created and downloaded to the NC memory using the table ID.


Global Variables

The tables that are to be used are specified in the global variables. File name, file type (ASCII or BIN) and the properties of the table (linear, cyclical, equidistant) in the file are specified in an initialised variable of type Tabledefinition. The files entered here are processed by the example program in sequence, and are independent of one another. This file list can be extended, provided the constant MAX_NUMBER_OF_FILES is increased.


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 camshaft). Here the table contains a certain number of prescribed reference points, and the NC interpolates position and speed between them.

The present document describes table coupling with the aid of a PLC program, which is explained step by step.

NC Camshaft

Certain preparatory steps are required in order to couple two axes through a table. The table data must be transferred to the TwinCAT NC’s memory, in order then to couple the slave axis by way of this table to the master axis. The following specific steps, whose programming will later be described with the aid of an example program, are necessary:

  • Creation of an initially empty table in the NC driver.
  • Reading table values out of a file. Alternatively, this data can be contained directly in initialised PLC variables.
  • Transferring the data to the NC table.
  • Taking the master and slave axes to defined start positions.
  • Coupling the slave axis to the master axis through the table.
  • Driving the master axis together with the slave axis, synchronised through the table.

For the generation of tables we use the TwinCAT Cam Design Editor .

Basic principles related to camshafts are provided in the section on Camshaft Axes.


Install and Start the Example Program

The camshaft example program reads the values for a table out of a file, uses it to couple two axes as master and slave, and operates them. This procedure is carried out in sequence with four table files. The four tables are used independently of each other, and are intended to clarify the handling of different properties within the program. For example, two tables are saved as ASCII files, the other two in binary format.

  • camshaft example program

The example program uses simulation axes (axes with simulated encoders), and can thus be run on any Windows NT PC without additional hardware. The file TcNcCammingSample.wsm is loaded into the TwinCAT System Manager, and the system is started with this setting.

TwinCAT Scope is used in order to be able to examine the result. The supplied setting, TcNcCammingSample.scp, allows the axis movement to be recorded. The dependency of slave on master created by the table is thus graphically displayed.

The example program assumes that four files exist in the directory C:\CamDesign, although the directory can be changed as described further below.

  • TableLinearEquidistant.txt
  • TableCyclicEquidistant.txt
  • TableLinearEquidistant2.BIN
  • TableCyclicEquidistant2.BIN

To read the files, this program uses a supplementary library, ChrAsc.lib, which is copied into the directory TwinCAT\Plc\Lib.

The example program, TcNcCammingSample.pro, is loaded into TwinCAT PLC Control, compiled and run.

Note

To run the sample program the PLC library TcNcCamming.lib will be required. The library is an additional product an is not shipped with TwinCAT.


Program Structure

The Main module calls the AxisEnable and Sequence blocks. The AxisEnable block activates all the necessary enable signals for the axes, and will not be described in any more detail at this point.

The program module Sequence controls the sequence of activities involved in the generation of a table, coupling of the axes and driving them. A new table is created in the directory Table Modules in the second step in Sequence, by calling block TableCreate.


Converting Table Formats

The essential difference between an ASCII table and a binary table is only the format in which it is saved on the external data medium. The format has no significance to the operation of the NC. The advantage of an ASCII table is the ease with which it can be read and edited with a text editor. The binary format can be read in more quickly and easily by the PLC, since the data can be transferred from the file directly into a variable.

Converting ASCII tables into binary format

The ASCII2BIN utility program supplied converts an ASCII table into a binary table. Clicking the mouse on "Open" selects an ASCII file, and with a further click on "Convert to binary file" it is converted into a binary file with the ending ".BIN".

Converting binary tables into ASCII format

The reverse conversion is also possible with the program ASCII2BIN. Here, clicking on "Open" selects a file with the ending ".BIN" as the source file. The ending enables ASCII2BIN to recognise that a binary file has been selected, and converts it to ASCII format with the ending ".TXT" with a click on "Convert to ASCII file".


Tables

Table contents

A table is a list of axis positions having more than one column. The table used for a master/slave axis coupling has two columns. Each line contains a pair of reference points for a master position and a corresponding slave position. The TwinCAT NC PTP expects that the first column will consist of a strictly monotonically rising sequence of master positions, so that each master position can have an unambiguous slave position assigned to it. A table thus describes a static relationship between master and slave positions (location curve). The TwinCAT NC PTP interpolates between two adjacent reference points in this location curve at run-time. Dynamic parameters (speed and acceleration) only arise at run-time as the set values are generated by the NC, and depends only on the master speed and the table data.
The term "table" is often used in a variety of contexts, although different structures are being described. It is therefore necessary to define the term.

Basic principles related to this topic are provided in the section on Camshaft Axes.

NC table

A table, in the sense of the TwinCAT NC, refers only to a data structure defined in the NC’s memory area containing the reference points for the interpolation of the axis positions. A table is identified by a unique table ID, similar to an axis ID.

Table file

A table file saves the data on an external data carrier, and can be created with the aid of various software tools.

Table variable

In order to process the table data with the TwinCAT PLC, it is necessary for it to be held in a variable in the PLC’s memory area. A two dimensional array is an example of a suitable structure. A change in the data held by the variable during run-time does not directly affect the axis coupling. Only after the altered data has been transferred into the table in the NC’s memory area is it used for positioning the axes.


Example of cam coupling with motion functions

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 TwinCAT cam plate editor provides a facility for defining the relationship between the master and slave positions, and for making it available as a cam plate. One way of representing a cam plate is as a two-column table of 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. 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.

The example program implements the cam plate coupling with a motion function. The program requires the supplementary TcMcCam.lib library, which is part of the cam plate package.

Saving the example program

Example program for cam plate coupling with motion functions


Example

TwinCAT NC PTP offers the PLC programmer simple function blocks for the operation of NC axes. This example shows how the target position and velocity can be changed during axis motion.

The procedure for saving and installing the example program is similar to the Axis movement example.

  • Example program "Changing of target position and velocity"


Global Variables

The axis interfaces between PLC and NC are declared in the global variables.


Installing and Running

The Flying Saw example program example program first starts a master axis. After this a flying saw is coupled, and, after carrying out an imaginary machining process, is once more decoupled.

The example program uses simulation axes (axes with simulated encoders), and can thus be run on any Windows NT PC without additional hardware. The file TcNcFlyingSawSample.wsm is loaded into the TwinCAT System Manager, and the system is started with this setting.

TwinCAT Scope is used in order to be able to examine the result. The supplied setting, TcNcFlyingSawSample.scp, allows the axis movements to be recorded.

The example program TcNcFlyingSawSample.pro is loaded into the TwinCAT PLC Control, compiled and run. The program uses the library TcNcFlyingSaw.lib which can be ordered as an additional product.

The Universal Flying Saw UFS is a advanced flying saw which is supposed to be used in new projects.

  • Universal Flying Saw example program
  • Flying Saw example program


Overview

In many plants workpieces undergo machining operations while being transported. For this purpose it is necessary to synchronize the position and the speed of tool and workpiece, so that the tool can then be applied as if to a stationary workpiece. One example of such an application is a saw that during the transport process cuts through the material that is being transported (flying saw). In order to implement this kind of application, TwinCAT provides the flying saw.

Slave axes are axes, whose set values are generated as functions of the set values of another axis. The simplest type of slave axis is the linear slave axis, that is coupled via a fixed transmission ratio (an electronic gearing system) to another axis (a master axis or another slave axis).

The diagonal slave axis is another name for the flying saw. In contrast to a linear slave axis, the diagonal slave axis is synchronized "on the fly" to the master axis as it moves, and is stopped and uncoupled at a later stage without halting the master axis. This means that the slave axis moves at an angle, diagonally to the master axis.

A special case of the diagonal slave axis is the parallel slave axis, which instead of moving diagonally, moves in parallel to the master axis. In fact this case is, in practice, altogether more common than the diagonal movement.

The present document describes the flying saw with the aid of a PLC program, which is explained step by step.

Flying saw

The following steps are required if an axis is to be operated as a flying saw:

  • The slave axis is coupled to the master axis in accordance with a specified absolute master and slave synchronization position. The slave axis then starts of its own accord, and synchronizes itself with the master axis. After the synchronization position has been reached, the master and slave axes then move in positional and speed synchronism.
  • The slave axis is halted after the machining operation using a special stop function.
  • The slave axis is decoupled from the master axis.
  • The slave axis is driven as an independent PTP axis back to its base position so that a new machining operation can begin.
    •

    Basic principles related to this topic are provided in the section on the Flying Saw.

    Universal Flying Saw

    The flying saw has been developed since TwinCAT 2.9 to the universal flying saw. Basic principles related to this topic are provided in the section on the Universal Flying Saw.


Program Modules

Sequence of Function Blocks

The Sequence function block controls the sequence of events.

  • The step StepStartMaster starts up the master axis in an endless operation that e.g. simulates a feed chain on a machine line.
  • In the next step StepCoupleSlave the slave axis is coupled to the master axis by specification of the master synchronous position. Coupling occurs early enough before this position is attained, to enable synchronisation of the NC. The NC uses these coupling parameters to calculate a dynamic coupling position, and starts the slave axis from this position. This implies that it is essential for the logical coupling position determined by the PLC to be located before the dynamic coupling position!
  • After an imaginary machining operation the slave axis is halted in the step StepStopSlave. This is achieved with the aid of a special stop function, because it is only in the special case of the flying saw that stopping a coupled slave axis is permitted.
  • When the slave axis is stationary, it is decoupled from the master axis in the step StepDecoupleSlave.
  • In StepReturnSlave the slave axis is now driven back as an independent PTP axis to its initial position.
  • Subsequently the machining operation cycle starts again from the beginning.


Program Structure

The Main module calls the AxisEnable and Sequence blocks. The AxisEnable block activates all the necessary enable signals for the axes, and will not be described in any more detail at this point.

The Sequence program module governs the flow of actions required for operation of the flying saw.


Example Axis position compensation

TwinCAT NC: Example NC-PTP

Axis position compensation (superposition)

TwinCAT NC PTP offers the PLC programmer simple function blocks for the operation of NC axes. This example demonstrates position compensation on an axis in motion.

The procedure for saving and installing the example program is similar to the Axis movement example.

  • Example program "Position compensation"


Cyclic axis interface

Each axis has a cyclic interface for connecting NC and PLC. This interface consists of two data structures for exchanging information between NC and PLC. One structure contains data made available by the NC for the PLC; conversely, the other structure contains PLC data for the NC. Both data structures are declared as variables in the PLC and later connected with the interface structures of the NC axis via the TwinCAT System Manager.


Setting of axis enables

Enable signals will have to be set by the PLC in order to enable axis movement. A distinction is made between software enabling and hardware enabling. A hardware enable signal switches a drive into a ready-to-run state via a digital signal. Hardware enabling is not necessary here, since this example uses simulation axes. Irrespective of this, the TwinCAT NC requires software enabling in order to switch an axis into the ready-to-run state. Furthermore, the set velocity of each axis may be influenced via a velocity override between 0% and 100%, which is normally set to 100%. With a value of 0%, the axis would not move.

  • Enable controller
  • Feed enabling for the positive direction
  • Feed enabling for the negative direction
  • Velocity override 100%

In the example program, the enabling functions are written into the cyclic axis interface via the function block MC_Power.


Overview

TwinCAT NC PTP offers the PLC programmer simple function blocks for the operation of NC axes. This example describes the integration and operation of an axis within the TwinCAT system.


Program Structure

The Main module calls the AxisEnable and MoveAbsolute blocks and governs the flow of actions required for operation of the axis.


Program flow

Setting of axis enables

The program starts with the program block MAIN, in which initially the program AxisEnable for setting of the required axis enables is run. After the enable signals are set, the axis is ready for operation.

Program block "MAIN"

The axis motion sequence is programmed in the program block MAIN. The axis is started at target position 2000 mm and subsequently moved to position 0 mm. This cycle is repeated continuously.

Starting and monitoring of an axis

In the second step, MOVESTATE_FORWARD, the axis is started at target position 2000 mm with a velocity of 1000 mm/s. The start is initiated within the action MoveAction via the function block MoveAbsolute.


Example Slave axis position compensation

TwinCAT NC: Example NC-PTP

Slave axis position compensation

TwinCAT NC PTP offers the PLC programmer simple function blocks for the operation of NC axes. This example demonstrates position compensation during motion of a slave axis coupled to a master.

The procedure for saving and installing the example program is similar to the Axis movement example.

  • Example program "Slave axis position compensation"