Download as pdf or txt
Download as pdf or txt
You are on page 1of 90

331 SOFTWARE

axes controller in AWL


Doc. MS229601
Ed.02 – english –18 July 1996

Via dell’Artigianato, 21
31050 Vascon (TV)
Tel. 0422/447411 - Fax 0422/447444
e-mail:cmz@cmz.it – support@cmz.it
331 SOFTWARE axes controller in AWL

WARNING
CMZ Sistemi Elettronici can modify or improve the products herein described at any time without prior notice.

This manual has been written by CMZ Sistemi Elettronici exclusively for its customers to provide them with the latest
and more updated information on its products. Information in this document is subject to change and does not represent a
commitment on the part of the company.

Special attention is required when using the functions herein described to avoid any possible danger for workers, damages
to the machines or any consequential damage that may result from wrong installation or misuse of the equipment.

No further guarantees are given by CMZ Sistemi Elettronici in particular for imperfections, incomplete information
and/or operative difficulties.

This manual is meant for the programmers of CTE300 and of those systems based on 331CPU card. Please note that
while CTE300 has a precise hardware configuration with maximum three axes, the other systems can have up to 16 axes.
The program for axes control in this operative system enables to operate on all axes, but to store in memory only 4 axes.
If the application would require a larger number of axes, it is necessary to allocate their relative memory areas (one for
each exceeding axis) directly in the user program. This manual does not introduce the modalities for memory allocation.
In the systems based on the 331CPU card the ENCODA card or the MINENC + CNV312 cards (or others) can be used to
control axes. The program for axes control expects the use of the ENCODA card. For other cards, the user's program
should be compiled together whit the drivers program provided by CMZ.
This manual does not introduce the operative modalities for these drivers and their installation procedure, but it will be
soon completed with all the missing instructions. Meanwhile CMZ's tchnicians are available for all further information
and explanations about operative modalities the customer might need.

2 Doc. MS229601 - Ed.02 – 18/07/96


SUMMARY

SUMMARY

AIM OF THE MANUAL ....................................................................................................................... 5

chapter 1. THE PROGRAM FOR AXES CONTROL ...................................................................... 6


1.1 PROGRAM ACTIVATION ...........................................................................................................6
1.2 THE VARIABLES OF THE MOTION PROGRAM....................................................................7
Axes specific variables .....................................................................................................................7
1.2.1 Select the axis to be controlled ...............................................................................................9
1.3 SECTION FOR QUOTA GENERATION.....................................................................................9
1.3.1 Axis operation mode.............................................................................................................10
1.3.2 Functions for axes control ....................................................................................................12
1.3.2.1 Prior note on speed ramps ............................................................................................12
1.3.2.2 Instruct the axis to reach a speed (mode 1) .................................................................13
1.3.2.3 Axis Stop (mode 10, 0) .................................................................................................14
1.3.2.4 Axis lock (mode 0) ........................................................................................................14
1.3.2.5 Axis in electric gear (mode 8) .......................................................................................14
1.3.2.6 Axis stand-by (mode 9) ................................................................................................14
1.3.2.7 Instruct the axis to reach a position (mode 2 and 3) ...................................................15
1.3.2.7.1 Positioning with back-lash recovery.....................................................................17
1.3.2.8 Zero search on home-micro switch (mode 6)..............................................................17
1.3.2.9 Zero search on home-micro switch and encoder index pulse (mode 4) ....................17
1.3.2.10 Control if the axis is stopped ......................................................................................18
1.3.2.11 Software Position Reset ..............................................................................................18
1.3.2.12 Set of the axes position value .....................................................................................18
1.3.2.13 Set software end-strokes .............................................................................................18
1.3.2.14 Exclusion of the software end-strokes .......................................................................18
1.3.2.15 Enabling and disabling of hardware end-stroke micro switches ..............................19
1.4. REGULATION.............................................................................................................................19
1.4.1 Regulation Algorithm............................................................................................................20
The following table shows the regulation algorithm for the axes program.................................21
1.4.2 Notes on the parameters .......................................................................................................23
1.4.2.1 KNDA and KIDIV normalisation coefficients ............................................................23
1.4.2.2 KN speed feed forward coefficient...............................................................................23
1.4.2.2.1 Driver with speed loop ..........................................................................................23
1.4.2.2.2 Driver with torque control.....................................................................................24
1.4.2.3 KFA acceleration feed forward coefficient ..................................................................24
1.4.2.4 PID Coefficients: KP KI KD.........................................................................................24
1.4.2.5 KIL limited integral action coefficient..........................................................................25
1.4.2.6 Software Offset..............................................................................................................25

chapter 2. AXES TUNING................................................................................................................... 26


T_MOT ACTIVATION ......................................................................................................................26
2.2 MAIN MENU................................................................................................................................27
2.3 SYSTEM CONFIGURATION TABLE.......................................................................................28
2.4 TUNING DRIVER PARAMETERS............................................................................................30
2.4.1 Hardware offset regulation....................................................................................................30

Doc. MS229601 - Ed.02 – 18/07/96 3


331 SOFTWARE axes controller in AWL

2.4.2 Assessment on encoder phases ............................................................................................31


2.4.3 Driver’s speed tuning ............................................................................................................31
2.5 KN TUNING .................................................................................................................................31
2.5.1 KN Tuning .............................................................................................................................32
2.5.2 PID Tuning.............................................................................................................................32
2.5.3 Offset software tuning...........................................................................................................33
2.6 FIRST PARAMETERS PAGE.....................................................................................................33
2.7 GRAPHIC VISUALISATION .....................................................................................................36
2.8 SECOND PARAMETER PAGE .................................................................................................37

chapter 3. AWL BASIC LIBRARY FOR AXES CONTROL ........................................................ 38

chapter 4. PROGRAMMING EXAMPLE ....................................................................................... 71

CORRECTION...................................................................................................................................... 85

4 Doc. MS229601 - Ed.02 – 18/07/96


AIM OF THE MANUAL

AIM OF THE MANUAL

The aim of this manual is that of providing AWL programmers with all the necessary information on
axes control. In particular on:

- the program for axes control


- the procedure for tuning axes
- the function library for axes control recallable by AWL

For the comprehension of this manual, knowledge of the AWL language system is required, as
explained in the 331 SOFTWARE - PLC User’s manual.

Doc. MS229601 - Ed.02 – 18/07/96 5


331 SOFTWARE axes controller in AWL

chapter 1. THE PROGRAM FOR AXES CONTROL

The program for axes control enables all motion functions and is fully controlled by the AWL
program. It is activated by interrupt on high priority every millisecond and separately examines
each axis. Therefore if three axes are enabled at the same time, the sampling time for each axis (Tc)
is three milliseconds.
In this program there are two different sections, operated in a sequence:

• a section for quota generation, which generates the theoretical axis’s trajectory.
• a section for quota regulation, which tries to maintain null the error between the real and the
theoretical quota.

For the programmer that uses the standard functions the management of these sections is
transparent.

In the following paragraph, comes furnished an explanation of the axes program operation way and
of the possible commands.
For a detailed explanation of each command see chapter 3.

1.1 PROGRAM ACTIVATION

The motion program is activated by the cm-start function that requires the number of axes to be
activated in ACC1. For example, with:

L KZ3
C cm-start

three axes are activated. The call for cm-start function must be inserted before starting the AWL
program or at least before other possible functions calls from the axes library. After their activation,
the axes enter the position maintenance mode (see 1.3.1).

The variables for the motion program can be divided in two groups:

work variables: automatically updated by the axes program


parameters: constants for the PID filter, ramps, etc., all set by the application program or by a
program for axes tuning.

The parameters are set with default values only during their first activation, while during further
activations only work variables are used. Therefore when a variable is modified, its new value
remains unchanged during all further program activations.

NOTE
It should be noted that the system’s RAM has a backup battery so it maintains its content even when there is no
electric supply or the plug is not connected. The system is normally already provided with initialised variables
due to factory tests. To force a total reset the cm-restot function should be used as herein specified.

To force a parameters total reset and to set-up the default values, the cm-restot function that
requires the number of axes to be controlled in ACC1 must be called. In the CTE300 system the

6 Doc. MS229601 - Ed.02 – 18/07/96


chapter 1. THE PROGRAM FOR AXES CONTROL

default values are those memorized in EEPROM (where the T_MOT program should previously
memorized them).
A total reset is necessary when the axes number is modified or when, due to errors caused by the
system program, the variables of the motion program have changed to the extent that a re-start is
impossible.

