Tecnosoft TML Manual
Tecnosoft TML Manual
TML
Programming
User Manual
Preliminary
© Technosoft 2006
TECHNOSOFT
MotionChip™ II
TML Programming
P091.055.MCII.TML.UM.0806
Technosoft S.A.
Buchaux 38
CH-2022 BEVAIX
Switzerland
Tel.: +41 (0) 32 732 5500
Fax: +41 (0) 32 732 5504
[email protected]
www.technosoftmotion.com/
Read This First
Whilst Technosoft believes that the information and guidance given in this manual is correct, all
parties must rely upon their own skill and judgment when making use of it. Technosoft does not
assume any liability to anyone for any loss or damage caused by any error or omission in the
work, whether such error or omission is the result of negligence or any other cause. Any and all
such liability is disclaimed.
All rights reserved. No part or parts of this document may be reproduced or transmitted in any
form or by any means, electrical or mechanical including photocopying, recording or by any
information-retrieval system without permission in writing from Technosoft S.A.
Notational Conventions
This document uses the following conventions:
• TML – Technosoft Motion Language
• Program examples are shown with a special font. Here is an example:
ENIO#36; //Configure dual function pin as I/O line 36
user_1 = IN#36; //Read I/O line 36 data into variable user_1
Trademarks
MotionChip is a trademark of Technosoft SA.
2. TML description................................................................................................................. 19
Motion programming and control................................................................................................ 19
2.1.1. Position Profile Modes .................................................................................................. 20
2.1.2. Speed Profile Modes..................................................................................................... 25
2.1.3. Position/Speed/Torque/Voltage Contouring Modes ..................................................... 26
2.1.4. External Position/Speed/Torque/Voltage Modes .......................................................... 30
2.1.5. Position/Speed Pulse & Direction Modes ..................................................................... 33
2.1.6. Electronic Gearing Modes............................................................................................. 35
2.1.7. Electronic Camming Modes .......................................................................................... 40
2.1.8. Motor Commands. Stop Modes .................................................................................... 46
2.1.9. Torque/Voltage Test Modes.......................................................................................... 50
2.1.10. Motion Mode Changing............................................................................................... 51
Program flow control................................................................................................................... 53
2.1.11. Events ......................................................................................................................... 53
2.1.12. GOTO, CALL............................................................................................................... 59
2.1.13. Interrupts ..................................................................................................................... 60
I/O Programming ........................................................................................................................ 63
2.1.14. General I/O.................................................................................................................. 63
2.1.15. Captures...................................................................................................................... 64
2.1.16. Limit switches.............................................................................................................. 65
Operation Code
Data (1)
…
Data (4)
Operation Code Structure
Operation Category Operand ID
15 ……………………9 8 ……………………….. 0
7FFFh A00h
Data memory space
Internal SRAM memory
Internal SRAM memory
FFFh
8000h
8200h
FFFFh
FFFFh
7FFFh A00h
Data memory space
8200h
87FFh
LOG_START_ADDR + 4 + NO_16B_VARS
LOG_START_ADDR+4 ADDR1 1st 16-bit location address which it will be acquired
LOG_START_ADDR+5 ADDR2 2nd 16-bit location address which it will be acquired
LOG_START_ADDR+6 ADDR3 3rd 16-bit location address which it will be acquired
… … …
LOG_START_ADDR+3+ ADDRn Last 16-bit location address which it will be acquired
NO_16B_VARS
LOG_START_ADDR+4+ END_LIST End of address list = 0 value
NO_16B_VARS
LOG_START_ADDR+5+ 1st 16-bit data acquired - first point
NO_16B_VARS
LOG_START_ADDR+6+ 2nd 16-bit data acquired - first point
NO_16B_VARS
Data Buffer
… …
LOG_START_ADDR+6+ 1st 16-bit data acquired - second point
2 * NO_16B_VARS
LOG_START_ADDR+7+ 2nd 16-bit data acquired - second point
2 * NO_16B_VARS
… …
Example for the acquisition of APOS and ATIME variables in speed/position loop period. The
acquisition buffer starts at the address 0x0A00.
samplings
0A03: 0A09 FREE_LOC The address of next free buffer location
0A04: 0228 ADDR1 The address of APOS variable (32-bits) - low part
0A05: 0229 ADDR2 The address of APOS variable (32-bits) - high part
0A06: 02C0 ADDR3 The address of ATIME variable (32-bits) - low part
0A07: 02C1 ADDR4 The address of ATIME variable (32-bits) - high part
0A08: 0000 END_LIST End of address list = 0 value
0A09: xxxx Acquired value – APOS(L) – first point
Buffer
Data
When the acquisition is done in speed/ position control loop the acquisition period is:
Acquisition period [s] = SLPER [bits] * <Sampling multiplier> [bits] * <PWM period>[s]
When the acquisition is done in current control loop the acquisition period is:
Acquisition period [s] = CLPER [bits] * <Sampling multiplier> [bits] * <PWM period>[s]
Example:
• SLPER = 20
• <Sampling multiplier> = 4
• <PWM period> = 50 x 10-6 [s]
Acquisition period [s] = 20 x 4 x 50 x 10-6 [s] = 4 x 10-3 [s]
Control Type
Motion Modes
Position Speed Torque Voltage
Position profiles √ – – –
Speed profiles – √ – –
Contouring (point to point with linear interpolation) √ √ √ √
External reference read from the analogue input √ SL √ SL
REFERENCE or set by an external device via a √ √
communication channel √ FL √ SL
Pulse and direction √ √ – –
Electronic Gearing/Camming – master √ √ – –
Electronic Gearing – slave √ – – –
Electronic Camming – slave √ – – –
Stop – √ √ √
Test (limited ramp) – – √ FL √ FL
Target
position position
time
Slew speed
speed
time
acc
acceleration
time
dec
Once programmed, the motion profile parameters are memorized. If you intend to use the same
values as previously defined for the acceleration rate, the slew speed, the position increment or
position to reach you don’t need to set these again, each time you program a new position profile.
Depending on the control structure used, four position profile modes are possible:
1
See par. 2.8 for details about the MCII internal units and their correspondence with the
International Standard (IS) units
172
CSPD = 8
CACC = 2
UPD
CPOS = 172
CSPD = 4
CACC = 1
UPD
There is no restriction for the commanded position. If during motion, a new position command is
issued that requires reversing the motor, the reference generator does automatically the following
operations:
• stops the motor with the programmed deceleration rate
Figure 2.3 shows the target speed generated by TML for the above example. During the
deceleration phase, the target speed:
• decelerates from 18 to 6 in 3 steps (target position advances by 36 counts)
• is kept constant for 1 step (target position advances by 6 counts)
• decelerates from 6 to 2 in one step (target position advances by 4 counts)
• decelerates from 2 to 0 in the last step (target position advances by 1 count)
Hence the deceleration space is 47 counts, which, added to 49 counts for acceleration phase and
to the 162 counts for constant speed, gives exactly the 258-count commanded position.
Programming Example
CACC = 1.5; // command acceleration = 1.5
// encoder counts/sampling2
CSPD = 20.; // command speed = 20 counts/sampling
CPOS = 20000; // command position = 20000 counts
CPA; // command position is absolute
MODE PP3; // set position profile mode 3
TUM1; // keep the position and speed reference
UPD; // update - start the motion
!MC; // set event on motion complete
WAIT!; // wait for the event to occur
Remarks:
• Once a position profile is started, you can find when the motion is completed, by setting
an event on motion complete and waiting until this event occurs (see for details par. 2.2)
• The TML instruction TUM1 must always be executed AFTER setting the motion mode and
BEFORE executing the UPD command. When a motion mode command is executed it
includes the TUM0 command. However, as the new motion mode becomes active only
after the UPD command, if TUM1 command is set, it overwrites TUM0 set together with the
motion mode
time
acc
acceleration
time
Depending on the control structure used, two speed profile modes are possible:
Table 2.4. Speed Profile - Motion Modes
24
20
16
12
0
0 2 4 6 8 10 12 14
Example:
A position contouring segment starts at position 0 and reaches position 2000 encoder counts in 1
second. Considering a slow-loop sampling period 1ms, the contouring segment data are:
Time = 1000 (1000 x 1ms = 1s)
Reference increment per sampling = 2 (1000 x 2 = 2000)
In position or speed contouring, the starting point is either the current value of the target
position/speed (if TUM1 command is set between the motion mode setting and the UPD
command), or the actual value of the motor position/speed (if TUM1 is omitted)
In torque/voltage contouring, the starting value is set by the user in the high part of the TML
parameter EREF i.e. in EREF(H). After reset, the default value of EREF(H) is zero.
Controlled Loops
Category Motion Modes
Position Speed Torque
PC3 √ √ √
PC2 √ √ –
Position Contouring
PC1 √ – √
PC0 √ – –
SC1 – √ √
Speed Contouring
SC0 – √ –
Torque Contouring TC – – √
Voltage Contouring VC – – –
Remarks:
• The selection of one of the above position contouring modes or speed contouring modes
must match with the setup data like in the case of position and speed profiles (see par.
2.1.1 and 2.1.2 for details)
• As in most applications the current/torque control is needed, the IPM Motion Studio does
not cover the setup options where current loop is not closed. Therefore, using IPM Motion
Studio, you can choose for position contouring only 2 options: position loop with speed
loop and current loop (MODE PC3) and position loop without speed loop and with current
loop (MODE PC1), and for speed contouring only the option with both speed and current
loop closed (MODE SP1)
Related TML Parameters
REF0(H) Starting value (int) – torque/voltage contouring in torque/voltage units
Time Value or variable (uint) – segment time interval in time units
Controlled Loops
Category Motion Modes
Position Speed Torque
PE3 √ √ √
PE2 √ √ –
Position External
PE1 √ – √
PE0 √ – –
SE1 – √ √
Speed External
SE0 – √ –
Torque External Slow TES – – √
Torque External Fast TEF – – √
Voltage External Slow VES – – –
Voltage External Fast VEF – – –
Remarks:
• The selection of one of the above position external modes or speed external modes must
match with the setup data like in the case of position and speed profiles (see par. 2.1.1
and 2.1.2 for details)
• As in most applications the current/torque control is needed, the IPM Motion Studio does
not cover the setup options where current loop is not closed. Therefore, using IPM Motion
Studio, you can choose for position external only 2 options: position loop with speed loop
and current loop (MODE PE3) and position loop without speed loop and with current loop
(MODE PE1), and for speed external only the option with both speed and current loop
closed (MODE SE1)
Related TML Parameters
EREF = 2000; // External position mode. Reference is set to 2000 position units
EREF = 1.5; // External speed mode. Reference is set to 1.5 speed units
EREF(H) = 5000; // External torque mode. Reference is set to 5000 current units
CADIN, SFTDIN, AD5OFF 16-bit TML parameters needed only for the external modes with
analogue reference. Are used to define the desired range for the position,
speed, current or voltage command that corresponds to the analogue input
range. For details regarding how to set these parameters see MotionChip
II Configuration Setup user manual
Related TML Variables
AD5 16-bit unsigned integer value representing the value read from the
analogue input REFERENCE. The output of the 10-bit A/D converter is set
in the 10 MSB (most significant bits) of the AD5
TPOS Target position (long) – position reference updated at each slow loop
(position/speed loop) sampling period, when position external mode is
performed. TPOS is set function of the analogue input value or with the
EREF value. Measured in position units
TSPD Target speed (fixed) – speed reference updated at each slow loop
sampling period when position or speed external mode is performed. TSPD
is set function of the analogue input value or with the EREF value during
external speed mode and is computed from TPOS in external position
mode. Measured in speed units
TACC Target acceleration (fixed) – acceleration or deceleration reference
computed by the reference generator at each slow loop sampling period
from the position or speed external references. Measured in acceleration
units
IQREF Current reference – updated at each fast or slow loop function of the
analogue input value or set with EREF value, when torque external mode is
performed. Measured in current units
Programming Example
EXTREF 1; // external reference read from analog input
MODE SE1; // set speed external mode 1
UPD; // update – activate new mode
Remarks:
TML instruction EXTREF 2 sets a third way of providing an external reference: using
nd
incremental encoder signals connected to the MotionChip II 2 encoder inputs. This
external mode is used only for electronic gearing and camming modes and will be
presented later on
TML instructions EXTREF 0, 1 or 2 are exclusive. After power on, EXTREF 0 is set by
default. After an EXTREF 1 command, EXTREF 0 is disabled and all the external
reference modes are read from the analogue input
• Position pulse & direction modes, where the motor is controlled in position.
• Speed pulse & direction modes, where the motor is controlled in speed.
Table 2.7 presents the possible pulse & direction modes.
Controlled Loops
Category Motion Modes
Position Speed Torque
PPD3 √ √ √
Position Pulse & PPD2 √ √ –
Direction PPD1 √ – √
PPD0 √ – –
Speed Pulse & SPD1 – √ √
Direction SPD0 – √ –
Remarks:
• The selection of one of the above position pulse & direction modes or speed pulse &
direction modes must match with the setup data like in the case of position and speed
profiles (see par. 2.1.1 and 2.1.2 for details)
• As in most applications the current/torque control is needed, the IPM Motion Studio does
not cover the setup options where current loop is not closed. Therefore, using IPM Motion
Studio, you can choose for position pulse & direction only 2 options: position loop with
speed loop and current loop (MODE PPD3) and position loop without speed loop and with
current loop (MODE PPD1), and for speed pulse & direction only the option with both
speed and current loop closed (MODE SPD1)
Related TML Variables
TPOS Target position (long) – position reference computed by the reference
generator at each slow loop (position/speed loop) sampling period when
position or speed pulse & direction modes are performed. Measured in
position units
TSPD Target speed (fixed) – speed reference computed by the reference
generator at each slow loop sampling period when position or speed pulse
& direction modes are performed. Measured in speed units
TACC Target acceleration (fixed) – acceleration/deceleration reference computed
by the reference generator at each slow loop sampling period when
position or speed pulse & direction modes are performed. Measured in
acceleration units
Programming Example
MODE PPD3; // set pulse & dir mode 3
UPD; // update – activate new mode. Motion starts
// when external device provides pulses
2) Enable master position calculation from 2nd encoder inputs, if the master position is provided
via its encoder signals.
This operation is done with TML instruction EXTREF 2. The initial value of the master position is
set by default to 0. It may be changed to a different value by writing the desired value in data
memory at location 0x81C. This operation can be performed by the following TML code:
3) Set master resolution e.g. the number of encoder counts per one revolution of the master
motor. The slaves need the master resolution to compute correctly the master position and speed
(i.e. position increment). This operation can be performed by the following TML code:
user_var = 0x81A; // set user variable user_var with 0x81A - the address of the
master
// resolution parameter
user_var),dm = resolution_value; // write resolution_value in data memory (dm) at
// address pointed by user_var i.e. in the master resolution
Remark: The master resolution is a 32-bit long integer value. If master position is not cyclic (i.e.
the resolution is equal with the whole 32-bit range of position), set master resolution to
0x80000001. When this value is used, no modulo operation is performed on the position counted
nd
from the 2 encoder inputs.
4) Enable synchronization with the master if the master position is provided via communication.
When the synchronization is enabled, the slave performs a slight adjustment of the moments
when the speed/position loop control is performed to synchronize them with the moments when
the master sends its position. This allows the slaves to always have a new master position before
starting to use it. In order to:
Enable the synchronization with the master, set TML variable EFLEVEL = 0;
Disable the synchronization with the master, set TML variable EFLEVEL = 0xFFFF;
Remark: The synchronization must be enabled only after the master starts sending its position
and must be disabled before or immediately after the master stops sending its position. Do not
leave a slave with the synchronization enabled while the master is disabled. During this period the
motor control performance is slightly degraded
5) Enable operation in one of the electronic gearing slave modes. Depending on the control
structure, the following four motion modes are possible for the slaves.
Table 2.8. Electronic Gearing Slave - Motion Modes
Programming Example
// On slave axis (Axis ID = 1):
GEAR = 0.66667; // set gear ratio value
GEARMASTER = 3; // set gear ration denominator
GEARSLAVE = 2; // set gear ratio numarator
EXTREF 0; //receive master position via a
//communication channel
EIR = 0x081A; // set EIR variable with address of MASTERRES
(EIR),dm = 2000L; // set MASTERRES = 2000
MODE GS3; //set gear slave mode 3
TUM1; // keep the position and speed reference (optional)
UPD; // update – activate gear slave mode. Slave starts
// following the master position
// On master axis:
SLAVEID 1; // slave axis has Axis ID = 1
SGM; // set electronic gearing master mode
SRB OSR,0xFFFF,0x8000; // send target position
[1]MPOS0 = TPOS; // set master target position on slave axis
UPD; // update – activate new mode. Master starts
// sending its position
Once define, a cam table must be downloaded into the EEPROM memory of the drive. Before
enabling an electronic camming slave mode, the cam table must be copied from the EEPROM
into the SRAM program memory. This operation can be done using the TML command:
INITCAM LoadAddress, RunAddress
where LoadAddress is the EEPROM memory address where the cam table was loaded and
RunAddress is the SRAM program memory address where to copy the cam table. After the
execution of this command the TML variable CAMSTART takes the value of the RunAddress.
Remarks:
• When electronic camming slave mode is performed, only the cam table from the SRAM
program memory is used to compute the slave position
• It is possible to download in the EEPROM memory several cam tables. You can use
INITCAM command to copy one or all of them into the SRAM program memory. In the
last case, in order to switch between several cam tables all you need to do is to change
the value of the TML parameter CAMSTART which points to the beginning of the cam
table to be used when electronic camming slave mode is activated
• LoadAddress and RunAddress values be expressed as decimal values
2) Enable master position calculation from 2nd encoder inputs, if the master position is provided
via its encoder signals.
This operation is done with TML instruction EXTREF 2. The initial value of the master position is
set by default to 0. It may be changed to a different value by writing the desired value in data
memory at location 0x81C.
This operation can be performed by the following TML code:
user_var = 0x81C; // set user variable user_var with 0x81C - the address of the
master
nd
// position computed from 2 encoder inputs
user_var),dm = initial_value; // write initial_value in data memory (dm) at
// address pointed by user_var i.e. in the master position
3) Set master resolution e.g. the number of encoder counts per one revolution of the master
motor. The slaves need the master resolution to compute correctly the master position and
speed (i.e. position increment). This operation can be performed by the following TML code:
user_var = 0x81A; // set user variable user_var with 0x81A - the address of the
master
// resolution parameter
user_var),dm = resolution_value; // write resolution_value in data memory (dm) at
// address pointed by user_var i.e. in the master resolution
Remark: The master resolution is a 32-bit long integer value. If master position is not cyclic (i.e.
the resolution is equal with the whole 32-bit range of position), set master resolution to
0x80000001. When this value is used, no modulo operation is performed on the position counted
from the 2nd encoder inputs.
4) Enable synchronization with the master if the master position is provided via communication.
When the synchronization is enabled, the slave performs a slight adjustment of the moments
when the speed/position loop control is performed to synchronize them with the moments
when the master sends its position. This allows the slaves to always have a new master
position before starting to use it. In order to:
Enable the synchronization with the master, set TML variable EFLEVEL = 0;
Disable the synchronization with the master, set TML variable EFLEVEL = 0xFFFF;
Remark: The synchronization must be enabled only after the master starts sending its position
and must be disabled before or immediately after the master stops sending its position. Do not
leave a slave with the synchronization enabled while the master is disabled. During this period the
motor control performance is slightly degraded
5) Enable operation in one of the electronic camming slave modes. Depending on the control
structure, the following four motion modes are possible for the slaves.
Table 2.9. Electronic Cam Slave - Motion Modes
Select STOP3 to stop the motor smoothly, with a deceleration rat set in TML parameter CACC.
When this command is executed, the drive is automatically set in speed profile mode (MODE SP1)
with jog speed command = 0. When the speed reference arrives at zero, the motion complete
condition is set
Select STOP2 to stop very abruptly the motor. When this command is executed, the drive is
automatically set in speed external mode (MODE SE1) with on-line speed reference set to 0.
Remark: STOP3 or STOP2 modes may not work correctly if in the setup data you have set your
drive for position control without closing the speed loop. In this case, you’ll close the speed loop
using a speed controller whose parameters have not been properly set.
Select STOP1 to stop the motor when the drive performs torque control. When this command is
executed, the drive is set in torque external mode (MODE TES) with on-line current reference set
to 0.
Select STOP0 to stop the motor when the drive performs voltage control. When this command is
executed, the drive is set in voltage external mode (MODE VES) with on-line voltage reference set
to 0. STOP0 is foreseen only for test purposes. During normal operation, the drive performs at
least torque control. Voltage control may occur only during setup tests or if you have specifically
set the drive in voltage contouring, voltage external or voltage test modes.
Remarks:
• In order to restart after a STOPx (x = 0,1,2,3) command, the motion mode has to be set
again, even if it is not changed. Setting a motion mode disables the stop mode and allows
the motor to move
• STOPx (x = 0,1,2,3) commands always set TUM0 mode to perform an update of the
target/reference position and speed with the actual motor position and speed
• When a host sends via a communication channel a STOPx command, this stops the
execution of any TML program from the local memory, in order to avoid the risk of
overwriting the STOPx command from the TML program
• Use with caution STOP2, STOP1 and STOP0 commands. These cause abrupt stops that
may generate an important energy towards the supply. If the power supply can’t absorb
Programming Example
CACC = 1.5; // command acceleration = 1.5
// encoder counts/sampling2
CSPD = 20.; // command speed = 20 counts/sampling
CPOS = 20000; // command position = 2000 counts
CPR; // command position is relative
MODE PP3; // set position profile mode 3
TUM1; // keep the position and speed reference
UPD; // update - start the motion
...
STOP3; // stop smoothly with CACC = 1.5
!MC; // set event on motion complete
WAIT!; // wait for the event to occur
SAP 0; // STOP3 disables TUM1. Hence APOS = 0 and
// TPOS = APOS + POSERR
...
MODE PP3; // set again the position profile mode 3
UPD; // update – restart motion after a STOP command
Remark: The Motion test is a special test mode to be used only in some special cases for drives
setup. The Motion Test mode is not supposed to be used during normal operation
Related Parameters
REFTST maximum value of the test reference in torque or voltage units (int)
RINCTST reference increment at each slow-loop sampling period (int)
THTST initial value for the electrical angle in electrical angle units (int)
TINCTST electrical angle increment at each fast-loop sampling period (int)
Related Instructions
MODE TT Set torque test mode
MODE VT Set voltage test mode
UPD Update motion mode and parameters. Start motion
2.2.1 Events
You can define an event (a condition) to be monitored and to perform one of the following actions:
• Change the motion mode and/or the motion parameters, when the programmed event occurs
• Stop the motion with one of the 4 possible stop modes, when the programmed event occurs
• Wait for the program event to occur
Remark: Only a single event can be monitored at a time. The programmed event is automatically
erased if the event is reached or if a new event is programmed.
There are 18 events, which can be programmed, one at a time, for monitoring. Table 2.11
presents them.
Table 2.11. Programmable Event Triggers
Remarks:
• After you have programmed a new motion mode and/or new motion parameters with an
update on event or a stop on event, it is recommended to introduce a wait until the
programmed event occurs. Otherwise, the TML program will continue with the next
instructions that may override the event set for monitoring.
• If the TML command WAIT! is executed and the programmed event doesn’t occur, the
TML program will remain in a loop. In order to get it out of the loop, you can send via a
communication channel a GOTO command to a preset location, which will move the
program execution outside the wait loop
• The TML command WAIT! is a sequential command. This means that the WAIT!
command must be executed only as part of a TML program and not as a command sent
on-line via a communication channel. If a host sends a WAIT! command on-line, the wait
condition is disregarded
Programming Examples:
1) !IN#4 0 // set event when input IO#4 goes low
CPOS=2000; // command position is 2000
CPR; // command position is relative
MODE PP3 // set position profile mode 3
UPD!; // when the event will occur, execute the move
WAIT!; // wait the event to occur
The monitored event is when TML variable TREF is equal or over/under with a 32-bit value or the
value of a 32-bit variable.
The TML variable TREF represents:
• The position reference, when position control is performed
• The speed reference, when speed control is performed
• The current/torque reference, when torque control is performed
• The voltage reference, when voltage control is performed
Depending on the reference type selection, the comparison value is a:
• 32-bit long integer value for position reference, expressed in position units
• 32-bit fixed value for speed reference, expressed in speed units
• 32-bit long integer value where the current reference is in the 16MSB part and the 16LSB
part is 0, where the 16MSB value is expressed in current units
• 32-bit long integer value where the voltage reference is in the 16MSB part and the 16LSB
part is 0, where the 16 MSB value is expressed in voltage command units
Remarks:
• Setting an event based on the position or speed reference is particularly useful for open
loop operation where motor position and speed is not available
• It is the user responsibility to know in which mode the drive operates when this event is
set and to set the comparison value accordingly.
Remark: The main task of the limit switches is to protect against accidental moves outside the
working area, by blocking moves in the wrong direction. For their main task, the limit switches are
active on level, i.e. as long as a limit switch is activated, it will stop any move in the wrong
2.2.3 Interrupts
The TML interrupts offer the possibility of selecting up to 12 interrupt conditions that can be
monitored in the same time. Unlike the events, where the programmed event is expected to occur
and is waited for, the TML interrupts’ main goal is to provide a way of reacting to unexpected
events as are most of the conditions in Table 2.12
The TML interrupt mechanism is the following:
• Conditions that may generate TML interrupts are continuously monitored
• When an interrupt condition occurs, a flag (bit) is set in the Interrupt status register (ISR)
• If the interrupt condition is enabled i.e. the same bit (as position) is set in the Interrupt
control register (ICR) and also if the interrupts are globally enabled (EINT instruction was
executed), the interrupt condition is qualified and it generates an interrupt
• The interrupt causes a jump to the associated interrupt service routine. On entry in this
routine, the TML interrupts are globally disabled (DINT) and the interrupt flag is reset
• The interrupt service routine ends with the TML instruction RETI, which returns to normal
program execution and in the same time globally enables the TML interrupts (EINT)
The interrupt service routines (ISR) of the TML interrupts are similar with the TML subroutines:
the starting point is a label and the ending point is the TML instruction RETI (return from
interrupt). The use of the TML interrupts requires defining an interrupt table. This starts with a
2.3.2 Captures
The MotionChip II has two capture inputs: IN#5/Z1/CAPI and IN#34/H2/Z2/2CAPI. These can be
programmed to sense either a low to high or high to low transition. Typically, on the IN#5/Z1/CAPI
input is connected the motor encoder index and on the IN#34/H2/Z2/2CAPI input is connected the
master encoder index (when available)
When the programmed transition occurs on IN#5/Z1/CAPI input, the actual (motor) position is
captured and stored in a dedicated variable named CAPPOS. When the programmed transition
occurs on IN#34/H2/Z2/2CAPI input, the master position APOS2 is captured and stored in a
dedicated variable named CAPPOS2.
When the position sensor is an incremental encoder, the captured position is very accurate as the
whole process is done in less than 200 ns.
The master position can be captured only in the following conditions:
• The encoder signals from the master are connected to the 2nd encoder inputs
• The drive is set as slave either in electronic gearing or electronic camming with the option
to read the master position from 2nd encoder inputs
You can set either an event or a TML interrupt on a capture input. In both cases you need to:
In order to set an event or a TML interrupt on a limit switch input, you need to:
Remarks:
• The main task of the limit switches i.e. to protect against accidental moves outside the
working area is performed, independently of the fact if the limit switches are enabled or
not to detect transitions
• You can disable the limit switches by executing the following TML code, once at the
beginning of the TML program:
user_var = 0x0832; // Set variable user_var with value 0x0832
(user_var),dm = 1; // Write 1 at data memory address 0x0832
Following this command, the active levels on limit switch inputs will no longer block the
movement in the wrong direction. The capability to detect transitions remains unchanged
• You can read the status of the limit switches inputs like any other general purpose inputs
using the TML instructions:
var = IN#2; // read status of the positive limit switch input
var = IN#24; // read status of the negative limit switch input
Programming Examples
1) Source: 16-bit immediate value, Destination: 16-bit TML data. The immediate value can be
decimal or hexadecimal
user_var = 100; // set user variable user_var with value 100
user_var = 0x100; // set user variable user_var with value 0x100 (256)
2) Source: 16-bit TML data, Destination: 16-bit TML data.
var_dest = var_source; // copy value of var_source in var_dest
var_dest = -var_source;// copy negate value of var_source in var_dest
3) Source: high or low part of a 32-bit TML data, Destination: 16-bit TML data. The 32-bit TML
data can be either long or fixed
int_var = long_var(L); // copy low part of long_var in int_var
int_var = fixed_var(H); // copy high part of fixed_var in int_var
4) Source: a memory location indicated through a pointer variable, Destination: 16-bit TML data.
The memory location can be of 3 types: SRAM data memory (dm), SRAM memory for TML
programs (pm), EEPROM SPI-connected memory for TML programs (spi). If the pointer variable
is followed by a + sign, after the assignment, the pointer variable is incremented by 1
p_var = 0x4500; // set 0x4500 in pointer variable p_var
var1 = (p_var),spi; // var1 = value of the EEPROM memory location 0x4500
var1 = (p_var+),spi; // var1 = value of the EEPROM memory location 0x4500
// p_var = 0x4501
p_var = 0x8200; // set 0x8200 in pointer variable p_var
var1 = (p_var),pm; // var1 = value of the SRAM program memory location 0x8200
var1 = (p_var+),pm; // var1 = value of the SRAM program memory location 0x8200
// p_var = 0x8201
p_var = 0xA00; // set 0xA00 in pointer variable p_var
Programming Examples
1) Source: 32-bit immediate value, Destination: 32-bit TML data. The immediate value can be
decimal or hexadecimal. The destination can be either a long or a fixed variable
long_var = 100000; // set user variable long_var with value 100000
long_var = 0x100000; // set user variable long_var with value 0x100000
fixed_var = 1.5; // set user variable fixed_var with value 1.5 (0x18000)
fixed_var = 0x14000; // set user variable fixed_var with value 1.25 (0x14000)
2) Source: 32-bit TML data, Destination: 32-bit TML data.
var_dest = var_source; // copy value of var_source in var_dest
var_dest = -var_source;// copy negate value of var_source in var_dest
Remark: source and destination must be of the same type i.e. both long or both fixed
3) Source: 16-bit immediate value (decimal or hexadecimal) or 16-bit TML data, Destination: high
or low part of a 32-bit TML data. The 32-bit TML data can be either long or fixed
long_var(L) = -1; // write value –1 (0xFFFF) into low part of long_var
fixed_var(H) = 0x2000; // write value 0x2000 into high part of fixed_var
long_var(L) = int_var; // copy int_var into low part of long_var
fixed_var(H) = int_var; // copy int_var into high part of fixed_var
4) Source: 16-bit TML data left shifted 0 to 16. Destination: 32-bit TML data. The 32-bit TML data
can be either long or fixed
long_var = int_var << 0; // copy int_var left shifted by 0 into long_var
fixed_var(H) = int_var << 16;// copy int_var left shifted by 16 fixed_var
Remarks:
• The left shift operation is done with sign extension. If you intend to copy the value of an
integer TML data into a long TML data preserving the sign use this operation with left shift 0
• If you intend to copy the value of a 16-bit unsigned data into a 32-bit long variable, assign the
16-bit data in low part of the long variable and set the high part with zero.
Examples:
var = 0xFFFF; // As integer, var = 1, as unsigned integer var = 65535
lvar = var << 0; // lvar = -1 (0xFFFFFFFF), the 16MSB of lvar are all set to 1 the
5) Source: a memory location indicated through a pointer variable, Destination: 32-bit TML data.
The memory location can be of 3 types: SRAM data memory (dm), SRAM memory for TML
programs (pm), EEPROM SPI-connected memory for TML programs (spi). If the pointer variable
is followed by a + sign, after the assignment, the pointer variable is incremented by 2. The
destination can be either a long or a fixed TML data
p_var = 0x4500; // set 0x4500 in pointer variable p_var
var1 = (p_var),spi; // var1 = value of the EEPROM memory location 0x4500
var1 = (p_var+),spi; // var1 = value of the EEPROM memory location 0x4500
// p_var = 0x4502
p_var = 0x8200; // set 0x8200 in pointer variable p_var
var1 = (p_var),pm; // var1 = value of the SRAM program memory location 0x8200
var1 = (p_var+),pm; // var1 = value of the SRAM program memory location 0x8200
// p_var = 0x8202
p_var = 0xA00; // set 0xA00 in pointer variable p_var
var1 = (p_var),dm; // var1 = value of the SRAM data memory location 0xA00
var1 = (p_var+),dm; // var1 = value of the SRAM data memory location 0xA00
// p_var = 0xA02
Remark: Check the memory map (par. 1.8) for the valid address ranges of the 3 memory types:
EEPROM memory for TML programs, SRAM memory for TML programs, SRAM data memory.
6) Source: 32-bit immediate value (decimal or hexadecimal) or a 32-bit TML data. Destination: a
memory location indicated through a pointer variable. The memory location can be of 3 types:
SRAM data memory (dm), SRAM memory for TML programs (pm), EEPROM SPI-connected
memory for TML programs (spi). If the pointer variable is followed by a + sign, after the
assignment, the pointer variable is incremented by 2
p_var = 0x4500; // set 0x4500 in pointer variable p_var
(p_var),spi = 200000; // write 200000 in the EEPROM memory location 0x4500
(p_var+),spi = var1; // write var1 value in the EEPROM memory location 0x4500
// p_var = 0x4502
p_var = 0x8200; // set 0x8200 in pointer variable p_var
(p_var),pm = 3.5; // write value 3.5 in SRAM program memory location 0x8200
(p_var+),pm = var1; // write var1 value in SRAM program memory location 0x8200
// p_var = 0x8202
p_var = 0xA00; // set 0xA00 in pointer variable p_var
(p_var),dm = -1L; // write –1 (0xFFFFFFFF) in the SRAM data memory 0xA00
(p_var+),dm = var1; // write var1 value in the SRAM data memory location 0xA00
// p_var = 0xA02
When this operation is performed having as source an immediate value, the TML compiler checks
the type and the dimension of the immediate value and based on this generates the binary code
for a 16-bit or a 32-bit data transfer. Therefore if the immediate value has a decimal point, it is
Multiplication: The 2 operands are multiplied and the result is saved in a dedicated 48-bit
register named PROD. The result of the multiplication can be left or right-shifted with 0 to 15 bits,
before being stored in the PROD register. At right shifts, high order bits are sign-extended and the
low order bits are lost. At left shifts, high order bits are lost and the low order bits are zeroed. The
result is preserved in the PROD register until the next multiplication.
The first (left) operand can be:
• A 16-bit TML data: TML parameter, variable or user variable
• A 32-bit TML data: TML parameter, variable or user variable
The second (right) operand can be:
• A 16-bit immediate value
• A 16-bit TML data: TML parameter, variable or user variable
Programming Examples
long_var * -200 << 0; // PROD = long_var * (-200)
fixed_var * 10 << 5; // PROD = fixed_var * 10 * 25 i.e. fixed_var *320
int_var1 * int_var2 >> 1; // PROD = (int_var1 * int_var2) / 2
long_var * int_var >> 2; // PROD = (long_var * int_var) / 4
long_var = PROD; // save 32LSB of PROD in long_var
long_var = PROD(H); // save 32MSB of PROD in long_var i.e. bits 47-15
Left and right shift: The operand is left or right shifted with 0 to 15. The result is saved in the
same operand. At right shifts, high order bits are sign-extended and the low order bits are lost. At
left shifts, high order bits are lost and the low order bits are zeroed.
The right shift is performed with sign-extension.
The operand can be:
• A 16-bit TML data: TML parameter, variable or user variable
• A 32-bit TML data: TML parameter, variable or user variable
• The 48-bit PROD register with the result of the last multiplication
Logic AND and OR: A logic AND is performed between the operand and a 16-bit data (the AND
mask), followed by a logic OR between the result and another 16-bit data (the OR mask).
The operand is a 16-bit TML data: TML register, TML parameter or user variable
The AND and OR masks are 16-bit immediate values, decimal or hexadecimal.
Programming Examples
int_var = 13; // int_var = 13 (0xD)
SRB int_var, 0xFFFE, 0x2; // set int_var bit 0 = 0 and bit 1 = 1
// int_var = 12 (0xC)
The SRB instruction modifies the TML data in specific conditions that avoid the interference with
changes done in parallel by the MotionChip II firmware. This is particularly useful for the TML
registers, which have bits that can be manipulated both at firmware level and at TML level by the
user. A typical example is the interrupt flag register (IFR) where the interrupt flags set and reset
by both the firmware and the user. The SRB instruction allows you to set/reset bits in a “safe” way
without the risk of altering the settings done in parallel by the firmware.
Remark: In the SRB instruction, the address of the operand must be between 0x200 and 0x3FF.
This happens for most of the TML data, including all the user-defined variables, which take
addresses between 0x3B0 to 0x3FF. There are however a limited number of TML parameters
and variables having an extended address situated between 0x800 and 0x9FF. For these TML
data, you should use the SRBL instruction, for setting and resetting bits:
SRBL TMLvar, 0xFFFE, 0x2; // set bit 0 = 0 and bit 1 = 1 in TMLvar with
// extended address
1) Source: local 16-bit TML data, Destination: remote 16-bit TML data.
[2]remote_var = local_var; // set remote_var from axis 2 with local_var value
[G2]remote_var = local_var; // set remote_var from group 2 with local_var value
2) Source: 16-bit TML data, Destination: remote memory location pointed by a remote pointer
variable. The remote memory location can be of 3 types: SRAM data memory (dm), SRAM
memory for TML programs (pm), EEPROM SPI-connected memory for TML programs (spi). If the
pointer variable is followed by a + sign, after the assignment, the pointer variable is incremented
by 1 if the source is a 16-bit integer or by 2 if the source is a 32-bit long or fixed
[2](p_var),spi = local_var; // set local_var value in EEPROM program memory
// location from axis 2, pointed by p_var from axis 2
[G3](p_var+),dm = long_var; // set local long_var value in SRAM data memory
// location from group 3 of axes, each location being
// pointed its own p_var, which is incremented by 2
[4](p_var+),pm = int_var; // set local int_var value in SRAM program memory
// location from axis 4, pointed by p_var from axis 4;
// p_var is incremented by 1
Remark: When the remote destination is a TML data, its address must be between 0x200 and
0x3FF. This happens for most of the TML data, including all the user-defined variables, which
take addresses between 0x3B0 to 0x3FF. There are however a limited number of TML
parameters and variables having an extended address situated between 0x800 and 0x9FF. For
these TML data, you should use either indirect addressing via a pointer variable, or the following
command that supports extended addressing:
[G2]remote_var,dm = local_var; // set remote_var from group 2 with
// local_var value, using extended addressing
Current units
The correspondence with the international standard (SI) units is:
2 Im axPS
Current[ A ] = ⋅ Current[i.u.]
65472
where:
ImaxPS – is the power stage peak current i.e. the maximum measurable current [A]
Typically, a motor phase current is measured through transducers that provide a voltage
proportional with the current value. This is connected to a MotionChip II analogue input. The
currents are both positive and negative, therefore the current transducer output is offset by half in
order to get zero current at half A/D input scale. The power stage peak current is the current
corresponding to half of the maximum value for the analogue input i.e. half of 3.3V. After A/D
conversion 3.3V is 65472.
Voltage command units
The significance of the voltage commands as well as the scaling factors, depend on the motor
technology and the control method used.
For a brushed DC motor the voltage command is the voltage to apply between the motor phases.
For a brushless DC motor (BLDC) i.e. a brushless motor with trapezoidal control (more exactly
with commutation on Hall sensors causing trapezoidal BEMF), the voltage command is the
voltage to apply between 2 of the 3 motor phases. These are the 2 phases that are supplied at
one moment.
For a brushless AC motor (PMSM) i.e. a brushless motor with sinusoidal control (field oriented
vector control generating sinusoidal currents and voltages), the voltage commands are the
amplitude of the sinusoidal phase voltages.
For the brushed DC and brushless DC motors, the correspondence with the international
standard (SI) units is:
Vdc
Voltage command [ V ] = ⋅ Voltage command [i.u.]
32767
where:
Vdc – is the rated DC-link/supply voltage [V]
In MotionChip II, the output voltage of each inverter is leg is set via a command in the range (-
32767, + 32767). The minimum value means that that lower transistor is all the time ON and
upped one is OFF, hence the inverter output voltage is 0. The maximum value means that the
upper transistor is all the time ON and the lower one is OFF, hence the inverter output voltage is
equal with the DC link/supply voltage (minus a slight voltage drop).
where:
Ts_S – is the speed loop sampling period
For example, if Ts_S is 1ms, one second is 1000 in internal time units.
Current increment units
The correspondence with the international standard (SI) units for current increment is:
2ImaxPS
Current Increment[A/s] = ⋅ Current Increment[i.u.]
65472 × Ts_S
where:
ImaxPS – is the power stage maximum current [A]
Ts_S – is the speed loop sampling period [s]
MCII Drive
Rx
SCIRx
PC or Host Gnd RS-232
transceiver SCITx
Tx
Figure 3.1. Serial RS-232 communication between a host and the MotionChip II
1 2 N
MCII Drive
MCII Drive
MCII Drive
IO#17/485TxEn
Host
SCIRx
SCITx
485A (R+=T+)
485B (R-=T-)
MCII Drive
MCII Drive
MCII Drive
Host
CANRx
CANTx
CAN CAN CAN
transceiver transceiver transceiver
CAN LO
CAN HI
1 2 N
MCII Drive
MCII Drive
MCII Drive
Rx
Gnd RS232 SCIRx
PC or Host
Tx transceiver SCITx
CANRX
CANTX
CAN LO
CAN HI
Figure 3.4.Multi-drop network using CAN-bus communication with host connected through RS-232 to an axis
used as communication relay
Apart from the Axis ID, each drive has also a group ID. The group ID represents a way to identify
a group of drives, for a multicast transmission. Each drive can be programmed to be member of
one or several of the 8 possible groups. When a TML command is sent to a group, all the axes
members of this group, will receive the command. For example, if the drive is member of group 1
and group 3, he will receive all the messages that in the group ID include group 1 and group 3.
This feature allows a host to send a command simultaneously to several axes, for example to
start or stop the axes motion in the same time.
The group ID is like the axis ID an 8-bit value. A TML command can be sent to 8 different groups.
Each group is defined as having one of the 8 bits of the group ID value set to 1 (see Table 3.2)
In a serial or CAN message, the axis or group ID is 16-bit word with the following structure:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 G ID7 ID6 ID5 ID4 ID3 ID2 ID1 ID0 0 0 0 H
7 6 5 4 3 2 1 0
Where:
• Bit 0 – HOST bit. In a network configuration the HOST bit indicates the destination axis for
messages received by the relay axis: 0 – relay axis, 1 – host. Messages received by the relay
axis with HOST bit set to 1, will be retransmitted through RS-232 to the host. Messages
received by the relay axis with HOST bit set to 0, will be interpreted as commands for this axis
and will be executed. On RS-485, the host and the drives have different axis ID, the HOST bit
has as no significance and must be set to 0.
• Bits 11-8 – ID7-ID0: the 8-bit value of an axis or group ID
• Bit 12 – GROUP bit: 0 – ID7-ID0 value is an axis ID, 1 – ID7-ID0 value is a group ID
The message length byte contains the total number of bytes of the message minus 2. Put in other
words, the length byte value is the number of bytes of the: axis/group ID (2bytes), the operation
code (2 bytes) and the data words (variable from 0 to 8 bytes). The checksum byte is the sum
modulo 256 of all the bytes of the message except the checksum byte itself.
Message types on serial communication
The serial communication protocol is based on two types of messages:
• Type A: Messages that don’t require an answer (a return message). In this category enter for
example the messages containing commands for parameter settings, commands that start or
stop motion execution, etc.
• Type B: Messages that require an answer. In this category enter the messages containing
commands that ask to return data, for example the value of TML parameters, registers, or
variables.
The type B message has two components:
• A request message sent through the TML command “Give Me Data”.
• An answer message sent through the TML command “Take Data”
The “Give Me Data” request message includes the following information:
“Give Me Data” Message Contents
The host receives from the drive a byte 0x4F as confirmation that the message was received OK.
Remarks:
1. If the host wants to sent the same TML instruction “kpp = 5” to another drive with axis
ID=1, drive connected via CAN-bus with the drive having axis ID=255, the destination ID
becomes 0010h instead of 0FF0h. Hence the modifications are: byte 2: 00h, byte 3: 10h,
checksum byte adjusted accordingly ( 99h ).
2. If the host is connected via RS-485 with a drive, the two devices must have different axis
ID values. For example if the host ID = 255 and the drive ID = 1, the message is the same
as in the previous remark.
Example 2:
A host is connected to a drive via RS-232 and wants to get the value of the kpp parameter from
the drive. The ID of host and drive are 255 = 0FFh.
Let’s suppose that the kpp value returned by the drive is 288 (120h). The host has to send a
“Give Me Data” TML command with the following instruction code:
The host receives from the drive a byte 0x4F as confirmation that the message was received OK.
The serial message received by the host with “Take Data” TML command must have the following
contents:
The chapter describes the complete set of TML instructions, grouped by functionality. In each
group the instructions are ordered alphabetically, mnemonic, syntax and description are given for
each instruction.
TML instructions are divided in groups as follows:
• Motion mode setting group (Table 4.1)
• Event group (Table 4.2)
• Program flow (decision) group (Table 4.3)
• I/O group (Table 4.4)
• Assignment group (Table 4.5)
• Arithmetic and logic group (Table 4.6)
• Configuration and command group (Table 4.7)
• Multiple axis group (Table 4.8)
• Miscellaneous group (Table 4.9).
• On-line group (Table 4.10)
Symbols Description
&Label Address of TML program label
&V16 Address of a 16-bit integer variable
&V32 Address of a 32-bit long or fixed variable
(V16) Memory location at address equal with V16 value
(la) Long addressing. Source/destination operand provided with 16-bit address.
Some TML instructions using 9-bit short addressing are doubled with their long
addressing equivalent
9LSB(&V16) The 9 LSB (less significant bits) of the address of a 16-bit integer
9LSB(&V32) The 9 LSB (less significant bits) of the address of a 32-bit long or fixed
A Axis ID
A/G Axis ID or Group ID
ANDdis 16-bit AND mask. See Table MCRx & AND/OR masks for DISIO#n and
Table MCRx & PxDIR addresses
ANDen 16-bit AND mask. See Table MCRx & AND/OR masks for ENIO#n and
Table MCRx & PxDIR addresses
ANDin 16-bit AND mask. See Table AND/OR masks for SETIO#n IN
ANDm 16-bit user-defined AND mask
ANDout 16-bit AND mask. See Table AND/OR masks for SETIO#n OUT
ANDrst 16-bit AND mask. See Table AND/OR masks for ROUT#n
Syntax
?VAR16 GiveMeData - 16-bit from SRAM data memory
?VAR32 GiveMeData - 32-bit from SRAM data memory
GiveMeData - 16-bit from SRAM program memory
GiveMaData - 32-bit from SRAM program memory
GiveMeData - 16-bit from EEPROM program memory
GiveMeData - 32-bit from EEPROM program memory
TakeData requested with GiveMeData - 16-bit data
TakeData requested with GiveMeData - 32-bit data
Get a 16-bit TML data (address range 200-3FFh)
Get a 32-bit TML data (address range 200-3FFh)
Take the 16-bit TML data requested with Get a 16-bit TML
Take the 32-bit TML data requested with Get a 32-bit TML
Get version
Answer to Get version request
Binary code
Get a 16-bit TML data (the TML data address must be in range 200-3FFh)
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 0 0 0 0 (9LSBs of &VAR16D)
Expeditor AxisID
Get a 32-bit TML data (the TML data address must be in range 200-3FFh)
Take the 16-bit TML data requested with Get 16-bit TML data
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 0 1 0 0 (9LSBs of &VAR16D)
Expeditor AxisID
Data requested
Take the 32-bit TML data requested with Get 32-bit TML data
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 1 0 1 1 0 (9LSBs of &VAR32D)
Expeditor AxisID
Data requested – 16 LSB
Data requested – 16 MSB
Get version
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 1
Expeditor AxisID
Description These instructions allow a host to interrogate a MotionChip II based drive in order to
find the contents of any TML data as well as the value of any memory location from
the TML program space (EEPROM or SRAM) or from the SRAM data space. The
Get version command offers the possibility to check find which is the firmware
version of the drive. The firmware version has the form: FxyzA, where xyz is the
firmware number (3 digits) and A is a letter for the revision
Binary code
!APO value32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 0 1 0 0 1 0 0 1 0
0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0
LOWORD(value32)
HIWORD(value32)
!APO VAR32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 1 1 0 0 1 0 0 1 0
0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0
&VAR32
Description Program the detection of the event when the motor position is greater than the
specified value. An update on event command (UPD!) must be used in these
cases, in order to activate an update operation when the monitored event occurs.
Execution Activate the setting of an event when motor position >= value32 or VAR32,
respectively.
The bits 14 and 11 of the TML motion status register (MSR) are reset.
This operation erases a previous programmed event that has occurred.
Syntax
!APU value32 ! if AbsPositionUnder value32
!APU VAR32 ! if AbsPositionUnder VAR32
Binary code
!APU value32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 0 1 0 0 0 0 0 1 1
0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0
LOWORD(value32)
HIWORD(value32)
!APU VAR32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 1 1 0 0 0 0 0 1 1
0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0
&VAR32
Description Program the detection of the event when the motor position is smaller than the
specified value. An update on event command (UPD!) must be used in these
cases, in order to activate an update operation when the monitored event occurs.
Execution Activate the setting of an event when motor position <= value32 or VAR32,
respectively.
The bits 15 and 14 of the TML motion status register (MSR) are reset.
This operation erases a previous programmed event that has occurred.
Example CACC = 1.5; //Acceleration command for speed profile
//(counts/sampling2)
CSPD = -20; //Speed command (counts/sampling)
MODE SP1; //Set Speed Profile Mode 1
UPD; //Update immediate
CSPD = -40; //New speed command (counts/sampling)
!APU -60000; //Set event when absolute position =< -
60000
//(counts)
UPD!; //Update on event
Syntax
!AT value32 ! if AbsoluteTime >= value32
!AT VAR32 ! if AbsoluteTime >= VAR32
Binary code
!AT value32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 0 1 0 0 1 1 0 0 0
0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0
LOWORD(value32)
HIWORD(value32)
!AT VAR32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 1 1 0 0 1 1 0 0 0
0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0
&VAR32
Description Program the detection of the event when the system absolute time is greater than
the specified value. An update on event command (UPD!) must be used in these
cases, in order to activate an update operation when the monitored event occurs.
Execution Activate the setting of an event when system absolute time >= value32 OR
VAR32, respectively.
The bits 15 and 14 of the TML motion status register (MSR) are reset.
This operation erases a previous programmed event that has occurred.
Syntax
!CAP ! if CAPture triggered
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 0 0 0 0 0 1 1 1 0
Description Program the detection of the event when one of the external captures (from
encoder index – CAPI, or from second encoder – 2CAPI) was detected and
triggered by the DSP. An update on event command (UPD!) must be used in
these cases, in order to activate an update operation, when the monitored event
occurs.
Execution Activate the setting of an event when an external capture was triggered.
The bits 15 and 14 of the TML motion status register (MSR) are reset.
This operation erases a previous programmed event that has occurred.
Example
CACC = 1.5; //Acceleration command for speed profile
//(counts/sampling2)
CSPD = 20; //Speed command (counts/sampling)
MODE SP1; //Set Speed Profile Mode 1
UPD; //Update immediate
ENCAPI0; //Activate CAPI input to trigger a falling
//transitions.
CSPD = 40; //New speed command (counts/sampling)
!CAP; //Set event when capture is triggered
UPD!; //Update on event
Syntax
!IN#n 0 ! if Input#n is 0
!IN#n 1 ! if Input#n is 1
Binary code
!IN#n 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 0 1 1 0 1 1 0 1 1
PxDATDIR
Bit_mask
!IN#n 1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 0 1 1 0 1 1 0 1 0
PxDATDIR
Bit_ mask
Description Program the detection of the event once the data read from input bit-port #n
becomes 0, respectively 1. An update on event command (UPD!) must be used in
these cases, in order to activate an update operation when the monitored event
occurs.
Execution Activate the setting of an event, when the data read from input bit-port #n
becomes 0 (!IN#n 0) or 1 (!IN#n 1), respectively.
The bits 15 and 14 of the TML motion status register (MSR) are reset.
This operation erases a previous programmed event that has occurred.
Example
CACC = 1.5; //Acceleration command for speed profile
//(counts/sampling2)
CSPD = 20; //Speed command (counts/sampling)
MODE SP1; //Set Speed Profile Mode 1
UPD; //Update immediate
CSPD = 40; //New speed command (counts/sampling)
!IN#38 1; //Set event if INput#38 is high
UPD!; //Update on event
Syntax
!LSN ! if LimitSwitchNegative active
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 0 0 0 0 0 1 1 0 0
Description Program the detection of the event once the negative limit switch is reached and
becomes active. An update on event command (UPD!) must be used in these
cases, in order to activate an update operation when the monitored event occurs.
Execution Activate the setting of an event when the negative limit switch becomes active.
The bits 15 and 14 of the TML motion status register (MSR) are reset.
This operation erases a previous programmed event that has occurred.
Example
CACC = 1.5; //Acceleration command for speed profile
//(counts/sampling2)
CSPD = -20; //Speed command (counts/sampling)
MODE SP1; //Set Speed Profile Mode 1
UPD; //Update immediate
ENLSN1; //Negative Limit Switch triggers rising
edge
CSPD = 20; //New speed command (counts/sampling)
!LSN; //Set event if Negative Limit Switch is
//reached
UPD!; //Update on event
Syntax
!LSP ! if LimitSwitchPositive active
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 0 0 0 0 0 1 1 0 1
Description Program the detection of the event once the positive limit switch is reached and
becomes active. An update on event command (UPD!) must be used in these
cases, in order to activate an update operation when the monitored event occurs.
Execution Activate the setting of an event when the positive limit switch becomes active.
The bits 15 and 14 of the TML motion status register (MSR) are reset.
This operation erases a previous programmed event that has occurred.
Example
CACC = 1.5; //Acceleration command for speed
//profile (counts/sampling2)
CSPD = 20; //Speed command (counts/sampling)
MODE SP1; //Set Speed Profile Mode 1
UPD; //Update immediate
ENLSP1; //Positive Limit Switch triggers
//rising edge
CSPD = -20; //New speed command (counts/sampling)
!LSP; //Set event if Positive LimitSwitch is
//reached
UPD!; //Update on event
Syntax
!MC !(set event) if MotionComplete
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 0 0 0 0 0 1 1 1 1
Description Program the detection of the event once the actual motion sequence is
completed. An update on event command (UPD!) must be used in these cases, in
order to activate an update operation when the monitored event occurs.
Execution Activate the setting of an event when the actual motion sequence is completed.
The bits 15 and 14 of the TML motion status register (MSR) are reset.
This operation erases a previous programmed event that has occurred.
Example
CACC = 1.5; //Acceleration command for position
//profile (counts/sampling2)
CSPD = 40; //Speed command for position profile
//(counts/sampling)
CPOS = 50000; //Position command (counts)
CPA; //Position command is Absolute
MODE PP3; //Set Position Profile Mode 3
UPD; //Update immediate
CPOS = 100000; //New position command (counts);
!MC; //Set event when MotionComplete
UPD!; //Update on event
Syntax
!RO value32 ! if ReferenceOver value32
!RO VAR32 ! if ReferenceOver VAR32
Binary code
!RO value32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 0 1 0 0 1 0 0 0 0
0 0 0 0 0 0 1 0 1 0 1 0 1 1 1 0
LOWORD(value32)
HIWORD(value32)
!RO VAR32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 1 1 0 0 1 0 0 0 0
0 0 0 0 0 0 1 0 1 0 1 0 1 1 1 0
&VAR32
Description Program the detection of the event when the reference value is greater than the
specified value. An update on event command (UPD!) must be used in these
cases, in order to activate an update operation when the monitored event occurs.
The reference value can be:
• a position reference
• a speed reference
• a torque reference
• a voltage reference
Execution Activate the setting of an event when the reference value is >= value32 or
VAR32, respectively.
The bits 15 and 14 of the TML motion status register (MSR) are reset.
This operation erases a previous programmed event that has occurred.
Syntax
!RPO value32 ! if RelPositionOver value32
!RPO VAR32 ! if RelPositionOver VAR32
Binary code
!RPO value32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 0 1 0 0 1 0 1 0 0
0 0 0 0 0 0 1 0 1 0 1 1 1 0 1 0
LOWORD(value32)
HIWORD(value32)
!RPO VAR32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 1 1 0 0 1 0 1 0 0
0 0 0 0 0 0 1 0 1 0 1 1 1 0 1 0
&VAR32
Description Program the detection of the event when the relative position value is greater
than the specified value. An update on event command (UPD!) must be used in
these cases, in order to activate an update operation when the monitored event
occurs.
Execution Activate the setting of an event when the relative position value is >= value32 or
VAR32, respectively.
The bits 15 and 14 of the TML motion status register (MSR) are reset.
This operation erases a previous programmed event that has occurred.
Example
CACC = 0.5; //Acceleration command for position
//profile (counts/sampling2)
CSPD = 20; //Speed command for position profile
//(counts/sampling)
CPOS = 100000; //Position command (counts0
CPR; //Position command is Relative
MODE PP3; //Set Position Profile Mode 3
Syntax
!RPU value32 ! if RelPositionUnder value32
!RPU VAR32 ! if RelPositionUnder VAR32
Binary code
!RPU value32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 0 1 0 0 0 0 1 0 1
0 0 0 0 0 0 1 0 1 0 1 1 1 0 1 0
LOWORD(value32)
HIWORD(value32)
!RPU VAR32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 1 1 0 0 0 0 1 0 1
0 0 0 0 0 0 1 0 1 0 1 1 1 0 1 0
&VAR32
Description Program the detection of the event when the relative position value is smaller
than the specified value. An update on event command (UPD!) must be used in
these cases, in order to activate an update operation when the monitored event
occurs.
Execution Activate the setting of an event, when the relative position value is <= value32 or
VAR32, respectively.
The bits 15 and 14 of the TML motion status register (MSR) are reset.
This operation erases a previous programmed event that has occurred.
Example
CACC = 0.5; //Set acceleration command
CSPD = -20; //Set speed command
CPOS = -100000; //Position command (counts)
CPR; //Position command is Relative
MODE PP3; //Set Position Profile Mode 3
UPD; //Update immediate
CSPD = -40; //New speed command (counts/sampling)
!RPU -60000; //Set event when relative position =< -60000
Syntax
!RT value32 ! if RelativeTime >= value32
!RT VAR32 ! if RelativeTime >= VAR32
Binary code
!RT value32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 0 1 0 1 1 1 0 0 1
0 0 0 0 0 0 1 0 1 1 0 0 0 0 1 0
LOWORD(value32)
HIWORD(value32)
!RT VAR32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 1 1 0 1 1 1 0 0 1
0 0 0 0 0 0 1 0 1 1 0 0 0 0 1 0
&VAR32
Description Program the detection of the event when the system relative time is greater than
the specified value. An update on event command (UPD!) must be used in these
cases, in order to activate an update operation when the monitored event occurs.
Execution Activate the setting of an event when system relative time >= value32 or VAR32,
respectively.
The bits 15 and 14 of the TML motion status register (MSR) are reset.
This operation erases a previous programmed event that has occurred.
Example
CACC = 0.5; //Set acceleration command)
CSPD = 20; //Set speed command
CPOS = 100000; //Position command (counts)
CPR; //Position command is Relative
MODE PP3; //Set Position Profile Mode 3
UPD; //Update immediate
CSPD = 30; //New speed command
!RT 2000; //Set event if Relative Time >= 2000
UPD!; //Update on event
Syntax
!RU value32 ! if ReferenceUnder value32
!RU VAR32 ! if ReferenceUnder VAR32
Binary code
!RU value32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 0 1 0 0 0 0 0 0 1
0 0 0 0 0 0 1 0 1 0 1 0 1 1 1 0
LOWORD(value32)
HIWORD(value32)
!RU VAR32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 1 1 0 0 0 0 0 0 1
0 0 0 0 0 0 1 0 1 0 1 0 1 1 1 0
&VAR32
Description Program the detection of the event when the reference value is smaller than the
specified value. An update on event command (UPD!) must be used in these
cases, in order to activate an update operation when the monitored event occurs.
The reference value can be:
• a position reference
• a speed reference
• a torque reference
• a voltage reference
Execution Activate the setting of an event when the reference value is <= value32 or
VAR32, respectively.
The bits 15 and 14 of the TML motion status register (MSR) are reset.
This operation erases a previous programmed event that has occurred.
Syntax
!SO value32 ! if SpeedOver value32
!SO VAR32 ! if SpeedOver VAR32
Execution Activate the setting of an event when motor speed >= value32 or VAR32,
respectively.
The bits 15 and 14 of the TML motion status register (MSR) are reset.
This operation erases a previous programmed event that has occurred.
Example
CACC = 0.005; //Set acceleration command
CSPD = 20; //Set speed command
CPOS = 100000; //Position command (counts)
CPA; //Position command is Absolute
MODE PP3; //Set Position Profile Mode 3
UPD; //Update immediate
CACC = 1; //Set new acceleration
!SO 15; //Set event if speed >= 15
UPD!; //Update on event
Syntax
!SU value32 ! if SpeedUnder value32
!SU VAR32 ! if SpeedUnder VAR32
Binary code
!SU value32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1
0 0 0 0 0 0 1 0 0 0 1 0 1 1 0 0
LOWORD(value32)
HIWORD(value32)
!SU VAR32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 0 0 1 1 0 0 0 0 1 1 1
0 0 0 0 0 0 1 0 0 0 1 0 1 1 0 0
&VAR32
Description Program the detection of the event when the motor speed is smaller than the
specified value. An update on event command (UPD!) must be used in these
cases, in order to activate an update operation when the monitored event occurs.
Execution Activate the setting of an event when motor speed <= value32 or VAR32,
respectively.
The bits 15 and 14 of the TML motion status register (MSR) are reset.
This operation erases a previous programmed event that has occurred.
Example
CACC = 0.005; //Set acceleration command
CSPD = -20; //Set speed command
CPOS = -100000; //Position command (counts)
CPA; //Position command is Absolute
MODE PP3; //Set Position Profile Mode 3
UPD; //Update immediate
CACC = 1; //Set new acceleration
!SU -15; //Set event if speed <= -15
UPD!; //Update on event
Syntax
!VO VAR32A, value32 ! if Var32AOver value32
!VO VAR32A, VAR32B ! if Var32AOver VAR32B
Syntax
!VU VAR32A, value32 ! if Var32AUnder value32
!VU VAR32A, VAR32B ! if Var32AUnder VAR32B
Binary code
Description Program the detection of the event when the selected variable (any 32-bit TML
variable) is smaller than the specified value or the value of another 32-bit
variable. An update on event command (UPD!) must be used in these cases, in
order to activate an update operation when the monitored event occurs.
Execution Activate the setting of an event when the selected variable (VAR32A) <= value32
or VAR32B, respectively.
The bits 15 and 14 of the TML motion status register (MSR) are reset.
This operation erases a previous programmed event that has occurred.
Example
CACC = 0.5; //Acceleration command for
//position profile (counts/sampling2)
CSPD = 20; //Speed command for position
//profile (counts/sampling)
CPOS = -50000; //Position command (counts)
Syntax
VAR16D = label set VAR16D to value of a label
VAR16D = value16 set VAR16D to value16
VAR16D = VAR16S set VAR16D to VAR16S value
VAR16D = VAR32S(L) set VAR16D to VAR32S(L) value
VAR16D = VAR32S(H) set VAR16D to VAR32S(H) value
VAR16D, dm = value16 set VAR16D from dm to value16
VAR16D, dm = VAR16S set VAR16D from dm to VAR16S
VAR16D = (VAR16S), TypeMem set VAR16D to &(VAR16S) from TM
VAR16D = (VAR16S+), TypeMem set VAR16D to &(VAR16S) from TM, then
VAR16S += 1
(VAR16D), TypeMem = value16 set &(VAR16D) from TM to value16
(VAR16D), TypeMem = VAR16S set &(VAR16D) from TM to VAR16S
(VAR16D+), TypeMem = value16 set &(VAR16D) from TM to value16, then
VAR16D += 1
(VAR16D+), TypeMem = VAR16S set &(VAR16D) from TM to VAR16S, then
VAR16D += 1
VAR32D(L) = value16 set VAR32D low word to value16
VAR32D(L) = VAR16S set VAR32D (L) to VAR16 value
VAR32D(H) = value16 set VAR32D high word to value16
VAR32D(H) = VAR16S set VAR32D (H) to VAR16 value
VAR16D = label
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 1 0 0 0 0 (9LSBs of &VAR16D)
&label
VAR16D = value16
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 1 0 0 0 0 (9LSBs of &VAR16D)
value16
VAR16D = VAR16S
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 1 0 1 0 0 (9LSBs of &VAR16D)
&VAR16S
VAR16D = VAR32S(L)
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 1 0 1 0 0 (9LSBs of &VAR16D)
&VAR32S
VAR16D = VAR32S(H)
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 1 0 1 0 0 (9LSBs of &VAR16D)
&VAR32S + 1
VAR16D,dm = value16
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0
&VAR16D
value16
VAR16D, dm = VAR16S
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0
&VAR16D
&VAR16S
VAR32D(L) = value16
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 1 0 0 0 0 (9LSBs of &VAR32D)
value16
VAR32D(L) = VAR16S
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 1 0 1 0 0 (9LSBs of &VAR32D)
&VAR16S
VAR32D(H) = value16
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 1 0 0 0 0 (9LSBs of &VAR32D+1)
value16
VAR32D(H) = VAR16S
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Description This command allows you to generate assignment TML instruction for a specified
16-bit variable. All possible 16-bit assignment instruction forms are covered.
Execution (destination variable) = source value
TypeMem
DM 01
PM 00
SPI 10
Example1
int Var1;
Label1 …
...
Var1 = Label1;
Example5
int Var1;
Example8
int Var1, pVar2;
...
Var1 = (pVar2), dm;
Example9
int Var1, pVar2;
...
Var1 = (pVar2+), dm;
Example10
int pVar1;
Example15
long Var5;
Example16
int Var1;
long Var5;
...
Var5(H) = Var1;
Example17
int Var1;
long Var5;
...
Var5(L) = Var1;
Syntax
VAR16D = IN#n read input #n into VAR16D
VAR16D = INPUT1, ANDm read inputs IN#25 to IN#32 into VAR16D with
ANDm
VAR16D = INPUT2, ANDm read input IN#33 to IN#39 into VAR16D with
ANDm
VAR16D = INPORT, 0xF read IN#36 to IN#39 into VAR16D with 0xF as
ANDm
Operands
Var16D: integer variable
IN#n : the source is input bit-port number n (0=<n<=39)
INPUT1: the source is 8 input lines status of IO inputs #25 to #32
INPUT2: the source is 8 input lines status of IO inputs #33 to #39
ANDm: a 16-bit mask used to indicate which bits are read from the input ports
INPORT: the source is 4 input lines status of IO inputs #39, #38, #37 and #36
The variable VAR16D must be a valid variable name, defined in the current TML
application. The selection of the IN#n line is specific for each Technosoft drive.
Binary code
VAR16D = IN#n
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 0 0 0 0 (9LSBs of &VAR16D)
PxDATDIR
0 0 0 0 0 0 0 0 Bit_mask
IN# 32 31 30 29 28 27 26 25
Port state 0 1 1 0 1 1 0 1 Bitwise
And_Mas operation
1 1 1 0 0 1 1 1
k
Var1 0 1 1 0 0 1 0 1
Example3
int Var1;
…
Var1 = INPUT2, 0x00E7;
IN# 39 38 37 36 35 34 33
Input state 1 0 0 1 1 0 1
Bitwise
And_Mas
1 1 0 0 1 1 1 operation
k
Var1 1 0 0 0 1 0 1
Example4
int Var1;
…
Var1 = INPORT, 0xF;
Syntax
VAR32D = value32 set VAR32D to value32
VAR32D = VAR32S set VAR32D to VAR32S value
VAR32D = VAR16S << N set VAR32D to VAR16S << N
VAR32D, DM = value32 set long VAR32D from DM to
value32
VAR32D, DM = VAR32S set long VAR32D from DM to
VAR32S
VAR32D = (VAR16S), TypeMem set VAR32D to &(VAR16S) from
TM
VAR32D = (VAR16S+), TypeMem set VAR32D to &(VAR16S) from
TM, then VAR16S += 2
(VAR16D), TypeMem = value32 set &( VAR16D) from TM to
value32
(VAR16D), TypeMem = VAR32S set &( VAR16D) from TM to
VAR32S
(VAR16D+), TypeMem = value32 set &( VAR16D) from TM to
value32, then VAR16D += 2
(VAR16D+), TypeMem = VAR32S set &( VAR16D) from TM to
VAR32S, then VAR16D += 2
Binary code
VAR32D = value32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 1 0 0 1 0 (9LSBs of &VAR32D)
LOWORD(value32)
HIWORD(value32)
VAR32D, dm = value32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 0 1 0 0 0 0 0 0 0 0 0 1 0 1
&VAR32D
LOWORD(value32)
HIWORD(value32)
VAR32D, dm = VAR32S
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 0 1 0 0 0 0 0 0 0 1 0 1 0 1
&VAR32D
&VAR32S
Description Assign the 32-bit value of the source operand to the 32-bit destination variable
TypeMem
DM 01
PM 00
SPI 10
Example1
long Var1;
...
Var1 = 0x1122AABB;
Example5
long Var1, Var2;
...
Var1, dm = Var2;
Example6
long Var1;
int pVar2;
...
Var1 = (pVar2), dm;
Example7
long Var1;
int pVar2;
...
Var1 = (pVar2+), dm;
Example9
int pVar1;
long Var2;
...
(pVar1), pm = Var2;
Example10
int pVar1;
...
(pVar1+), pm = 0x5422AFCD;
Example11
int pVar1;
long Var2;
...
(pVar1+), pm = Var2;
Syntax
VAR16D = [Axis] VAR16S local VAR16D = [Axis] VAR16S
VAR16D = [Axis] VAR16S, DM local VAR16D = [Axis] VAR16S, DM
VAR16D = [Axis] (VAR16S), TypeMem local VAR16D = [Axis] &(VAR16S),
TM
VAR16D = [Axis] (VAR16S+), TypeMem local VAR16D = [Axis] &(VAR16S),
TM, then V16S+=1
Binary code
Description Bring the 16-bit value of the source operand from an external axis and assign it to
the 16-bit destination local variable.
Execution (local 16-bit destination variable) = external source 16-bit value, from another axis
TypeMem
DM 01
PM 00
SPI 10
Example1
int VarLoc, VarExt;
...
VarLoc = [15]VarExt;
Example2
int VarLoc, VarExt;
...
VarLoc = [15]VarExt, dm;
Example3
int VarLoc, pVarExt;
...
VarLoc = [15](pVarExt), dm;
Example4
Syntax
VAR32D = [Axis] VAR32S local VAR32D = [A] VAR32S
VAR32D = [Axis] VAR32S, DM local VAR32D = [A] VAR32S, DM
VAR32D = [Axis] (VAR16S), TypeMem local VAR32D = [A] &(VAR16S), TM
VAR32D = [Axis] (VAR16S+), TypeMem local VAR32D = [A] &(VAR16S), TM,
then V16S+=2
Binary code
Description Bring the 32-bit value of the source operand from an external axis and assign it to
the 32-bit destination local variable
Execution (local 32-bit destination variable) = external source 32-bit value, from another axis
TypeMem
DM 01
PM 00
SPI 10
Example1
long VarLoc, VarExt;
…
VarLoc = [15]VarExt;
Syntax
[Axis/Group] VAR16D = VAR16S [A/G] VAR16D = local VAR16S
[Axis/Group] VAR16D,dm = VAR16S [A/G] VAR16D, dm = local VAR16S
[Axis/Group] (VAR16D), TypeMem = VAR16S [A/G] &(VAR16D), TM = local VAR16S
[Axis/Group] (VAR16D+), TypeMem = VAR16S [A/G] &(VAR16D), TM = local VAR16S,
then V16D+=1
Binary code
Description Send the 16-bit local value of the source operand to an external axis and assign it
to the 16-bit destination external variable
Execution (external 16-bit destination variable from another axis) = local source 16-bit value
TypeMem
DM 01
PM 00
SPI 10
Example1
int VarLoc, VarExt;
...
[G8]VarExt = VarLoc;
Example2
int VarLoc, VarExt;
...
[15]VarExt, dm = VarLoc;
Syntax
[Axis/Group] VAR32D = VAR32S [A/G] long VAR32D = local VAR32S
[Axis/Group] VAR32D, DM = VAR32S [A/G] long VAR32D, DM = local
VAR32S
[Axis/Group] (VAR16D), TypeMem = [A/G] &(VAR16D), TM = local
VAR32S VAR32S
[Axis/Group] (VAR16D+), TypeMem = [A/G] &(VAR16D), TM = local
VAR32S VAR32S, then V1DS+=2
Binary code
Description Send the 32-bit local value of the source operand to an external axis and assign it
to the 32-bit destination external variable
TypeMem
DM 01
PM 00
SPI 10
Execution (external 32-bit destination variable from another axis) = local source 32-bit value
Example1
long VarLoc, VarExt;
...
[15]VarExt = VarLoc;
Syntax –
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 0 1 0 0 0 0 0 0 0 0 TypeMem 0 0
Destination Address
16-bit value
Description The instructions request, via a communication channel, from a remote drive the
value contained in the memory location(s) with address specified directly in the
code. The address can be in data memory, program memory or SPI memory.
TypeMem
DM 01
PM 00
SPI 10
Execution Request from the remote drive, the remote drive sends the value requested.
Syntax –
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 0 1 0 0 0 0 1 0 0 0 TypeMem 0 0
Destination Address
LOWORD(value32)
HIWORD(value32)
Execution Request from the remote drive, the remote drive sends the requested value.
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 0 1 0 1 0 length(MLI) – 1
0 0 0 A/G Axis/Group 0 0 0 0
TML instruction word 1 (operation code)
TML instruction word 2 (data)
…
TML instruction word (length(MLI)) (data)
Description This multiple axis operation allows one to send TML commands from one axis to
another one. When this code is encountered, the TML instruction included in it is
sent to the destination axis, and will be executed as an on-line TML command
received by that axis.
Execution
TML instruction
Local axis Destination axis
communication channel (Axis/Group)
Example
[G8] {STOP3;}//Send to all axes that belong to group 8 the command
//to execute a motion stop of type 3.
Syntax
VAR16D = -VAR16S set VAR16D to –VAR16S value
VAR32D = -VAR32S set VAR32D to –VAR32S value
Binary code
VAR16D = -VAR16S
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 1 1 0 0 0 (9LSBs of &VAR16D)
&VAR16S
VAR32D = -VAR32S
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 1 1 0 1 0 (9LSBs of &VAR32D)
&VAR32S
Example
int Var1;
long Var2;
...
Var1 = - Var1;
Var2 = - Var1;
Syntax
VAR16 += value16 add to VAR16 value16
VAR16D += VAR16S add to VAR16D VAR16S value
VAR32 += value32 add to VAR32 value32
VAR32D += VAR32S add to VAR32D VAR32S value
Binary code
VAR16 += value16
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 1 1 1 0 0 (9LSBs of &VAR16)
value16
VAR16D += VAR16S
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 0 0 (9LSBs of &VAR16D)
&VAR16S
VAR32 += value32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 1 1 1 1 0 (9LSBs of &VAR32)
LOWORD(value32)
HIWORD(value32)
VAR32D += VAR32S
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 0 1 0 (9LSBs of &VAR32D)
&VAR32S
Description Add to the destination variable the value of the source variable or value. Store the
result in the destination variable.
Syntax
VAR16 -= value16 subtract from VAR16 value16
VAR16D -= VAR16S subtract from VAR16D VAR16S value
VAR32 -= value32 subtract from VAR32 value32
VAR32D -= VAR32S subtract from VAR32D VAR32S value
Binary code
VAR16 -= value16
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 1 0 0 (9LSBs of &VAR16)
value16
VAR16D -= VAR16S
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 0 0 0 (9LSBs of &VAR16D)
&VAR16S
VAR32 -= value32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 0 1 1 0 (9LSBs of &VAR32)
LOWORD(value32)
HIWORD(value32)
VAR32D -= VAR32S
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 0 1 0 (9LSBs of &VAR32D)
&VAR32S
Description Subtract from the destination variable the value of the source variable or value.
Store the result in the destination variable.
Syntax
VAR16 * VALUE16 >> N PROD = (VAR16*value16) >> N
VAR16 * VALUE16 << N PROD = (VAR16*value16) << N
VAR16A * VAR16B >> N PROD = (VAR16A*VAR16B) >> N
VAR16A * VAR16B << N PROD = (VAR16A*VAR16B) << N
VAR32 * VALUE16 >> N PROD = (VAR32*value16) >> N
VAR32 * VALUE16 << N PROD = (VAR32*value16) << N
VAR32 * VAR16 >> N PROD = (VAR32*VAR16) >> N
VAR32 * VAR16 << N PROD = (VAR32*VAR16) << N
Binary code
Description Multiply two values and store the result (eventually shifted) in the PROD (product)
register of the TML environment.
Execution PROD register = (first operand * second operand) shifted to left or right with a
specified number of bits
Example1
int Var1;
long var2;
...
Var1 * 0x125;
Var2 = PROD;
Example3
int Var2, Var3;
long Var4;
...
Var2 * Var3 >> 4;
Var4 = PROD;
Example4
int Var2, Var3;
long Var7;
...
Var2 * Var3 << 8;
Var7 = PROD(H);
Example5
long Var1, Var2;
...
Var1 * 0x125;
Var2 = PROD;
Example7
long Var2, Var9;
int Var3;
...
Var2 * Var3 >> 4;
Var9 = PROD(H);
Example8
long Var2, Var9;
int Var3;
...
Var2 * Var3 << 8;
Var9 = PROD;
Syntax
VAR16 >>= N shift VAR16 right by N
VAR32 >>= N shift VAR32 right by N
PROD >>= N shift PROD (product reg.) right by N
Binary code
VAR16 >>= N
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 0 0 1 0 0 0 0 0 0 0 N (0≤N≤15)
&VAR16
VAR32 >>= N
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 0 0 1 0 0 1 0 0 0 0 N (0≤N≤15)
&VAR32
PROD >>= N
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 0 0 1 0 0 0 1 0 0 0 N (0≤N≤15)
Description Right shift the source operand with the specified number of bits (N). Fill the most
significant bits with the sign bit (sign extension mode applied, all values are
considered as signed values).
Syntax
VAR16 <<= N shift VAR16 left by N
VAR32 <<= N shift VAR32 left by N
PROD <<= N shift PROD (product reg.) right by N
Binary code
VAR16 <<= N
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 0 0 1 0 0 0 0 0 1 0 N (0<N<15)
&VAR16
VAR32 <<= N
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 0 0 1 0 0 1 0 0 1 0 N (0<N<15)
&VAR32
PROD <<= N
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 0 0 1 0 0 0 1 0 1 0 N (0<N<15)
Description Left shift the source operand, with the specified number of bits (N). Fill the least
significant bits with 0.
Example1
int Var1;
…
Var1 <<= 4;
Example3
PROD <<= 4;
Syntax
ADDGRID value16 Add value16 to GROUP ID
ADDGRID VAR16 Add value of VAR16 to GROUP ID
Description In multiple axis structures, this command allows one to add a new group ID to the
local axis.
After the execution of this command, the new group ID value is recognized by the
axis and is used by the communication drivers in order to accept or reject
messages addressed to groups of axes.
Only the lower 8 bits of the value16 or VAR16 parameters are used for group
coding. Each bit corresponds to a group.
Up to 8 groups (1 to 8) can be defined/added/removed in a multiple axis structure.
An axis can belong to any of the groups. A multiple-axis message can be
addressed to one axis or to a group of axes.
Execution Group_ID = Group_ID + value16 (or value of VAR16).
Example
GROUPID 1; //local axis belongs to group 1
ADDGRID 2; //from now on, the local axis belongs
//to groups 1 and 2 GROUPID = 3)
ADDGRID 4; //from now on, the local axis belongs
//to groups 1, 2 and 4
//(GROUPID 11)
...
[G4] {STOP3;} //send stop motion command to all axes
//belonging to group 4
Syntax
AXISID value16 Set AXIS ID address
AXISID VAR16 Set AXIS ID with value of VAR16
Binary code
AXISID value16
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1
Value16
AXISID VAR16
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1
&VAR16
Description In multiple axis structures, these commands allows changing the ID of the axis.
After the execution of these commands, the new ID value is recognized by the
axis. The ID value16 or the ID value of VAR16 has the range from 0 to 255.
Example
AXISID 10; // from now on, the local axis ID is 10
...
[10] {AXISID 9;} // change the ID of axis 10 to 9 (this
//instruction is send and executed on
//the actual axis 10)
...
[9] {CSPD = 30;} // send a command to axis 9 (previous axis
//10)
Syntax
AXISOFF AXIS is OFF (deactivate control)
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0
Description This command deactivates the control loops (current, speed and position) and the
reference generator module. The PWM outputs are also deactivated (put in the
high impedance status).
The real-time kernel continues to be active, both slow and high frequency
sampling loops are active. Only acquisition of measured data (currents, position,
Vdc, etc) continues to be performed.
Example
BEGIN;
#include “dc_epc.ini” //includes the setup file
ENDINIT; //end of setup file
Loop: AXISON; //start program
MODE SP1 ; //work mode ;
CSPD = 20.; //setup reference speed
UPD; //update
!RT 1000; //Set event if RelativeTime >= 1000
WAIT!; //WAIT until event occurs
AXISOFF; //deactivate the control
!RT 20000; //Set event if RelativeTime >= 20000
WAIT!; //WAIT until event occurs
GOTO loop; // restart the motion
END; //end of program
Syntax
AXISON AXIS is ON (activate control)
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0
Description This command activates the control loops (current, speed and position) and the
reference generator module. The PWM outputs are also activated.
Example
BEGIN;
#include “dc_epc.ini” //includes the setup file
ENDINIT; //end of setup file
Loop: AXISON; //start program
MODE SP1 ; //work mode ;
CSPD = 20.; //setup reference speed
UPD; //update
!RT 1000; //Set event if RelativeTime >= 1000
WAIT!; //WAIT until event occurs
AXISOFF; //deactivate the control
!RT 20000; //Set event if RelativeTime >= 20000
WAIT!; //WAIT until event occurs
GOTO loop; // restart the motion
END; //end of program
Syntax
BEGIN Beginning of a TML program
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 0 0 1 0 0 1 0 0 1 1 1 0 0
Example
BEGIN;
#include “dc_epc.ini” //includes the setup file
ENDINIT; //end of setup file
Loop: AXISON; //start program
MODE SP1 ; //work mode ;
CSPD = 20.; //setup reference speed
UPD; //update
END; //end of program
Syntax
CALL Label Unconditional CALL of a TML function
CALL Label, VAR16, Flag CALL if VAR16 Flag 0
CALL Label, VAR32, Flag CALL if VAR32 Flag 0
Binary code
CALL Label
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 1
&Label
Flag
LT 0x0090
LEQ 0x0088
EQ 0x00C
0
NEQ 0x00A0
GT 0x0084
GEQ 0x0082
Example1
CALL fct1, i_var1, GEQ; //call function fct1, if i_var1 >= 0
CALL fct1, i_var1, EQ; //call function fct1, if i_var1 = 0
CALL fct1, i_var1, NEQ; //call function fct1, if i_var1 != 0
CALL fct1; //unconditional call of function fct1
fct1:
...
...
RET;
Example2
int my_pos;
...
END;
Syntax
CANBR value16 Set the baud rate for CAN-bus
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0
Value16
Description This command is used to setup the baud rate for CAN communication parameters
channel. It also sets the CBR register.
Baud rate Value 16
[kb]
125 0xF36C
250 0x736C
500 0x3273
800 0x412A
1000 0x1273
Example In order to configure the baud rate at 1 Mb for the CAN communication channel
use the following assignment instruction:
CANBR 0x1273;
Syntax
CHECKSUM, TypeMem Start, Stop, V16D V16D=Checksum data from TM Start
address to TM Stop address-1
Binary code
Description The selected 16-bit variable is assigned with checksum operation performed on
the all memory locations situated in TypeMem between Start address and Stop
address –1.
TypeMem
DM 01
PM 00
SPI 10
Example
int Var1;
…
CHECKSUM, SPI 0x5000, 0x5007, VAR1;
Syntax
CPA Command Position is Absolute
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0
Description After the execution of this instruction, all position commands will be considered as
absolute values. So, position references will be compared with the absolute
position of the motor (stored in the APOS variable).
Example
...
CACC = 1.5; //Acceleration command for position profile
//(counts/sampling2)
CSPD = 40; //Speed command for position profile
//(counts/sampling)
CPOS = 50000; //Position command (counts)
CPA; //Position command is Absolute
MODE PP3; //Set Position Profile Mode 3
UPD; //Update immediate
Syntax
CPR Command Position is Relative
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Description After the execution of this instruction, all position commands will be considered as
relative values. Depending on the target update mode setting (using instructions
TUM0 or TUM1), the position value will be relative to the actual and respectively
target motor position.
Example
...
CACC = 0.5; //Acceleration command for position
//profile (counts/sampling2)
CSPD = 20; //Speed command for position profile
//(counts/sampling)
CPOS = 40000; //Position command (counts)
CPA; //Position command is Absolute
MODE PP3; //Set Position Profile Mode 3
UPD; //Update immediate
CPOS = 80000; //New Position command (counts)
CPR; //Position command is Relative
TUM0; //Target update mode 0
!IN#38 1; //Set event if INput#38 is high
UPD!; //Update on event
WAIT!; //WAIT until event occurs
Syntax
DINT Disable TML INTerrupts
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0
Description After the execution of this instruction, further TML interrupts are disabled. Use the
EINT instruction to re-enable TML interrupts.
Syntax
DIS2CAPI DISable 2nd CAPture Index
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0
Description After the execution of this instruction the index2 capture connected to 2CAPI pin
is disabled.
Use the EN2CAPI0 or EN2CAPI1 instructions to re-enable this capture.
In the disabled mode, the index2 capture is reprogrammed and can be used as a
general purpose I/O pin. By default, it is re-programmed as an input pin.
Index2Capture captures the master position. The master position can be captured
only in the following conditions:
• The encoder signals from the master system are connected to the 2nd
encoder input of the drive
• The drive is set as slave either in electronic gearing or electronic camming
with option Read master position from 2nd encoder input activated
In order to enable the index2 capture input, specify the type of transition to look
for: index2 Capture transition low->high or index2 Capture transition high-> low.
Normally, you don’t need to disable the index2 capture input as this is
automatically done when the programmed transition occurs. Use Disable only if
you want to disable on purpose the index2 capture input, before sensing the
transition.
Syntax
DISCAPI DISable CAPture Index
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 1
Description After the execution of this instruction, the index capture, connected to CAPI pin, is
disabled.
Use the ENCAPI0 or ENCAPI1 instructions to re-enable this capture.
In the disabled mode, the index capture is reprogrammed and can be used as a
general purpose I/O pin. By default, it is re-programmed as an input pin.
Index capture captures the motor position.
In order to enable a capture input, specify the type of transition to look for:
Capture transition low->high or Capture transition high-> low. Normally, you don’t
need to disable a capture input as this is automatically done when the
programmed transition occurs. Use Disable only if you want to disable on purpose
a capture input, before sensing the transition.
Syntax
DISIO#n DISable IO#n
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0
MCRx
ANDdis
ORdis
Description After the execution of this instruction, the I/O bit-port #n is disabled. Use the
ENIO#n instruction to re-enable this I/O bit-port. In the disabled mode, the
associated pin is reprogrammed and can be used for its primary function on the
DSP.
Syntax
DISLSN DISable Limit Switch Negative
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0
0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Description After the execution of this instruction, the negative limit switch is deactivated.
Use the ENLSN0 or ENLSN1 instructions to re-enable the negative limit switch
detection.
In the disabled mode, the negative limit switch pin is re-programmed and can be
used as an input pin, usable to get the status of the limit switch signal. Use the
LSN variable in order to examine the status of this pin.
Syntax
DISLSP DISable Limit Switch Positive
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0
0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Description After the execution of this instruction, the positive limit switch is deactivated.
Use the ENLSP0 or ENLSP1 instructions to re-enable the positive limit switch
detection.
In the disabled mode, the positive limit switch pin is re-programmed and can be
used as an input pin, usable to get the status of the limit switch signal. Use the
LSP variable in order to examine the status of this pin.
Syntax
EINT Enable TML INTerrupts
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 1 0 1 0 0 0 1 0 0 0 0
Description After the execution of this instruction, the TML interrupts will be enabled. If an
interrupt flag is set by a specific event, and the corresponding interrupt enable bit
from the ICR register is active, the corresponding TML interrupt service routine
will be called and executed. The TML interrupts can be de-activated using the
DINT instruction.
Syntax
EN2CAPI0 Enable 2ndCAPture Index 1->0
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0
Description After the execution of this instruction, the DSP will detect the first transition from 1
to 0 on the index2 capture input (pin 2CAPI) for drives where the second encoder
input is available. Index2 Capture captures the master position.
The master position can be captured only in the following conditions:
• The encoder signals from the master are connected to the second encoder
input of the drive
• The drive is set as slave either in electronic gearing or electronic camming
with option Read master position from second encoder input activated
When the programmed transition occurs, the following happens:
• The value of the master position will be stored in the CAPPOS2 system
variable;
• An event is detected, and the update event and the wait event bits of the
MSR register are set if a capture triggered (!CAP) instruction was executed
prior the occurrence of the capture;
• If an update on event was programmed, a motion update is performed;
• The corresponding status bit in the MSR register (Bit 8, position capture) is
set
• The corresponding interrupt bit in the ISR register (Bit 8, position capture) is
set, and will determine the execution of the associated interrupt service
routine if the corresponding mask bit from the ICR register is set.
• The DSP index capture pin is programmed as a general input data pin(bit-port
#34 in TML).
A capture input is automatically disabled after the programmed transition was
detected and the position was captured. In order to reuse a capture input, you
need to enable it again.
Syntax
EN2CAPI1 Enable 2ndCAPture Index 0->1
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0
Description After the execution of this instruction, the DSP will detect the first transition from 0
to 1 on the index2 capture input (pin 2CAPI) for drives where the second encoder
input is available.
Index2 Capture captures the master position.
The master position can be captured only in the following conditions:
• The encoder signals from the master are connected to the second encoder
input of the drive
• The drive is set as slave in electronic gearing or electronic camming with
option Read master position from second encoder input activated
When the programmed transition occurs, the following happens:
• The value of the master position will be stored in the CAPPOS2 system
variable;
• An event is detected, and the update event and the wait event bits of the
MSR register are set if a capture triggered (!CAP) instruction was executed
prior the occurrence of the capture;
• If an update on event was programmed, a motion update is performed;
• The corresponding status bit in the MSR register (Bit 8, position capture) is
set
• The corresponding interrupt bit in the ISR register (Bit 8, position capture) is
set, and will determine the execution of the associated interrupt service
routine if the corresponding mask bit from the ICR register is set.
• The DSP index capture pin is programmed as a general input data pin(bit-port
#34 in TML).
A capture input is automatically disabled after the programmed transition was
detected and the position was captured. In order to reuse a capture input, you
need to enable it again.
Example
CACC = 0.5; //Acceleration command for speed profile
//(counts/sampling2)
CSPD = 20; //Speed command (counts/sampling)
MODE SP1; //Set Speed Profile Mode 1
UPD; //Update immediate
EN2CAPI1; //Activate 2CAPI input to trigger a rising
//transitions.
CSPD = 30; //New acceleration command for speed profile
//(counts/sampling2)
!CAP; //Set event if CAPture is triggered
UPD!; //Update on event
Syntax
ENCAPI0 Enable CAPture Index 1->0
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1
Description After the execution of this instruction, the DSP will detect the first transition from 1
to 0 on the index capture input (CAPI pin).
Index capture captures the motor actual position.
On capture, the following happens:
• the value of the motor position will be stored in the CAPPOS system variable;
• an event is detected, and the update event and the wait event bits of the MSR
register are set if a capture triggered (!CAP) instruction was executed prior
the occurrence of the capture;
• if an update on event was programmed, a motion update is performed;
• the corresponding status bit in the MSR register (Bit 8, position capture) is set
• the corresponding interrupt bit in the ISR register (Bit 8, position capture) is
set, and will determine the execution of the associated interrupt service
routine if the corresponding mask bit from the ICR register is set.
• the DSP index capture pin is programmed as a general input data pin(bit-port
#5 in TML).
Example
CACC = 0.5; //Acceleration command for speed profile
//(counts/sampling2)
CSPD = 20; //Speed command (counts/sampling)
MODE SP1; //Set Speed Profile Mode 1
UPD; //Update immediate
ENCAPI0; //Activate CAPI input to trigger a falling
//transitions.
CSPD = 50; //New acceleration command for speed profile
//(counts/sampling2)
!CAP; //Set event if CAPture is triggered
Syntax
ENCAPI1 Enable CAPture Index 0->1
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1
Description After the execution of this instruction, the DSP will detect the first transition from 0
to 1 on the index capture input (CAPI pin). Index capture captures the motor
actual position.
On capture, the following happens:
• The value of the motor position will be stored in the CAPPOS system
variable;
• An event is detected, and the update event and the wait event bits of the
MSR register are set if a capture triggered (!CAP) instruction was
executed prior the occurrence of the capture;
• If an update on event was programmed, a motion update is performed;
• The corresponding status bit in the MSR register (Bit 8, position capture)
is set
• The corresponding interrupt bit in the ISR register (Bit 8, position capture)
is set, and will determine the execution of the associated interrupt service
routine if the corresponding mask bit from the ICR register is set.
• The DSP index capture pin is programmed as a general input data pin
(bit-port #5 in TML).
Example
CACC = 0.5; //Set acceleration command
CSPD = 20; //Ser speed command (counts/sampling)
MODE SP1; //Set Speed Profile Mode 1
UPD; //Update immediate
ENCAPI1; //Activate CAPI input to trigger a rising
//transitions.
CSPD = 50; //Set new acceleration command
!CAP; //Set event if CAPture is triggered
Syntax
END END of a TML program
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
Description The END instruction will indicate the end of a TML program sequence. After the
execution of this instruction, the TML kernel will enter in a wait loop, and no other
TML instruction is executed (this stops the execution of the motion program
resident in the drive memory). A RESET, a TML interrupt or an on-line GOTO or
CALL instructions are needed to change this status, and to start the execution of
another TML program sequence.
Please note that after the execution of the END instruction, the control, PWM
outputs and real-time section of the system continue to operate as before the
execution of this instruction. Use commands as AXISOFF in order to stop the
controllers and to de-activate the PWM outputs.
Remarks:
1. It is mandatory to end the motion program (main routine) with an END
command. All the TML subroutines and interrupt service routines should be
added after the END command.
2. If you intend to change the program of a drive set for stand-alone operation
(e.g. which starts to execute automatically after reset the TML program from
the E2ROM memory) you should do the following:
a. Send to the drive the command END, to stop the current program
execution. In order to disable the power stage, send also an AXISOFF
command
b. Compile the new program
c. Download the new program
d. Reset the drive. The new program will start to execute
Syntax
ENDINIT END of INITialization
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
Description The ENDINIT instruction will indicate the end of the initialization part of the TML
program. This instruction must be preceded by all the initializations (TML
instructions) needed to setup the motion system configuration structure and
parameters.
When executed, this instruction uses these parameters and settings in order to
setup the operating environment of the motion system (real-time sampling
periods, PWM parameters, sensor-related parameters, etc.).
The following settings must be done before executing the ENDINIT instruction.
Remarks:
1. Only one ENDINIT instruction may be executed in a TML program.
2. The ENDINIT instruction activates the real-time interrupts and the measurement from A/D
channels, but no PWM outputs or controllers. Use the AXISON command in order to
activate them, too.
The AXISON command must be executed after the ENDINIT command!
Syntax
ENIO#n Enable IO#n
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0
MCRx
ANDen
ORen
Description After the execution of this instruction, the I/O bit-port #n is enabled.
Use the DISIO#n instruction to disable this I/O bit-port.
In the enabled mode, the associated pin is programmed and can be used as a
general-purpose I/O bit. The ENIO#n instruction does not change the bit-port type
(input or output). By default, after reset, the bit-port is set as an input port.
Use the SETIO#n OUT instruction to change it to an output bit-port or,
alternatively, the SETIO#n IN to change it to an input bit-port.
Execution Enable the use of the IO#n signal as an I/O line (0<=n<=39).
Example
ENIO#5 // enable port 5
Syntax
ENLSN0 Enable Limit Switch Negative 1->0
Operands –
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0
0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 1
1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
Description After the execution of this instruction, the DSP will detect the first transition from 1
to 0 on the negative limit switch input.
In this case, the following happens:
• the update event and the wait event bits of the MSR register are set if a
negative limit switch triggered (!LSN) instruction was executed prior the
occurrence of the transition;
• if an update on event was programmed, a motion update is performed;
• the corresponding status bit in the MSR register (Bit 7) is set;
• the corresponding interrupt bit in the ISR register (Bit 7) is set, and will
determine the execution of the associated interrupt service routine if the
corresponding mask bit from the ICR register is set;
• the negative limit switch pin is reprogrammed in the disabled mode and can
be used as an input pin, usable to get the status of the limit switch signal.
Use the DISLSN instruction to disable this function.
Use the LSN variable in order to examine the status of the negative limit switch
pin.
Execution Enable falling-edge front detection on negative limit switch.
Example
CACC = 1.5; //Set acceleration command
CSPD = -20; //Speed command (counts/sampling)
MODE SP1; //Set Speed Profile Mode 1
UPD; //Update immediate
ENLSN0; //Negative Limit Switch triggers falling edge
CSPD = 20; //Set new speed command (counts/sampling)
!LSN; //Set event if Negative LimitSwitch is reached
UPD!; //Update on event
Syntax
ENLSN1 Enable Limit Switch Negative 0->1
Operands –
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0
0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1
Description After the execution of this instruction, the DSP will detect the first transition from 0
to 1 on the negative limit switch input.
In this case, the following happens:
• the update event and the wait event bits of the MSR register are set if a
negative limit switch triggered (!LSN) instruction was executed prior the
occurrence of the transition;
• if an update on event was programmed, a motion update is performed;
• the corresponding status bit in the MSR register (Bit 7) is set;
• the corresponding interrupt bit in the ISR register (Bit 7) is set, and will
determine the execution of the associated interrupt service routine if the
corresponding mask bit from the ICR register is set;
• the negative limit switch pin is reprogrammed in the disabled mode and can
be used as an input pin, usable to get the status of the limit switch signal.
Use the DISLSN instruction to disable this function.
Use the LSN variable in order to examine the status of the negative limit switch
pin.
Execution Enable rising-edge front detection on negative limit switch.
Example
CACC = 1.5; //Set acceleration command
CSPD = -20; //Set speed command (counts/sampling)
MODE SP1; //Set Speed Profile Mode 1
UPD; //Update immediate
ENLSN1; //Negative Limit Switch triggers rising edge
CSPD = 20; //Set new speed command (counts/sampling)
!LSN; //Set event if Negative LimitSwitch is reached
UPD!; //Update on event
Syntax
ENLSP0 Enable Limit Switch Positive 1->0
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0
0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0
1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
Description After the execution of this instruction, the DSP will detect the first transition from 1
to 0 on the positive limit switch input.
In this case, the following happens:
• The update event and the wait event bits of the MSR register are set if a
positive limit switch triggered (!LSP) instruction was executed prior the
occurrence of the transition;
• If an update on event was programmed, a motion update is performed;
• The corresponding status bit in the MSR register (Bit 6) is set;
• The corresponding interrupt bit in the ISR register (Bit 6) is set, and will
determine the execution of the associated interrupt service routine if the
corresponding mask bit from the ICR register is set;
• The positive limit switch pin is reprogrammed in the disabled mode and can
be used as an input pin, usable to get the status of the limit switch signal.
Use the DISLSP instruction to disable this function.
Use the LSP variable in order to examine the status of the positive limit switch
pin.
Execution Enable falling-edge front detection on positive limit switch.
Example
CACC = 1.5; //Set acceleration command
CSPD = 20; //Set speed command (counts/sampling)
MODE SP1; //Set Speed Profile Mode 1
UPD; //Update immediate
ENLSP0; //Positive Limit Switch triggers falling edge
CSPD = -20; //Set new speed command (counts/sampling)
!LSP; //Set event if Positive LimitSwitch is reached
Syntax
ENLSP1 Enable Limit Switch Positive 0->1
Operands –
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0
0 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1
Description After the execution of this instruction, the DSP will detect the first transition from 0
to 1 on the positive limit switch input.
In this case, the following happens:
• the update event and the wait event bits of the MSR register are set if a
positive limit switch triggered (!LSP) instruction was executed prior the
occurrence of the transition;
• if an update on event was programmed, a motion update is performed;
• the corresponding status bit in the MSR register (Bit 6) is set;
• the corresponding interrupt bit in the ISR register (Bit 6) is set, and will
determine the execution of the associated interrupt service routine if the
corresponding mask bit from the ICR register is set;
• the positive limit switch pin is reprogrammed in the disabled mode and
can be used as an input pin, usable to get the status of the limit switch
signal.
Use the DISLSP instruction to disable this function.
Use the LSP variable in order to examine the status of the positive limit switch
pin.
Execution Enable rising – edge front detection on positive limit switch.
Example
CACC = 1.5; //Acceleration command for speed profile
CSPD = 20; //Speed command (counts/sampling)
MODE SP1; //Set Speed Profile Mode 1
UPD; //Update immediate
ENLSP1; //Positive Limit Switch triggers rising edge
CSPD = -20; //New speed command (counts/sampling)
!LSP; //Set event if Positive LimitSwitch is reached
Syntax
EXTREF value Set EXTernal REFerence type
Binary code
EXTREF 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
EXTREF 1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
EXTREF 2
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1
0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
Description This instruction sets the type of external references depending on the parameter
value:
• value = 0: external reference read from EREF system variable (integer or long
variable) updated on-line
• value = 1: external reference read from REFERENCE input
• value = 2: external reference read from second encoder input
Execution Sets the external reference type based on value’s value (0, 1 or 2)
Example
EXTREF 1; // the reference will be read from the analogue
//reference A/D channel (REFERENCE input)
Syntax
GOTO Label Unconditional GOTO to label
GOTO Label, VAR16, Flag GOTO if VAR16 Flag 0
GOTO Label, VAR32, Flag GOTO if VAR32 Flag 0
Description This instruction allows the jump to a TML instruction located at the address Label.
When a conditional GOTO instruction is encountered, the condition is checked
and, if it is true (i.e. the tested variable is in the specified relation with 0), a jump
to the specified label is executed. If condition is false, the next TML instruction is
executed.
Example1
GOTO label1, i_var2, LT; // jump to label1 if i_var2 < 0
GOTO label2, i_var2, LEQ; // jump to label2 if i_var2 <= 0
GOTO label3, i_var2, GT; // jump to label3 if i_var2 > 0
GOTO label4; // unconditional jump to label4
Example2
...
GOTO MOVEP; // jump unconditionally
...
GOTO MOVEP, ASPD, GT; // jump if motor speed > 0
...
MOVEP: // program sequence to move to a
//specified position
CACC = 1.5; // acceleration = 1.5
//(counts/sampling2)
CSPD = -20.; // slew speed = -20 (counts/sampling)
CPOS = my_pos; // position command
UPD; // start motion
GOTO Exit; // exit
...
Exit: //label
Syntax
GROUPID value16 Set GROUP ID address
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0
Value16
Description In multiple axis structures, this command allows one to change the group ID of
the local axis.
After the execution of this command, the new ID value is recognized by the axis
and is used by the communication drivers in order to accept or reject messages
addressed to groups of axes.
Only the lower 8 bits of the value16 parameter are used for group coding. Each
bit corresponds to a group. Up to 8 groups can be defined in a multiple axis
structure.
An axis can belong to any of the 8 groups.
A multiple-axis message can be addressed to one or more of the axes.
Example
GROUPID 1; // local axis belongs to groups 1
GROUPID 3; // from now on, the local axis belongs to group 3
...
[G3] {STOP3;} // stop the motion for all axes belonging
to
//group 3
Syntax
INITCAM LoadAddress, RunAddress InitCam table from LoadAddress to
RunAddress
Binary code
Description The INITCAM instruction copies the selected CAM Table from the drives’ E2ROM
memory to the drives’ RAM memory where the CAM Table must reside while
electronic camming is enabled.
The LoadAddress represents the address (decimal number) of E2ROM memory
where the selected CAM Table was loaded.
The RunAddress parameter (decimal number) specifies address in the RAM
memory of the Technosoft drive where the CAM profile Table resides at run-time.
Note that in order to copy a CAM table using this instruction, the following steps
must be done:
• The cam must be created or imported before;
• The cam must be selected as an active cam;
• The cam must be downloaded to the drive. The Download CAM files
command downloads into the drives’ E2ROM memory all the active cams
selected;
• The cam must be selected from the Use Table list of cams available into the
E2ROM memory.
Execution Copy CAM table from drive’s SPI memory to drive’s RAM memory.
Example
INITCAM 18864,2560; //Copy CAM table from SPI memory
//(address 0x49B0) to RAM memory
//(address 0xA00)
UPD; // Update immediate
Syntax
MODE CS0 Set axis in MODE Camming Slave 0 ()
MODE CS1 Set axis in MODE Camming Slave 1 (T)
MODE CS2 Set axis in MODE Camming Slave 2 (S)
MODE CS3 Set axis in MODE Camming Slave 3 (S,T)
Operands –
Binary code
MODE CS0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 0 1 0 0 1 1 0 0 0 1 1 0
1 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0
MODE CS1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 0 1 0 1 1 1 0 0 0 1 1 0
1 0 0 0 0 1 0 1 0 0 0 0 0 1 1 0
MODE CS2
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 0 1 1 0 1 1 0 0 0 1 1 0
1 0 0 0 0 1 1 0 0 0 0 0 0 1 1 0
MODE CS3
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 0 1 1 1 1 1 0 0 0 1 1 0
1 0 0 0 0 1 1 1 0 0 0 0 0 1 1 0
Description MODE CS0/CS1/CS2/CS3 instruction set the axis to operate in the slave
camming mode.
Execution Sets the slave camming mode operation for the axis (reference type). Four cases
are possible:
Example
EXTREF 0;
EIR = 0x081A;
(EIR),dm = 2000;
EIR = 0x081B;
(EIR),dm = 0;
MODE CS3; //Set as slave, position mode 3
TUM1; //Set Target Update Mode 1
UPD; //Update immediate
EFLEVEL = 0; //Activate synchronization
Syntax
MODE GS0 Set axis in MODE Gear Slave 0 ()
MODE GS1 Set axis in MODE Gear Slave 1 (T)
MODE GS2 Set axis in MODE Gear Slave 2 (S)
MODE GS3 Set axis in MODE Gear Slave 3 (S,T)
Operands –
Binary code
MODE GS0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 0 1 0 0 1 1 0 0 0 1 0 1
1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1
MODE GS1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 0 1 0 1 1 1 0 0 0 1 0 1
1 0 0 0 0 1 0 1 0 0 0 0 0 1 0 1
MODE GS2
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 0 1 1 0 1 1 0 0 0 1 0 1
1 0 0 0 0 1 1 0 0 0 0 0 0 1 0 1
MODE GS3
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 0 1 1 1 1 1 0 0 0 1 0 1
1 0 0 0 0 1 1 1 0 0 0 0 0 1 0 1
Description MODE GS0/GS1/GS2/GS3 instruction set the axis to operate in the slave gear
mode. In this mode, the reference values must be sent from the master and
stored into the variable MREF. Multiplied with the parameter GEAR, these values
will be used as position reference for the axis.
Execution Sets the slave gear mode operation for the axis (reference type). Four cases are
possible:
Example
GEAR = 2.00000;
GEARMASTER = 1; //Gearing factor for master axis
GEARSLAVE = 2; //Gearing factor for slave axis
EXTREF 0; //Set axis as Gear Slave without read
//master position from 2nd Encoder Input
EIR = 0x081A;
(EIR),dm = 2000;
EIR = 0x081B;
(EIR),dm = 0;
MODE GS3; //Set as slave, position mode 3
UPD; //Update immediate (enable gear mode)
EFLEVEL = 0xFFFF; //Deactivate synchronization
Syntax
MODE PC0 MODE Position Contouring 0 ( )
MODE PC1 MODE Position Contouring 1 (T)
MODE PC2 MODE Position Contouring 2 (S)
MODE PC3 MODE Position Contouring 3 (S,T)
Operands –
Binary code
MODE PC0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 1 1 0 0 1 1 0 0 0 0 1 0
1 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0
MODE PC1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 1 1 0 1 1 1 0 0 0 0 1 0
1 0 0 0 0 1 0 1 0 0 0 0 0 0 1 0
MODE PC2
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 1 1 1 0 1 1 0 0 0 0 1 0
1 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0
MODE PC3
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 1 1 1 1 1 1 0 0 0 0 1 0
1 0 0 0 0 1 1 1 0 0 0 0 0 0 1 0
Description MODE PC0/PC1/PC2/PC3 instruction defines the position control operating in the
contouring reference motion mode.
In this mode, the reference module will perform linear interpolation based on
motion segments, described using the SEG instruction.
Execution Sets the position contouring motion mode. Four cases are possible:
Example
MODE PC3; //Set Position Contouring Mode 3
SEG 100U, 5.00000; //Set 1st motion segment. Increment
//position reference with 5 counts for
//the next 100 sampling periods
UPD; //Update immediate
SEG 100U, 5.00000; //Set 2st motion segment.
SEG 100U, -20.00000; //Set 3st motion segment.
SEG 100U, 10.00000; //Set 4st motion segment.
SEG 0, 0.; //End of contouring mode
Syntax
MODE PE0 MODE Position External 0 ( )
MODE PE1 MODE Position External 1 (T)
MODE PE2 MODE Position External 2 (S)
MODE PE3 MODE Position External 3 (S,T)
Operands –
Binary code
MODE PE0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 1 1 0 0 1 1 0 0 0 0 0 0
1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
MODE PE1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 1 1 0 1 1 1 0 0 0 0 0 0
1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0
MODE PE2
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 1 1 1 0 1 1 0 0 0 0 0 0
1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0
MODE PE3
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0
1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0
Description MODE PE0/PE1/PE2/PE3 instruction defines the position control operating in the
external reference motion mode.
In this mode, the reference module will use an external reference, as previously
defined by the EXTREF instruction.
Execution Sets the position external motion mode (reference type). Four cases are possible:
Example
MODE PE3; // set position external mode, with speed and
// current loops active
TUM1; // set target update mode 1
UPD; // update immediate
Syntax
MODE PP0 MODE Position Profile 0 ( )
MODE PP1 MODE Position Profile 1 (T)
MODE PP2 MODE Position Profile 2 (S)
MODE PP3 MODE Position Profile 3 (S,T)
Operands –
Binary code
MODE PP0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 1 1 0 0 1 1 0 0 0 0 0 1
1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1
MODE PP1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 1 1 0 1 1 1 0 0 0 0 0 1
1 0 0 0 0 1 0 1 0 0 0 0 0 0 0 1
MODE PP2
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 1 1 1 0 1 1 0 0 0 0 0 1
1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 1
MODE PP3
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 1 1 1 1 1 1 0 0 0 0 0 1
1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1
Description MODE PP0/PP1/PP2/PP3 instructions define the position control operating in the
profile reference motion mode. In this mode, the reference module will generate a
position value with a trapezoidal speed profile.
Execution Sets the position profile motion mode (reference type). Four cases are possible:
Example
CACC = 0.5; //Acceleration command for position
//profile (counts/sampling2)
CSPD = 20; //Speed command for position profile
//(counts/sampling)
CPOS = 100000; //Position command (counts)
CPA; //Position command is Absolute
MODE PP3; //Set Position Profile Mode 3
TUM1; //Set Target Update Mode 1
UPD; //Update immediate
Syntax
MODE PPD0 MODE Position External 0 ( )
MODE PPD1 MODE Position External 1 (T)
MODE PPD2 MODE Position External 2 (S)
MODE PPD3 MODE Position External 3 (S,T)
Operands –
Binary code
MODE PPD0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 1 1 0 0 1 1 0 0 0 1 0 0
1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0
MODE PPD1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 1 1 0 1 1 1 0 0 0 1 0 0
1 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0
MODE PPD2
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 1 1 1 0 1 1 0 0 0 1 0 0
1 0 0 0 0 1 1 0 0 0 0 0 0 1 0 0
MODE PPD3
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 1 1 1 1 1 1 0 0 0 1 0 0
1 0 0 0 0 1 1 1 0 0 0 0 0 1 0 0
Execution Sets the position / user pulse & direction motion mode (reference type). Four
cases are possible:
Example
MODE PPD3; //Set Position mode 3 with Pulse &
Direction
//reference
UPD; //Update immediate
Syntax
MODE SC0 MODE Speed Contouring 0 ( )
MODE SC1 MODE Speed Contouring 1 (T)
Operands –
Binary code
MODE SC0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 1 0 1 0 1 1 0 0 0 0 1 0
1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0
MODE SC1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 1 0 1 1 1 1 0 0 0 0 1 0
1 0 0 0 0 0 1 1 0 0 0 0 0 0 1 0
Description MODE SC0/SC1 instruction defines the speed control operating in the contouring
reference motion mode.
In this mode, the reference module will perform linear interpolation based on
motion speed segments described using the SEG instruction. The reference will
represent a speed reference value, in speed control structures. The reference is
generated in the slow control loop (position/speed loop).
See Motion Programming chapter for details about contouring reference
parameters and implementation.
Depending on the selected option (SC0, SC1), the internal current control loop –
is activated/deactivated (depending on the system structure).
Note that if the current control loop is needed to implement the selected mode
(MODE SC1), one must define the corresponding parameters.
The selected motion mode will become effective at the first motion update
command (immediate update – UPD, or update on event, UPD!).
Example
MODE SC1; //Set Speed Contouring Mode 1
TUM1; //Set Target Update Mode 1
SEG 100U, 5.00000; //Set 1st motion segment. Increment
//speed reference with 5 counts/sampling
//for the next 100 sampling periods
UPD; //Update immediate
SEG 100U, 5.00000; //Set 2st motion segment.
SEG 200U, -10.00000; //Set 3st motion segment.
SEG 100U, -10.00000; //Set 4st motion segment.
SEG 200U, 10.00000; //Set 5st motion segment.
SEG 0, 0.; //End of contouring mode
Syntax
MODE SE0 MODE Speed External 0 ( )
MODE SE1 MODE Speed External 1 (T)
Operands –
Binary code
MODE SE0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 0 0 1 0 1 1 0 0 0 0 0 0
1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
MODE SE1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 0 0 1 1 1 1 0 0 0 0 0 0
1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0
Description MODE SE0/SE1 instruction defines the speed control operating in the external
reference motion mode.
In this mode, the reference module will use an external reference, as previously
defined by the EXTREF instruction. The reference will represent a speed
reference value, in speed control structures. The reference will be generated in
the slow control loop (position/speed loop).
See Motion Programming chapter for details about external reference parameters
and implementation.
Depending on the selected option (SE0, SE1), the internal current control loop is
activated or not (depending on the system structure).
Note that if the current control loop is needed to implement the selected mode
(MODE SE1), one must define the corresponding parameters.
The selected motion mode will become effective at the first motion update
command (immediate update – UPD, or update on event, UPD!).
Example
MODE SE1 ; //Set Speed External Mode 1
UPD; //Update immediate
Syntax
MODE SP0 MODE Speed Profile 0 ( )
MODE SP1 MODE Speed Profile 1 (T)
Operands –
Binary code
MODE SP0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 1 0 1 0 1 1 0 0 0 0 0 1
1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1
MODE SP1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 1 0 1 1 1 1 0 0 0 0 0 1
1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1
Description MODE SP0/SP1 instruction defines the speed control operating in the profile
reference motion mode.
In this mode, the reference module will generate a ramp speed profile. The
reference will represent a speed reference value, in speed control structures. The
reference is generated in the slow control loop (position/speed loop).
See Motion Programming chapter for details about speed profile reference
parameters and implementation.
Depending on the selected option (SP0, SP1), the internal current control loop is
activated or not (depending on the system structure).
Note that if the current control loop is needed to implement the selected mode
(MODE SP1), one must define the corresponding parameters.
The selected motion mode will become effective at the first motion update
command (immediate update – UPD, or update on event, UPD!).
Example:
CACC = 0.5; //Acceleration command for speed profile
//(counts/sampling2)
CSPD = -20; //Speed command (counts/sampling)
MODE SP1; //Set Speed Profile Mode 1
UPD; //Update immediate
Syntax
MODE SPD0 MODE Speed External 0 ( )
MODE SPD1 MODE Speed External 1 (T)
Operands –
Binary code
MODE SPD0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 1 0 1 0 1 1 0 0 0 1 0 0
1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0
MODE SPD1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 1 0 1 1 1 1 0 0 0 1 0 0
1 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0
Description MODE SPD0/SPD1 instruction defines the speed control operating in the pulse
and direction reference motion mode.
In this mode, the reference module will get the reference values from the specific
pulse and direction interface of the DSP.
The reference will represent a speed reference value, in speed control structures.
The reference will be generated in the slow control loop (position/speed loop).
See Motion Programming chapter for details about pulse and direction reference
parameters and implementation.
Depending on the selected option (SPD0, SPD1), the internal current control loop
is activated or not (depending on the system structure).
Note that if the current control loop is needed to implement the selected mode
(MODE SPD1), one must define the corresponding parameters.
The selected motion mode will become effective at the first motion update
command (immediate update – UPD, or update on event, UPD!).
Example
MODE SPD1; //Set Speed mode 1 with Pulse & Direction
//reference
UPD; //Update immediate
Syntax
MODE TC MODE Torque Contouring
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 0 0 0 1 1 1 0 0 0 0 1 1
1 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1
Description MODE TC instruction defines the torque control operating in the contouring
reference motion mode.
In this mode, the reference module will perform linear interpolation based on
motion speed segments, described using the SEG instruction. The reference will
represent a torque reference value, in torque control structures.
The reference will be generated in the slow control loop (position/speed loop).
See Motion Programming chapter for details about contouring reference
parameters and implementation.
Note that the current control loop is needed to implement the selected mode, thus
one must define the corresponding parameters.
The selected motion mode will become effective at the first motion update
command (immediate update – UPD, or update on event, UPD!).
Example
MODE TC; //Set Torque Contouring Mode 1
REF0 = 0.00000; //Initial reference
SEG 200U, 2.00000;; //Set 1st motion segment. Increment
//torque reference with 2 bits for the
//next 200 sampling periods
UPD; //Update immediate
SEG 100U, -1.00000; //Set 2st motion segment.
SEG 200U, 0.00000; //Set 3st motion segment.
SEG 100U, -1.00000; //Set 4st motion segment.
Syntax
MODE TEF MODE Torque External Fast
MODE TES MODE Torque External Slow
Operands –
Binary code
MODE TEF
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 0 0 0 1 1 1 1 0 0 0 0 0
1 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0
MODE TES
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 0 0 0 1 1 1 0 0 0 0 0 0
1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0
Description MODE TEF/TES instruction defines the torque control operating in the external
reference motion mode.
If MODE TEF is set, the reference module will always use only the analogue
reference input. In MODE TES there are also possible the other external modes
as previously defined by the EXTREF instruction. The reference will represent a
torque reference value, in torque control structures.
See Motion Programming chapter for details about external reference parameters
and implementation.
Depending on the selected option (TEF or TES), the reference is generated in the
fast control loop or in the slow control loop. This is based to the fact that
normally, an external torque reference needs to be updated in the fast control
loop (where the current controllers are activated).
Note that the current control loop is needed to implement the selected mode, thus
one must define the corresponding parameters.
The selected motion mode will become effective at the first motion update
command (immediate update – UPD, or update on event, UPD!).
Example
MODE TEF; //Set Torque External reference in
//fast loop
UPD; //Update immediate
Syntax
MODE TT MODE Torque Test
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 0 0 0 1 1 1 0 0 1 0 0 0
1 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0
Description MODE TT instruction defines the torque test operating motion mode. In this
mode, the reference module will use the values of specific variables, allowing the
generation of a saturated ramp or a constant value for the amplitude of the torque
/ current and for the electric angle of the motor.
Thus, one can apply a constant or a rotating current vector to the motor, for test
or control loops tuning purposes.
The reference will be generated in the slow control loop (position/speed loop).
See Motion Programming chapter for details about test reference parameters and
implementation.
Note that the current control loop is needed to implement the selected mode, thus
one must define the corresponding parameters.
The selected motion mode will become effective at the first motion update
command (immediate update – UPD, or update on event, UPD!).
Example
MODE TT; //Set Torque Test Mode
REFTST = 40; //Reference saturation value in test mode
//(bits)
RINCTST = 1; //Reference increment value in test mode
//(bits/sampling)
UPD; //Update immediate
Syntax
MODE VC MODE Voltage Contouring
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1
1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1
Description MODE VC instruction defines the voltage control operating in the contouring
reference motion mode.
In this mode, the reference module will perform linear interpolation based on
motion speed segments described using the SEG instruction.
The reference will represent a voltage reference value, in voltage control
structures. The reference will be generated in the slow control loop
(position/speed loop).
See Motion Programming chapter for details about contouring reference
parameters and implementation.
Note that no control loop is needed to implement the selected mode.
The selected motion mode will become effective at the first motion update
command (immediate update – UPD, or update on event, UPD!).
Example
MODE VC; //Set Voltage Contouring
REF0 = 0.00000; //Initial reference
SEG 100U, 12.00000; //Set 1st motion segment. Increment
//voltage reference with 12 bits for
//the next 100 sampling periods
UPD; //Update immediate
SEG 100U, 3.00000; //Set 2st motion segment.
SEG 100U, -15.00000; //Set 3st motion segment.
SEG 0, 0.; //End of contouring mode
Syntax
MODE VEF MODE Voltage External Fast
MODE VES MODE Voltage External Slow
Operands –
Binary code
MODE VEF
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 0 0 0 0 1 1 1 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
MODE VES
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 0 0 0 0 1 1 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Description MODE VEF/VES instructions define the voltage control operating in the external
reference motion mode.
If MODE VEF is set, the reference module will always use only the analogue
reference input. In MODE VES there are also possible the other external modes
as previously defined by the EXTREF instruction.
The reference will represent a voltage reference value, in voltage control
structures. See Motion Programming chapter for details about external reference
parameters and implementation.
Depending on the selected option (VEF or VES), the reference is generated in the
fast control loop or in the slow control loop.
Note that no control loop is needed to implement the selected mode.
The selected motion mode will become effective at the first motion update
command (immediate update – UPD, or update on event, UPD!).
Example
MODE VES; //MODE Voltage External reference in slow loop
UPD; //Update immediate
Syntax
MODE VT MODE Vorque Test
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 0 0 0 0 1 1 0 0 1 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
Description MODE VT instruction defines the voltage test operating motion mode.
In this mode, the reference module will use the values of specific variables,
allowing the generation of a saturated ramp or a constant value for the amplitude
of the voltage and for the electric angle of the motor.
Thus, one can apply a constant or a rotating voltage vector to the motor, for test
purposes.
The reference will be generated in the slow control loop (position/speed loop).
See Motion Programming chapter for details about test reference parameters and
implementation.
Note that no control loop is needed to implement the selected mode.
The selected motion mode will become effective at the first motion update
command (immediate update – UPD, or update on event, UPD!).
Example
MODE VT; //Set Voltage Test Mode
REFTST = 15; //Reference saturation value in test mode
//(bits)
RINCTST = 4; //Reference increment value in test mode
//(bits/sampling)
UPD; //Update immediate
Syntax
NOP No Operation
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Description NOP instruction can be used to introduce a delay between two instructions. It also
can be used as a labeled instruction for GOTO instructions.
Execution No operation is executed. The TML program will continue with the next
instruction.
Example
CACC = 0.5; //Acceleration command for speed profile
//(counts/sampling2)
CSPD = -20; //Speed command (counts/sampling)
MODE SP1; //Set Speed Profile Mode 1
UPD; //Update immediate
CSPD = 30.; // New jog speed command for the next
update
UPD; // on-the-fly change of jog speed, during
//motion
LOOP:
NOP; // no operation
GOTO LOOP; // infinite loop, exit only by RESET or a
//TML interrupt
Syntax
OUTPORT VAR16 OUTput VAR16 value to IOPORT
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 1 0 1 1 0 (9LSBs of &VAR16)
Description The OUTPORT instruction sends a 16-bit value to the user output port. VAR16
variable can be any of the TML or user variables.
See details about user output I/O port according to the drive.
Execution The 16-bit value of Var16 is send to the user output port.
Example
int Var1;
Var1 = 0x1255; // setup Var1 variable
OUTPORT Var1; // output Var1 value to user port
Syntax
RAOU Reset Automatic Origin Update
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Description The RAOU instruction resets the automatic origin update mode. In this case, the
variable POS0 is not changed at event occurrence, and needs to be initialized by
the user. For successive motions, the event tests for relative position will be
based on the same value of the POS0 parameter. Use instruction SAOU in order
to automatically update variable POS0 after each detected event.
Example
CACC = 0.5; //Acceleration command for position profile
//(counts/sampling2)
CSPD = 20; //Speed command for position profile
//(counts/sampling)
CPOS = 80000; //Position command (counts)
CPA; //Position command is Absolute
MODE PP3; //Set Position Profile Mode 3
UPD; //Update immediate
RAOU ; // Reset automatic update mode
POS0 = APOS; //Store the actual position as reference
UPD; //Update immediate
CSPD = 40; //New speed command for position profile
//(counts/sampling)
!RPO 20000; //Set event when relative position >= 20000
//(bits)
UPD!; //Update on event
Syntax
REMGRID value16 Remove value16 from GROUP ID
REMGRID VAR16 Remove value of VAR16 from GROUP ID
Binary code
REMGRID value16
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0
Value16
REMGRID VAR16
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 1 0 0 1 1 0 0 0 0 0 0 0
&VAR16
Description In multiple axis structures, this command allows one to remove a group ID of the
local axis.
After the execution of this command, the group ID value removed is no more
recognized by the axis and the communication drivers will reject messages
addressed to the removed group ID.
Only the lower 8 bits of the value16 or VAR16 parameters are used for group
coding. Each bit corresponds to a group. Up to 8 groups can be
defined/added/removed in a multiple axis structure.
An axis can belong to any of the 8 groups.
A multiple-axis message can be addressed to one axis or to a group of axes.
Execution Delete Group_ID with the specified value from the Group_Ids of the local axis.
Example
GROUPID 1; //local axis belongs to groups 1
ADDGRID 2; //local axis belongs to groups 1 and 2
ADDGRID 5; //local axis belongs to groups 1, 2 and 5
REMGRID 2; //from now on, the local axis belongs only
//groups 1 and 5
Syntax
RESET Reset DSP processor
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0
Description The RESET instruction resets the DSP processor. After this instruction the
complete TML environment is reinitialized. The following basic initializations are performed:
• The TML registers and parameters are initialized with their default values;
• Based on these values, and some hardware tests, the basic hardware
initializations are also performed;
• The TML environment detects if an external memory is installed on the
SPI interface, by identifying a valid TML command at the start address of
this memory;
• If such a program is detected, it is executed; otherwise, an infinite loop is
executed and only an on-line TML command will change this status.
Execute such a command in order to exit from a malfunctioning situation, when
the system does not operate correspondingly.
This instruction can be used also from a TML interrupt or when detecting an error
in the motion system operation (protections, control error, etc.).
Example
CACC = 0.5; //Acceleration command for position profile
//(counts/sampling2)
CSPD = 20; //Speed command for position profile
//(counts/sampling)
CPOS = 70000; //Position command (counts)
CPA; //Position command is Absolute
MODE PP3; //Set Position Profile Mode 3
UPD; //Update immediate
!MC; //Set event when MotionComplete
WAIT!; //WAIT until event occurs
RESET; //After motion complete, reset the system
Syntax
RET Unconditional RETurn from a TML function
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0
Description This instruction allows the return from a TML function (subroutine).
Specific sequences can be called from different points of the TML program.
The RET instruction may be used to end the execution of a function and to
continue the TML sequence following the CALL instruction.
Example
int my_pos;
my_pos = 2000;
CALL MOVEP; //Execute a first motion of 2000
//counts
my_pos = 4000;
Syntax
RETI RETurn from a TML Interrupt function
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0
Description This instruction allows the return from a TML interrupt service routine.
When a TML interrupt service routine is entered, a specific TML sequence is
executed.
The return from interrupt instruction will be used to end the execution of the
interrupt function and to continue the TML sequence that was interrupted.
Example
// test TML interrupts
int u_var, dt ;
fixed dp;
Syntax
RGM Reset axis as Gear/Cam Master
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Description RGM instruction resets the axis from the electronic gearing/camming master
operation mode. In this mode, the reference values will be generated only locally.
The axis does not send its position information to the slave axes, but use it only
locally.
See Motion Programming chapter for details about gearing reference parameters
and implementation.
Execution Resets the axis from the gear/cam master operation mode.
Example
RGM; //exit from master mode; enter in local mode
Syntax
ROUT#n Reset OUT#n to low state (0)
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0
PxDATDIR
ANDrst
ORrst
Description ROUT#n instruction resets the output status of the bit-port (IO line) number n.
Note that the bit-port must be defined as an output port (using the SETIO#n OUT
instruction).
Example
SETIO#13 OUT; //Set IO line 13 as output
ROUT#13; //Reset the IO line 13
Syntax
SAOU Reset Automatic Origin Update
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
Description The SAOU instruction sets the automatic origin update mode. In this case, the
variable POS0 is changed at an UPDATE event occurrence, and needs not to be
initialized by the user. For successive motions, the event tests for relative position
will be based on the updated values of the POS0 parameter. Use instruction
RAOU in order to manually update variable POS0.
Example
CACC = 0.5; //Acceleration command for position profile
//(counts/sampling2)
CSPD = 20; //Speed command for position profile
//(counts/sampling)
CPOS = 90000; //Position command (counts)
CPR; //Position command is Relative
MODE PP3; //Set Position Profile Mode 3
SAOU ; //Set automatic update mode
UPD; //Update immediate
CSPD = 40; //New speed command for position profile
//(counts/sampling)
!RPO 20000; //Set event when relative position >= 20000
//i.e. when motor position has done 20000
// counts
UPD!; //Update on event
WAIT!; //Wait event to occur
Syntax
SAP value32 Set Actual Position to value32
SAP VAR32 Set Actual Position to VAR32
Binary code
SAP value32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
LOWORD(value32)
HIWORD(value32)
SAP VAR32
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
1 0 0 0 0 0 0 (9LSBs of &VAR32)
Description Sets the value of variable APOS (absolute position) with the value value32 or
VAR32. Also corrects the reference value, so that the difference between the
position reference and the actual position before the setting will be preserved
after the change of the absolute position value.
Execution
Depending on the target update mode bit:
If TUM1 is set:
value32:
value32 - old reference + old APOS -> new APOS
value32 -> new reference
VAR32:
VAR32 - old reference + old APOS -> new APOS
VAR32 -> new reference
If TUM0 is set:
value32:
value32 + old reference – old APOS-> new reference
value32 -> new APOS
VAR32:
VAR32 + old reference – old APOS -> new reference
VAR32 -> new APOS
Syntax
SCIBR value16 Set SCI Baud Rate to value16
SCIBR VAR16 Set SCI Baud Rate to VAR16
Binary code
SCIBR value16
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0
Value16
SCIBR VAR16
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0
&VAR16
Description Sets the value of SCI serial communication baud rate, based on the value of the
input parameter value16.
Baud rates range from 9600 to 115200 baud. The default baud rate value of the
drive is 9600.
Execution Sets the SCI serial communication baud rate, based on value16 value:
Example
SCIBR 4; // sets the SCI baud rate to 115200 baud
Syntax
SGM Set axis as Gear/Cam Master
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
Description SGM instruction sets the axis in the gear/cam master operation mode.
In those modes, the position reference values computed for the master axis (the
local axis) will also be sent to the slave axes. The master will use the SLAVEID
parameter in order to generate the address of slave axes toward which the
gearing/camming value is sent.
Depending on the “Electronic gearing/camming mode” bit of OSR register (bit 15),
the value sent to the slaves is the master actual position – APOS (if bit 15 of OSR
is 0), or the master target position – TPOS (if bit 15 of OSR is 1).
See Motion Programming chapter for details about gearing reference parameters
and implementation.
Example
SLAVEID = 2; //ID of the slave axis referenced
SGM; //Enable Master in Electronic Gearing mode
SRB OSR,0xFFFF,0x8000; //Set OSR register, 15 bit to send
//reference position to slave axis 2
UPD; //Update immediate
Syntax
SOUT#n Set OUT#n to high state (1)
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0
PxDATDIR
ANDset
ORset
Description SOUT#n instruction sets the output status of the bit-port number n.
Note that the bit-port must be defined as an output port (using the SETIO#n OUT
instruction).
Example
SETIO#13 OUT; //Set IO line 13 as output
SOUT#13; //Set High to I/O line 13
Syntax
SPIBR value16 Set SPI Baud Rate to value16
SPIBR VAR16 Set SPI Baud Rate to VAR16
Binary code
SPIBR value16
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0
Value16
SPIBR VAR16
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0
&VAR16
Description Sets the value of SPI serial communication baud rate, based on the value of the
input parameter value16 or VAR16.
Baud rates range from 1 to 5 Mbaud. The default baud rate value is 1 Mb.
Execution Sets the SPI serial communication baud rate, based on value16 value:
Example
SPIBR 1; // sets the SPI baud rate to 2 Mbaud
Syntax
SRB VAR16, ANDmask, ORmask Set/Reset Bits of VAR16
SRBL VAR16, ANDmask, ORmask Set/Reset Bits of VAR16 (long
addressing)
Example
int var1;
...
SRB var1, 0xFF0F, 0x0003; //Reset bits 4 to 7, set bits 0
//and 1 of var1
Syntax
STA Set Target position = Actual position
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 1 0 1 1 0 0 1 0 1 1 0 0 1 0
0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0
Description STA instruction sets the value of the target position (the position reference) to the
value of the actual motor position.
This can be useful for example for actualization of the reference during the
execution of a given reference profile, when changing “on-the-fly” the reference
value allows one to re-start from a 0-error point, the reference generation and
motion execution.
Example
MODE PC2; //Set Position Contouring Mode 2
TUM1; //Set target update mode 1
SEG 100U, 5.00000; //Set 1st motion segment
UPD; //Update immediate
SEG 100U, 5.00000; //Set 2st motion segment.
SEG 100U, -20.00000; //Set 3st motion segment.
SEG 100U, 10.00000; //Set 4st motion segment.
SEG 0, 0.; //End of contouring mode
STA; //Set target position value equal to
//the actual position value
Syntax
STOP0 STOP motion in mode 0
STOP1 STOP motion in mode 1
STOP2 STOP motion in mode 2
STOP3 STOP motion in mode 3
Operands –
Binary code
STOP0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0
STOP1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 1 0 1 0 0 0 1 0 0
STOP2
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 0
STOP3
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 1 1 1 0 0 0 1 0 0
When a STOP instruction sent on-line is executed it will also contain an END
instruction after the initialization of the stop mode! The END instruction will stop
the execution of any current TML program!
If a STOP instruction is executed from a TML program, it will only stop the motor.
Example
CACC = 1.5; //Acceleration command for position
//profile (counts/sampling2)
CSPD = -20; //Speed command for position profile
//(counts/sampling)
CPOS = -100000; //Position command (counts)
CPR; //Position command is Relative
MODE PP3; //Set Position Profile Mode 3
UPD; //Update immediate
CSPD = -40; //New speed command for position profile
//(counts/sampling)
!RU -20000; //Set event if Reference =< -20000
//(counts)
WAIT!; //Wait until event occurs
STOP0; //Apply 0 voltage reference to the motor
Syntax
STOP0! STOP motion in mode 0 on event
STOP1! STOP motion in mode 1 on event
STOP2! STOP motion in mode 2 on event
STOP3! STOP motion in mode 3 on event
Operands –
Binary code
STOP0!
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0
STOP1!
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0
STOP2!
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0
STOP3!
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 1 1 0 0 0 1 0 0
Description STOP[0/1/2/3]! Instruction imposes a motor stop when an event occurs during
the motion. Four different stop modes can be used, as presented in the table
bellow.
Syntax
TUM0 Set Target Update Mode 0
TUM1 Set Target Update Mode 1
Operands –
Binary code
TUM0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
TUM1
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 0 1 1 0 0 1 0 0 0 0 1 0 0 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Description TUM0 and TUM1 (target update mode 0 or 1) let the user to choose how to
consider the origin for relative positioning commands.
After a TUM0 command, the origin is considered as the actual motor position
(default). This option is useful in applications where, for example, the motor
should move a specified distance after it reaches a contact (event that can be
signaled by setting an input event).
After a TUM1 command, the origin is considered as the target position. In this
case, successive relative moves can be commanded and the final target
represents the exact sum of the individual commands. In the example below, 2nd
update command occurs when the motion commanded by the 1st update is
complete, i.e. when target position reaches the command value 3000. Hence, due
to TUM1 mode, the next absolute position command is 3000+3000 = 6000.
It is important to note that the event motion complete refers to the target position
and not to the actual motor position, which follows the target usually with a certain
delay. If in the example below, TUM1 command is replaced with TUM0, the next
position command will not be 6000, but 6000 – the position error from the
moment when target position reaches 3000.
Execution After a TUM0 command, the origin is considered as the actual motor position
(default). After a TUM1 command, the origin is considered as the target position.
Example
CACC = 0.5; //Acceleration command for position profile
CSPD = 10; //Speed command for position profile
CPOS = 3000; //Position command
CPR; //Position command is Relative
MODE PP3; //Set Position Profile Mode 3
TUM1; //Set Target Update Mode 1
UPD; //Update immediate
Syntax
UPD UPDate motion immediate
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0
Description All motion parameters are buffered. Consequently, when a motion parameter is
changed, the new value is placed into a buffer. This operation doesn’t affect the
reference generator, which continues to generate the target reference using the
previous motion parameters.
In order to activate the new motion parameters an update command must be
issued. The update command UPD transfers all motion parameters from buffers
into the active registers, which are used for reference computation.
The same principle applies also to the MODE commands, which set the motion
modes.
The update command can be issued at any time. If it is issued during motion, it
determines a motion mode and/or motion parameter change on the fly. If it is
issued after the motion was completed, it acts like a start motion command.
Execution Transfer all motion parameters from buffers into the active registers, which are
used for reference computation.
Example
CACC = 0.5; //Acceleration command for speed
//profile(counts/sampling2)
CSPD = 40; //Speed command (counts/sampling)
MODE SP1; //Set Speed Profile Mode 1
UPD; //Update immediate
CSPD = -40; //Speed command (counts/sampling)
UPD; //Update immediate
Syntax
UPD! UPDate motion on event !
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0
Execution Transfer all motion parameters from buffers into the active registers, which are
used for reference computation, when a monitored event occurs.
Example
CACC = 1.5; //Acceleration command for speed profile
//(counts/sampling2)
CSPD = 20; //Speed command (counts/sampling)
MODE SP1; //Set Speed Profile Mode 1
UPD; //Update immediate
ENLSP1; //Positive Limit Switch triggers rising
edge
CSPD = -20; //New speed command (counts/sampling)
!LSP; //Set event if Positive LimitSwitch is
//reached
UPD!; //Update on event
Syntax
WAIT! WAIT motion event !
Operands –
Binary code
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0
Description WAIT! holds the execution of the following TML instructions from the TML
program sequence, until the monitored event occurs.
There are 18 events, which can be programmed, one at a time, for monitoring:
!MC When the actual motion is completed
!APO When motor absolute position is equal or over a value or
the value of a variable
!APU When motor absolute position is equal or under a value or
the value of a variable
!RPO When motor relative position is equal or over a value or the
value of a variable
!RPU When motor relative position is equal or under a value or
the value of a variable
!SO When motor speed is equal or over a value or the value of
a variable
!SU When motor speed is equal or under a value or the value of
a variable
!AT After a wait absolute time equal with a value or the value of
a variable
!RT After a wait relative time equal with a value or the value of a
variable
!RO When position/speed/torque/voltage reference is equal or
over a value or the value of a variable
!RU When position/speed/torque/voltage reference is equal or
under a value or the value of a variable
!CAP When the selected capture input is triggered
!LSP When the positive limit switch is triggered
!LSN When the negative limit switch is triggered
!IN#n 1 When a digital input goes high
!IN#n 0 When a digital input goes low
Execution Hold up execution of the following instructions until the monitored event occurs.
Example:
CACC = 1; //Acceleration command for speed profile
//(counts/sampling2)
CSPD = 25.5; // Speed command (counts/sampling)
MODE SP1; //Set Speed Profile Mode 1
UPD; //Update immediate
!SO 10; //Set event if speed >= 10
(counts/sampling)
. . .
STOP2!; //Stop mode 2 when event occurs
WAIT!; //Wait until event occurs