The cm-restot and cm-start functions must be called once, not continuously. The cm-restot
function should be called only at system’s first start (it must be written in the #RESET block); the
cm-start function should instead be called at every new start (it must be written in the #START
block). The cm-restot function initialises the axes program. An activation example is given in
chapter 3 (cm-restot).

1.2 THE VARIABLES OF THE MOTION PROGRAM

The variables of the motion program are contained in the RAM memory of operating system. Some
variables are common to all axes, while others are multiple since each axis has its own.
A list of the motion program’s variables that the programmer might wish to change or control is
here specified along with their dimension ( B= byte W= word L= double word) and their
accessibility from AWL (R= only reading W=only writing R/W=reading and writing NO=not
accessible from AWL). Parameters are indicated in italics, while work variables are in normal
characters. The DEFAULT column indicates the parameters value during system total reset.
Only the clearness parameters are important for a standard use of the axes program.

Variables common to all axes:

VARIABLE DIM AWL DEFAULT DESCRIPTION


Dtc L W 1000 Value of the inside timer launching the interrupt of the axes
program (in microsecond)
N.ASSI W R/W 3 Number of system axes
CONT W NO Number of actual axis that cyclically varies from 0 to N.AXIS -1
RES W W Total reset flag. If during initialisation its content is found different
from 1234, there is a total reset and default values are applied to the
variables. Then the resolution value is set to 1234.
axis W R/W Number of selected axis

Axes specific variables

VARIABLE DIM AWL DEFAULT DESCRIPTION


P1 L R/W 0 Position of the axis read by the encoder, set to zero at total
reset.
PA W NO P1 increase at each sampling interval.
V1 W R Axis speed worked out by the encoder. The speed is measured
in encoder pulses every KK/2 × Tc
KP W R/W 0 Coefficient of the proportional action
KI W R/W 0 Coefficient of the integral action
KD W R/W 0 Coefficient of the derivative action
KIL W NO 0 Coefficient of the integral limited action
KIDIV W NO 100 Division coefficient of the integral action
KNDA W NO 100 General division Coefficient of the regulation mode
KK W NO 26 Number of intervals for the measurement of V1 (see), its value
can be max. 60

Doc. MS229601 - Ed.02 – 18/07/96 7


331 SOFTWARE axes controller in AWL

LIM L NO $ 7000000 Maximum limit for integral accumulation


LIMINT W NO 1000 Error at which the integral action holds
Cerr B R/W Error code in mode 12
MEMIN L NO Integral error accumulation
ER W R Present Position Error
KFA W NO 0 Coefficient of the acceleration feed forward
KRAS L W 100 KVS increase with 'S' ramps
VETT.ARR L NO 0 Vector for mode 14
ERD W NO Derivative Error
IND W NO 1 Delay time for derivative action
EY W NO Error at regulation exit
VU W R Image of output voltage ( -10V=-32768 +10V=32767)
VDESID L R Instant speed required by the axis
PDESID L NO Position required by the axis
modo W R Axis Operation Mode
modo.pre W NO Operation Mode at previous moment
KN W R/W 0 Normalisation coefficient or speed feed forward
TOLL L R/W 1 Tolerance to the entrance in mode 0 at the end of positioning
VMINIMA L R/W 10000 Arrival speed during positioning phases
VIND L R/W -1000000 Speed during zero search first phase
VTACC L R/W 65536 Searching speed for the encoder index pulse
ENC.FIN L NO Position to be reached during positioning phase and for
position maintenance
KVS L W 10000 Speed increase in acceleration ramps
KVD L W 10000 Speed decrease in deceleration ramps
VREGIME L NO Speed to be reached during some operation modes
offset W NO 0 Axis offset software
flaz W NO 0 Auto-tuning Flag
RAPINS W R/W 65536 Following ratio for operation in electric gear
flca W W 0 Open loop (1) or Closed loop (0) Flag
VETT.CUST L NO addr Subroutine address for the 11 mode. At the moment of total reset an
address internal to the motion program executing no functions is loaded.
flow W NO 1 Flag for enabling (1) or disabling (0) the entrance in mode 12
for regulation saturation.
LIMITS L W $7FFFFFFF Software positive end-stroke. A limit value as $7FFFFFFF
excludes the control.
LIMITI L W -$80000000 Software negative end-stroke. A limit value as -$80000000
excludes the control.
NUM.IC W NO -1 Enabling flag for hardware negative end-stroke (entrance
NSTOP). A negative value excludes the control
NUM.FC W NO -1 Enabling flag for hardware positive end-stroke (entrance
PSTOP). A negative value excludes the control.
VEMAX L R/W $7FFFFFFF VDESID maximum value.
modoins W R/W 0 Following mode for the operation in electric gear
CIRC L R/W 0 Number of pulses at the revolution of circular axis. If the CIRC value is
more than zero, the axis is considered circular: at its entrance in mode 0
the quota is normalised within the revolution.
GIOCO L R/W 0 Backlash quota during positioning.
ANTIC L R/W 0 Progression quota on the ramps during positioning.
modogio W R/W 0 Backlash recovery mode.
KRAD L W 100 KVD increase with 'S' ramps
ftr W R/W 0 Flag type ramp, equal to 1 for 'S' ramps and to 0 for linear
ramps.
EROVFL W R/W -1 Maximum error for operation in mode 13. A negative value
excludes this control.
NUM.AVL W W -1 Output number for FORWARD SLOW function in on/off axes.
NUM.INDL W W -1 Output number for BACKWARD SLOW function in on/off axes.

8 Doc. MS229601 - Ed.02 – 18/07/96


chapter 1. THE PROGRAM FOR AXES CONTROL

NUM.AVV W W -1 Output number for FORWARD RAPID function in on/off axes.


NUM.INDV W W -1 Output number for BACKWARD RAPID function in on/off axes.
NUM.ABIL W W -1 Output number for ABILITATION function in on/off axes.
NUM.INV W W -1 Output number for REVERSING function in on/off axes.
Risenc L R/W 0 Encoder resolution.

NOTE
The axis position (P1) is set to zero only at total reset, but during later starts it maintains the reached value.
Therefore in a machine controlled by the system, the axes position is not changed the same even after switching
it on and off. If the axes position is manually changed because the controller is switched off or the program is
not activated, there is obviously no position updating, so a zero search is required.

NOTE
The Risenc parameter is not part of the axes program, it cannot be set by T_MOT. In the CTE300 system, in case
of total reset it is not loaded by EEPROM.

1.2.1 Select the axis to be controlled

The axis number where to address instructions should be previously selected by the w.asse function
demanding the axes number to be controlled in ACC1. For example, the following program selects
axis 0 as the axis to which instructions should be addressed:

L KZ0 * Number of the axis to be selected


C w.asse * Call for the axis selection function

The selection is valid until a new selection.


The number of the selected axis can be known by calling the r.asse function that provides its
number in ACC1.

1.3 SECTION FOR QUOTA GENERATION

This program section generates a theoretical position (PDESID) and a theoretical speed (VDESID)
that together set the axes trajectory.
Quota, speed and acceleration are all expressed in their own unit of measurement, in particular:

Quota Unit
Quotas are expressed in encoder impulses. It is important to note that the system interface multiplies by four the primary
wave of the encoder. Impulses to be considered are always those multiplied.

Speed Unit
The different speeds are expressed in (encoder impulses for every Tc) × 65536

Acceleration Unit
Accelerations (KVD, KVS parameters) are expressed in speed increase for every Tc.

Acceleration variation Unit


The acceleration variations (KRAS, KRAD parameters during the operation with "S" style ramps) are expressed in
acceleration increase for every Tc.

These units of measurement are internally used by the axes control system and will be called inside
units. However, for quota and speed units of measurement for physics interpretation (called
physical units) are available: these are faster than inside units. To use them, the axis resolution

Doc. MS229601 - Ed.02 – 18/07/96 9


331 SOFTWARE axes controller in AWL

must be set: a whole number at 32 bits expressing the number of physical units, multiplied by
10000, for each encoder impulse. Imagine a positioning system with a final linear movement
where a 1 metre movement corresponds to 41500 encoder impulses: if we want to work with the
hundredth of millimetre unit, 1 metre will have 100000 physical units, and the resolution will be
measured as following:
100000
ris = × 10000 = 24096
41500

To set the resolution value of the selected axes (see w.asse and r.asse) w.ris is available: it requires
the encoder resolution in ACC1. For example, to select the resolution of axis n° 1 at 24096, we
should operate as following:

L KZ1 * Select the axis number


C w.asse
L KZ24096 * Load encoder resolution
C w.ris * Call set-up function for encoder resolution

It is also possible to know the value of the present resolution (selected axis) by calling the r.ris
function that gives its value in ACC1.

Once the resolution has been set, the following conversion function can be used:

C.U.I Converts the value contained in ACC1 from physical units to encoder impulses.
C.I.U Converts the value contained in ACC1 from encoder impulses to physical units.
C.UI.V Converts the speed value contained in ACC1 from physical units per second to inside
units.
C.IU.V Converts the speed value contained in ACC1 from inside units to physical units per
second.

These functions allow to express a quota or speed in physical units and then to turn them into inside
units or vice versa.

1.3.1 Axis operation mode

The mode for quota or speed generation varies according to the state or mode in which the axis is.
This state is constantly indicated by the modo variable, with the following meaning:

mode FUNCTION
0 maintaining the position
VDESID speed is constantly kept = 0 and the PDESID position is kept equal to the value of the ENC.FIN
variable representing the final quota at the last positioning. Therefore the axis remains in its present position.
1 movement in speed
VDESID speed reaches the VREGIME variable when the ramp is set, while the PDESID quota is increased at
each Tc of the value given by VDESID. Practically the axis moves at VDESID speed. If VDESID=0 and
VREGIME=0, it automatically switches to mode 0.
2-3 positioning
these two modes take place during the positioning point to point, when the axis switches from present
position to that contained in ENC.FIN. Mode 2 concerns the acceleration ramp ( VDESID goes to
VREGIME when the ramp is set ) and its possible distance at constant speed (VDESID=VREGIME), while
mode 3 concerns the deceleration ramp (VDESID goes back to zero when the ramp is set). Once the
positioning has been accomplished, it automatically switches to mode 0, or if enabled, to mode 14.

10 Doc. MS229601 - Ed.02 – 18/07/96


chapter 1. THE PROGRAM FOR AXES CONTROL

4 zero search with home micro-switch and encoder index pulse


This mode is active during zero search on home micro-switch and encoder index pulse. The axis searches for
the speed indicated by VIND ( positive or negative ) until it reaches the home micro-switch. Then it changes
its motion direction and with VTACC speed it abandons the micro and searches for the encoder index pulse.
Once it has found it, it sets the quota to zero, it stops with ramp and switches to mode 0. During this
procedure, the control on software limits is excluded.
6 zero search with home micro-switch
This mode is active during zero search with home micro-switch. The axis maintains the speed indicated by
VIND ( positive or negative ) until it reaches the home micro-switch. Then it changes the motion direction
and with VTACC speed abandons the micro. Once abandoned the micro, it sets the quota to zero, it stops
with ramp and switches to mode 0. During this procedure, control on software limits is excluded.
8 electric gear
During this mode the axis searches for another axis. The electric gear ratio given by the RAPINS parameter.
9 stand-by
During this mode the axis is not driven. However, the encoder is still read and its P1 quota updated.
10 stop in open loop
During this mode the axis reaches the zero speed with set ramp, the ramp is in open loop (see regulation).
When speed is equal to 0, it automatically switches to mode 0.
11 custom mode
During this mode PDESID and VDESID are generated by a user’s subroutine whose address must be
memorised in the VETT.CUST variable. For practical reasons, it is better the subroutine to be written in
assembler. All most common operations (ex. interpolation, flying shear, etc.) use this mode.
12 axis in overflow
The axis automatically enters this mode when the action of the regulation program is saturated and the
maximum error EROVFL has been exceeded twice. In this way the driver’s exit command is set at the offset
value and the axis in no longer driven. Generally there is an electromechanical cause. If the regulation should
be saturated, it is possible to stop the axis entering this mode by setting at 0 the flow variable. However in
such way, in case of an encoder breakdown or any similar breakage, there might be a motor overrun at
maximum speed. To exit the mode 12 a CM-STOP or CM-LOCK instruction can be given.
The reason for this anomaly can be found by testing the Cerr variable.
bit 0= 1 regulation overflow
bit 1= 1 double maximum error
Bits must be reset by the function program.
13 axis in error
The axis automatically enters this mode when the following error exceeds, in absolute value, the value
indicated by the EROVFL variable, or the hardware or software end-switches come into action. The axis
remains still at its present position as in mode 0. If the maximum error is exceeded when mode 13 has
already been entered, the axis goes to mode 12. Any command enables to exit mode 13.
14 special actions after positioning
If at the end of the positioning there is a value different from zero in the variable VETT.ARR, the axis
automatically enters this mode (instead of entering mode 0). In this mode quota and speed should be
generated by a user’s program whose address is contained in VETT.ARR. This procedure is used in many
standard function programs. This mode cannot be initialised from AWL.

The mode can be read by the R.modo function which returns its value in ACC1. For example, if we
want DW0 to contain the mode for axis n° 2:
L KZ2 * Select the axis
C w.asse
C R.modo * Read axis mode
T DW0 * Transfer mode into DW0

Doc. MS229601 - Ed.02 – 18/07/96 11


331 SOFTWARE axes controller in AWL

1.3.2 Functions for axes control

The functions for axes control described in this paragraph is operative only after the activation of the
motion program (see 1.1).

1.3.2.1 Prior note on speed ramps

The axis current speed is contained in the VDESID variable, while the speed to be reached during
normal function modes, is contained in the VREGIME variable. Changing from one speed to the
other is achieved by means of a linear or "S" type ramp. The variables defining the characteristics
of the ramp are:

- KVS acceleration (expressed in VDESID increases per each Tc)


- KVD deceleration (expressed in VDESID decreases per each Tc)

- ftr enabling flag for "S" ramps


- KRAS acceleration increase or decrease per each Tc
- KRAD deceleration increase or decrease per each Tc

For the units of measurement of these parameters, see the note at the beginning of this chapter.

If the "S" ramps are not enabled, (ftr=0, default) the transfer from one speed (VDESID1) to the
other (VDESID2=VREGIME) is achieved by a linear ramp with slope equal to KVS or KVD,
depending whether there is a speed increase or decrease (as absolute value).

LINEAR ACCELERATION RAMP LINEAR DECELERATION RAMP

ts VDESID 2
(VREGIME) VDESID 1

KVD

KVS VDESID 2
VDESID 1 (VREGIME)

td

VREGIME − VDESIDiniz.
ts =
KVS
VDESIDiniz. − VREGIME
td =
KVD

Times are expressed in Tc number.

If the "S" ramps are enabled, (ftr=1) KVS or KVD accelerations are gradually inserted, starting
from an acceleration equal to zero and increasing it with KRAS or KRAD at every sampling
interval, so there is a smoother speed variaton. Hence, when the speed has almost reached the set
value, deceleration starts decreasing according to the same modalities, so when
VDESID=VREGIME acceleration is already equal to zero.

12 Doc. MS229601 - Ed.02 – 18/07/96


chapter 1. THE PROGRAM FOR AXES CONTROL

The ramps show a typical "S" trend which produces a very inferior mechanic stress on the axis.

TYPE 'S' ACCELERATION RAMP

t t1 VDESID 2
(VREGIME)
deltaV

KVS
VDESID 1 deltaV

t1

KVS
t1 =
KRAS
t1( t1 + 1)
deltaV = KRAS ×
2
( VREGIME − VDESIDiniz. ) − 2deltaV
t=
KVS

It is clear that the total speed variation would be inferior to 2deltaV, the ramp could not be complete
in all its stages and it would miss the linear section t and its two variable acceleration sections could
have a duration inferior to t1.

The same notions can be easily applied to the deceleration ramp by substituting KVS with KVD
and KRAS with KRAD.

To set KVS and KVD parameters the function cm-ramp can be used that requires the KVD
parameter in ACC1 and the KVS parameter in ACC2. These parameters are obviously set to the
axis selected at that moment.

To set KRAS and KRAD parameters the function cm-ramps can be used that requires the KRAD
parameter and in ACC1 the KRAS parameter in ACC2.

For the parameter ftr, the two functions W.ftr and R.ftr: one sets the ftr flag up with the value
contained in ACC1, the other returns its value in ACC1.

NOTE
In ramp generation, the absolute value VDESID is limited by the value contained in the variable VEMAX.

1.3.2.2 Instruct the axis to reach a speed (mode 1)

The function cm-veli instructs the selected axis to reach the speed indicated in ACC1 (expressed in
inside units) with the ramp set. This function keeps axis in mode 1 until a different instruction is
given or until the end-stroke switch is exceeded.
Doc. MS229601 - Ed.02 – 18/07/96 13
331 SOFTWARE axes controller in AWL

Speed can be positive or negative. If the axis is already in motion, it goes from its actual speed to
that indicated. If the speed is equal to zero, the axis stops and then enters mode 0.

1.3.2.3 Axis Stop (mode 10, 0)

The function cm-stop stops the selected axis by executing the deceleration ramp in open loop (that
is, the trajectory along the deceleration ramp is not necessarily maintained). When the axis stops, it
enters mode 0. This function requires no parameters in ACC1 or ACC2.

1.3.2.4 Axis lock (mode 0)

The function cm-lock locks the selected axis in its present position and puts it in mode 0. If the axis
is in motion, it immediately stops without ramp.

NOTE
An instant axis lock at high speed can generate an error situation (mode 12).

1.3.2.5 Axis in electric gear (mode 8)

When an axis is in electric gear with another axis (called master), it moves along with the master
axis movement, the two axes’s movements, in encoder impulses, maintain a defined ratio. The
function operating the electric gear is insegui that puts the selected axis in electric gear with another
axis whose number is specified in ACC1.

The electric gear ratio is given by the coefficient RAPINS (of the slave axis) at 32 bits, according to
the following ratio:
deltaQ 2 × RAPINS
deltaQ1 =
65536

deltaQ1 and deltaQ2 represent the position variations of the slave and master axes according to the
moment when the insegui function was operated. A RAPINS value equal to 65536 produces an
electric gear ratio of 1:1.

A second parameter called modoins (at 16 bits), sets a particular function of this mode. In
particular, if modoins is equal to 0, the maximum speed of the slave axis (see the regulation
paragraph) is given by the theoretical VDESID speed of the master axis. Instead, if it is equal to 1, it
is given by the real speed V1. Practically modoins should be set at 0 (default) if the master axis is
driven by the system in closed loop, and at 1 if it is driven by any other engine or by the system in
open loop.

The parameters RAPINS and modoins can be set or read by the functions: W.RAPINS,
R.RAPINS, W.modoins and R.modoins which require or restore the value in ACC1.

NOTE
Since all axes parameters can be set by the program T_MOT, normally modoins is set during the tuning phase
and it is not changed at AWL level.

1.3.2.6 Axis stand-by (mode 9)

With the cm-free function the selected axis is no longer driven, however its encoder is still read and
its position is updated.

14 Doc. MS229601 - Ed.02 – 18/07/96


chapter 1. THE PROGRAM FOR AXES CONTROL

1.3.2.7 Instruct the axis to reach a position (mode 2 and 3)

The functions cm-move and cm-movei can instruct the selected axis to reach a wanted quota: cm-
move considers the quota in absolute terms, while cm-movei considers the quota as an increase
from its present position. These functions require the speed (expressed in inside units) in ACC1 and
the quota (absolute or incremental) expressed in encoder impulses in ACC2.

The speed sign is not important and is correctly set up according to the direction of the movement.
Normally this instruction is given to an axis in mode 0 that after reaching position, goes back to
mode 0. During the positioning phase, speed is as following:

Speed POSITIONING WITH LINEAR RAMPS

mode 2 mode 3 mode 0

VREGIME

VMINIMA

time

The positioning with “S" ramps is similar.

Other elements and parameters can influenced the axis performance in its arrival point.

Doc. MS229601 - Ed.02 – 18/07/96 15


331 SOFTWARE axes controller in AWL

WITH LINEAR RAMPS WITH TYPE 'S' RAMPS

possible mode 14 possible mode 14

modo=3 modo=0 modo=3 modo=0

ENC.FIN ENC.FIN

VMINIMA VMINIMA

quota quota
TOLL time TOLL time

ANTIC ANTIC

The two pictures highlight that:

• The ENC.FIN variable contains the position to be reached, automatically updated by the
function cm-move (or cm-movei).

• The VMINIMA speed represents the speed by which the axis approaches ENC.FIN in the last
distance (the speed ramp stops at that value). A high value of that parameter enables a faster
positioning though with a sudden stop.

• The ANTIC quota causes a position advancement in the measuring of the deceleration ramp. The
default value is 0, a higher value makes the last leg of a distance equal to ANTIC to be run at
minimum speed. The advance is useful when linear ramps are used in order to guarantee an axis
arrival at the final quota with slow speed. On the other hand, with the "S" ramps, which already
assure a ‘smooth’ arrival, it is better to leave it at zero. However the advance is useful in open
loop since deceleration ramps are not granted. It should be said that linear ramps tend to zero
speed when meeting VMINIMA, while "S" ramps tend to VMINIMA.

• The quota TOLL represents an advance from the final position (ENC.FIN). In this case when
the axis position exceeds the quota [ENC.FIN - TOLL], the axis enters mode 0, so it concludes
the positioning phase and enters a position control phase. Its default value is 1: the change to
mode 0 takes place in ENC.FIN. For axes driven in closed loop, it is suggested not to modify
this value: with a higher value (as shown in the picture) the position would be reached with a
regulation effect and not at predictable speed. For axes in open loop a TOLL increase could be
necessary, as an on the moment of their stop.

16 Doc. MS229601 - Ed.02 – 18/07/96


chapter 1. THE PROGRAM FOR AXES CONTROL

1.3.2.7.1 Positioning with back-lash recovery

Positioning can also be achieved with back-lash recovery. This action is useful when the encoder is
tightly connected to the motor, but between the motor axis and the final movement there are
mechanical back-lashes. The positioning instruction is still the same (cm-move or cm-movei), while
recovery modalities are given by the two parameters modogio and GIOCO with the following
meaning:

modogio=0 no recovery. This is the default condition.

modogio=1 the quota contained in the GIOCO variable is summed to the final quota for backward
movements. Forward movements are normal. The GIOCO value can be positive or negative.

modogio=2 the quota contained in the GIOCO variable is summed to the final quota for forward
movements. Backward movements are normal. The GIOCO value can be positive or negative.

modogio=3 in backward movements the axis exceeds the final quota for the quantity indicated by the
GIOCO variable, then it reverts its movement and goes to the final quota with the minimum
speed VMINIMA. Forward movements are normal. The GIOCO value must be positive.

modogio=4 in forward movements the axis overcomes the final quota for the quantity indicated by the
GIOCO variable, then reverts its movement and goes to the final quota at minimum speed
VMINIMA. Backward movements are normal. The GIOCO value must be positive

1.3.2.8 Zero search on home-micro switch (mode 6)

The function cm-inic executes the zero search is that makes the selected axis move at VIND speed
until it reaches the home-micro switch, then revert its direction and at home-micro switch release,
resets its position and stops. To know when the zero search is achieved, it is necessary to question
the axis with the function ?fermo. If VIND is negative, the axis moves backward searching for zero,
if positive, it moves forward. The home-micro switch must be connected according to table A. (See
hardware manual)
VIND The parameter can be set or read with the functions W.VIND and R.VIND that require or
return the value in ACC1.

NOTE
The quota reset is done at home-micro switch release: at the end of this performance the axis quota could not be
0 due to the distance run in the final deceleration ramp. This does not mean reset has not been correctly
achieved. If you wish axis to be in position 0, a positioning instruction should be given to the quota 0.

1.3.2.9 Zero search on home-micro switch and encoder index pulse (mode 4)

The function cm-rtac moves the selected axis at VIND speed until it meets the home-micro switch.
Then the axis reverts its motion direction and at home-micro switch release, it starts searching the
encoder index pulse with VTACC speed. When it has reached it, it resets its position and stops. To
know when the zero search is achieved, it is necessary to question the axis with the function
?fermo. If VIND is negative, the axis moves backward searching for zero, if positive, it moves
forward. The home-micro switch must be connected according to table A or B (See hardware
manual).
The parameter VTACC can be set or read with the functions W.VTACC and R.VTACC that require
or give back the value in ACC1.

Doc. MS229601 - Ed.02 – 18/07/96 17


331 SOFTWARE axes controller in AWL

NOTE
The quota is reset when there is an encoder index pulse edge: at the end of this performance the axis quota could
not to be 0 due to the distance run in the final deceleration ramp. This does not mean the reset has not been
correctly achieved. If you wish the axis to be in position 0, give a positioning instruction to the quota 0.

NOTE
The VTACC value is automatically limited so that during this phase the frequency of the encoder primary wave
would not overcome 3 Khz because of hardware problems.

1.3.2.10 Control if the axis is stopped

The function ?fermo controls if the axis is stopped: it sets or resets RLC depending on whether the
selected axis is stopped or not. In alternative to ?fermo, the function ?toll sets RLC if the axis is
stopped and if the position error is less than the previous value in ACC1.

1.3.2.11 Software Position Reset

The function cm-zeroa resets the quota of the selected axis.

1.3.2.12 Set of the axes position value

The function cm-setp1 sets the value provided in ACC1 to the actual position of the selected axis.

1.3.2.13 Set software end-strokes

The parameters LIMITS and LIMITI contain the value for software end-strokes (respectively
superior limit and inferior limit).
If speed is positive the LIMITS exceeding is kept under control, while if negative, the LIMITI
exceeding is kept under control. When the axis overcomes the set limit quotas, it stops without ramp
and enters mode 13. The only possible movement is in a direction opposite the one of limits
exceeding. During the zero search phase, the control of software limits is not enabled.

The function cm-limit modifies the limits value: it requires the LIMITI in ACC1 value and the
LIMITS value in ACC2, both expressed in encoder impulses.

1.3.2.14 Exclusion of the software end-strokes

The function cm-limoff excludes he software end-strokes: it memorises $7FFFFFFF in LIMITS


and -$80000000 in LIMITI.

18 Doc. MS229601 - Ed.02 – 18/07/96


chapter 1. THE PROGRAM FOR AXES CONTROL

1.3.2.15 Enabling and disabling of hardware end-stroke micro switches

The motion program can manage two inputs for axis end-stroke micro switches. When the axis
meets an end-stroke micro switch, it stops without ramp and enters mode 13. The only possible
movement is that in opposite direction. The number to enter negative movements is contained in the
parameter NUM.IC, while for positive movements in NUM.FC. A value -1 memorised in one of
the variables disables the corresponding input. End-strokes cannot be set from AWL, but only from
the axes tuning program T_MOT or from FORTH. The input number is not identified by the
couple byte.bit as in AWL, but by a single value as in the following rule.

input number = byte × 8 + bit

For example if the end-stroke micro switch for backward movements is E3.4

NUM.IC = 3 × 8 + 4 = 28

1.4. REGULATION

The regulation section controls the motor in order to maintain the real position P1 the closest
possible to the wished PDESID one. The following error ER is so named:

ER=PDESID-P1

The operation can be done in open or closed loop. The flag flca defines this modality.

flca=0 operation in closed loop (default)


flca=1 operation in open loop
flca=-1 operation in closed loop and in open loop when in mode 2

In open loop the quota PDESID is set equal to P1 therefore the error ER is always null.
To switch from one operation mode to another, there are the functions cm-cap (puts the selected
axis in open loop, flca=1) and cm-nocap (puts the selected axis in closed loop, flca=0) that reset all
the possible error conditions.
The third operation mode is not available from AWL.
In order to choose an operation modality, three aspects are important:

• An axis in closed loop can be totally controlled and thus should always be preferred. However it
requires the tuning of PID filter’s parameters. When not correctly done, it can generate auto-
oscillations and can produce an overflow axis condition (mode 12).
• The precise movement of an axis in open loop depends on the linearity typical of the motor-
driver group. It requires no corrections, only the tuning of the KN coefficient. An axis so driven
moves more regularly, but is less controllable: it will probably not maintain its position due to the
unavoidable offsets (in this case it is better to disable the driver when the axis is stopped).
• An axis with flca=-1 is normally in closed loop, it switches to open loop during the first
positioning phase and returns to closed loop in the deceleration ramp. This kind of operation
allows to avoid possible errors in the acceleration ramp that could influence the achievement of
position, though it is useful only in limited cases.

Doc. MS229601 - Ed.02 – 18/07/96 19


331 SOFTWARE axes controller in AWL

At any time the function mode can be changed from open loop to closed loop and vice versa.
For example, if the encoder is not closely tightened to the motor but can be easily discharged from it
(ex. a metric wheel leaning on the material to be worked), it is better to set the axis in open loop
when the encoder is not connected, to prevent a motor overrun due to the encoder absence.
If the driver works in torque control, closed loop is necessary.

1.4.1 Regulation Algorithm

The regulation equation allowing the generation of an output voltage VU controlling the driver is:

VU=VB1+VB2+EY+offset

VU it is a 16 bit variable representing the output voltage, it can vary from -32768 (-10 volt) to 32767 (+10
volt). Actually the output converter D/A has a 12 bit resolution, therefore the four VU’s less important
bits are not relevant.

VB1 this is VU basic value that it should have in case of perfect linearity of the electromechanical system
with no perturbations. Therefore it represents the speed feed forward contribution. The VU value is
measured as VDESID/KN: KN represents the static earning of the motor-driver group (see 1.4.2.2).
VB1 is not a variable memorised in the regulation program.

VB2 it represents the contribution from the acceleration feed forward (see 1.4.2.3). It is measured as:
(var.vel) × KFA. The speed variation var.vel is measured during the two sampling intervals and is
expressed in [decimal of encoder impulses / Tc×Tc]. KFA is a coefficient that can be set (see 1.4.2.3).
VB2 is not a variable memorised by the regulation program

EY position error filtered by the regulation algorithm according to the following rule:
MEMIN
KP × ER + KD × ERD +KI × + KIL × EYprec
EY = KIDIV
KNDA
where:

KP coefficient of the proportional action

ER instant error

KD coefficient of the derivative action

ERD error variation measured according to a fixed time. This time has an IND intervals Tc
value

KI coefficient of the integral action

KIDIV divisive coefficient of the integral action. Normally its default value=100 is not
modified.

MEMIN sum of the errors measured every Tc

KIL integration coefficient limited in time

EYprec EY value at previous interval

KNDA divisive coefficient. Normally its default value=100 is not modified.

20 Doc. MS229601 - Ed.02 – 18/07/96


chapter 1. THE PROGRAM FOR AXES CONTROL

offset system software offset

The following table shows the regulation algorithm for the axes program.

Doc. MS229601 - Ed.02 – 18/07/96 21


331 SOFTWARE axes controller in AWL

GENERAL TABLE REGULATION PROGRAM

dVDESID KFA acceleration feed forward


dT

KN=0 +
1 speed feed forward +
VDESID
KN KN=0

QUOTA
GENERATOR KP

closed + + +10V
loop PDESID ER -
+ dER KD + 1 EY + VU D/A
PDESID CONVERTER
dT + KNDA
open
loop - + +
P1

Sum. KI
ER KIDIV
HARDWARE

EYprev. KIL offset


ENCODER
P1axis real position ENCODER PULSES
INTERFACE

22 Doc. MS229601 - Ed.02 – 18/07/96


chapter 1. THE PROGRAM FOR AXES CONTROL

1.4.2 Notes on the parameters

1.4.2.1 KNDA and KIDIV normalisation coefficients

These coefficients, both having a default value=100, are used as normalisation factors to enable the
other regulation coefficients having an whole value bigger than one. KIDIV only concerns the
integral action, while KNDA all actions. Practically, a value of KP=100 (KNDA) means that the real
KP of the transfer function is 1, in the same way KI=10000 (KNDA x KIDIV) means real KI is 1. It
is suggested not to set parameters different from their default values.

1.4.2.2 KN speed feed forward coefficient

1.4.2.2.1 Driver with speed loop


The normalisation coefficient KN represents the ratio between the speed and the VU voltage sent to
the driver. Theoretically it has to be equal to the static gain of the driver-motor-encoder group in the
reaction loop. When the axis is moving, KN can be measured as following:
VDESID
KN =
VU

Since VDESID is expressed in (impulses/Tc)×65536 and Tc=(Dtc×N.ASSI)/1000:


FMAX × N. ASSI × Dtc
KN =
500000

where:

FMAX = encoder frequency (expressed in impulse/second) at motor maximum speed (that is when command voltage is
of 10 Volt ⇒ VU = 32767).

N.ASSI= number of system axes.

Dtc= sampling time expressed in microsecond (default value=1000 µsec)

Once KN has been correctly measured, it is easy to find the speed maximum value (that is, the one
corresponding to an output voltage of 10 Volts) that is normally memorised in the variable VEMAX,
to obtain a limitation of VDESID:

VEMAX=KN × 32767

In some applications you might wish to keep speed under that value: just give VEMAX a value
inferior to the one in the formula.

The VDESID/KN ratio represents the contribution given by speed feed forward; if KN is not
correctly set, the regulation corrects the error but the axis performance decreases in respect to
promptness in reaction. A value of KN=0 excludes such contribution.
In open loop the axis is exclusively driven by feed forward, so it is important KN to be well tuned.
KN can be automatically measured, which is better than a formula measurement since it also takes
into account driver’s eventual imprecise tunings. This procedure is described in the Motor Tuning
paragraph.

Doc. MS229601 - Ed.02 – 18/07/96 23


331 SOFTWARE axes controller in AWL

1.4.2.2.2 Driver with torque control

When there is a driver with torque control, the speed feed forward is used only to compensate the
components of the resistant torque proportional to motor speed. In this case a measurement as
shown in the previous paragraph is not possible, but it is normally set experimentally. Since the
contribution by feed forward is always measured as VDESID/KN, it is clear that the bigger the KN
value is, the less its contribution value. However it is often better to have a value of KN=0 totally
excludes the action.

1.4.2.3 KFA acceleration feed forward coefficient

The action of the acceleration feed forward permits to drive the motor during the acceleration or
deceleration phase, no matter what the error value is. The intensity of over-driving is proportional to
the KFA coefficient value. This action is particularly useful for a driver with torque control, but in
case of speed control it is used only for those applications where extremely quick ramps are
required. However this parameter has to be set during the testing phase.

1.4.2.4 PID Coefficients: KP KI KD

These three coefficients permit to vary the PID filter action operating in order to reduce the error ER.
KP concerns the proportional action, KI the integral action and KD the derivative one. There is a
brief explanation about the three actions, but practical modalities for the determination of their value
are presented in the Motor Tuning paragraph.

Proportional Action
The proportional action operates in order to reduce the instant error. The higher the energetic value
is, the best the correction effect. Too high KP values can generate auto-oscillations.

Integral Action
The integral action operates against error persistence over time. Its effect is useful to correct these
non-linear behaviours of the axis and especially of the offset. Only the integral action guarantees to
reach a position with zero error. KI high values can be highly corrective, can also generate auto-
oscillations. The integral action is held in case of error values, in absolute value, higher than
LIMINT (default=1000) and of error total values higher than LIM (always in absolute value).

Derivative action
The derivative action has a stabilising effect to compensate for those values which are higher than
other parameters. Its action is related to the error variation, which is measured according to the error
previously found by IND sampling intervals. The IND default value equal to 1 is generally fine, but
it can be increased when there are high time constants. The stabilising effect is proportional to the
KD value. However too high KD values can generate vibrations due to the quantization of
dimensions and elaboration. Its use is fundamental for drivers with torque control, while for those
with speed control it must very often be kept at zero.

24 Doc. MS229601 - Ed.02 – 18/07/96


chapter 1. THE PROGRAM FOR AXES CONTROL

1.4.2.5 KIL limited integral action coefficient

The limited integral action maintains the regulation effect over a certain time, even if there is no
error. KIL represents the time constant by which the effect stops: the decrease is equal to
KIL/KNDA for every sampling interval. For KIL=KNDA (100) the effect continues over an
unlimited time and surely there is an instability situation.

1.4.2.6 Software Offset

The offset variable is summed to other contributions in order to compensate eventual offsets present
in the system. Its measure unit is the same as VU (-32768=-10V, 32767=+10V). It is possible to
measure the offset automatically. However it can often be left at 0 because the regulation already
compensates the effect of small offsets.

Doc. MS229601 - Ed.02 – 18/07/96 25


331 SOFTWARE axes controller in AWL

chapter 2. AXES TUNING

The tuning consists in defining the value of those parameters that optimise the motor performance.
The system firmware of CTE300 has a tuning program called T_MOT that enables this operation by
a graphic assessment on axes performance. It also enables to check the operation of main functions
such as: positioning, zero search, following mode (electric gear) ecc.
The program has been projected for a driver with speed loop, in case of drivers with torque control
the auto-tuning function, herewith described, cannot be used.

The procedure is the following:

1) Disconnect the application program, or even better, completely reset the CTE300 to avoid
the ram area used by T_MOT, for graphics memorisation, to dirt the FORTH vocabulary.
To stop the user program you must press the keys Ctrl+Shift+Esc and after only the Esc key,
succesively you must type the command:

COLD <enter>

2) Reset the RES variable if you want to start with a total parameters initialisation. Type the
command:

0 RES ! <enter>

3) Call the program T_MOT by the keyboard, by using its functions, define the axes
parameters.
4) Once the awaited answer is given, memorise the parameters in the EEPROM and exit from
T_MOT.
5) The AWL program is compiled (or just put the PLC in run if the program has already been
compiled): in the beginning it will call the cm-restot, function that will load the values
memorised in EEPROM.

The user program has been prepared so that the found parameters can be varied (for example, by
host computer or by AWL program with the due functions).
Additionally it could be used also during the execution of the user program for check the behavior
of the axes and change some parameters.

NOTE
The T_MOT program is present only in the operating system of the CTE300. In the case of systems with
331CPU card the T_MOT program must be compiled. In this chapter comes taken in consideration only the
T_MOT program of the CTE300.
The operators that use the 331CPU card must remenber that the funcion of memorization in EEPROM are not
available and that the functions of visualization of the chart are not available on the LCD of the CTX618 and
CTD913 systems.

T_MOT ACTIVATION

The access to the tuning program is possible by pressing the T_MOT command and then the key
<cr>. The main menu is entered automatically.

26 Doc. MS229601 - Ed.02 – 18/07/96


chapter 2. axes tuning

The measure units are the same as those for the regulation program (see paragraph 1.3), if not
differently specified.

2.2 MAIN MENU

In this menu the function keys enabling to enter a particular table for function tuning are active.
Function keys:

F1 = Select system configuration


Enables to define the system configuration to be tuned (number of axes, memory areas, PC
type, trigger ecc.).

F2 = Driver Tuning
Enables the first tests on axis motion to verify the connections and to tune the driver.

F3 = KN Tuning
Enables the automatic measurement of KN coefficient, PID parameters and software offset.

F4 = Access to parameters
Enables to set all regulation parameters and motor motion parameters and to make several
tests to find out the best system performance.

F5 = Enter the PLC program


The inside PLC can be operated during the axes tuning phase. For further information see
331 SOFTWARE plc user's manual.

Ctrl+Q = Quit to forth


Exits the motor tuning program and returns to the FORTH interpreter

The number of axis to be tuned can be set on the last line.

All the described tables enable returning to the main menu by pressing the <Esc> key.

Doc. MS229601 - Ed.02 – 18/07/96 27


331 SOFTWARE axes controller in AWL

2.3 SYSTEM CONFIGURATION TABLE

Sampling period tc:


It represent the time of sampling for each axis, it's expressed in microseconds and is unique for all
the axes. The change of this parameters (Dtc) requires a new tuning of the axes. A lowering of this
value guarantees good throughputs of the axes but to the same reduces the free time of the CPU
used for the other operations (user program). We suggest you not decreasing the default value in the
CTE300 and don't descend under the 700µs in the case of 331CPU. Vice versa you could be increase
this value (20%) without appreciable differences in the control axes (expecially when the dynamics
of the machine is not critic) and to make better the throughputs in your program.

Number of system axes:


The number of system axes to be controlled by the system must be set (1-3). The control on each
axis is done every Dtc µsec: since only a single axis is in turn considered, the real control period (Tc)
depends on the actual number of system axes. The exact regulation interval is necessary for a
correct physical interpretation of some parameters’ values, such as speed.

The purpose of the following parameters is the configuration in order to acquire and visualise
graphics on motor performance. In particular they are:

Acquisition Step:
It indicates every how many Tc intervals the selected variable must be memorised in the buffer. The
variable values can later be represented in a graphic. By increasing this parameter value, having the
buffer a fixed length, it is possible to control the axis behaviour over a longer time (obviously with a
lowest temporal resolution).

Variable to acquire:
All the options available appear by pressing a key: just select the wanted one with the Enter key.
The selection is about the parameters acquisition and its graphic visualisation. It can be:

position error, that is the difference at every single moment between the theoretical position
and the real axis position (this option is meaningful only if the axis is in closed loop ).

28 Doc. MS229601 - Ed.02 – 18/07/96


chapter 2. axes tuning

speed error, that is the difference at every single moment between the theoretical speed and
the real axis speed as compiled by the encoder (variable V1).

Speed trend, that is the speed trend analysed (V1) by the encoder referred to the axis
theoretical sped.

NOTE
The V1 speed is measured by counting the encoder impulses every KK/2 Tc, so it is an average speed on an
interval, therefore always delayed in respect to the instant speed.

Acquisition Trigger:
Enables to choose the mode by which the program starts acquiring data for graphic visualisation.
This can be:

manual: the acquisition starts when pressing the corresponding function key (see key
F5, first parameters page)

deceleration ramp:
the acquisition starts when the motor enters the deceleration ramp

VDESID: the acquisition starts when the motor’s VDESID exceeds in absolute value
the value indicated.

VDESID for trigger:


When the speed exceeds the value herein set, the acquisition starts (when the acquisition trigger is
set on VDESID). The value can be introduced as speed in inside units (impulses × 65536 every Tc)
or as a value expressed in units per minute (U/min).

Acquisition buffer address (size $6400):


Enables to set the initial memory address where the data memorisation buffer is located. The
buffer’s size is $ 6400 bytes.
We suggest you to see the system memory map before change this value.

NOTE
The value showed in the previus figure is referred to CTE300 system. For the 331CPU system this value is
obviously different.

Language
Italian or English can be selected for program messages.

Doc. MS229601 - Ed.02 – 18/07/96 29


331 SOFTWARE axes controller in AWL

2.4 TUNING DRIVER PARAMETERS

Function Keys:

F1= Go forward.
Generates in the D/A output voltage set in the Axes Control Voltage area.

F2= Go backward
Generates in the D/A output a voltage with sign opposed to the one set in the Axes Control
Voltage area.

F3= Res. quota


Reset the encoder quota visualised in the table.

Space = Stop
Reset voltage in the D/A output

In this page there are some useful functions for a first axes motion, that permit to assess the
electrical wiring system and the correct connection of encoder phases.
This page can be considered as a voltage generator and a quota encoder measurer (with motor
revolution counter).

These different ‘means’ should make the following axis assessment possible:

2.4.1 Hardware offset regulation

By an output voltage = 0 (space pressure) the trimmer of the driver’s offset regulation should be
regulated until the visualised encoder quota is not stable enough.

30 Doc. MS229601 - Ed.02 – 18/07/96


chapter 2. axes tuning

2.4.2 Assessment on encoder phases

The assessment on encoder phases can be achieved by setting an axes control voltage with positive
(negative) value and by moving the axis with the function key F1. If the encoder is correctly
connected, its encoder quota (represented in the picture on bottom right) must increase (decrease).
In case of wrong connection, the message "encoder reversed phases " will appear.
We suggest you to test the axis motion in both direction.

2.4.3 Driver’s speed tuning

Select a voltage for which the number of motor revolutions (according to motor physic
characteristics) is known. Then regulate the trimmer for speed gain until the motor has not reached
the expected speed. For example, 10 volt = 3000 rpm, 5 volt = 1500 rpm ect. It can be useful to
assess the linearity in the driver’s operation by checking the motor’s real speed with different
control voltages.
Motor speed can be read with a normal revolution counter. When not available, if knowing the
number of encoder impulses for each chosen physical unit (ex. revolutions, metres, etc.), the video
measurer can be used (central table on the page indicated by Motor speed). It can be operated by
simply inserting the number of encoder impulses(× 4) for each unit, in the area encoder impulses
per unit.
For example, to visualise speed in revolutions per minute, the number of encoder impulses for each
motor revolution must be provided.
Or, to visualise speed in metres per minute, the number of encoder impulses for each meter of the
axis movement must be provided.

NOTE
The encoder parameter impulses per unit, here set, is useful also for other T_MOT pages, since it is used
whenever speed has to be visualised or set in units different from inside units.

2.5 KN TUNING

Function keys:

Doc. MS229601 - Ed.02 – 18/07/96 31


331 SOFTWARE axes controller in AWL

F1= Go forward
Generates in the D/A output voltage set in the Reference voltage for tuning area and
calculate the KN value.

F2= Go backward
Generates in the D/A output a voltage with sign opposed to the one set in the Reference
voltage for tuning area and calculate the KN value.

F3= Offset
Calculate the axis offset.

F4 = Calc. P.I.
Calculate the proportional and integral coefficients according to the system answer to the
voltage step.

Space = Stop
Reset voltage in the D/A output and stop the autotuning procedure.

This page enables the automatic tuning of: KN, the offset software and the PID parameters.
Once these tunings have been achieved, the axis is ready to work.

2.5.1 KN Tuning

KN parameter tuning is an important step in the control of the axis correct operation. In fact it
relates the analog output with the encoder resolution. Remember: KN is important only for those
drivers with speed loop.
In the open loop control, KN is responsible only for the driving voltage, the more this value
represents the real motor function of voltage-speed transfer, the more the values for real and
theoretical speed can match.
There is a similar problem for the closed loop control, but here due to the PID regulation, eventual
small differences concerning the real value or depending on the driver’s non-linearity are
compensated. However the truer KN is, the simpler the tuning of other parameters is.
KN tuning is executed by setting a voltage and by moving the motor with the keys F1=forward and
F2=backward (‘SPACE’ stops the motor)
When the motor reaches the set state speed, KN is measured (the message ‘KN TUNING’ appears).

KN tuning is to be considered achieved when the variation of the visualised value is more or less
than one unit. KN might need a certain time to stabilise.
If the voltage set for the movement produces an encoder speed too slow for a precise KN
measurement, then the message 'Speed too slow for calculating KN parameter' appears. In this
case the command voltage can be increased or the manual measurement can be started by using the
formula described at page 23:
It might be important to assess the answer linearity of the motor-driver system. So it should be
made sure that the measured KN does not change because of different command voltages.

2.5.2 PID Tuning

With the function key F4 the motor is driven with a voltage step equal to the value set in the area
'Reference Voltage for tuning'. If the mechanical frame connected to the motor enables it, the step
32 Doc. MS229601 - Ed.02 – 18/07/96
chapter 2. axes tuning

to should have at least 4 Volts. According to the axis answer found out by the encoder, the values of
both KP proportional and KI integral regulation coefficient are estimated, while KIL, KD and KFA
coefficients are reset. The values found out by this procedure can be optimised during further
phases.

The procedure for PID tuning calculates also the VEMAX parameter, as speed corresponding to a
driving voltage of 10 Volt. It initialises the ramp coefficients with default values.

2.5.3 Offset software tuning

The function key F3 starts and stops this operation that requires a zero voltage on the analog output
and controls which voltage is used in order to keep the axis still.

WARNING
The tuning function puts the motor in closed loop, so this function is to be used after PID tuning.
Normally the offset tuning is not very essential to the system because if the driver offset has already
been correctly tuned, the remaining offset is certainly compensated by the PID control in closed
loop.

WARNING
For a correct system tuning is necessary respect the following commands sequence:
1. KN tuning
2. PID tuning
3. Offset tuning

2.6 FIRST PARAMETERS PAGE

This page enables to modify regulation parameters and to operate motion tests to assess the axes
performance.
The page is divided in three parts: motor parameters, pre-set test, motor state.
Doc. MS229601 - Ed.02 – 18/07/96 33
331 SOFTWARE axes controller in AWL

In the part for motor parameters it is possible to modify the various parameters that define the
movement of the motor: from regulation coefficients (KP, KI, KD) to the values of acceleration and
deceleration ramps.

In the pre-set test table it is possible to pre-set a speed (both in inside units and units per minute)
and two quotas (Quota1 and Quota2). These data are used by the function keys which enable the
motion (see F1 F2 D S space)

In the motor state table on the right, some important information are constantly visualised for an
understanding and an evaluation on motor behaviour, as here described.

Motor state
Indicates if motor is controlled in open or closed loop (see flca flag). The two driving modes
can be forced by the function key F6.

Control Mode
Indicates the axis mode.

Cerr Alarm
In case of alarm, appearing in the line below the one visualising the mode, the Cerr error bits
are in turns visualised. For reset this alarm message pres the Shift+F2 keys.

Motor Quota
It is the actual position expressed in encoder impulses.

34 Doc. MS229601 - Ed.02 – 18/07/96


chapter 2. axes tuning

Motor speed
It is the actual speed expressed in units per minute. The units depend on the parameter set in
the driver tuning page.
D/A Voltage
Visualise the D/A output expressed in volts.
Instant Error
Visualise the axis error expressed in encoder impulses.
Maximum Error
Memorises the maximum position error found out by the control. It can be useful to verify the
error dimension during transfer. The reset of this value is executed by the function key F3.

Function Keys:
F1 = Enable to reach Quota1 with the speed in the pre-set test table.

F2 = Enable to reach Quota2 with the speed in the pre-set test table.

F3 = Reset the maximum error found.

F4 = Reset encoder quota

F5 = Start/Stop acquisition parameters.


This function enables to memorise in a buffer the trend of the theoretical speed VDESID and
of a chosen variable in the 'system configuration' among: position error, speed error and speed
trend.
The pressure of this key enables the acquisition that starts according to the trigger enabled in
the 'system configuration' page. If the trigger is MANUAL the acquisition starts immediately
and is highlighted by the buffer filling percentage visualised under the pre-set test table. If the
trigger is on DECELERATION RAMP or VDESID, the message 'acquisition start' appears on
the screen. The real acquisition starts when the motor enters the deceleration ramp or when
VDESID exceeds in absolute value the set value in the 'system configuration' page.
A second pressure of key F5 stops the acquisition.
It is possible to visualise the obtained data buffer in a graphic with the function F7.

F6= Change motor command from open loop to closed loop and vice versa.

F7=Enable to visualise the graphic of parameters acquired with F5 (see 2.7)

F8= Achieve zero search with home-micro switch.

F9= Achieve zero search with home-micro switch and encoder zero notch.
During this function, in the motor state table, at the end of the procedure for zero search,
instead of the quota encoder, the distance in impulses from the release of the reference micro
to the zero notch is visualised. This enables to evaluate if the zero notch is too close to the
micro release. If so, there is the danger the encoder index pulse to be recognised only during
the following revolution. The pressure of any other function key or the change to another table
restores the visualisation of the encoder quota.

shift F1= Enable to shift to the motor parameters’s table II

Doc. MS229601 - Ed.02 – 18/07/96 35


331 SOFTWARE axes controller in AWL

shift F2= Execute a reset of the Cerr variable and a consequent reset of the alarms visualised.

shift F3= Memorises on EEPROM the axis parameters. Before saving, confirmation of this
operation is required since all the parameters previously memorised will be lost (This function is
available only for the CTE300 system).

shift F4= Return parameters from EEPROM to those of the actual axis. Confirmation of this
operation is required since all present axis parameters will go lost (This function is available only for
the CTE300 system).

D= move the axis forward at selected speed, the axis stops when <space> is pressed.

S= move the axis backward with at selected speed, the axis stops when <space> is pressed.

<space>= stop movements

2.7 GRAPHIC VISUALISATION

By entering this page the whole data buffer is automatically visualised.


The graphic shows time on the x-co-ordinate and two dimensions on the y-co-ordinate: the selected
dimension and the theoretical speed. The first curve visualised (in yellow for colour monitor)
represents the VDESID trend, that is the trend of the theoretical curve generated by the axes control
program which the motor has to follow. The second curve (in red) represents the measured
dimension according to the selection.
The VDESID curve has no reference on the axis’s y-co-ordinate, but enables temporal references in
the graphic.
Two graphics can be visualised: the first gives a global dimension (visualised at page entrance), the
second a zoom of a part of the global one. The zoom area is selectable by a cursor (highlighted by
two vertical white lines) that can be positioned by the arrow keys (little movements) and
shift+arrow (big movements). In the zoom mode the graphic is amplified only in the temporal axis
(every pixel corresponds to a reading at every regulation interval).
On the top right the scales of the two Cartesian co-ordinates are shown: the X-co-ordinate (time)
expressed in msec, and the Y-co-ordinate expressed in imp., imp. per second or inside units
depending on whether the graphic shows a position error, a speed error or a speed trend error.
In the 'position error' and 'speed error' graphics the y-co-ordinate can be amplified by setting a new
resolution in the upper right corner. Then, the graphic must be visualised by pressing F1 o F2
(global graphic or zoom).
There are two cursors T1 and T2 that can be move independently and that permits to calculate the
time period. The T1 cursor mark the start point of zoom function.

Function Keys:
F1 = Show the global graphic.

F2 = Show the zoom graphic of the select area.

F3 = Print a refence grid.

F4 = Select the cursor to move. The active cursor is showed in the upper right corner.

36 Doc. MS229601 - Ed.02 – 18/07/96


chapter 2. axes tuning

ï ,ð
ð = Move the active cursor.

ï , Ctrl+ð
Ctrl+ï ð = Move, in rapid mode, the active cursor.

The graphic highlights all the axis passage to mode 0 (position maintenance) with a vertical yellow
line on the X-axis. So the motor trend at the end of a positioning phase can be identified and
evaluated.

A key pressure during graphic insertion phases stops the visualisation process there.

2.8 SECOND PARAMETER PAGE

This page has two charts: the left chart (motor parameters) shows a range of variables for the
regulation program, the right one shows a range of switches that can be enabled or disabled with the
function keys.

The parameters that can be set are: the axis software limits, the control of on/off axes, data about the
axes control in electrical gear.

Function keys:

shift+F1,Esc = go back to the first parameters tuning page

F1 = disable the axis software limits. The disabling of software limits is indicated in the 'enable' table
by the message 'OFF' in the areas 'Pos.soft.Lim.' and 'Neg.soft Lim.'.

F6 = Reset the Cerr variable.

F8 = Put the selected axis in following mode with the axis indicated in MOT.TRA.

Doc. MS229601 - Ed.02 – 18/07/96 37


331 SOFTWARE axes controller in AWL

chapter 3. AWL BASIC LIBRARY FOR AXES CONTROL

In this chapter all the functions for axes control are listed in alphabetical order. Many of them have
already been presented in chapter 1.

?fermo

If the selected axis is stopped, it returns RLC=true otherwise RLC=false.

Belonging class: Axes control library


Call mode: C U C UN C O C ON C
RLC Modification: YES
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: ?toll

Example: You want the M50.0 flag to be set-up when all the three axes are in position.

C w.asse0 * Select axis 0


C ?fermo * Test the state of the axis 0 - stopped or moving
C w.asse1 * Select axis 1
U C ?fermo * Test and combining the state of the axis 1
C w.asse2 * Select axis 2
U C ?fermo * Test and combining the state of the axis 2
= M50.0

?toll

If the selected axis has reached the position and the position error is less than the value contained in
ACC1, it returns RLC=vero otherwise RLC=falso. This function is to be preferred to ?fermo for
those axes requiring long adjustment time.

Belonging class: Axes control library


Call mode: C U C UN C O C ON C
Modify RLC: YES
Required Parameters ACC1: Tolerance in encoder impulses
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: ?fermo

Example: You want M60.0 to be in 1 when the axis 1 has reached the position and the position error is less than 10
impulses.

L KZ1 * Select axis 1


C w.asse
L KZ10 * 10 impulses
C ?toll * Read axis state
= M60.0

38 Doc. MS229601 - Ed.02 – 18/07/96


chapter 3. AWL BASIC LIBRARY FOR AXES CONTROL

C.I.U

Converts a quota from encoder impulses to physical units. To make the function give back the
correct value, the encoder resolution must be set with the w.ris function.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Quota in physical units
ACC2: Ineffective
Restored Parameters ACC1: Quota in encoder impulses
ACC2: Unchanged
See also: C.U.I w.ris

Example: You want Double Word 8 to contain the actual quota of axis 0 expressed in physical units (you must
previously load encoder resolution).

C w.asse0
C R.P1 * Read axis quota in impulses
C C.I.U * Execute the transformation
T DD8 * Update the Double Word 8

C.IU.V

Converts a speed from inside units into units per second.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Speed in inside units
ACC2: Ineffective
Restored Parameters ACC1: Speed in units per second
ACC2: Unchanged

See also: C.UI.V

cm-aenc

Forces a reading of all the encoders every millisecond. The default is read at every sampling period
(three milliseconds in case of three axes). The call to this function must be done immediately after
the cm-restot for program starting.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-senc

Doc. MS229601 - Ed.02 – 18/07/96 39


331 SOFTWARE axes controller in AWL

cm-cap

Forces the selected axis to operate in open loop.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-nocap

Example: Axis 0 must be set in open loop if the E0.0 input is not available (manual engine), otherwise it must be set in
closed loop (automatic engine). The command is given on the leading or falling edges of the above-mentioned input.

C w.asse0 * Select axis 0


UN E0.0 * Analyse falling edge
D M250.0
= C cm-cap * Put axis 0 in open loop
U E0.0 * Analyse leading edge
D M250.1
= C cm-nocap * Put axis 0 in closed loop

cm-free

Releases the selected axis. The selected axis is not anymore driven, however its encoder is still read
and the position is still updated.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged

Example: If the E1.3 input is present, axis 0 must be set in stand-by. When there is the falling-edge the axis must be
blocked.

C w.asse0 * Select axis 0


U E1.3 * Analyse the E1.3 leading edge
D M244.0
= C cm-free * Axis 0 in stand-by
UN E1.3 * Analyse the E1.3 falling edge
D M244.1
= C cm-lock * Block axis 0

cm-inic

Commands the selected axis to execute zero search on the home micro-switch. By this command
(to be given just once) the axis moves with VIND speed until it finds the home-micro switch, then it
reverses its direction and at home-micro switch release it resets its position.

40 Doc. MS229601 - Ed.02 – 18/07/96


chapter 3. AWL BASIC LIBRARY FOR AXES CONTROL

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-rtac

Example: On the leading edge of the E0.1 input, the axis 0 executes the zero search on the home micro-switch. The
M48.0 flag indicates that zero search is going on, while the M48.1 flag indicates that the search has been correctly
executed.

C w.asse0 * Select axis 0


U E0.1 * Analyse E0.1 leading edge
D M251.0
= C cm-inic * Start zero search
S M48.0 * Set flag for zero search on-going
R M48.1 * Reset flag for zero search correctly executed
U M48.0 * Zero Search on-going
U C ?fermo * And axis in position
= M48.1 * Then zero search correctly executed

cm-limit

Sets the values indicated in ACC1 (LIMITI= inferior limit) and ACC2 (LIMITS= superior limit) to
the software end-micro switches of the selected axis.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Inferior limit in encoder impulses
ACC2: Superior limit in encoder impulses
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-limoff

Example: If you want to set the software limits of axis 0 to the values -300000 (inferior limit) and +300000 (superior
limit):

L KZ0 * Select axis 0


C w.asse
L KZ300000 * Load superior limit
L KZ-300000 * Load inferior limit
C cm-limit * Set software limits

cm-limoff

Excludes the software end-micro switch of the selected axis.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective

Doc. MS229601 - Ed.02 – 18/07/96 41


331 SOFTWARE axes controller in AWL

Restored Parameters ACC1: Unchanged


ACC2: Unchanged
See also: cm-limit

Example: You want to disable the control of software limits for axis 1.

C w.asse1
C cm-limoff * Excludes the software limits control

cm-lock

Blocks the selected axis in its present position. If the axis is in motion, it immediately stops without
ramp. A sudden stop at high speed can generate an error situation (mode 12).

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-stop

Example: The E0.6 and E0.7 inputs represent the end-stroke micro-switches (respectively positive and negative) of the
axis 0. When the axis reaches the end-stroke micro-switches (if these are of a normally closed type, then the relative input
is open), the axis must immediately be stopped. The axis direction must obviously be considered.

C w.asse0 * Select axis 0

C R.VDESID * Read Speed


L KZ0
>F
= M10.0 * Scratch flag indicating positive speed
<F
= M10.1 * Scratch flag indicating negative speed

U M10.0 * Positive Speed


UN E0.7 * Positive end-stroke switch
O
U M10.1 * Negative Speed
UN E0.6 * Negative end-stroke switch
= C cm-lock * Sudden axis stop

cm-move

This command (to be given once) instructs the selected axis to reach the quota indicated in ACC2 at
the speed indicated in ACC1. Quota and speed are expressed in inside units. The arrival at quota can
be assessed by ?fermo or ?toll.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Speed in inside units.
ACC2: Quota to be reached in encoder impulses.
Restored Parameters ACC1: Unchanged

42 Doc. MS229601 - Ed.02 – 18/07/96


chapter 3. AWL BASIC LIBRARY FOR AXES CONTROL

ACC2: Unchanged
See also: cm-movei ?fermo ?toll

Example: At every E0.2 leading edge axis 0 must position at the quota contained in DD20 (expressed in physical units)
with the speed contained in DD24 (expressed in inside units ).

U E0.2 * Analyse E0.2 leading edge


D M250.0
IF
C w.asse0
L DD20 * Load the position to be reached
C C.U.I * Convert in impulses
L DD24 * Load the position speed
C cm-move * Positioning
ENDIF

cm-movei

Same command as cm-move, the quota in this case is considered as incremental.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Speed in inside units.
ACC2: Quota increase to be reached in encoder impulses
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-move ?fermo ?toll

Example: See cm-move

cm-nocap

Forces the selected axis to operate in closed loop. The command must be given once.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-cap
Example: See cm-cap

cm-ramp

Sets the ramp coefficients KVS (ACC2) and KVD (ACC1) for the selected axis.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Coefficient of the deceleration ramp (KVD)

Doc. MS229601 - Ed.02 – 18/07/96 43


331 SOFTWARE axes controller in AWL

ACC2: Coefficient of the acceleration ramp(KVS)


Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-ramps

Example: You want to set the KVS parameter (acceleration ramp) of axis 0 at 50000 and the KVD
parameter(deceleration ramp) at 90000.

L KZ0 * Select axis


C w.asse
L KZ50000 * Load KVS
L KZ90000 * Load KVD
C cm-ramp * Set the ramps

cm-ramps

Sets the "S" ramp coefficients KRAS (ACC2) and KRAD (ACC1) for the selected axis.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Coefficient of deceleration ramp (KRAD)
ACC2: Coefficient of acceleration ramp (KRAS)
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-ramp

Example: See cm-ramp

cm-restot

Activates the axes control program by forcing a parameters total reset and, if the system is the
CTE300, by loading default parameters from EEPROM. The number of axes to be controlled must
be set in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Number of axes to be controlled
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-start

Example: An example of complete activation for three axes is here presented:

#RESET
L KZ3
C cm-restot
BE
#START
L KZ3
C cm-start
BE

44 Doc. MS229601 - Ed.02 – 18/07/96


chapter 3. AWL BASIC LIBRARY FOR AXES CONTROL

cm-rtac

Commands the selected axis to execute zero search on the home micro switch and encoder index
pulse. The selected axis moves at VIND speed until it reaches the encoder index pulse, then it
reverses its direction and at micro release, it starts searching for the encoder index pulse with
VTACC speed. When it has reached it, it stops and resets its position. The command must be given
once, not repetitively.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-inic
Example: See the example in cm-inic (just change cm-inic with cm-rtac).

cm-senc

Forces encoder reading at every sampling period. The call for this function is useless if the function
cm-aenc has not been previously used.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-aenc

cm-setp1

Sets the value contained in ACC1 and expressed in impulses to the selected axis actual position. The
command must be given once and not repetitively.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Quota in impulses to be set to the selected axis
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-zeroa

Example: At every leading edge of the E0.5 input the position of axis 2 must be set to the quota (expressed in physical
units) contained in DD40.

U E0.5 * Analyse E0.5 leading edge


D M240.0
IF
C w.asse2

Doc. MS229601 - Ed.02 – 18/07/96 45


331 SOFTWARE axes controller in AWL

L DD40 * Load the position to be set-up


C C.U.I * Conversion from physical units to impulses
C cm-setp1 * Set the present axis quota
ENDIF

cm-setp1e

Sets the value contained in ACC1 and expressed in impulses to the selected axis actual position,
leaving unaffected the value of the error. The command must be given once and not repetitively.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Quota in impulses to be set to the selected axis
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-zeroa cm-setp1

cm-settc

Change the time of sampling of the axes program, the time of sampling, expressed in microseconds,
must be contained in ACC1 (default 1000).

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Time of sampling of axes program
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged

cm-start

Activates the axes control program. The number of axes to be controlled must be contained in
ACC1. The command must be given once at every system starting.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Number of axes to be controlled
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-restot

Example: See example in cm-restot.

cm-stop

Stops the selected axis by executing the deceleration ramp in open loop.

46 Doc. MS229601 - Ed.02 – 18/07/96


chapter 3. AWL BASIC LIBRARY FOR AXES CONTROL

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-lock

Example: Axis 0 must be manually controlled. The E1.0 input makes the axis go forward, while the E1.1 input makes
the axis go backward. Switches release stops the axis. The motion speed is contained in DD36 (expressed in inside units ).

C w.asse0
L DD36 * Load Speed
U E1.0 * Analyse E1.0 leading edge
D M241.0
= C cm-veli * Axis Advancement
U E1.1 * Analyse E1.1 leading edge
D M241.1
IF
KZW * Inverts speed sign
C cm-veli * Axis Rearward
ENDIF
UN E1.0 * Analyse both switches falling edge
UN E1.1
D M241.2
= C cm-stop * Axes Stop

cm-veli

Commands the selected axis in speed. The speed must be set in ACC1 and expressed in inside units.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Speed in inside units
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-stop

Example: See example in cm-stop.

cm-zeroa

Resets the selected axis quota to the actual position. The command must be given once and not
repetitively.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged

Doc. MS229601 - Ed.02 – 18/07/96 47


331 SOFTWARE axes controller in AWL

See also: cm-setp1

Example: At the leading edge of the E0.6 input the quota of axis 1 must be reset.

L KZ1 * Select axis 1


C w.asse
U E0.6 * Analyse E0.6 leading edge
D M240.0
= C cm-zeroa * Reset axis position

C.U.I

Converts the value contained in ACC1 from physical units to encoder impulses.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Quota in physical units
ACC2: Ineffective
Restored Parameters ACC1: Quota in encoder impulses
ACC2: Unchanged
See also: C.I.U
Example: See example in cm-move.

C.UI.V

Converts a speed from physical units per second to inside units.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Speed in units per second
ACC2: Ineffective
Restored Parameters ACC1: Speed in inside units
ACC2: Unchanged
See also: C.IU.V

insegui

Puts the selected axis in electric gear with the axis whose number is specified in ACC1 (master axis).
The command must be given once and not repetitively. The following ratio is given by the
coefficient RAPINS.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Number of axis to be followed
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: W.RAPINS R.RAPINS W.modoins R.modoins

Example: Axis 1 must follow axis 0 that is driven in open loop (the modoins flag must be set-up).

48 Doc. MS229601 - Ed.02 – 18/07/96


chapter 3. AWL BASIC LIBRARY FOR AXES CONTROL

C w.asse1
L KZ1 * Load the value to be inserted in 'modoins'
C W.modoins
L KZ0 * Load axis to be followed
C insegui

R.ANTIC

Returns the ANTIC variable value of the selected axis in ACC1. The ANTIC variable indicates the
advancement quota on the ramps during positioning phases.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: ANTIC Value
ACC2: Unchanged
See also: W.ANTIC

Example: You want to memorise in DD60 the ANTIC parameter value of axis 2.

C w.asse2 * Select axis 2


C R.ANTIC * Read ANTIC parameter
T DD60 * Memorise in DD60

r.asse

Returns the number of the selected axis in ACC1

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Number of selected axis
ACC2: Unchanged
See also: w.axis

Example: DW0 must contain the number of selected axis

C r.asse * Read selected axis


T DW0

R.Cerr

Returns the Cerr variable value of the selected axis in ACC1. The variable Cerr indicates the error
code if the axis is in mode 12 (= axis in overflow) according to the following custom:

bit 0 = Regulation Overflow


bit 1 = Maximum double error

Doc. MS229601 - Ed.02 – 18/07/96 49


331 SOFTWARE axes controller in AWL

The Cerr variable is updated by the axes program as soon as the axis enters in mode 12 and is not
modified unless a new error condition. Therefore this variable must be reset by he AWL program.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Cerr Value
ACC2: Unchanged
See also: W.Cerr

Example: In case of axis 0 error, MB20 must contain the error code, in particular M20.0 indicates a regulation
overflow and M20.1 indicates the maximum double error.

C w.asse0
C R.modo * Read axis mode
L KZ12
=F * Axis in mode 12 ?
IF
C R.Cerr * Read error code
T MB20 * Memorise in MB20
ELSE
L KZ0 * Reset MB20
T MB20
C W.Cerr * Reset error code
ENDIF

rch.funz

Enables the routine on interrupt for finding the home-micro switch edges and the encoder index
pulse. It also enables to test these edges and to read the state of the home-micro switch. The
function executed by rch.funz is specified in ACC1 according to the following table:
When an edge is found, its corresponding routine must be rehabilitated on interrupt to find the
following leading edge.

ACC1 Azione
0 Test the leading edge of NC input whitout debounce software. Returns the result in
ACC1.
1 Test the falling edge of NC input whitout debounce software. Returns the result in
ACC1.
2 Test the leading edge of the encoder index pulse. Returns the result in ACC1.
3 Test the NO input state. Returns the result in ACC1.
4 Test the NC input state. Returns the result in ACC1.
5 Enables the routine on interrupt to find the NC input leading edge (to be tested by the
rch.funz’s function 0).
6 Enables the routine on interrupt to find the NC input falling edge (to be tested by the
rch.funz’s function 1).
7 Enables the routine on interrupt to find the encoder index pulse leading edge (to be
tested by the rch.funz’s function 2).
8 Disables the routine on interrupt to find the NC input leading edge.
9 Disables the routine on interrupt to find the NC input falling edge.

50 Doc. MS229601 - Ed.02 – 18/07/96


chapter 3. AWL BASIC LIBRARY FOR AXES CONTROL

10 Disables the routine on interrupt to find the encoder index pulse leading edge.
11 Enables the routine on interrupt with hardware reset of axis's quota at the NC input
leading edge.
12 Enables the routine on interrupt with hardware reset of axis's quota at the NC input
falling edge.
13 Enables the routine on interrupt with hardware reset of axis's quota at the encoder
index pulse leading edge.
14 Disables the routine on interrupt with hardware reset of axis's quota at the NC input
falling edge.
15 Disables the routine on interrupt with hardware reset of axis's quota at the NC input
falling edge.
16 Disables the routine on interrupt with hardware reset of axis's quota at the encoder
index pulse leading edge.
17 Test the leading edge of NC input whit debounce software. Returns the result in
ACC1.
18 Test the falling edge of NC input whit debounce software. Returns the result in ACC1.

NOTE
For the resetting hardware of the quota of the axis is necessary to use a contact of exchange.

NOTE
With ACC1= 0 or ACC1= 1 no control on the bounces of the signal is performed. The use of such formality is
necessary if a contact of exchange are used (on falling edge of the NC input and then with ACC1= 1).

NOTE
With ACC1= 17 or ACC1= 18 a control on the bounces of the signal is perfomed analyzing the edge and the
level of the same. The use of such formality has recommended if a contact of C type are used for avoid of
receive more leading and/or falling edge of the NC input. But in this situation could happen a condition of
malfunction if the impulse of the NC input is too brief (inferior to an indicative time of 1ms.); in fact if this
impulse happens while a high level interrupt routine are served (like to example a interrupt of the axes program
or a interrupt of the serial canals) then the edge are detected but not the level and therefore the edge is discarged.
See the following figure:

Duration of the higher priority


interrupt routine

Duration of the NC input pulse


In this moment the NC input
is low and the edge is discarged

WARNING
We want to put in evidence that, beyond on the index pulse the interrupt is generated only on the
leading/falling edge of the NC input. For which the connection of B type (connection commonly
closed) you doesn't can ever be used because the NC input level is always maintained to high level.

Doc. MS229601 - Ed.02 – 18/07/96 51


331 SOFTWARE axes controller in AWL

Switch state Switch state Switch state

on on on

off off off

NC input level NC input level NC input level

red led lighted red led lighted red led lighted


24 V 24 V 24 V

0V 0V 0V

NO input level NO input level NO input level

yellow led lighted yellow led lighted yellow led lighted


24 V 24 V 24 V

0V 0V 0V

EXCHANGE CONTACT NORMALLY CLOSED CONTACT NORMALLY OPEN CONTACT


A TYPE B TYPE C TYPE

The red led show the 24 Vdc voltage presence on the NC input.
The yellow led show the 24 Vdc voltage presence on the NO input.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Number of required function
ACC2: Ineffective
Restored Parameters ACC1: Result of the function required
ACC2: Unchanged

Note: Edge finding (of the inputs and of the encoder index pulse) cannot be executed at the same time with the zero
search’s cm-rtac and cm-inic functions.

Example: At E0.0 leading edge axis 0 must be commanded in speed; at every NC input falling edge the axis must move
of 1000 impulses.

C w.asse0
U E0.0 * Test E0.0 leading edge
D M10.0
IF
L KZ100000 * Command axis in speed
C cm-veli
L KZ6 * Enable routine for edge finding
C rch.funz
ENDIF

L KZ1 * Test if the edge has arrived


C rch.funz
L KZ0
<>F
= M10.1 * Flag for arrived edge

U M10.1 * Positioning
D M10.2
IF
L KZ1000 * Movement

52 Doc. MS229601 - Ed.02 – 18/07/96


chapter 3. AWL BASIC LIBRARY FOR AXES CONTROL

L KZ100000 * Speed
C cm-movei
ENDIF

R.CIRC

Returns the CIRC variable value of the selected axis in ACC1. The CIRC variable indicates the
number of revolution impulses for circular axes. If this variable’s value is above zero, the axis is
considered circular.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: CIRC Value
ACC2: Unchanged

Example: See example in R.ANTIC (just change R.ANTIC with R.CIRC).

R.ENC.FIN

Returns the ENC.FIN variable value of the selected axis in ACC1. The ENC.FIN variable indicates
the position to be reached during the positioning phase expressed in encoder impulses.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: ENC.FIN Value
ACC2: Unchanged
See also: R.VREGIME

Example: You want to execute a Hold function. At the E0.6 leading edge axis 0 stops (only if it is in mode 1,2 or 3),
at the following input edge the axis re-starts the operation it was executing.

C w.asse0

U E0.6 * Test HOLD button leading edge


D M240.0
IF
U M10.0 * HOLD function active
IF
R M10.0
U M11.0 * Before there was a speed command
IF
L DD44
C cm-veli
ELSE
L DD40
L DD44
C cm-move
ENDIF
ELSE * HOLD function not active
C R.modo

Doc. MS229601 - Ed.02 – 18/07/96 53


331 SOFTWARE axes controller in AWL

L KZ1
=F
= M11.0 * Axis commanded in speed
TAK
L KZ2
=F
= M11.1 * Positioning mode
TAK
L KZ3
=F
= M11.2 * Positioning mode
O M11.0
O M11.1
O M11.2
IF
C R.ENC.FIN
T DD40
C R.VREGIME
T DD44
C cm-stop
S M10.0
ENDIF
ENDIF
ENDIF

R.ER

Returns the ER variable value of the selected axis in ACC1. The ER variable indicates the actual
position error expressed in encoder impulses.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: ER Value
ACC2: Unchanged

Example: The A0.1 output must be switched on whenever the position error of axis 0 exceeds 50 impulses.

C w.asse0
C R.ER * Read error
ASS * Measure the absolute value
L KZ50 * Number of impulses - maximum error
>F * Superior to 50 impulses ?
= A0.1 * Command exit

R.EROVFL

Returns the EROVFL variable value of the selected axis in ACC1. The EROVFL variable indicates
the maximum error (in impulses) for the activation of the mode 13, a negative value in this variable
disables the control.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO

54 Doc. MS229601 - Ed.02 – 18/07/96


chapter 3. AWL BASIC LIBRARY FOR AXES CONTROL

Required Parameters ACC1: Ineffective


ACC2: Ineffective
Restored Parameters ACC1: EROVFL Value
ACC2: Unchanged
See also: W.EROVFL

Example: See example in R.ANTIC (just change R.ANTIC with R.EROVFL).

R.ftr

Returns the ftr flag value of the selected axis in ACC1. The ftr flag indicates the type of selected
ramp: 0 ð linear ramps, 1 ð"S" ramps.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: ftr Value
ACC2: Unchanged
See also: W.ftr

Example: See example in R.ANTIC (just change R.ANTIC with R.ftr).

R.GIOCO

Returns the GIOCO value of the selected axis in ACC1. The GIOCO variable indicates the back-
lash quota during the positioning.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: GIOCO Value
ACC2: Unchanged
See also: W.GIOCO
Example: See example in R.ANTIC (just change R.ANTIC with R.GIOCO).

R.KD

Returns the KD derivative constant value of the selected axis in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: KD Value
ACC2: Unchanged
See also: W.KD
Example: See example in R.ANTIC (just change R.ANTIC with R.KD).

Doc. MS229601 - Ed.02 – 18/07/96 55


331 SOFTWARE axes controller in AWL

R.KI

Returns the KI integral constant value of the selected axis in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: KI Value
ACC2: Unchanged
See also: W.KI

Example: See example in R.ANTIC (just change R.ANTIC with R.KI).

R.KN

Returns the KN normalisation constant value of the selected axis in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: KN Value
ACC2: Unchanged
See also: W.KN

Example: See example in R.ANTIC (just change R.ANTIC with R.KN).

R.KP

Returns the KP proportional constant value of the selected axis in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: KP Value
ACC2: Unchanged
See also: W.KP
Example: See example in R.ANTIC (just change R.ANTIC with R.KP).

R.modo

Returns the modo variable value of the selected axis in ACC1. The modo variable indicates the axis
operation mode.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO

56 Doc. MS229601 - Ed.02 – 18/07/96


chapter 3. AWL BASIC LIBRARY FOR AXES CONTROL

Required Parameters ACC1: Ineffective


ACC2: Ineffective
Restored Parameters ACC1: modo Value
ACC2: Unchanged

Example: See example in R.Cerr.

R.modogio

Returns the modogio flag value of the selected axis in ACC1. The modogio flag indicates the
operation mode for positioning with back-lash recovery.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: modogio Value
ACC2: Unchanged
See also: W.modogio

Example: See example in R.ANTIC (just change R.ANTIC with R.modogio).

R.modoins

Returns the modoins flag value of the selected axis in ACC1. The modoins flag indicates the
operation mode of the electric gear.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: modoins Value
ACC2: Unchanged
See also: W.modoins follows W.RAPINS R.RAPINS
Example: See example in R.ANTIC (just change R.ANTIC with R.modoins).

R.N.ASSI

Returns the number of the axes controlled by the motion program with the functions cm-start or
cm-restot.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Number of controlled axes
ACC2: Unchanged
See also: cm-start cm-restot
Example: DW2 must contain the number of controlled axes.

Doc. MS229601 - Ed.02 – 18/07/96 57


331 SOFTWARE axes controller in AWL

C R.N.ASSI * Read number of axes


T DW2

R.P1

Returns the actual position (P1) in impulses of the selected axis in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Axis actual position
ACC2: Unchanged
See also: cm-setp1 cm-zeroa

Example: See example in C.I.U.

R.RAPINS

Returns the RAPINS variable value of the selected axis in ACC1. The RAPINS variable indicates
the electric gear ratio between master axis and slave axis.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: RAPINS Value
ACC2: Unchanged
See also: W.RAPINS follow

Example: See example in R.ANTIC (just change R.ANTIC with R.RAPINS).

r.ris

Returns the ris encoder resolution value of the selected axis in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: ris Value.
ACC2: Unchanged
See also: w.ris

Example: DD80 must contain the encoder resolution of the axis 0.

C w.asse0
C r.ris * Read resolution
T DD80 * Memorise in DD80

58 Doc. MS229601 - Ed.02 – 18/07/96


chapter 3. AWL BASIC LIBRARY FOR AXES CONTROL

R.TOLL

Returns the TOLL variable value of the selected axis in ACC1. The TOLL variable represents the
tolerance in impulses for the entrance in mode 0 at the end of positioning.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: TOLL Value
ACC2: Unchanged
See also: W.TOLL

Example: See example in R.ANTIC (just change R.ANTIC with R.TOLL).

R.V1

Returns the speed (V1) of the selected axis in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Axis speed
ACC2: Unchanged
See also: R.P1 R.VDESID

R.VDESID

Returns the theoretical speed (VDESID) of the selected axis in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: V1 Value
ACC2: Unchanged
See also: R.V1

Example: See example in R.ANTIC (just change R.ANTIC with R.VDESID).

R.VEMAX

Returns the VEMAX variable value of the selected axis in ACC1. The VEMAX variable contains
the maximum value VDESID theoretical speed can have.

Belonging class: Axes control library


Call mode: C =C

Doc. MS229601 - Ed.02 – 18/07/96 59


331 SOFTWARE axes controller in AWL

Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: VEMAX Value
ACC2: Unchanged
See also: W.VEMAX

Example: See example in R.ANTIC (just change R.ANTIC with R.VEMAX).

R.VIND

Returns the VIND variable value of the selected axis in ACC1. The VIND variable indicates speed
during the first phase of zero search.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: VIND Value
ACC2: Unchanged
See also: W.VIND R.VTACC W.VTACC cm-inic cm-rtac
Example: See example in R.ANTIC (just change R.ANTIC with R.VIND).

R.VMINIMA

Returns the VMINIMA variable value of the selected axis in ACC1. The VMINIMA variable
indicates the arrival speed during positioning phases.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: VMINIMA Value
ACC2: Unchanged
See also: W.VMINIMA
Example: See example in R.ANTIC (just change R.ANTIC with R.VMINIMA).

R.VREGIME

Returns the VREGIME variable value of the selected axis in ACC1. The VREGIME variable
indicates the speed to be reached during some function modes.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: VREGIME Value
ACC2: Unchanged
Example: See example in R.ENCFIN.

60 Doc. MS229601 - Ed.02 – 18/07/96


chapter 3. AWL BASIC LIBRARY FOR AXES CONTROL

R.VTACC

Returns the VTACC variable value of the selected axis in ACC1. The VTACC variable indicates the
speed searching for the encoder index pulse.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: VTACC Value
ACC2: Unchanged
See also: W.VTACC cm-rtac

Example: See example in R.ANTIC (just change R.ANTIC with R.VTACC).

R.VU

Returns in ACC1 the value of the output voltage (VU) normalised at the range -32768 ÷ +32767
(-10V ð VU=-32768, +10V ð VU=+32767).

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: VU Value
ACC2: Unchanged
Example: See example in R.ANTIC (just change R.ANTIC with R.VU).

W.ANTIC

Sets to the ANTIC variable of the selected axis the value contained in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: ANTIC Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: R.ANTIC
Example: Set ANTIC parameter of axis 1 at 50.

C w.asse1
L KZ50 * Value to be set to the parameter
C W.ANTIC

w.asse

Selects the axis number for further instructions. The axis number must be contained in ACC1.

Doc. MS229601 - Ed.02 – 18/07/96 61


331 SOFTWARE axes controller in AWL

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Axis number
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: r.asse

Example: See function examples already described.

w.asse0

Selects axis 0 for further instructions.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: w.asse w.asse1 w.asse2

w.asse1

Selects axis 1 for further instructions.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: w.asse w.asse0 w.asse1

w.asse2

Selects axis 2 for further instructions.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: w.asse w.asse0 w.asse1

62 Doc. MS229601 - Ed.02 – 18/07/96


chapter 3. AWL BASIC LIBRARY FOR AXES CONTROL

W.Cerr

Sets to the Cerr variable of the selected axis the value contained in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Cerr Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: R.Cerr

Example: See example in R.Cerr.

W.CIRC

Sets to the variable CIRC of the selected axis the value contained in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: CIRC Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: R.CIRC
Example: See example in W.ANTIC (just change W.ANTIC with W.EROVFL and its value with a more appropriate
value).

W.EROVFL

Sets to the EROVFL variable of the selected axis the value contained in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: EROVFL Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: R.EROVFL
Example: See example in W.ANTIC (just change W.ANTIC with W.EROVFL and its value with a more appropriate
value).

W.ftr

Sets to the ftr flag of the selected axis the value contained in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO

Doc. MS229601 - Ed.02 – 18/07/96 63


331 SOFTWARE axes controller in AWL

Required Parameters ACC1: ftr Value


ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: R.ftr

Example: When E0.0 input is on, the ‘S' ramps for the axis 0 must be set. Otherwise, linear ramps must be set.

C w.asse0
U E0.0 * Analyse E0.0 leading edge
D M240.0
L KZ1 * Value to be set to ftr
= C W.ftr
UN E0.0 * Analyse E0.0 falling edge
D M240.1
L KZ0 * Value to be set to ftr
= C W.ftr

W.GIOCO

Sets to the GIOCO variable of the selected axis the value contained in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: GIOCO Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: R.GIOCO

Example: See example in W.ANTIC (just change W.ANTIC with W.GIOCO and its value with a more appropriate
value).

W.KD

Sets to the KD derivative constant of the selected axis the value contained in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: KD Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: R.KD R.KI W.KI R.KP W.KP

Example: See example in W.ANTIC (just change W.ANTIC with W.KD and its value with a more appropriate value).

W.KI

Sets to the KI integral constant of the selected axis the value contained in ACC1.

Belonging class: Axes control library

64 Doc. MS229601 - Ed.02 – 18/07/96


chapter 3. AWL BASIC LIBRARY FOR AXES CONTROL

Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: KI Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: R.KI R.KD W.KD R.KP W.KP

Example: See example in W.ANTIC (just change W.ANTIC with W.KI and its value with a more appropriate value).

W.KN

Sets to the KN normalisation constant of the selected axis the value contained in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: KN Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: R.KN

Example: See example in W.ANTIC (just change W.ANTIC with W.KN and its value with a more appropriate value).

W.KP

Sets to the KP proportional constant of the selected axis the value contained in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Value di KP
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: R.KP R.KD W.KD R.KI W.KI

Example: See example in W.ANTIC (just change W.ANTIC with W.KP and its value with a more appropriate value).

W.modogio

Sets to the modogio flag of the selected axis the value contained in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: modogio Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged

Doc. MS229601 - Ed.02 – 18/07/96 65


331 SOFTWARE axes controller in AWL

ACC2: Unchanged
See also: R.modogio R.GIOCO W.GIOCO

Example: See example in W.ANTIC (just change W.ANTIC with W.modogio and its value with a more appropriate
value).

W.modoins

Sets to the modoins flag of the selected axis the value contained in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: modoins Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: R.modoins

Example: See example in W.ANTIC (just change W.ANTIC with W.modoins and its value with a more appropriate
value).

W.N.ABL

Sets to the NUM.ABL parameter of the selected axis the value contained in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: NUM.ABL Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: W.N.AVV W.N.AVL W.N.IDV W.N.IDL W.N.INV

W.N.ASSI

Sets to the N.ASSI parameter of the selected axis the value contained in ACC1. The parameter
N.ASSI indicates the number of axes to be controlled. It is better to use the cm-start function(or
cm-restot) that requires the number of axes to be controlled in ACC1 and initialises the axes
program.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: N.ASSI Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: R.N.ASSI cm-start cm-restot

66 Doc. MS229601 - Ed.02 – 18/07/96


chapter 3. AWL BASIC LIBRARY FOR AXES CONTROL

W.N.AVL

Sets to the NUM.AVL parameter of the selected axis the value contained in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: NUM.AVL Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: W.N.AVV W.N.IDV W.N.IDL W.N.ABL W.N.INV

W.N.AVV

Sets to the NUM.AVV parameter of the selected axis the value contained in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: NUM.AVV Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: W.N.AVL W.N.IDV W.N.IDL W.N.ABL W.N.INV

W.N.IDL

Sets to the NUM.IDL parameter of the selected axis the value contained in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: NUM.IDL Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: W.N.AVV W.N.AVL W.N.IDV W.N.ABL W.N.INV

W.N.IDV

Sets to the NUM.IDV parameter of the selected axis the value contained in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: NUM.IDV Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: W.N.AVV W.N.AVL W.N.IDL W.N.ABL W.N.INV

Doc. MS229601 - Ed.02 – 18/07/96 67


331 SOFTWARE axes controller in AWL

W.N.INV

Sets to the NUM.INV parameter of the selected axis the value contained in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: NUM.INV Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: W.N.AVV W.N.AVL W.N.IDV W.N.IDL W.N.ABL

W.RAPINS

Sets to the RAPINS variable of the selected axis the value contained in ACC1. RAPINS can be
modified also when the axis is in electric gear because the W.RAPINS call initialises again the
‘following command’ if RAPINS previous value was different from the actual one.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: RAPINS Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: R.RAPINS

Example: You want to put axis 1 in electric gear with axis 0, the following ratio (which is likely to continually vary) is
contained in the double word 4.

C w.asse1
UN M80.5 Flag to avoid repeating the command
IF
L DD4 * Sets up the following ratio
C W.RAPINS
L KZ0 * Master Axis
C insegui * Axis 1 follows axis 0
ENDIF
L DD4 * RAPINS Variation on line
C W.RAPINS

W.RES

Sets to the RES variable of the selected axis the value contained in ACC1. When the function cm-
start is modified such variable, if containing a value different from 1234, executes a total reset of
the axes program. For axes program reset it is better to use the cm-restot function.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Value RES
ACC2: Ineffective
Restored Parameters ACC1: Unchanged

68 Doc. MS229601 - Ed.02 – 18/07/96


chapter 3. AWL BASIC LIBRARY FOR AXES CONTROL

ACC2: Unchanged

w.ris

Sets to the ris encoder resolution of the selected axis the value contained in ACC1

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: Resolution of the encoder ris
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged

Example: See example in W.ANTIC (just change W.ANTIC with w.ris and its value with a more appropriate value).

W.TOLL

Sets to the TOLL variable of the selected axis the value contained in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: TOLL Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: R.TOLL

Example: See example in W.ANTIC (just change W.ANTIC with W.TOLL and its value with a more appropriate
value).

W.VEMAX

Sets to the VEMAX variable of the selected axis the value contained in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: VEMAX Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: R.VEMAX

Example: See example in W.ANTIC (just change W.ANTIC with W.VEMAX and its value with a more appropriate
value).

W.VIND

Sets to the VIND variable of the selected axis the value contained in ACC1.

Doc. MS229601 - Ed.02 – 18/07/96 69


331 SOFTWARE axes controller in AWL

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: VIND Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: R.VIND R.VTACC W.VTACC

Example: See example in W.ANTIC (just change W.ANTIC with W.VIND and its value with a more appropriate
value).

W.VMINIMA

Sets to the VMINIMA variable of the selected axis the value contained in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: VMINIMA Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: R.VMINIMA

Example: See example in W.ANTIC (just change W.ANTIC with W.VMINIMA and its value with a more appropriate
value).

W.VTACC

Sets to the VTACC variable of the selected axis the value contained in ACC1.

Belonging class: Axes control library


Call mode: C =C
Modify RLC: NO
Required Parameters ACC1: VTACC Value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: R.VTACC R.VIND W.VIND

Example: See example in W.ANTIC (just change W.ANTIC with W.VTACC and its value with a more appropriate
value).

70 Doc. MS229601 - Ed.02 – 18/07/96


chapter 4. PROGRAMMING EXAMPLE

chapter 4. PROGRAMMING EXAMPLE

Y
dX
Y
X

Z dY

(X1,Y1)

0 X

Axes orientation Run to perform

The machine can work both in automatic and manual mode. In manual mode, every axis can be
moved by its corresponding button. The movement of the X-co-ordinate and the Y-co-ordinate is
inhibited if axis Z quota is not less than a set security quota. In this mode it is possible to execute the
zero search by the ZERO SEARCH button.

The E0.1 key changes the operation mode from manual to automatic or vice versa. The shift to
automatic mode is inhibited if zero search has not been executed. In automatic, at cycle start
(START button) the axes go to the point (X1,Y1): when they arrive in quota, axis Z goes down to
quota Z1 and waits for a set time. After that time, axis Z goes up again and overpasses the security
quota, the X and Y axes go to the next point indicated by dX and dY and repeat the whole cycle
again. Once the work is finished (it is possible to set the number of holes to be done), the axes go
back to the point (0,0,0). The cycle can be stopped by the STOP button.
The M40.0 flag enables the machine continuos operation. When the last hole has been done, the
axes take position at the first point and execute a new operation.
All the parameters characterising the work are set in DATA DOUBLE WORD

DD0 = dX (horizontal shift) DD4 = dY (vertical shift)


DD8 = Number of holes D12 = X1 (initial position)
DD16 = Y1 (initial position ) DD20 = Z1 (quota of axis Z work)
DD24 = Axis X manual speed DD28 = Axis Y manual speed
DD32 = Axis Z manual speed DD36 = Axis X speed in automatic
DD40 = Speed in automatic axis Y DD44 = Axis Z speed in automatic
DD48 = Axis Z Security Quota DD52 = Axis Z Delay in lifting
DD100= dX during work DD104= dY during work
DD200= Axis X Position DD204= Axis Y Position
DD208= Axis Z Position

The reason for an alarm situation can be read in MW64 with the following meaning:

M64.1 = Emergency inserted


M64.2 = Zero Search not executed
M64.3 = Axis Z over security quota
M64.6 = Axis X in error

Doc. MS229601 - Ed.02 – 18/07/96 71


331 SOFTWARE axes controller in AWL

M64.7 = Axis Y in error


M65.0 = Axis Z in error

The system configuration is the following:

Axis 0 = Axis X
Axis 1 = Axis Y
Axis 2 = Axis Z

E0.0 = Auxiliary presence (N.C.)


E0.1 = Selector for manual/automatic
E0.2 = X+ Input
E0.3 = X- Input
E0.4 = Y+ Input
E0.5 = Y- Input
E0.6 = Z+ Input
E0.7 = Z- Input
E1.1 = START cycle Input
E1.2 = STOP cycle Input
E1.4 = Zero search Input
E1.5 = Input for alarm acquisition

A0.1 = Work on-going


A0.4 = Output for present alarm
A0.5 = Output for function mode

****************************************************************************
*
* Initialisation of program
*
****************************************************************************
#RESET
L KZ3 * Number of axes to be controlled
C cm-restot * Initialisation with EEPROM loading
S M0.0 * Avoid a new initialisation of the axes program
S M80.0 * Avoid a new starting of the axes program

C w.asse0 * Set up the encoder resolution for axis X


L KZ10000
C w.ris

C w.asse1 * Set up the encoder resolution for axis Y


L KZ10000
C w.ris

C w.asse2 * Set up the encoder resolution for axis Z


L KZ10000
C w.ris

BE
****************************************************************************
*
* Start of program
*
*****************************************************************************
#START

72 Doc. MS229601 - Ed.02 – 18/07/96


chapter 4. PROGRAMMING EXAMPLE

L KZ3 * Number of axes to be controlled


C cm-start * Start the axes program
BE
******************************************************************************
*
* Main program
*
*****************************************************************************
#MAIN
*****************************************************************************
*
* Axes Z security
*
*****************************************************************************
* If axis Z is under the quota set in DD48, the movement of axes X and Y is not
* possible. If axis Z goes under the security quota with axes X and Y in motion,
* all axes are blocked, the MW90 and MW100 flags are reset and the M64.3 alarm
* flag is set-up. The axes are locked in their corresponding area.

C w.asse2
C R.P1 * Read quota axis Z
L DD48 * Axis Z Security Quota
C C.U.I * Convert in impulses
<=F * Present Quota minor or equal to security quota
= M24.0 * Axis Z Flag in security quota

C ?fermo * Read axis Z state


= M24.3 * Axis Z stopped

C w.asse0
C ?fermo * Read axis X state
= M24.1 * Axis X stopped

C w.asse1
C ?fermo * Read axis Y state
= M24.2 * Axis Y stopped

UN M24.0 * Axis Z out from security quota


U(
ON M24.1 * Axis X not stopped
ON M24.2 * Axis Y not stopped
)
D M253.7
= M20.6 * Axis Z leading edge out from security quota
S M64.3 * Axis Z out from security quota

********************************************************************************
*
* Emergency control and change in function mode
*
********************************************************************************

* At every E0.0 falling edge (emergence) and at every change in the function
* mode, all axes must be instantly blocked (In emergency case the M64.1 alarm
* flag must be set up) and all MW100 and MW90 flags must be reset.
* If the zero search procedure indicated by M80.2 flag has not been previously
* executed, the shift to automatic mode is not possible. If mode switch to
* automatic should be tried even without executing the zero search, M64.2 flag
* (alarm) will be set up.
* The state is restored in M80.3 (manual) flag and in M80.4 (automatic).

Doc. MS229601 - Ed.02 – 18/07/96 73


331 SOFTWARE axes controller in AWL

* Axes are instantly stopped in the next block.

UN E0.0 * Analyse emergence falling edge


D M255.6 * Scratch
= M20.0 * Emergence falling edge
S M64.1 * Emergency Alarm on
U E0.1 * Analyse leading edge selector for mode change
D M255.5 * Scratch
= M20.1 * Leading edge selector for mode change
UN E0.1 * Analyse falling edge selector for mode change
D M255.4 * Scratch
= M20.2 * Falling edge selector for mode change

U M20.1 * Shift to automatic


U M80.2 * Zero Search executed
U E0.0 * Emergency not on
S M80.4 * Machine in automatic
R M80.3 * Machine not in manual

U M20.1 * Shift to automatic


UN M80.2 * Zero Search not executed
S M64.2 * Zero Search Alarm not executed

UN E0.1 * Selector in manual


U E0.0 * Emergence not on
S M80.3 * Machine in manual
R M80.4 * Machine not in automatic

********************************************************************************
*
* Block axes in case of emergency or mode change or else
*
********************************************************************************
* In case of emergency or change in the function mode or if axis Z is not in the
* security quota, axes are instantly blocked and the zero search and automatic
* cycle flags are reset.
*

O M20.0 * Emergency pressed


O M20.1 * Shift to automatic
O M20.2 * Shift to manual mode
O M20.6 * Axis Z not in security quota
IF
R M40.1 * Reset continuos function
C w.asse0
C cm-lock
C w.asse1
C cm-lock
C w.asse2
C cm-lock
L KZ0
T MW90 * Reset zero search flag
T MW100 * Reset automatic flag
ENDIF

********************************************************************************
*
* Axis X Manual Control
*
********************************************************************************
* The manual commands for axes X and Y are not available if the zero search

74 Doc. MS229601 - Ed.02 – 18/07/96


chapter 4. PROGRAMMING EXAMPLE

* procedure is on (indicated by the flag M90.0). When the machine is in


* automatic and axis Z is not in a security quota, M24.0 flag indicates this
* condition. Manual speed drawn from DD24 is converted in inside units by the
* C.UI.V function.

C w.asse0
L DD24 * Load manual speed
C C.UI.V * Convert in inside units

U E0.2 * Analyse leading edge X+ input


D M255.3
= M22.0 * Leading edge X+ input
UN E0.2 * Analyse falling edge X+ input
D M255.2
= M22.1 * Falling edge X+ input

U E0.3 * Analyse leading edge X- input


D M255.1
= M22.2 * Leading edge input X-
UN E0.3 * Analyse falling edge X- input
D M255.0
= M22.3 * Falling edge X- input

U M22.0 * Leading edge X+ input


UN E0.3 * X- Input not pressed
U M80.3 * Machine in manual
UN M90.0 * Zero Search not on-going
U M24.0 * Axis Z high
= C cm-veli * Command axis X in speed

U M22.2 * Leading edge input X-


UN E0.2 * Input X+ not pressed
U M80.3 * Machine in manual
UN M90.0 * Zero Search not on-going
U M24.0 * Axis Z high
KZW * Invert speed sign
= C cm-veli * Command in speed axis X

O M22.1 * Falling edge X+ input


O M22.3 * Falling edge X- input
U M80.3 * Machine in manual
= C cm-stop * Stop axis X

********************************************************************************
*
* Axis Y Manual Control
*
********************************************************************************
* It is similar to that of axis X

C w.asse1
L DD28 * Load manual speed
C C.UI.V * Convert in inside units

U E0.4 * Analyse leading edge Y+ input


D M254.7
= M22.4 * Leading edge Y+ input
UN E0.4 * Analyse falling edge Y+ input
D M254.6

Doc. MS229601 - Ed.02 – 18/07/96 75


331 SOFTWARE axes controller in AWL

= M22.5 * Falling edge Y+ input

U E0.5 * Analyse leading edge Y- input


D M254.5
= M22.6 * Leading edge Y- input
UN E0.5 * Analyse falling edge Y- input
D M254.4
= M22.7 * Falling edge Y- input

U M22.4 * Leading edge Y+ input


UN E0.5 * Y- Input not pressed
U M80.3 * Machine in manual
UN M90.0 * Zero Search not on-going
U M24.0 * Axis Z high
= C cm-veli * Command axis Y in speed

U M22.6 * Leading edge Y- input


UN E0.4 * Input Y+ not pressed
U M80.3 * Machine in manual
UN M90.0 * Zero Search not on-going
U M24.0 * Axis Z high
KZW * Invert speed sign
= C cm-veli * Command axis Y in speed

O M22.5 * Falling edge input Y+


O M22.7 * Falling edge input Y-
U M80.3 * Machine in manual
= C cm-stop * Stop axis Y

********************************************************************************
*
* Axis Z Manual Control
*
*********************************************************************************
* It is similar to that of axes X and Y. Obviously there is no security quota
* interlock of axis Z.

C w.asse2
L DD32 * Load manual speed
C C.UI.V * Convert in inside units

U E0.6 * Analyse leading edge input Z+


D M254.3
= M23.0 * Leading edge input Z+
UN E0.6 * Analyse falling edge input Z+
D M254.2
= M23.1 * Falling edge input Z+

U E0.7 * Analyse leading edge input Z-


D M254.1
= M23.2 * Leading edge input Z-
UN E0.7 * Analyse falling edge input Z-
D M254.0
= M23.3 * Falling edge input Z-

U M23.0 * Leading edge input Z+


UN E0.7 * Input Z- not pressed
U M80.3 * Machine in manual
UN M90.0 * Zero Search not on-going

76 Doc. MS229601 - Ed.02 – 18/07/96


chapter 4. PROGRAMMING EXAMPLE

= C cm-veli * Command axis Z in speed

U M23.2 * Leading edge input Z-


UN E0.6 * Input Y+ not pressed
U M80.3 * Machine in manual
UN M90.0 * Zero Search not on-going
KZW * Invert speed sign
= C cm-veli * Command axis Z in speed

O M23.1 * Falling edge input Z+


O M23.3 * Falling edge input Z-
U M80.3 * Machine in manual
= C cm-stop * Stop axis Z

********************************************************************************
*
* Zero search control
*
********************************************************************************
* The zero search immediately starts the zero search for axis Z is, then for 8
* axes X and Y. When the whole zero search procedure is over the M80.2 flag is
* set up. The zero search procedure can be interrupted by pressing again the
* zero search key.

U E1.4 * Analyse zero search leading edge input


D M253.6
= M23.4 * Zero search leading edge input

U M23.4 * Require zero search


U M90.0 * Zero Search on-going
IF * -> Zero Search aborted
C w.asse0
C cm-stop
C w.asse1
C cm-stop
C w.asse2
C cm-stop
L KZ0 * Reset zero search procedure
T MW90
R M23.4 * Reset zero search leading edge input
ENDIF

U M23.4 * Require zero search


UN M90.0 * Zero Search on-going
U M24.1 * Axis X in position
U M24.2 * Axis Y in position
U M24.3 * Axis Z in position
U M80.3 * Manual
IF
C w.asse2
C cm-rtac
S M90.0 * Set zero search flag on-going
ENDIF

C w.asse2 * Up-date axis Z flag in position


C ?fermo
= M24.3

U M90.0 * Zero Search on-going


U M24.3 * Axis Z Zero Search accomplished

Doc. MS229601 - Ed.02 – 18/07/96 77


331 SOFTWARE axes controller in AWL

UN M90.1 * X Y Zero Search not started


IF
C w.asse0 * Command axis X zero search
C cm-rtac
C w.asse1 * Command axis Y zero search
C cm-rtac
S M90.1 * Set X Y zero search flag started
ENDIF

C w.asse0 * Up-date axis X flag to position


C ?fermo
= M24.1

C w.asse1 * Up-date axis Y flag to position


C ?fermo
= M24.2

U M90.1 * Zero Search X Y started


U M24.1 * Zero X Search Achieved
U M24.2 * Zero Y Search Achieved
R M90.0 * Reset zero search flag
R M90.1
S M80.2 * Set zero search flag correct

********************************************************************************
*
* Wait for start input
*
********************************************************************************
* During the automatic function mode. When START button is pressed,the item-
* counter is reset, axis Z reaches the position(quota 0). If it is below the
* security quota (M24.0) axes X and Y go to the first point (X1,Y1). At key
* pressure the variables dX and dY are copied into the work variables (DD100 and
* DD104).

U E1.1 * Analyse leading edge input START


D M253.5
= M23.5 * Leading edge input START

U M40.0 * Continuous Functioning enabled ?


U M23.5 * Cycle START
S M40.1 * Start Continuous Functioning

O M23.5 * Require Cycle START


O M40.1 * Require continuously
U M80.4 * Machine in automatic
UN M100.0 * Automatic Cycle not started
R Z0 * Reset the item-counter
IF
L DD0 * Update dX work
T DD100
L DD4 * Update dY work
T DD104
C w.asse2
L KZ0 * Axis Z in position
L DD44 * Axis Z work speed
C C.UI.V * Convert in inside units
C cm-move * Position Command for axis Z
S M100.0 * Set automatic cycle flag started

78 Doc. MS229601 - Ed.02 – 18/07/96


chapter 4. PROGRAMMING EXAMPLE

ENDIF

U M100.0 * Automatic Cycle started


UN M100.1 * Axes X Y first positioning not Achieved
U M24.0 * Axis Z in security quota
IF
C w.asse0
L DD12 * Quota X first point
C C.U.I * Conversion in impulses
L DD36 * Axis X speed
C C.UI.V * Conversion in inside units
C cm-move * Axis X positioning on first point
C w.asse1
L DD16 * Quota Y first point
C C.U.I * Conversion in impulses
L DD40 * Axis Y speed
C C.UI.V * Conversion in inside units
C cm-move * Axis Y positioning on first point
S M100.1 * Set positioning flag on-going on first point
ENDIF

********************************************************************************
*
* Wait for arrival at quota
*
********************************************************************************
* When axes X and Y arrive at quota, axis Z moves to
* quota Z1.

C w.asse0 * Up-date axis X flag in position


C ?fermo
= M24.1

C w.asse1 * Up-dates axis Y flag in position


C ?fermo
= M24.2

U M100.1 * First positioning command achieved


UN M100.2 * Axis Z Lowering not started
U M24.1 * Axis X in quota
U M24.2 * Axis Y in quota
IF
C w.asse2
L DD20 * Axis Z work quota
C C.U.I * Conversion in impulses
L DD44 * Axis Z speed
C C.UI.V * Conversion in inside units
C cm-move * Axis Z Positioning
S M100.2 * Set Z positioning flag started
ENDIF

********************************************************************************
*
* Wait for axis Z positioning end
*
********************************************************************************
* At the end of positioning, axis Z waits for a set time in DD52, then goes
* back to its position quota.

C w.asse2 * Update axis Z flag in position

Doc. MS229601 - Ed.02 – 18/07/96 79


331 SOFTWARE axes controller in AWL

C ?fermo
= M24.3

U M100.2 * Axis Z Positioning started


UN M100.3 * Axis Z Return not started
U M24.3 * Axis Z in quota
L DD52 * Load axis Z delay in lifting
SE T2
= A0.1 * Working

U T2 * Axis in position [DD52] "/100


IF
L KZ0 * Axis Z in position
L DD44 * Axis Z speed
C C.UI.V * Conversion in inside units
C cm-move * Axis Z Positioning
S M100.3 * Set axis Z return flag started
ENDIF

U M100.3 * Command axis Z return


ZV Z0 * Increase the item-counter

********************************************************************************
*
* Control if the working is finished
*
********************************************************************************
* The M101.7 flag is set up if working is not finished.

L Z0 * Load Number of items worked


L DD8 * Load Number of holes to be done
<F
= M101.7 * Cycle Flag not finished

********************************************************************************
*
* Working not finished: position X Y on the next point
*
********************************************************************************
*
* If the working is not finished, it is necessary to move to the next point.
*

U M101.7 * Working not finished


U M100.3 * Axis Z return started
U M24.0 * Axis Z in security quota
IF
C w.asse0
L DD100 * dX Working
C C.U.I * Conversion in impulses
L DD36 * Axis X speed
C C.UI.V * Conversion in inside units
C cm-movei * Incremental Positioning

C w.asse1
L DD104 * dY Working
C C.U.I * Conversion in impulses
L DD40 * Axis Y speed
C C.UI.V * Conversion in inside units
C cm-movei * Incremental Positioning

80 Doc. MS229601 - Ed.02 – 18/07/96


chapter 4. PROGRAMMING EXAMPLE

L DD104 * Invert the dY's sign


KZW
T DD104

R M100.2 * Return to the waiting point - X Y in position


R M100.3

ENDIF

********************************************************************************
*
* Working finished: position X Y on point zero
*
********************************************************************************

UN M101.7 * Working finished


U M100.3 * Axis Z returning
U M24.0 * Axis Z in security quota
IF
C w.asse0
L KZ0 * Axis X Quota to be reached
L DD36 * Axis X speed
C C.UI.V * Conversion in inside units
C cm-move * Axis X Positioning on point 0
C w.asse1
L KZ0 * Axis Y Quota to be reached
L DD40 * Axis Y speed
C C.UI.V * Conversion in inside units
C cm-move * Axis Y Positioning on point 0
R M100.0 * Return to initial point
R M100.1
R M100.2
R M100.3
ENDIF

********************************************************************************
*
* Cycle stop control
*
********************************************************************************
* If the STOP input is pressed when the machine is in automatic, all axes are
* stopped and the MW100 flags are reset.

U E1.2 * Analyse leading edge STOP input


D M253.4
= M23.6 * Leading edge STOP input

U M100.0 * Machine in automatic


U M23.6 * Require cycle STOP
IF
R M40.1 * Reset continuous working flag
C w.asse0
C cm-stop
C w.asse1
C cm-stop
C w.asse2
C cm-stop
L KZ0

Doc. MS229601 - Ed.02 – 18/07/96 81


331 SOFTWARE axes controller in AWL

T MW100
ENDIF

********************************************************************************
*
* Control Axes in Error
*
********************************************************************************
* If an axis enters an error mode, all axes must be immediately stopped and all
* M64.6 M64.7 and M65.0 alarm flags must be set up, while MW90 and MW100 flags
* must be reset.

C w.asse0
C R.modo
L KZ12
=F
= M25.0 * Axis X in error
S M64.6 * Axis X in error

C w.asse1
C R.modo
L KZ12
=F
= M25.1 * Axis Y in error
S M64.7 * Axis Y in error

C w.asse2
C R.modo
L KZ12
=F
= M25.2 * Axis Z in error
S M65.0 * Axis Z in error

O M25.0 * Axis X in error


O M25.1 * Axis Y in error
O M25.2 * Axis Z in error
IF
C w.asse0
C cm-lock
C w.asse1
C cm-lock
C w.asse2
C cm-lock
L KZ0 * Reset cycle flag
T MW90
T MW100
ENDIF

********************************************************************************
*
* Control function mode light
*
********************************************************************************
* The light for function mode can mean the following:
* off = manual
* slow flashing = zero search on-going
* fast flashing = working on-going
* on = automatic - waiting for cycle start

82 Doc. MS229601 - Ed.02 – 18/07/96


chapter 4. PROGRAMMING EXAMPLE

UN M30.0 * Flashing Clock


L KT20.0 * 200 ms
SE T3
U T3
= M30.0 * Clock

U M30.0 * Create 16 clocks multiplied by 200 ms in MW32


IF
INC MW32
ENDIF

U M80.3 * Manual
U M90.0 * Zero Search
U M33.1 * Slow flashing
O
U M80.4 * Automatic
U M100.0 * Cycle started
U M33.0 * Fast flashing
O
U M80.4 * Automatic
UN M100.0 * Cycle not started
= A0.5

********************************************************************************
*
* Alarm control
*
********************************************************************************
* In case of alarm, as MW64 contains a value different from zero, the alarms’spy
* should automatically switch on. If the alarm spy is on by pressing the alarm
* acquisition input, MW64 is reset.

L MW64 * Analyse the alarm word


L KZ0
<>F
= A0.4 * Alarm light

U A0.4 * Alarms present


U E1.5 * Alarm acquired
IF
L KZ0 * Reset alarm word
T MW64
ENDIF

********************************************************************************
*
* Quota reading
*
********************************************************************************
* The quotas of the three axes are restored in DD200, DD204 and DD208 to be
* monitored during program tuning-up.

C w.asse0
C R.P1 * Read quota in impulses
C C.I.U * Conversion in units
T DD200

C w.asse1
C R.P1 * Read quota in impulses
C C.I.U * Conversion in units
T DD204

Doc. MS229601 - Ed.02 – 18/07/96 83


331 SOFTWARE axes controller in AWL

C w.asse2
C R.P1 * Read quota in impulses
C C.I.U * Conversion in units
T DD208
BE * Program End

84 Doc. MS229601 - Ed.02 – 18/07/96


CORRECTION

CORRECTION

In this correction are described some commands non included in the manual. These commands
regard the systems CTN320 – CTN350 – CTN560. For each comman it is specified what systems
support it.

cm-?btb (CTN320-350-560)

This function permits to test the input of driver ready to work.

NOTE
The function cm-?btb substitute the function ?btb. For compatibility, the old function is still present in the
AWL vocabolary. We suggest you to use cm-?btb

Belonging class: Axes control library


Call mode: C, U C, UN C, O C, ON C
Modify RLC: YES
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-?i2t

cm-?i2t (CTN320-350-560)

This function permits to drive’s allarm input I2T.

NOTE
The function cm-?i2t substitute the function ?i2t. For compatibility, the old function is still present in the AWL
vocabolary. We suggest you to use cm-?i2t

Belonging class: Axes control library


Call mode: C, U C, UN C, O C, ON C
Modify RLC: YES
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-?btb

cm-?nstop (CTN320-350)

It permits to test the negative extra-switch.

Doc. MS229601 - Ed.02 – 18/07/96 85


331 SOFTWARE axes controller in AWL

NOTE
The function cm-?nstop substitute the function ?nstop. For compatibility, the old function is still present in the
AWL vocabolary. We suggest you to use cm-?nstop

Belonging class: Axes control library


Call mode: C, U C, UN C, O C, ON C
Modify RLC: YES
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-?pstop

cm-?pstop (CTN320-350)

It permits to test the positive extra-switch.

NOTE
The function cm-?pstop substitute the function ?pstop. For compatibility, the old function is still present in the
AWL vocabolary. We suggest you to use cm-?pstop

Belonging class: Axes control library


Call mode: C, U C, UN C, O C, ON C
Modify RLC: YES
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-?nstop

cm-abibtb (CTN320-350-560)

It permits to enable the BTB input control.

Belonging class: Axes control library


Call mode: C, =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-disbtb, cm-abii2t, cm-disi2t

cm-abii2t (CTN320-350)

It permits to enable the I2T input control.

Belonging class: Axes control library


Call mode: C, =C
Modify RLC: NO
Required Parameters ACC1: Ineffective

86 Doc. MS229601 - Ed.02 – 18/07/96


CORRECTION

ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-abibtb, cm-disbtb, cm-disi2t

cm-copp (CTN320-350)

It sets percentage of the maximun torque with the ACC1 value. The command must be given once,
not repetitively.

Belonging class: Axes control library


Call mode: C, =C
Modify RLC: NO
Required Parameters ACC1: Percentage of maximun torque
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-rcopp

cm-coppia (CTN320-350)

It enables the digital output for switching from speed command to torque command. Thish function
must be used only in drivers with torque control option.

Belonging class: Axes control library


Call mode: C, =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-veloc

cm-disbtb (CTN320-350-560)

It permits to disable the BTB input control.

Belonging class: Axes control library


Call mode: C, =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-abibtb, cm-abii2t, cm-disi2t

cm-disi2t (CTN320-350)

It permits to disable the I2T input control.


Doc. MS229601 - Ed.02 – 18/07/96 87
331 SOFTWARE axes controller in AWL

Belonging class: Axes control library


Call mode: C, =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-abibtb, cm-disbtb, cm-abii2t

cm-lib (CTN320-350-560)

It disable the driver of the selected axis. This is possible only if the system manages the driver
enabling operation by its special output.

Belonging class: Axes control library


Call mode: C, =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-nolib

cm-nolib (CTN320-350-560)

It enable the driver of the selected axis. This is possible only if the system manages the driver
enabling operation by its special output.

Belonging class: Axes control library


Call mode: C, =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-nolib

cm-rcopp (CTN320-350)

It reset the torque of the selected axis. This function must be used to synchronize the digital
potentiometer. Give the comand just once.

Belonging class: Axes control library


Call mode: C, =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-copp

88 Doc. MS229601 - Ed.02 – 18/07/96


CORRECTION

cm-veloc (CTN320-350)

It disables the digital output used to switch from speed to torque control.

Belonging class: Axes control library


Call mode: C, =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: cm-coppia

R.Cerr

It returns the Cerr variable value of the selected axis in ACC1. The variable Cerr indicates the error
code when the axis is in mode 12 (= axis in overflow) according to the following custom:

Bit 0 = Regulation overflow


Bit 1 = Maximun double error
Bit 2 = BTB (Only for CTN320-350-560)
Bit 3 = I2T (Only for CTN320-350)

Belonging class: Axes control library


Call mode: C, =C
Modify RLC: NO
Required Parameters ACC1: Ineffective
ACC2: Ineffective
Restored Parameters ACC1: Cerr value
ACC2: Unchanged
See also: W.Cerr

W.N.FC (CTN320-350)

It sets the N.FC variable of the selected axis with the value contained in ACC!. The Value –1
disables teh test on the positive extraswitch. Every other value enables it.

Belonging class: Axes control library


Call mode: C, =C
Modify RLC: NO
Required Parameters ACC1: N.FC value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: W.N.IC, cm-?pstop, cm-?nstop

Doc. MS229601 - Ed.02 – 18/07/96 89


331 SOFTWARE axes controller in AWL

W.N.IC (CTN320-350)

It sets the N.FC variable of the selected axis with the value contained in ACC!. The Value –1
disables teh test on the negative extraswitch. Every other value enables it.

Belonging class: Axes control library


Call mode: C, =C
Modify RLC: NO
Required Parameters ACC1: N.IC value
ACC2: Ineffective
Restored Parameters ACC1: Unchanged
ACC2: Unchanged
See also: W.N.FC, cm-?pstop, cm-?nstop

90 Doc. MS229601 - Ed.02 – 18/07/96

You might also like