OMRON products are manufactured for use according to proper procedures
by a qualified operator and only for the purposes described in this manual.
The following conventions are used to indicate and classify precautions in
this manual. Always heed the information provided with them. Failure to
heed precautions can result in injury to people or damage to property.
Definition of precautionary information
WARNING
Indicates a potentially hazardous situation, which, if not avoided,
could result in death or serious injury.
Caution
Indicates a potentially hazardous situation, which, if not avoided,
may result in minor or moderate injury, or property damage.
Trademarks and Copyrights
PROFIBUS is a registered trademark of PROFIBUS International.
MECHATROLINK is a registered trademark of Yaskawa Corporation.
DeviceNet is a registered trademark of Open DeviceNet Vendor Assoc INC.
CIP is a registered trademark of Open DeviceNet Vendor Assoc INC.
CANopen is a registered trademark of CAN in Automation (CiA).
ModbusTCP is a registered trademark of Modbus IDA.
Trajexia is a registered trademark of OMRON.
Motion Perfect is a registered trademark of Trio Motion Technology Ltd.
All other product names, company names, logos or other designations
mentioned herein are trademarks of their respective owners.
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, mechanical, electronic, photocopying,
recording, or otherwise, without the prior written permission of OMRON.
No patent liability is assumed with respect to the use of the information contained herein.
Moreover, because OMRON is constantly striving to improve its high-quality products, the
information contained in this manual is subject to change without notice. Every precaution
has been taken in the preparation of this manual. Nevertheless, OMRON assumes no
responsibility for errors or omissions. Neither is any liability assumed for damages resulting
from the use of the information contained in this publication.
PROGRAMMING MANUALI
About this manual
NameCat. No.Contents
This manual describes the installation and operation of the Trajexia Motion
Control System.
Please read this manual and the related manuals listed in the following table
carefully and be sure you understand the information provided before
attempting to install or operate the Trajexia Motion Control units. Be sure to
read the precautions provided in the following section.
/i
NameCat. No.Contents
Trajexia motion control system
QUICK START
GUIDE
Trajexia motion control system HARDWARE
REFERENCE MANUAL
Trajexia motion control system
PROGRAMMING
MANUAL
Sigma-II Servo
Driver manual
Sigma-III with
MECHATROLINK
interface manual
Sigma-V Servo
Driver manual
JUNMA series servo
Revision 5.0
drive manual
I50EDescribes how to get quickly familiar
with Trajexia, moving a single axis using
MECHATROLINK-II, in a test set-up.
I51EDescribes the installation and hardware
specification of the Trajexia units, and
explains the Trajexia system philosophy.
I52EDescribes the BASIC commands to be
used for programming Trajexia, communication protocols and Trajexia Studio
software, gives practical examples and
troubleshooting information.
SIEP S800000 15Describes the installation and operation
of Sigma-II Servo Drivers
SIEP S800000 11Describes the installation and operation
of Sigma-III Servo Drivers with MECHATROLINK-II interface
TOEP-C71080603 01-OY Describes the installation and operation
Describes the installation and operation
of Sigma-V Servo Drivers
of JUNMA Servo Drivers
V7 InverterTOEP C71060605 02-OY Describes the installation and operation
of V7 Inverters
F7Z InverterTOE S616-55 1-OYDescribes the installation and operation
of F7Z Inverters
G7 InverterTOE S616-60Describes the installation and operation
of G7 Inverters
JUSP-NS115 manual
SI-T MECHATROLINK interface for
the G7 & F7
ST-T/V7 MECHATROLINK interface
for the V7
MECHATROLINK IO
Modules
SYSMAC CS/CJ
Series Communications Commands
Omron Smartslice
GRT1-Series, slice I/
O units, Operation
manual
Omron G-series
user’s manual
Omron Accurax G5
user’s manual
Trajexia Studio user
manual
SIEP C71080001Describes the installation and operation
of the MECHATROLINK-II application
module
SIBP-C730600-08Describes the installation and operation
of MECHATROLINK-II interfaces for G7
and F7 Inverters
SIBP-C730600-03Describes the installation and operation
of MECHATROLINK-II interfaces for V7
Inverters
SIE C887-5Describes the installation and operation
of MECHATROLINK-II input and output
modules and the MECHATROLINK-II
repeater
W342Describes FINS communications proto-
col and FINS commands
W455-E1Describes the installation and operation
of Omron slice I/O units
I566-E1Describes the installation and operation
of G-series Servo Drivers
I572-E1Describes the installation and operation
of Accurax G5 Servo Drivers
I56E-ENDescribes the use of Trajexia Studio
programming software
PROGRAMMING MANUALII
WARNING
Failure to read and understand the information provided in this
manual may result in personal injury or death, damage to the product, or product failure. Please read each section in its entirety and
be sure you understand the information provided in the section and
related sections before attempting any of the procedures or operations given.
Functions supported by unit versions
During the development of Trajexia new functionality was added to the
controller unit after market release.
This functionality is implemented in the firmware, and/or the FPGA of the
controller unit.
In the table below, the overview of the applicable functionality is shown
related to the firmware and FPGA version of the TJ1-MC__.
/i
Connect the TJ1-MC__ to Trajexia Studio software. Refer to the
Programming Manual.
Open the terminal window and type the following commands:
Type
PRINT VERSION in the terminal window. The version parameter returns
the current firmware version number of the motion controller.
Type
PRINT FPGA_VERSION SLOT(-1) in the terminal window. The
parameter returns the current FPGA version number of the TJ1-MC__.
FunctionalityTJ1-MC__ Firmware
version
Full support TJ1-FL02V1.650921 and higher
Support BASIC commands FINS_COMMSV1.6509All versions
Support TJ1-DRTV1.6509All versions
Support TJ1-MC04 andTJ1-ML04V1.660721 and higher
Support TJ1-CORT, GRT1-ML2, ModbusTCP, Sigma-V series Servo Drivers
(except DATUM and REGIST BASIC com-
mands) and allow Inverters to be controlled
as servo axes
Support for G-series Drivers, full support for
Sigma-V series Servo Drivers
Support for Accurax G5 DriversV1.672021 and higher
Revision 5.0
V1.665221 and higher
V1.671421 and higher
TJ1-MC__ FPGA
version
Verify the firmware and FPGA versions of the TJ1-MC__
PROGRAMMING MANUALIII
Contents
1Safety warnings and precautions................................................................................................................................................................1
2Trajexia system ...........................................................................................................................................................................................6
2.5Command line interface ..................................................................................................................................................................................................................13
5Examples and tips .................................................................................................................................................................................... 212
6.1Voltage and analysis tools ............................................................................................................................................................................................................293
Revision history ..............................................................................................................................................................................................307
Revision 5.0
PROGRAMMING MANUALV
Safety warnings and precautions
1Safety warnings and precautions
1.1Intended audience
This manual is intended for personnel with knowledge of electrical systems
(electrical engineers or the equivalent) who are responsible for the design,
installation and management of factory automation systems and facilities.
WARNING
Never short-circuit the positive and negative terminals of the batteries, charge the batteries, disassemble them, deform them by
applying pressure, or throw them into a fire.
The batteries may explode, combust or leak liquid.
1.2General precautions
The user must operate the product according to the performance
specifications described in this manual.
Before using the product under conditions which are not described in the
manual or applying the product to nuclear control systems, railroad systems,
aviation systems, vehicles, safety equipment, petrochemical plants, and
other systems, machines and equipment that can have a serious influence
on lives and property if used improperly, consult your OMRON
representative.
1.3Safety precautions
WARNING
Do not attempt to take the Unit apart and do not touch any of the
internal parts while power is being supplied.
Doing so may result in electrical shock.
WARNING
Do not touch any of the terminals or terminal blocks while power is
being supplied.
Doing so may result in electric shock.
Revision 5.0
WARNING
Fail-safe measures must be taken by the customer to ensure
safety in the event of incorrect, missing, or abnormal signals
caused by broken signal lines, momentary power interruptions, or
other causes.
Not doing so may result in serious accidents.
WARNING
Emergency stop circuits, interlock circuits, limit circuits, and similar
safety measures must be provided by the customer as external circuits, i.e., not in the Trajexia motion controller.
Not doing so may result in serious accidents.
WARNING
When the 24-VDC output (I/O power supply to the TJ1) is overloaded or short-circuited, the voltage may drop and result in the
outputs being turned off.As a countermeasure for such problems,
external safety measures must be provided to ensure safety in the
system.
WARNING
The TJ1 outputs will go off due to overload of the output transistors
(protection).As a countermeasure for such problems, external
safety measures must be provided to ensure safety in the system.
PROGRAMMING MANUAL1
Safety warnings and precautions
WARNING
The TJ1 will turn off the WDOG when its self-diagnosis function
detects any error.As a countermeasure for such errors, external
safety measures must be provided to ensure safety in the system.
WARNING
Provide safety measures in external circuits, i.e., not in the Trajexia Motion Controller (referred to as "TJ1"), in order to ensure
safety in the system if an abnormality occurs due to malfunction of
the TJ1 or another external factor affecting the TJ1 operation.
Not doing so may result in serious accidents.
WARNING
Do not attempt to disassemble, repair, or modify any Units.
Any attempt to do so may result in malfunction, fire, or electric
shock.
Caution
Confirm safety at the destination unit before transferring a program
to another unit or editing the memory.
Doing either of these without confirming safety may result in injury.
Caution
User programs written to the Motion Control Unit will not be automatically backed up in the TJ1 flash memory (flash memory function).
Caution
Tighten the screws on the terminal block of the Power Supply Unit
to the torque specified in this manual.
Loose screws may result in burning or malfunction.
1.4Operating environment precautions
Caution
Do not operate the Unit in any of the following locations.
Doing so may result in malfunction, electric shock, or burning.
-Locations subject to direct sunlight.
-Locations subject to temperatures or humidity outside the
range specified in the specifications.
-Locations subject to condensation as the result of severe
changes in temperature.
-Locations subject to corrosive or flammable gases.
-Locations subject to dust (especially iron dust) or salts.
-Locations subject to exposure to water, oil, or chemicals.
-Locations subject to shock or vibration.
Caution
Take appropriate and sufficient countermeasures when installing
systems in the following locations.
Inappropriate and insufficient measures may result in malfunction.
-Locations subject to static electricity or other forms of noise.
-Locations subject to strong electromagnetic fields.
-Locations subject to possible exposure to radioactivity.
-Locations close to power supplies.
Revision 5.0
Caution
Pay careful attention to the polarity (+/-) when wiring the DC power
supply.A wrong connection may cause malfunction of the system.
PROGRAMMING MANUAL2
Safety warnings and precautions
Caution
The operating environment of the TJ1 System can have a large
effect on the longevity and reliability of the system.
Improper operating environments can lead to malfunction, failure,
and other unforeseeable problems with the TJ1 System.
Make sure that the operating environment is within the specified
conditions at installation and remains within the specified conditions during the life of the system.
1.5Application precautions
WARNING
Do not start the system until you check that the axes are present
and of the correct type.
The numbers of the Flexible axes will change if MECHATROLINKII network errors occur during start-up or if the MECHATROLINK-II
network configuration changes.
WARNING
Check the user program for proper execution before actually running it in the Unit.
Not checking the program may result in an unexpected operation.
Caution
Take appropriate measures to ensure that the specified power with
the rated voltage and frequency is supplied. Be particularly careful
in places where the power supply is unstable.
An incorrect power supply may result in malfunction.
Caution
Install external breakers and take other safety measures against
short-circuiting in external wiring.
Insufficient safety measures against short-circuiting may result in
burning.
Caution
Do not apply voltage to the Input Units in excess of the rated input
voltage.
Excess voltage may result in burning.
Caution
Do not apply voltage or connect loads to the Output Units in
excess of the maximum switching capacity.
Excess voltage or loads may result in burning.
Caution
Disconnect the functional ground terminal when performing with-
Caution
Always use the power supply voltage specified in this manual.
An incorrect voltage may result in malfunction or burning.
Revision 5.0
PROGRAMMING MANUAL3
stand voltage tests.
Not disconnecting the functional ground terminal may result in
burning.
Safety warnings and precautions
Caution
Always connect to a class-3 ground (to 100Ω or less) when installing the Units.
Not connecting to a class-3 ground may result in electric shock.
Caution
Always turn off the power supply to the system before attempting
any of the following.
Not turning off the power supply may result in malfunction or electric shock.
-Mounting or dismounting expansion Units, CPU Units, or any
other Units.
-Assembling the Units.
-Setting dipswitches or rotary switches.
-Connecting or wiring the cables.
-Connecting or disconnecting the connectors.
Caution
Be sure that all mounting screws, terminal screws, and cable connector screws are tightened to the torque specified in this manual.
Incorrect tightening torque may result in malfunction.
Caution
Use crimp terminals for wiring. Do not connect bare stranded wires
directly to terminals.
Connection of bare stranded wires may result in burning.
Caution
Double-check all the wiring before turning on the power supply.
Incorrect wiring may result in burning.
Caution
Wire correctly.
Incorrect wiring may result in burning.
Caution
Mount the Unit only after checking the terminal block completely.
Caution
Be sure that the terminal blocks, expansion cables, and other
items with locking devices are properly locked into place.
Improper locking may result in malfunction.
Caution
Leave the dust protective label attached to the Unit when wiring.
Removing the dust protective label may result in malfunction.
Caution
Confirm that no adverse effect will occur in the system before
changing the operating mode of the system.
Not doing so may result in an unexpected operation.
Caution
Remove the dust protective label after the completion of wiring to
Revision 5.0
ensure proper heat dissipation.
Leaving the dust protective label attached may result in malfunction.
PROGRAMMING MANUAL4
Safety warnings and precautions
Caution
Resume operation only after transferring to the new CPU Unit the
contents of the VR and table memory required for operation.
Not doing so may result in an unexpected operation.
Caution
Use the dedicated connecting cables specified in operation manuals to connect the Units.Using commercially available RS-232C
computer cables may cause failures in external devices or the
Motion Control Unit.
Caution
When replacing parts, be sure to confirm that the rating of a new
part is correct.
Not doing so may result in malfunction or burning.
Caution
Outputs may remain on due to a malfunction in the built-in transistor outputs or other internal circuits.As a countermeasure for such
problems, external safety measures must be provided to ensure
the safety of the system.
Caution
Do not pull on the cables or bend the cables beyond their natural
limit. Doing so may break the cables.
Caution
The TJ1 will start operating in RUN mode when the power is
turned on and if a BASIC program is set to Auto Run mode.
Caution
1.6Unit assembly precautions
Before touching the system, be sure to first touch a grounded
metallic object in order to discharge any static build-up.
Otherwise it might result in a malfunction or damage.
Caution
Install the unit properly.
Caution
Improper installation of the unit may result in malfunction.
UTP cables are not shielded. In environments that are subject to
noise use a system with shielded twisted-pair (STP) cable and
hubs suitable for an FA environment.
Do not install twisted-pair cables with high-voltage lines.
Do not install twisted-pair cables near devices that generate noise.
Do not install twisted-pair cables in locations that are subject to
high humidity.
Caution
Be sure to mount the Termination Unit supplied with the TJ1MC__ to the right most Unit.
Unless the Termination Unit is properly mounted, the TJ1 will not
function properly.
Do not install twisted-pair cables in locations subject to excessive
Revision 5.0
dirt and dust or to oil mist or other contaminants.
PROGRAMMING MANUAL5
Trajexia system
2Trajexia system
2.1Introduction
Trajexia is OMRON's motion platform that offers you the performance and
the ease of use of a dedicated motion system.
Trajexia is a stand-alone modular system that allows maximum flexibility and
scalability. At the heart of Trajexia lies the TJ1 multi-tasking motion
coordinator. Powered by a 32-bit DSP, it can do motion tasks such as e-cam,
e-gearbox, registration control and interpolation, all using simple motion
commands.
Trajexia offers control of up to 16 axes over a MECHATROLINK-II motion
bus or traditional analogue or pulse control with independent position, speed
or torque control for every axis. And its powerful motion instruction set
makes programming intuitive and easy.
You can select from a wide choice of best-in-class rotary, linear and directdrive servos as well as Inverters. The system is scalable up to 16 axes and 8
Inverters & I/O modules.
2.1.1Trajexia hardware
The Trajexia hardware is described in the Trajexia Hardware Reference
manual. It is recommend to read the Hardware Reference manual first.
The Trajexia system gives these advantages:
NS-series HMI
Digital I/O
Hostlink
CJ-series PLCCX-one
Ethernet
MECHATROLINK-II
fig. 1
Trajexia Tools
PROFIBUS-DP
Master
DEVICENET
Master
CANopen
Master
Direct connectivity via Ethernet
Trajexia's Ethernet built-in port provides direct and fast connectivity to PCs,
PLCs, HMIs and other devices while providing full access to the drives over
a MECHATROLINK-II motion bus. It allows explicit messaging over Ethernet
and through MECHATROLINK-II to provide full transparency down to the
actuator level, and making remote access possible.
Revision 5.0
PROGRAMMING MANUAL6
Trajexia system
Keep your know-how safe
Trajexia's encryption method guarantees complete protection and
confidentiality for your valuable know-how.
Serial Port and Local I/Os
A serial port provides direct connectivity with any OMRON PLC, HMIs or any
other field device. 16 Inputs and 8 outputs are freely configurable embedded
I/Os in the controller to enable you to tailor Trajexia to your machine design.
MECHATROLINK-II Master
The MECHATROLINK-II master performs control of up to 16 servos,
Inverters or I/Os while allowing complete transparency across the whole
system.MECHATROLINK-II offers the communication speed and time
accuracy essential to guarantee perfect motion control of servos. The
motion cycle time is selectable between 0.5 ms, 1 ms or 2 ms.
TJ1-FL02 (Flexible Axis Unit)
The TJ1-FL02 allows full control of two actuators via an analogue output or
pulse train. The module supports the main absolute encoder protocols
allowing the connection of an external encoder to the system.
Drives and Inverters
A wide choice of rotary, linear and direct-drive servos as well as Inverters
are available to fit your needs in compactness, performance and reliability.
The Inverters connected to the MECHATROLINK-II are driven at the same
update cycle time as the Servo Drivers.
Remote I/Os
The I/Os on the MECHATROLINK-II motion bus provide for system
expansion while keeping the devices under one motion bus.
PROFIBUS-DP
The PROFIBUS-DP slave allows connectivity to the PROFIBUS network in
Revision 5.0
your machine.
DeviceNet
The DeviceNet slave allows connectivity to the DeviceNet network in your
machine.
CANopen
The CANopen master allows connectivity to the CANopen network in your
machine.
2.1.2This manual
This Programming Manual gives the dedicated information for:
•The description and use of the BASIC commands
•The communication protocols necessary for the Trajexia system
•The use and description of the parts of the Trajexia Studio interface
•Program examples and good programming practices
•Troubleshooting and fault finding.
2.2Multitasking BASIC programming
The TJ1-MC__ units (Motion Controller Unit) feature a multitasking version
of the BASIC programming language. The motion control language is largely
based upon a tokenised BASIC and the programs are compiled into the
tokenised form prior to their execution.
Multitasking is simple to set up and use and allows very complex machines
to be programmed. Multitasking gives the TJ1-MC__ a significant advantage
over equivalent single task systems. It allows modular applications where
the logically connected processes can be grouped together in the same task
program, thus simplifying the code architecture and design.
The TJ1-MC__ can hold up to 14 programs if memory size permits. The
execution of the programs is user controlled using BASIC.
The BASIC commands, functions and parameters presented here can be
found in chapter 3.
PROGRAMMING MANUAL7
Trajexia system
2.3BASIC programming
The BASIC language consists among others of commands, functions and
parameters. These BASIC statements are the building blocks provided to
control the TJ1-MC__ operation.
Commands are words recognized by the processor that perform a certain
action but do not return a value. For example, PRINT is a recognized word
that will cause the value of the following functions or variables to be printed
on a certain output device.
Functions are words recognized by the processor that perform a certain
action and return a value related to that action. For example, ABS will take
the value of its parameter and return the absolute value of it to be used by
some other function or command. For example ABS(-1) will return the value
1, which can be used by the PRINT command, for example, to generate a
string to be output to a certain device.
Parameters are words recognized by the processor that contain a certain
value. This value can be read and, if not read only, written. Parameters are
used to determine and monitor the behavior of the system. For example,
ACCEL determines the acceleration rate of a movement for a certain axis.
2.3.1Axis, system and task statements
The commands, functions and parameters apply either to (one of) the axes,
the tasks running or the general system.
Individual axis dependent commands or parameters can also be
programmed to work on a temporary base axis by including the AXIS
function as a modifier in the axis dependent command. A temporary base
axis is effective only for the command or parameter after which AXIS
appears.
Task statements
The task parameters apply to a single task. The task parameters monitor the
task for example for error handling. The PROC modifier allows the user to
access a parameter of a certain task. Without PROC the current task is
assumed. The BASE command (see above) is task specific and can be
used with the PROC modifier.
System statements
These statements govern the overall system features, which are basically all
statements which do not belong to the first two groups.
2.3.2Memory areas
Three main memory areas can be identified in the Trajexia Motion Controller
Unit:
•I/O memory.
•VR memory.
•TABLE memory.
Axis statements
The motion control commands and the axis parameters apply to one or more
axes. Axis parameters determine and monitor how an axis reacts on
commands given and how it reacts to the outside world. Every axis has a set
of parameters, so that all axes can work independently of each other. The
motion control commands are able to control one or more of the axes
simultaneously, while every axis has its own behavior. The axis parameters
are reset to their default values for each startup.
The commands and parameters work on some base axis or group of axes,
Revision 5.0
specified by the BASE command. The BASE command is used to change
this base axis group and every task has its own group which can be changed
at any time. The default base axis is 0.
PROGRAMMING MANUAL8
I/O memory
I/O memory is used for holding the status of input and output devices
connected to the Trajexia system. It is divided into two sub-areas: one for
digital I/O memory, and one for analog I/O memory. The digital I/O memory
holds input and output statuses of digital I/O devices. Its capacity is 256 bits
(input points) for input and 256 bits (output points) for outputs. The inputs in
this memory can be accessed using the IN command. The outputs can be
accessed using the OUT command.
The analog I/O memory holds input and output values of analog I/O devices.
Its capacity is 36 input channels and 36 output channels. The analog input
channels can be accessed using the AIN command. The analog output
channels can be accessed using the AOUT command.
Trajexia system
VR memory
VR memory is commonly used if some data or value needs to be global,
which means that it is accessible from all programs in the project at the
same time. The size of this memory is 1024 slots with indexes 0 to 1023. A
memory slot is addressed using the VR(x) macro where x is index of the VR
memory slot. The VR memory is accessible for reading and writing. Writing
is done by making mathematical assignment using the = command in the
program. The content of this memory is held in the battery powered RAM
memory and is preserved during power off. The VR memory is also
preserved when changing the battery, if this is done quickly.
TABLE memory
TABLE is commonly used if some data or value needs to be global, which
means that it is accessible from all programs in the project at the same time.
Whereas the VR memory is used for similar purposes to define several
global data and values, TABLE memory is used for much bigger amounts of
global data, which also need to be arranged in a certain order. For this
reason, TABLE memory is commonly used for storing TABLE data, motion
profiles, logging data, etc. Some BASIC commands that provide this type
and size of data, for example SCOPE, CAM, CAMBOX etc., require use of
TABLE memory to write their results. The size of this memory is 64000 slots
with indexes 0 to 63999. The TABLE is accessible for reading and writing
too, but the way it is accessed differs for those two operations. Before being
read, a particular TABLE memory slot needs to be defined and written first,
using the command TABLE(x, value1, value2,…) where x is the index of
the start TABLE memory slot to define, and value1, value2, ... are the
values written into the TABLE memory at indexes x, x+1, ... Once defined
and written, the TABLE memory slot can be read using the TAB LE ( x )
command, where x is the index of the TABLE memory slot. An attempt to
read an undefined TABLE memory slot results in an error reported by the
TJ1-MC__. The TABLE memory content is held in the battery powered RAM
memory and is preserved during power off. The TABLE memory is also
preserved when changing the battery, if this is done quickly.
Revision 5.0
2.3.3Data structures and variables
BASIC programs can store numerical data in various types of variables.
Some variables have predefined functions, such as the axis parameters and
system parameters; other variables are available for the programmer to
define as required in programming. The TABLE, global and local variables of
the TJ1-MC__ are explained in this section. Furthermore also the use of
labels will be specified.
TABLE variables
The TABLE is an array structure that contains a series of numbers. These
numbers are used for instance to specify positions in the profile for a CAM or
CAMBOX command. They can also be used to store data for later use, for
example to store the parameters used to define a workpiece to be
processed.
The TABLE is common to all tasks on the TJ1-MC__. This means that the
values written to the TABLE from one task can be read from other tasks.
TABLE values can be written and read using the TABLE command. The
maximum length of the array is 64000 elements, from TABLE(0) to
TABLE(63999). The TABLE array is initialized up to the highest defined
element.
Global variables
The global variables, defined in VR memory, are common to all tasks on the
TJ1-MC__. This means that if a program running on task 2 sets VR(25) to a
certain value, then any other program running on a different task can read
that same value from VR(25). This is very useful for synchronizing two or
more tasks, but care must be taken to avoid more than one program writing
to the same variable at the same time. The controller has 1024 global
variables, VR(0) to VR(1023). The variables are read and written using the
VR command.
PROGRAMMING MANUAL9
Trajexia system
/i
Note
The TABLE and VR data can be accessed from the different running tasks. When using either VR or TABLE variables, make sure
to use only one task to write to one particular variable. This to
avoid problems of two program tasks writing unexpectedly to one
variable.
Local variables
Named variables or local variables can be declared in programs and are
local to the task. This means that two or more programs running on different
tasks can use the same variable name, but their values can be different.
Local variables cannot be read from any task except for the one in which
they are declared. Local variables are always cleared when a program is
started. The local variables can be cleared by using either the CLEAR or the
RESET command.
A maximum of 255 local variables can be declared. Only the first 16
characters of the name are significant. Undefined local variables will return
zero. Local variables cannot be declared on the command line.
Labels
The BASIC programs are executed in descending order through the lines.
Labels can be used to alter this execution flow using the BASIC commands
GOTO and GOSUB. To define a label it must appear as the first statement
on a line and it must be ended by a colon (:). Labels can be character strings
of any length, but only the first 15 characters are significant.
Using variables and labels
Each task has its own local labels and local variables. For example, consider
the two programs shown below:
Revision 5.0
start:
FOR a = 1 to 100
MOVE(a)
WAIT IDLE
NEXT a
GOTO start
start:
a=0
REPEAT
a = a + 1
PRINT a
UNTIL a = 300
GOTO start
These two programs when run simultaneously in different tasks and have
their own version of variable a and label start.
If you need to hold data in common between two or more programs, VR
variables should be used. Or alternatively if the large amount of data is to be
held, the TABLE memory can be used.
To make a program more readable when using a global VR variable, two
approaches can be taken. The first is using a named local variable as a
constant in the VR variable. The local constant variable, however, must be
declared in each program using the global VR variable. Using this approach,
the example below shows how to use VR(3) to hold a length parameter
common for several programs:
The other approach is even more readable and uses the GLOBAL
command to declare the name as a reference to one of the global VR
variables. The name can then be used from within the program containing
the GLOBAL definition and all other programs. Take care that the program
containing the GLOBAL definition must be run before the name is used in
other programs. The best practice is to define global names in the start-up
program. Using this approach, the example above becomes:
PROGRAMMING MANUAL10
Trajexia system
/i
'The declaration in start-up program
GLOBAL length, 3
'In other programs executed after the start-up program
start:
length = x
...
...
start:
MOVE(length)
PRINT(length)
...
2.3.4Mathematical specifications
Number format
The TJ1-MC__ has two main formats for numeric values: single precision
floating point and single precision integer.
The single precision floating point format is internally a 32 bit value. It has an
8 bit exponent field, a sign bit and a 23 bit fraction field with an implicit 1 as
the 24th bit. Floating point numbers have a valid range of ±5.9×10
±3.4×10
38
.
Integers are essentially floating point numbers with a zero exponent. This
implies that the integers are 24 bits wide. The integer range is therefore
given from -16,777,216 to 16,777,215. Numeric values outside this range
will be floating point.
WARNING
All mathematical calculations are done in floating point format. This
implies that for calculations of/with larger values the results may
have limited accuracy. The user should be aware of this when
developing the motion control application.
−39
to
>> VR(0)=$FF
>> PRINT VR(0)
255.0000
A value can be printed in hexadecimal by using the HEX function. Negative
values result in the 2’s complement hexadecimal value (24-bit). Valid range
is from −8,388,608 to 16,777,215. Example:
For positioning, the TJ1-MC__ will round up if the fractional encoder edge
distance calculated exceeds 0.9. Otherwise the fractional value will be
rounded down. The internal measured position and demanded position of
the axes, represented by the MPOS and DPOS axis parameters, have 32-bit
counters.
Floating point comparison
The comparison function considers a small difference between values as
equal to avoid unexpected comparison results. Therefore any two values for
which the difference is less than 1.19×10
−6
are considered equal.
Precedence
The precedence of the operators is given below:
1. Unary minus, NOT
2. ^
3. / *
4. MOD
5. + -
6. = <> > >= <= <
7. AND OR XOR
8. Left to right
Hexadecimal format
Revision 5.0
The TJ1-MC__ supports assigning and printing hexadecimal values. A
hexadecimal number is input by prefixing the number with the $ character.
The best way to ensure the precedence of various operators is through the
use of parentheses.
Valid range is from 0x0 to 0xFFFFFF. Example:
PROGRAMMING MANUAL11
Trajexia system
2.4Motion execution
Every task on the TJ1-MC__ has a set of buffers that holds the information
from the motion commands given.
2.4.1Motion generator
The motion generator has a set of two motion buffers for each axis. One
buffer called MTYPE, holds the Actual Move, which is the move currently
executing on the axis. The other buffer called NTYPE, holds the Next Move,
which is executed after the Actual Move has finished.
See chapter 2.8 “Motion Buffers” in the Trajexia Hardware Reference
manual for detailed explanation.
The BASIC programs are separate from the motion generator program,
which controls moves for the axes. The motion generator has separate
functions for each axis, so each axis is capable of being programmed with its
own axis parameters (for example speed, acceleration) and moving
independently and simultaneously or they can be linked together using
special commands.
When a move command is being processed, the motion generator waits until
the move is finished and the buffer for the required axis has become empty,
and then loads these buffers with the next move information.
Note
If the task buffers are full, the program execution is paused until
buffers are available again. This also applies to the command line
task and no commands can be given for that period. Trajexia Studio will disconnect in such a case. The PMOVE task parameter will
be set to TRUE when the task buffers are full and will be reset to
FALSE when the task buffers are available again.
Task buffers
Task 1
MOVECIRC(..) AXIS(0)
FORWARD AXIS(1)
Task 2
Task 3
MOVE(..) AXIS(0)
fig. 2
Motion
Generator
Sequencing
Move buffers
Revision 5.0
Axis
Next Move (NTYPE)
Next Move (NTYPE)
012
MOVE (1)
MOVECIRC (4)
FORWARD (10)
MOVECIRC (4)
IDLE (0)
IDLE (0)
Move
Loading
PROGRAMMING MANUAL12
Trajexia system
2.4.2Sequencing
On each servo cycle interrupt (see section 2.6.1), the motion generator
examines the NTYPE buffers to see if any of them are available. If there are
any available then it checks the task buffers to see if there is a move waiting
to be loaded. If a move can be loaded, then the data for all the specified
axes is loaded from the task buffers into the NTYPE buffers and the
corresponding task buffers are marked as idle. This process is called
sequencing.
2.4.3Move loading
Once sequencing has been completed, the MTYPE buffers are checked to
see if any moves can be loaded. If the required MTYPE buffers are
available, then the move is loaded from the NTYPE buffers to the MTYPE
buffers and the NTYPE buffers are marked as idle. This process is called
move loading. If there is a valid move in the MTYPE buffers, then it is
processed. When the move has been completed, the MTYPE buffers are
marked as idle.
2.5Command line interface
The command line interface provides a direct interface for the user to
execute commands and access parameters on the system.
Use the Terminal Window in Trajexia Studio when the TJ1-MC__ is
connected.
The TJ1-MC__ puts the last 10 commands given on the command line in a
buffer. Pressing the Up and Down Cursor Key will cycle through the buffer to
execute the command again.
The Trajexia Studio software package is used to store and load programs to
and from a computer for archiving, printing and editing. It also has several
controller monitor and debugging facilities. For more information please refer
to the Trajexia Studio user manual.
2.6.1Program execution
The timing of the execution for the different tasks and the refreshing of the I/
O of the TJ1-MC__ revolves around the servo cycle period of the system.
The servo cycle period is determined by the SERVO_PERIOD system
parameter. The TJ1-MC__ will either have a servo cycle period of 0.5, 1.0 or
2.0 ms.
I/O refresh
The I/O status of the TJ1-MC__ is refreshed at the beginning of every servo
cycle.
•The captured status of the digital inputs is transferred to the IN system
input variable. Note that this is the status captured in the previous servo
cycle.
•The analogue outputs for the speed references are updated.
•The digital outputs are updated conform the status of the OP system
output variable.
•The status of the digital inputs is captured.
Note that no automatic processing of the I/O signals is taking place, except
for registration. This implies that all actions must be programmed in the
BASIC programs.
2.6BASIC programs
The TJ1-MC__ can store up to 14 programs in memory, provided the
capacity of memory is not exceeded. The TJ1-MC__ supports simple filehandling instructions for managing these program files rather like the DOS
Revision 5.0
filing system on a computer.
PROGRAMMING MANUAL13
Trajexia system
Relevant commands
Trajexia Studio provides several ways of executing, pausing and stopping
the programs using buttons on the control panel and the editing windows.
The following commands can be given on the command line to control the
execution.
/i
CommandFunction
RUNRun the current selected program or a specified program, optionally on a
specified task number.
STOPStop the current selected program or a specified program.
HALTStop all programs on the system.
PROCESSDisplays all running tasks.
The user can explicitly allocate the task priority on which the BASIC program
is expected to run. When a user program is run without explicit task
allocation, it is assigned the highest available task priority.
Setting programs to run at start-up
Programs can be set to run automatically at different priorities when power is
turned on. If required, the computer can be left connected as an operator
interface or may be removed and the programs run stand-alone.
Programs are set in Trajexia Studio to run automatically at start-up by setting
the startup priority with the Priority property in the Properties window. If you
click the ellipsis button in the edit field of this property, the StartUp Priority
window shows. To set the program to run at power up, select the Run at
Power Up check box and select a priority in the list. Possible priority values
are Default or 1 (lowest priority) to 14 (highest priority).The current status in
the controller can be seen using the DIR command.
For more information on program control, multitasking and cycle times, refer
to sections 2.2 and 2.3 of the Trajexia Hardware Reference Manual.
Revision 5.0
PROGRAMMING MANUAL14
BASIC commands
3BASIC commands
3.1Categories
This section lists all BASIC commands divided by categories. The categories
are:
•Axis commands.
•Axis parameters.
•Communication commands and parameters.
•Constants.
•I/O commands, functions and parameters.
•Mathematical functions and operations.
•Program commands.
•Program control commands.
•Slot parameters and modifiers.
•System commands and functions.
•System parameters.
•Task commands and parameters.
The lists are quick reference guides only. A complete description of the
commands is given in alphabetical order in the next section.
3.1.1Axis commands
/i
NameDescription
ACCChanges the ACCEL and DECEL at the same time.
ADD_DACSum to the DAC value of one axis to the analogue output of the
base axis.
ADDAXSets a link to a superimposed axis. All demand position movements
for the superimposed axis will be added to any moves that are currently being executed.
Revision 5.0
B_SPLINEExpands the profile stored in TABLE memory using the B-Spline
mathematical function.
BACKLASHAllows the backlash compensation to be loaded.
NameDescription
BASEUsed to set the base axis to which the commands and parameters
are applied.
CAMMoves an axis according to values of a movement profile stored in
the TABLE variable array.
CAMBOXMoves an axis according to values of a movement profile stored in
the TABLE variable array. The motion is linked to the measured
motion of another axis to form a continuously variable software gearbox.
CANCELCancels the move on an axis.
CONNECTConnects the demand position of an axis to the measured move-
ments of the driving axis to produce an electronic gearbox.
DATUMPerforms one of 7 origin search sequences to position an axis to an
absolute position or reset a motion error.
DEFPOSDefines the current position as a new absolute position.
DISABLE_GROUPGroups axes together for error disabling.
DRIVE_ALARMMonitors the current alarm.
DRIVE_CLEARClears the alarm status of the Servo Driver.
DRIVE_READReads the specified parameter of the Servo Driver.
DRIVE_RESETResets the Servo Driver.
DRIVE_WRITEWrites a specific value to the specified parameter of the Servo
Driver.
FORWARDMoves an axis continuously forward at the speed set in the SPEED
parameter.
HW_PSWITCHSets on and off the hardware switch on output 0 of the TJ1-FL02
when predefined positions are reached.
MECHATROLINKInitializes MECHATROLINK-II bus and performs various operations
on MECHATROLINK-II stations connected to the bus.
MHELICALInterpolates 3 orthogonal axes in a helical move.
MOVEMoves one or more axes at the demand speed, acceleration and
deceleration to the position specified as increment from the current
position.
PROGRAMMING MANUAL15
BASIC commands
NameDescription
MOVEABSMoves one or more axes at the demand speed, acceleration and
deceleration to the position specified as absolute position.
MOVECIRCInterpolates 2 orthogonal axes in a circular arc.
MOVELINKCreates a linear move on the base axis linked via a software gear-
box to the measured position of a link axis.
MOVEMODIFYChanges the absolute end position of the current single-axis linear
move (MOVE or MOVEABS).
RAPIDSTOPCancels the current move on all axes.
REGISTCaptures an axis position when a registration input or the Z mark on
the encoder is detected.
REVERSEMoves an axis continuously in reverse at the speed set in the
SPEED parameter.
STEP_RATIOSets the ratio for the axis stepper output.
3.1.2Axis parameters
/i
NameDescription
ACCELContains the axis acceleration rate.
ADDAX_AXISContains the number of the axis to which the base axis is cur-
rently linked to by ADDAX.
ATYPEContains the axis type.
AXIS_DISPLAYSelects information that are represented by the LEDs on the
front cover of the TJ1-FL02.
AXIS_ENABLEEnables and disables particular axis independently of other axis.
AXISSTATUSContains the axis status.
BACKLASH_DISTDefines the amount of backlash compensation.
CLOSE_WINDefines the end of the window in which a registration mark is
Revision 5.0
CLUTCH_RATEDefines the change in connection ratio when using the
expected.
CONNECT command.
NameDescription
CREEPContains the creep speed.
D_GAINContains the derivative control gain.
DAC_SCALESets scale and polarity applied to DAC values.
DATUM_INContains the input number to be used as the origin input.
DECELContains the axis deceleration rate.
DEMAND_EDGESContains the current value of the DPOS axis parameter in
encoder edges.
DPOSContains the demand position generated by the move com-
mands.
DRIVE_CONTROLSelects data to be monitored using DRIVE_MONITOR for axes
connected via the MECHATROLINK-II bus. For axes connected
via the TJ1-FL02, DRIVE_CONTROL sets outputs of the TJ1FL02.
DRIVE_INPUTSHolds I/O data of the driver connected to MECHATROLINK-II
bus. Data is updated every servo cycle.
DRIVE_MONITORMonitors data of the Servo Driver connected to MECHATRO-
LINK-II bus. Data are updated every servo cycle.
DRIVE_STATUSContains the current status of the Servo Driver.
ENCODERContains a raw copy of the encoder hardware register.
ENCODER_BITSSets the number of bits for the absolute encoder connected to
TJ1-FL02.
ENCODER_CONTROLControls operating mode of the EnDat absolute encoder.
ENCODER_IDReturns the ID value of the absolute encoder connected to TJ1-
FL02.
ENCODER_RATIOSets scaling value for incoming encoder counts.
ENCODER_STATUSReturns the status of the Tamagawa absolute encoder.
ENCODER_TURNSReturns the multi-turn count of the absolute encoder.
ENDMOVEHolds the position of the end of the current move.
ERRORMASKContains the mask value that determines if MOTION_ERROR
occurs depending on the axis status.
PROGRAMMING MANUAL16
BASIC commands
NameDescription
FAST_JOGContains the input number to be used as the fast jog input.
FASTDECDefines ramp to zero deceleration ratio when an axis limit switch
or position is reached.
FEContains the Following Error.
FE_LATCHContains the FE value which caused the axis to put controller in
MOTION_ERROR state.
FE_LIMITContains the maximum allowable Following Error.
FE_LIMIT_MODEDefines how FE influences MOTION_ERROR state.
FE_RANGEContains the Following Error warning range limit.
FHOLD_INContains the input number to be used as the feedhold input.
FHSPEEDContains the feedhold speed.
FS_LIMITContains the absolute position of the forward software limit.
FWD_INContains the input number to be used as a forward limit input.
FWD_JOGContains the input number to be used as a jog forward input.
I_GAINContains the integral control gain.
INVERT_STEPSwitches a hardware Inverter into the stepper output circuit.
JOGSPEEDSets the jog speed.
MARKDetects the primary registration event on a registration input.
MARKBDetects the secondary registration event on a registration input.
MERGEIs a software switch that can be used to enable or disable the
merging of consecutive moves.
MPOSIs the position of the axis as measured by the encoder.
MSPEEDRepresents the change in the measured position in the last
servo period.
MTYPEContains the type of move currently being executed.
NTYPEContains the type of the move in the Next Move buffer.
Revision 5.0
OFFPOSContains an offset that will be applied to the demand position
without affecting the move in any other way.
NameDescription
OPEN_WINDefines the beginning of the window in which a registration
mark is expected.
OUTLIMITContains the limit that restricts the speed reference output from
the TJ1-MC__.
OV_GAINContains the output velocity control gain.
P_GAINContains the proportional control gain.
REG_POSContains the position at which a registration event occurred.
REG_POSBContains the position at which the secondary registration event
occurred.
REMAINIs the distance remaining to the end of the current move.
REP_DISTContains or sets the repeat distance.
REP_OPTIONControls the application of the REP_DIST axis parameter.
REV_INContains the input number to be used as a reverse limit input.
REV_JOGContains the input number to be used as a jog reverse input.
RS_LIMITContains the absolute position of the reverse software limit.
S_REFContains the speed reference value which is applied when the
axis is in open loop.
S_REF_OUTContains the speed reference value being applied to the Servo
Driver for both open as closed loop.
SERVODetermines whether the axis runs under servo control or open
loop.
SPEEDContains the demand speed in units/s.
SPEED_SIGNConfigures the voltage range of the analog speed reference out-
put of the TJ1-FL02.
SRAMPContains the S-curve factor.
T_REFContains the torque reference value which is applied to the
servo motor.
TRANS_DPOSContains axis demand position at output of frame transforma-
tion.
UNITSContains the unit conversion factor.
PROGRAMMING MANUAL17
BASIC commands
NameDescription
VERIFYSelects different modes of operation on a stepper output axis.
VFF_GAINContains the speed feed forward control gain.
VP_SPEEDContains the speed profile speed.
3.1.3Communication commands and parameters
/i
NameDescription
FINS_COMMSSends FINS Read Memory and Write Memory to a designated
FINS server unit.
HLM_COMMANDExecutes a specific Host Link command to the Slave.
HLM_READReads data from the Host Link Slave to either VR or TABLE var-
iable array.
HLM_STATUSRepresents the status of the last Host Link Master command.
HLM_TIMEOUTDefines the Host Link Master timeout time.
HLM_WRITEWrites data to the Host Link Slave from either VR or TABLE var-
iable array.
HLS_NODEDefines the Slave unit number for the Host Link Slave protocol.
SETCOMSets the serial communications.
3.1.4Constants
/i
NameDescription
FALSEEqual to the numerical value 0.
OFFEqual to the numerical value 0.
ONEqual to the numerical value 1.
PIEqual to the numerical value 3.1416.
TRUEEqual to the numerical value -1.
3.1.5I/O commands, functions and parameters
/i
NameDescription
AINHolds the value of the analog channel.
AOUTHolds the value of the analog channel.
GETWaits for the arrival of a single character and assigns the ASCII
code of the character to variable.
INReturns the value of digital inputs.
INDEVICEParameter defines the default input device.
INPUTWaits for a string to be received and assigns the numerical value
to variable.
KEYReturns TRUE or FALSE depending on if character is received.
LINPUTWaits for a string and puts it in VR variables.
OPSets one or more outputs or returns the state of the first 24 out-
puts.
OUTDEVICEDefines the default output device.
PRINTOutputs a series of characters to a serial port.
Revision 5.0
PSWITCHTurns on an output when a predefined position is reached, and
turns off the output when a second position is reached.
READ_OPReturns the value of the digital outputs.
PROGRAMMING MANUAL18
BASIC commands
3.1.6Mathematical functions and operands
/i
NameDescription
+ (ADDITION)Adds two expressions.
- (SUBTRACTION)Subtracts two expressions.
* (MULTIPLICATION)Multiplies two expressions.
/ (DIVISION)Divides two expressions.
^ (POWER)Takes the power of one expression to the other expression.
= (IS EQUAL TO)Checks two expressions to see if they are equal.
= (ASSIGNMENT)Assigns an expression to a variable.
<> (IS NOT EQUAL
TO)
> (IS GREATER THAN) Checks two expressions to see if the expression on the left is
>= (IS GREATER
THAN OR EQUAL TO)
< (IS LESS THAN)Checks two expressions to see if the expression on the left is
<= (IS LESS THAN OR
EQUAL TO)
ABSReturns the absolute value of an expression.
ACOSReturns the arc-cosine of an expression.
ANDPerforms an AND operation on corresponding bits of the integer
ASINReturns the arc-sine of an expression.
ATANReturns the arc-tangent of an expression.
ATAN2Returns the arc-tangent of the non-zero complex number made
Revision 5.0
COSReturns the cosine of an expression.
EXPReturns the exponential value of an expression.
Checks two expressions to see if they are different.
greater than the expression on the right.
Checks two expressions to see if the expression on the left is
greater than or equal to the expression on the right.
less than the expression on the right.
Checks two expressions to see if the expression on the left is
less than or equal to the expression on the right.
parts of two expressions.
by two expressions.
NameDescription
FRACReturns the fractional part of an expression.
IEEE_INReturns floating point number in IEEE format, represented by 4
bytes.
IEEE_OUTReturns single byte extracted from the floating point number in
IEEE format.
INTReturns the integer part of an expression.
LNReturns the natural logarithm of an expression.
MODReturns the modulus of two expressions.
NOTPerforms a NOT operation on corresponding bits of the integer
part of the expression.
ORPerforms an OR operation between corresponding bits of the
integer parts of two expressions.
SGNReturns the sign of an expression.
SINReturns the sine of an expression.
SQRReturns the square root of an expression.
TANReturns the tangent of an expression.
XORPerforms an XOR function between corresponding bits of the
integer parts of two expressions.
3.1.7Program commands
/i
NameDescription
' (COMMENT FIELD)Enables a line not to be executed.
: (STATEMENT
SEPARATOR)
AUTORUNStarts all the programs that have been set to run at start-up.
COMPILECompiles the current program.
COPYCopies an existing program in the motion controller to a new
Enables more statements on one line.
program.
PROGRAMMING MANUAL19
BASIC commands
NameDescription
DELDeletes a program from the motion controller.
DIRDisplays a list of the programs in the motion controller, their size
and their RUNTYPE on the standard output.
EDITAllows a program to be modified using a VT100 Terminal.
EPROMStores a program in the flash memory.
LISTPrints the program on the standard output.
NEWDeletes all lines of the program in the motion controller.
PROCESSReturns the running status and task number for each current
task.
RENAMEChanges the name of a program in the motion controller.
RUNExecutes a program.
RUNTYPEDetermines if a program is run at start-up, and which task it is to
run on.
SELECTSpecifies the current program.
STEPLINEExecutes a single line in a program.
STOPHalts program execution.
TROFFSuspends a trace at the current line and resumes normal pro-
gram execution.
NameDescription
IF..THEN..ELSE..ENDIF Controls the flow of the program base on the results of the con-
dition.
ON.. GOSUB or ON..
GOTO
REPEAT..UNTILLoop allows the program segment to be repeated until the con-
WHILE..WENDLoop allows the program segment to be repeated until the con-
Enables a conditional jump to one of several labels.
dition becomes TRUE.
dition becomes FALS E.
3.1.9Slot parameters and modifiers
/i
NameDescription
ALLIs a modifier that specifies that all items in the controller are con-
cerned.
COMMSTYPEContains the type of unit in a controller slot.
FPGA_VERSIONReturns the FPGA version of unit with unit_number in a control-
ler system.
SLOTIs a modifier that specifies slot number of unit.
TRONCreates a breakpoint in a program.
3.1.8Program control commands
/i
NameDescription
FOR..TO..STEP..NEXTLoop allows a program segment to be repeated with increasing/
decreasing variable.
GOSUB..RETURNJumps to a subroutine at the line just after label. The program
Revision 5.0
GOTOJumps to the line containing the label.
execution returns to the next instruction after a “RETURN” on
page 157 is given.
3.1.10 System commands and functions
/i
NameDescription
$ (HEXADECIMAL
INPUT)
AXISSets the axis for a command, axis parameter read, or assign-
BASICERRORIs used to run a specific routine when an error occurs in a
CAN_CORTConfigures the TJ1-CORT for data exchange, or returns the sta-
Assigns a hexadecimal number to a variable.
ment to a particular axis.
BASIC command.
tus of the TJ1-CORT.
PROGRAMMING MANUAL20
BASIC commands
NameDescription
CLEARClears all global variables and the local variables on the current
task.
CLEAR_BITClears the specified bit of the specified VR variable.
CLEAR_PARAMSClears all parameter sand variables stored in Flash-ROM to
their default values.
CONSTANTDeclares a constant for use in BASIC program.
DATE$Prints the current date as a string.
DAY$Prints the current day as a string
DEVICENETConfigures the TJ1-DRT (DeviceNet Slave Unit) for data
exchange, or returns the data exchange status of the TJ1-DRT.
ETHERNETReads and sets various parameters of TJ1-MC__ Ethernet port.
EXResets the controller.
FLAGSets and reads a bank of 32 bits.
FLAGSRead and sets FLAGS as a block.
FREEReturns the amount of available memory.
GLOBALDeclares a reference to one of VR variables.
HALTStops execution of all programs currently running.
INITIALISESets all axes and parameters to their default values.
INVERT_INInverts input channels 0 - 31 in the software.
INVERTER_COMMAND Reads I/O and clears alarm of the Inverter.
INVERTER_READReads parameter, alarm, speed and torque reference of the
Inverter.
INVERTER_WRITEWrites to parameter, speed and torque reference of the Inverter.
LIST_GLOBALShows all GLOBAL and CONSTANT variables.
LOCKPrevents the programs from being viewed or modified.
PROFIBUSConfigures the TJ1-PRT (PROFIBUS-DP Slave Unit) to
Revision 5.0
exchange I/O data with the master and returns the status of the
TJ1-PRT.
NameDescription
READ_BITReturns the value of the specified bit in the specified VR varia-
ble.
RESETResets all local variables on a task.
SCOPEPrograms the system to automatically store up to 4 parameters
every sample period to the TABLE variable array.
SET_BITSets the specified bit in the specified VR variable to one.
TABLEWrites and reads data to and from the TABLE variable array.
TABLEVALUESReturns list of values from the TABLE memory.
TIME$Prints the current time as a string.
TRIGGERStarts a previously set SCOPE command.
VRWrites and reads data to and from the global (VR) variables.
VRSTRINGCombines VR memory values so they can be printed as a string.
WAHolds program execution for the number of milliseconds speci-
fied.
WAIT IDLESuspends program execution until the base axis has finished
executing its current move and any buffered move.
WAIT LOADEDSuspends program execution until the base axis has no moves
buffered ahead other than the currently executing move.
WAIT UNTILRepeatedly evaluates the condition until it is TRUE.
3.1.11 System parameters
/i
NameDescription
BATTERY_LOWReturns the current status of the battery condition.
CHECKSUMContains the checksum for the programs in RAM.
COMMSERRORContains all the communications errors that have occurred since
the last time that it was initialised.
CONTROLContains the type of TJ1-MC__ in the system.
PROGRAMMING MANUAL21
BASIC commands
NameDescription
D_ZONE_MAXControls the DAC output in conjunction with the Following Error
value.
D_ZONE_MINControls the DAC output in conjunction with the Following Error
value.
DATESets or returns the current date held by the real time clock.
DAYSets or returns the current day.
DISPLAYDetermines I/O channels to be displayed on the front panel
LEDs.
ERROR_AXISContains the number of the axis which caused the motion error.
FRAMESpecifies operating frame for frame transformations.
LAST_AXISContains the number of the last axis processed by the system.
MOTION_ERRORContains an error flag for axis motion errors.
NAIOReturns the number of analogue channels connected on the
MECHATROLINK-II bus.
NEG_OFFSETApplies a negative offset to the DAC signal from the servo loop.
NIOContains the number of inputs and outputs connected to the
system.
POWER_UPDetermines whether programs should be read from Flash-ROM
on power up or reset.
POS_OFFSETApplies a positive offset to the DAC signal from the servo loop.
3.1.12 Task commands and parameters
/i
NameDescription
ERROR_LINEContains the number of the line which caused the last BASIC
program error.
PMOVEContains the status of the task buffers.
PROCLets a process parameter from a particular process to be
accessed.
PROC_STATUSReturns the status of the process specified.
PROCNUMBERContains the number of the task in which the currently selected
program is running.
RUN_ERRORContains the number of the last BASIC error that occurred on the
specified task.
TICKSContains the current count of the task clock pulses.
SCOPE_POSContains the current TABLE position at which the SCOPE com-
mand is currently storing its first parameter.
SERVO_PERIODSets the servo cycle period of the TJ1-MC__.
SYSTEM_ERRORContains the system errors since the last initialization.
TIMEReturns the current time held by the real time clock.
TSIZEReturns the size of the currently defined Table.
VERSIONReturns the version number of the controller firmware.
Revision 5.0
WDOGThe software switch that enables Servo Drivers.
PROGRAMMING MANUAL22
BASIC commands
3.2All BASIC commands
3.2.1+ (Addition)
/i
TypeMathematical function
Syntaxexpression1 + expression2
DescriptionThe operator + adds two expressions.
Arguments•expression1
Any valid BASIC expression.
•expression2
Any valid BASIC expression.
Exampleresult = 4 + 3
Assigns the value 7 to the variable result.
See alsoN/A
3.2.2- (Subtraction)
/i
TypeMathematical function
Syntaxexpression1 - expression2
DescriptionThe operator - subtracts expression2 from expression1.
Arguments•expression1
Any valid BASIC expression.
•expression2
Any valid BASIC expression.
Exampleresult = 10 - 2
Assigns the value 8 to the variable result.
See alsoN/A
3.2.3* (Multiplication)
/i
TypeMathematical function
Syntaxexpression1 * expression2
DescriptionThe operator * multiplies two expressions.
Arguments•expression1
Any valid BASIC expression.
•expression2
Any valid BASIC expression.
Exampleresult = 3 * 7
Assigns the value 21 to the variable result.
See alsoN/A
3.2.4/ (Division)
/i
TypeMathematical function
Syntaxexpression1 / expression2
DescriptionThe operator / divides expression1 by expression2.
Arguments•expression1
Any valid BASIC expression.
•expression2
Any valid BASIC expression.
Exampleresult = 11 / 4
Assigns the value 2.75 to the variable result.
See alsoN/A
Revision 5.0
PROGRAMMING MANUAL23
BASIC commands
3.2.5^ (Power)
/i
TypeMathematical function
Syntaxexpression1 ^ expression2
DescriptionThe power operator ^ raises expression1 to the power of expression2.
This operation uses floating point algorithms and may give small deviations for
integer calculations.
Arguments•expression1
Any valid BASIC expression.
•expression2
Any valid BASIC expression.
Exampleresult = 2^5
Assigns the value 32 to the variable result.
See alsoN/A
3.2.6= (Is equal to)
/i
TypeMathematical function
Syntaxexpression1 = expression2
DescriptionThe operator = returns TRUE if expression1 is equal to expression2, other-
wise it returns FALSE.
Arguments•expression1
Any valid BASIC expression.
•expression2
Any valid BASIC expression.
ExampleIF a = 10 THEN GOTO label1
If variable a contains a value equal to 10, program execution continues at
label label1. Otherwise, program execution continues with the next statement.
See alsoN/A
Revision 5.0
3.2.7= (Assignment)
/i
TypeMathematical function
Syntaxvariable = expression
DescriptionThe operator = assigns the value of the expression to the variable.
Arguments•variable
A variable name.
•expression
Any valid BASIC expression.
Examplevar = 18
Assigns the value 18 to the variable var.
See alsoN/A
3.2.8<> (Is not equal to)
/i
TypeMathematical function
Syntaxexpression1 <> expression2
DescriptionThe operator <> returns TRUE if expression1 is not equal to expression2,
otherwise it returns FALSE.
Arguments•expression1
Any valid BASIC expression.
•expression2
Any valid BASIC expression.
ExampleIF a <> 10 THEN GOTO label1
If variable a contains a value not equal to 10, program execution continues at
label label1. Otherwise, program execution continues with the next statement.
See alsoN/A
PROGRAMMING MANUAL24
BASIC commands
3.2.9> (Is greater than)
/i
TypeMathematical function
Syntaxexpression1 > expression2
DescriptionThe operator > returns TRUE if expression1 is greater than expression2,
otherwise it returns FALS E.
Arguments•expression1
Any valid BASIC expression.
•expression2
Any valid BASIC expression.
ExampleIF a > 10 THEN GOTO label1
If variable a contains a value greater than 10, program execution continues at
label label1. Otherwise, program execution continues with the next statement.
See alsoN/A
3.2.10 >= (Is greater than or equal to)
/i
TypeMathematical function
3.2.11 < (Is less than)
/i
TypeMathematical function
Syntaxexpression1 < expression2
DescriptionThe operator < returns TRUE if expression1 is less than expression2, other-
wise it returns FALSE.
Arguments•expression1
Any valid BASIC expression.
•expression2
Any valid BASIC expression.
ExampleIF a < 10 THEN GOTO label1
If variable a contains a value less than 10, program execution continues at
label label1. Otherwise, program execution continues with the next statement.
See alsoN/A
3.2.12 <= (Is less than or equal to)
/i
TypeMathematical function
Syntaxexpression1 >= expression2
DescriptionThe operator >= returns TRUE if expression1 is greater than or equal to
expression2, otherwise it returns FALSE.
Arguments•expression1
Any valid BASIC expression.
•expression2
Any valid BASIC expression.
ExampleIF a >=10 THEN GOTO label1
If variable a contains a value greater than or equal to 10, program execution
continues at label label1. Otherwise, program execution continues with the
Revision 5.0
See alsoN/A
next statement.
Syntaxexpression1 <= expression2
DescriptionThe operator <= returns TRUE if expression1 is less than or equal to
expression2, otherwise it returns FALSE.
Arguments•expression1
Any valid BASIC expression.
•expression2
Any valid BASIC expression.
ExampleIF a <= 10 THEN GOTO label1
If variable a contains a value less than or equal to 10, program execution continues at label label1. Otherwise, program execution continues with the next
statement.
See alsoN/A
PROGRAMMING MANUAL25
BASIC commands
3.2.13 $ (Hexadecimal input)
/i
TypeSystem command
Syntax$hex_num
DescriptionThe $ command makes the number that follows a hexadecimal number.
Arguments•hex_num
A hexadecimal number (consisting of the characters 0 - 9 and A - F).
hex_num ranges from 0 to FFFFFF.
Example>>TABLE(0, $F, $ABCD)
>>print TABLE(0), TABLE(1)
15.0000 43981.0000
See alsoHEX (PRINT)
3.2.14 ' (Comment field)
/i
TypeProgram command
Syntax'
Description' marks all that follows it on a line as comment and not program code. Com-
ment is not executed when the program is run. You can use ' at the beginning
of a line or after a valid statement.
ArgumentsN/A
Example' This line is not printed
PRINT "Start"
See alsoN/A
3.2.15 : (Statement separator)
/i
TypeProgram command
Syntax:
DescriptionThe statement separator : separates multiple BASIC statements on one line.
You can use it on the command line and in programs.
ArgumentsN/A
ExamplePRINT "THIS LINE": GET low : PRINT "DOES THREE THINGS"
See alsoN/A
3.2.16 #
/i
TypeSpecial character
Syntax#
DescriptionThe # symbol is used to specify a communications channel to be used for
serial input/output commands.
Note: Communications Channels greater than 3 will only be used when running the Trajexia Studio software.
ArgumentsN/A
ExamplePRINT #1, "RS232"
PRINT #2, "RS485"
ExampleIF KEY #1 THEN GET #1, k
Checks keypad on RS232 port, which represent communication channel 1.
See alsoN/A
Revision 5.0
PROGRAMMING MANUAL26
BASIC commands
3.2.17 ABS
/i
TypeMathematical function
SyntaxABS(expression)
DescriptionThe ABS function returns the absolute value of an expression.
Arguments•expression
Any valid BASIC expression.
ExampleIF ABS(A) > 100 THEN PRINT "A is outside range -100 ... 100"
See alsoN/A
3.2.18 ACC
/i
TypeAxis command
SyntaxACC(rate)
DescriptionSets the acceleration and deceleration at the same time.
This command gives a quick method to set both ACCEL and DECEL. Acceleration and deceleration rates are recommended to be set with the ACCEL
and DECEL axis parameters.
Arguments•rate
The acceleration/deceleration rate in units/s
with the UNITS axis parameter.
ExampleACC(100)
Sets ACCEL and DECEL to 100 units/s
See alsoACCEL, DECEL, UNITS
2
.
2
. You can define the units
3.2.19 ACCEL
/i
TypeAxis parameter
SyntaxACCEL = expression
DescriptionThe ACCEL axis parameter contains the axis acceleration rate. The rate is
. The parameter can have any positive value including zero.
3.2.20 ACOS
/i
TypeMathematical function
SyntaxACOS(expression)
DescriptionThe ACOS function returns the arc-cosine of the expression. The expression
value must be between -1 and 1. The result in radians is between 0 and PI.
Input values outside the range will return 0.
Arguments•expression
Any valid BASIC expression.
Example>> PRINT ACOS(-1)
3.1416
See alsoN/A
Revision 5.0
PROGRAMMING MANUAL27
BASIC commands
3.2.21 ADD_DAC
/i
TypeAxis command
SyntaxADD_DAC(axis)
fig. 1/i
DescriptionThe ADD_DAC command adds the DAC_OUT value of axis to the
DAC_OUT value of the base axis. Use ADD_DAC(-1) to cancel the sum.
ADD_DAC works on the default basis axis (set with BASE) unless AXIS is
used to specify a temporary base axis.
Note:
1.Be aware that the control loop gains for both axes need to be determined
with care. As different encoders with different resolutions are used, the
gains are not identical.
2.Set the OUTLIMIT parameter to the same value for both linked axes.
3.This command has no meaning for a MECHATROLINK-II axis in position
mode (ATYPE=40), because the value of DAC_OUT is ignored.
Arguments•axis
The axis from which to sum the speed reference output to the base axis.
Set the argument to -1 to cancel the link and return to normal operation.
ExampleNo example.
See alsoAXIS, DAC_OUT, OUTLIMIT
Demanded
position
Demanded
position
Measured
position
Measured
position
AXIS m
Position loop
+
_
AXIS n
Position loop
+
_
Following
error
Following
error
Speed
command
Speed
command
DAC
SERVO = OFF
SERVO = ON
DAC
SERVO = OFF
SERVO = ON
ADD_DAC(n) AXIS(m):
+
DAC_OUT AXIS(m) + DAC_OUT AXIS(n)
+
Final speed reference in AXIS(n) =
Revision 5.0
PROGRAMMING MANUAL28
BASIC commands
3.2.22 ADDAX
/i
TypeAxis command
SyntaxADDAX(axis)
DescriptionThe ADDAX command is used to superimpose two or more movements to
build up a more complex movement profile.
The ADDAX command takes the demand position changes from the superimposed axis as specified by the axis argument and adds them to any movement running on the axis to which the command is issued. The axis specified
by the parameter can be any axis and does not have to physically exist in the
system.
The ADDAX command therefore allows an axis to perform the moves specified on two axes added together. When the axis parameter is set to OFF on
an axis with an encoder interface the measured position MPOS is copied into
the demanded position DPOS. This allows ADDAX to be used to sum
encoder inputs.
After the ADDAX command has been issued the link between the two axes
remains until broken. Use ADDAX(-1) to cancel the axis link. ADDAX allows
an axis to perform the moves specified for 2 axes added together. Combinations of more than two axes can be made by applying ADDAX to the superimposed axis as well.
ADDAX works on the default basis axis (set with BASE) unless AXIS is used
to specify a temporary base axis.
Note: The ADDAX command sums the movements in encoder edge units.
Arguments•axis
The axis to be set as a superimposed axis. Set the argument to -1 to cancel the link and return to normal operation.
Revision 5.0
PROGRAMMING MANUAL29
BASIC commands
ExampleUNITS AXIS(0)=1000
UNITS AXIS(1)=20
' Superimpose axis 1 on axis 0
ADDAX(1) AXIS(0)
MOVE(1) AXIS(0)
MOVE(2) AXIS(1)
'Axis 0 will move 1*1000+2*20=1040 edges
fig. 2/i
Revision 5.0
PROGRAMMING MANUAL30
BASIC commands
ExamplePieces are placed randomly onto a belt that moves continuously. Further
along the line they are transferred to a second flighted belt. A detection system indicates if a piece is in front of or behind its nominal position, and how
far.
expected=2000 ' sets expected position
BASE(0)
ADDAX(1)
CONNECT(1,2) ' continuous geared connection to flighted belt
REPEAT
GOSUB getoffset ' get offset to apply
MOVE(offset) AXIS(1) ' make correcting move on virtual axis
UNTIL IN(2)=OFF ' repeat until stop signal on input 2
RAPIDSTOP
ADDAX(-1) ' clear ADDAX connection
STOP
getoffset: ' sub routine to register the position of the
' piece and calculate the offset
BASE(0)
REGIST(3)
WAIT UNTIL MARK
seenat=REG_POS
offset=expected-seenat
RETURN
Axis 0 in this example is connected to the encoder of the second conveyor. A
superimposed MOVE on axis 1 is used to apply offsets.
fig. 3/i
R AXIS 0
MOTOR
AXIS 0
ENCODER
AXIS 2
Revision 5.0
PROGRAMMING MANUAL31
BASIC commands
ExampleAn X-Y marking machine must mark boxes as they move along a conveyor.
Using CONNECT enables the X marking axis to follow the conveyor. A virtual
axis is used to program the marking absolute positions; this is then superimposed onto the X axis using ADDAX.
ATYPE AXIS(3)=0 'set axis 3 as virtual axis
SERVO AXIS(3)=ON
DEFPOS(0) AXIS(3)
ADDAX (3)AXIS(0) 'connect axis 3 requirement to axis 0
WHILE IN(2)=ON
REGIST(3) 'registration input detects a box on the conveyor
WAIT UNTIL MARK OR IN(2)=OFF
IF MARK THEN
CONNECT(1,2) AXIS(0)'connect axis 0 to the moving belt
BASE(3,1) 'set the drawing motion to axis 3 and 1
'Draw the M
MOVEABS(1200,0)'move A > B
MOVEABS(600,1500)'move B > C
MOVEABS(1200,3000)' move C > D
MOVEABS(0,0)'move D > E
WAIT IDLE
BASE(0)
CANCEL 'stop axis 0 from folowing the belt
WAIT IDLE
MOVEABS(0) 'move axis 0 to home position
ENDIF
WEND
CANCEL
AXIS 0
ENCODER
AXIS 2
fig. 4/i
AXIS 1
R AXIS 0
See alsoADDAX_AXIS, AXIS, OUTLIMIT
WARNING
Beware that giving several ADDAX commands in a system can
create a dangerous loop when for instance one axis is linked to
Revision 5.0
PROGRAMMING MANUAL32
another and vice versa. This may cause instability in the system.
BASIC commands
3.2.23 ADDAX_AXIS
/i
TypeAxis parameter (read-only)
SyntaxADDAX_AXIS
DescriptionThe ADDAX_AXIS axis parameter returns the number of the axis to which
the base axis is currently linked to by ADDAX. If the base axis in not linked to
any other axis, the ADDAX_AXIS parameter returns -1.
ArgumentsN/A
Example>> BASE(0)
>> ADDAX(2)
>> PRINT ADDAX_AXIS
2.0000
>> ADDAX(-1)
>> PRINT ADDAX_AXIS
-1.0000
See alsoADDAX, AXIS
3.2.24 AIN
/i
TypeI/O command
SyntaxAIN(analogue_chan)
DescriptionThe AIN reads a value from an analogue input. Analogue input channels are
provided by connecting GRT1-ML2 Slice Coupler, Phoenix IL MII BK Slice
Coupler, or JEPMC-AN2900 modules on the MECHATROLINK-II bus.
Argumentsanalogue_chan.
Analogue input channel number 0.31
ExampleMOVE(-5000)
REPEAT
a=AIN(1)
IF a<0 THEN a=0
SPEED=a*0.25
UNTIL MTYPE=0
The speed of a production line is governed by the rate at which material is fed
onto it. The material feed is via a lazy loop arrangement which is fitted with an
ultra-sonic height sensing device. The output of the ultra-sonic sensor is in
the range 0V to 4V where the output is at 4V when the loop is at its longest.
Note: The analogue input value is checked to ensure it is above zero even
though it always should be positive. This is to allow for any noise on the
incoming signal which could make the value negative and cause an error
because a negative speed is not valid for any move type except FORWARD
or REVERSE.
See alsoN/A
3.2.25 ALL
/i
TypeSlot modifier
SyntaxALL
DescriptionThe ALL modifier is used with the commands DEL and NEW. It indicates that
these commands are applied to all items in the directory structure of the controller.
ArgumentsN/A
ExampleDEL ALL
This deletes all programs and the TABLE memory of the controller.
ExampleHALT
NEW ALL
STORE
This creates the memory of the controller.
Revision 5.0
See alsoDEL, NEW.
PROGRAMMING MANUAL33
BASIC commands
3.2.26 AND
/i
TypeMathematical operation
Syntaxexpression1 AND expression2
DescriptionThe AND operator performs the logical AND function on the corresponding
bits of the integer parts of two valid BASIC expressions.
The logical AND function between two bits is defined as follows:
0 AND 0 = 0
0 AND 1 = 0
1 AND 0 = 0
1 AND 1 = 1
Arguments•expression1
Any valid BASIC expression.
•expression2
Any valid BASIC expression.
ExampleVR(0) = 10 AND (2.1*9)
The parentheses are evaluated first, but only the integer part of the result, 18,
is used for the AND operation. Therefore, this expression is equivalent to the
following:
VR(0) = 10 AND 18
The AND is a bit operator and so the binary action is as follows:
01010 AND 10010 = 00010
Therefore, VR(0) will contain the value 2.
ExampleIF MPOS AXIS(0) > 0 AND MPOS AXIS(1) > 0 THEN GOTO cycle1
If measured positions MPOS of both axis 1 and axis 2 are greater than zero,
program execution continues at label cycle1. Otherwise, program execution
continues with the next statement.
See alsoN/A
DescriptionThe AOUT command sets the output value of the analogue output channels
that are provided by connecting GRT1-ML2 Slice Coupler, Phoenix IL MII BK
Slice Coupler, or JEPMC-AN2910 modules on the MECHATROLINK-II bus.
The range of the value set is [-32000, 32000] for full output range. The output
range depends on the analogue unit used and can be one of the following: [10V, 10V], [0V, 10V] or [0V, 5V] for voltage and [0mA, 20mA] or [4mA, 20mA]
for current output.
Arguments•analogue_chan.
Analogue output channel number 0.31
ExampleNo example.
See alsoN/A
3.2.28 ASIN
/i
TypeMathematical function
SyntaxASIN(expression)
DescriptionThe ASIN function returns the arc-sine of the argument. The argument must
have a value between -1 and 1. The result in radians is between -PI/2 and PI/
2. Input values outside this range return 0.
Arguments•expression
Any valid BASIC expression.
Example>> PRINT ASIN(-1)
-1.5708
See alsoN/A
3.2.29 ATAN
/i
3.2.27 AOUT
/i
Revision 5.0
TypeI/O command
SyntaxAOUT(analogue_chan)
TypeMathematical function
SyntaxATAN(expression)
DescriptionThe ATAN function returns the arc-tangent of the argument. expression can
have any value. The result is in radians and is between -PI/2 and PI/2.
PROGRAMMING MANUAL34
BASIC commands
Arguments•expression
Any valid BASIC expression.
Example>> PRINT ATAN(1)
0.7854
See alsoN/A
3.2.30 ATAN2
/i
TypeMathematical function
SyntaxATAN2(expression1, expression2)
DescriptionThe ATAN2 function returns the arc-tangent of the non-zero complex number
(expression1, expression2), which is equivalent to the angle between a
point with coordinate (expression1, expression2) and the x-axis. If
expression2 >= 0, the result is equal to the value of ATAN(expression1 /
expression2). The result in radians will be between -PI and PI.
Arguments•expression1
Any valid BASIC expression.
•expression2
Any valid BASIC expression.
Example>> PRINT ATAN2(0,1)
0.0000
See alsoN/A
3.2.31 ATYPE
/i
TypeAxis parameter
/i
AXIS typeATYPE valueApplicable TJ1 unit
Virtual0All
MECHATROLINK-II Position40TJ1-ML__
MECHATROLINK-II Speed41TJ1-ML__
MECHATROLINK-II Torque42TJ1-ML__
Flexible axis Stepper Out43TJ1-FL02
Flexible axis Servo44TJ1-FL02
Flexible axis Encoder Out45TJ1-FL02
Flexible axis Absolute Tamagawa46TJ1-FL02
Flexible axis Absolute EnDat47TJ1-FL02
Flexible axis Absolute SSI48TJ1-FL02
MECHATROLINK-II Inverter49TJ1-ML__
/i
The ATYPE parameters are set by the system at start-up. For axes controlled
by the Servo Drivers connected to the system via MECHATROLINK-II bus,
the default ATYPE value is 41 (MECHATROLINK-II Speed) for Sigma II Servo
Drivers, or 40 (MECHATROLINK-II Position) for JUNMA Servo Drivers. For
axes controlled by the Servo Drivers connected to the system via the TJ1FL02, the default ATYPE value is 44 (Flexible Axis Servo).
ArgumentsN/A
ExampleATYPE AXIS(1) = 45
This command will set axis 1 as Flexible axis encoder output axis.
See alsoAXIS
SyntaxATYPE = value
DescriptionThe ATYPE axis parameter indicates the axis type for the axis. The valid val-
Revision 5.0
ues depend on TJ1 module the Servo Driver controlling the axis is connected
to. See the table below.
3.2.32 AUTORUN
/i
TypeProgram command
SyntaxAUTORUN
PROGRAMMING MANUAL35
BASIC commands
DescriptionThe AUTORUN command starts all the programs that have been set to run at
start-up.
Note: This command should only be used on the Command Line Terminal.
ArgumentsN/A
ExampleNo example.
See alsoRUNTYPE
3.2.33 AXIS
/i
TypeSystem command
SyntaxAXIS(axis_number)
DescriptionThe AXIS modifier sets the axis for a single motion command or a single axis
parameter read/write to a particular axis. AXIS is effective only for the command or axis parameter operation. If it is required to change the axis used to
a particular axis in every subsequent command, use the BASE command
instead.
Arguments•axis_number
Any valid BASIC expression specifying the axis number.
ExampleBASE(0)
PRINT VP_SPEED AXIS(2)
DescriptionThe AXIS_DISPLAY axis parameter enables different data to be displayed by
the LEDs on the front cover of the TJ1-FL02 unit. LEDs affected by this
parameter setting are two yellow LEDs showing axis status. The default value
of this parameter on start-up for all axes is 0. The valid values are shown in
the table below.
/i
AXIS_DISPLAY value0123
A0REG 0AUX INOUT 0ENCODER A
A1REG 1ENCODER Z
B0REG 0AUX INOUT 0ENCODER A
B1REG 1ENCODER ZOUT 1ENCODER B
1
OUT 1ENCODER B
1. In case of incremental encoder, it reflects the status of the Z-input.
In case of absolute encoder, it reflects the status of the clock output.
/i
ArgumentsN/A
ExampleAXIS_DISPLAY AXIS(2) = 2
This command will display status of the outputs OUT 0 and OUT 1 allocated
to axis 2.
See alsoN/A
ExampleMOVE(300) AXIS(0)
ExampleREP_DIST AXIS(1) = 100
See alsoBACKLASH
3.2.34 AXIS_DISPLAY
/i
TypeAxis parameter
Revision 5.0
SyntaxAXIS_DISPLAY = value
3.2.35 AXIS_ENABLE
/i
TypeAxis parameter
SyntaxAXIS_ENABLE = ON/OFF
PROGRAMMING MANUAL36
BASIC commands
DescriptionThe AXIS_ENABLE axis parameter is used to enable or disable particular
axis independently of others. This parameter can be set ON or OFF for each
axis individually. The default value on start-up is ON or all axes. The axis will
be enables if both AXIS_ENABLE for that axis is ON and WDOG is on. For
MECHATROLINK-II axes setting AXIS_ENABLE to OFF will disable Servo
Driver output to the motor. For Flexible axis Servo axis setting AXIS_ENABLE
to OFF will force both voltage outputs to 0. For Flexible axis Stepper Out and
Encoder Out axes, setting AXIS_ENABLE to OFF will block pulses generation
on the outputs.
ArgumentsN/A
ExampleAXIS_ENABLE AXIS(3) = OFF
This command will disable axis 3 independently of other axes in the system.
See alsoAXIS, DISABLE_GROUP
3.2.36 AXISSTATUS
/i
TypeAxis parameter (read-only)
SyntaxAXISSTATUS
DescriptionThe AXISSTATUS axis parameter contains the axis status and is used for the
motion error handling of the controller. The axis status consists of status bits,
which definitions are shown in the table below.
/i
Bit
number
0-1-
DescriptionValueCharacter (as used in
Trajexia Studio)
Bit
number
7Feed hold input128h
8Following error exceeds limit256e
9In forward software limit512x
10In reverse software limit1024y
11Cancelling move2048c
12Encoder out overspeed4096o
/i
ArgumentsN/A
ExampleIF (AXISSTATUS AND 16)>0 THEN PRINT "In forward limit"
DescriptionExpands an existing profile stored in the TABLE using the B-Spline mathemat-
ical function. The expansion factor is configurable and the B_SPLINE stores
expanded profile to another area in the TABLE.
This is ideally used where the source CAM profile is too course and needs to
be extrapolated into a greater number of points.
1Following error warning range2w
2Servo Driver communication error4a
3Servo Driver alarm8m
4In forward limit16f
Revision 5.0
5In reverse limit32r
6Datuming64d
PROGRAMMING MANUAL37
BASIC commands
Arguments•type
Reserved for future expansion. Always set this to 1.
•data_in
Location in the TABLE where the source profile is stored.
•number_in
Number of points in the source profile.
•data_out
Location in the TABLE where the expanded profile will be stored.
•expansion_ratio
The expansion ratio, i.e., if the source profile is 100 points and
expansion_ratio is set to 10 the resulting profile will be 1000 point (100 *
10).
ExampleBASE(1)
B_SPLINE(1, 0, 10, 200, 10)
This command expands a 10 point profile in TABLE locations 0 to 9 to a larger
100 points profile starting at TABLE location 200.
See alsoN/A
3.2.38 BACKLASH
/i
TypeAxis command
SyntaxBACKLASH(on/off, distance, speed, accel)
DescriptionThe BACKLASH command allows the parameters for the backlash compen-
sation to be loaded. The backlash compensation is achieved as follows:
•An offset move is applied when the motor demand is in one direction.
•The offset move is reversed when the motor demand is in the opposite
direction.
These moves are superimposed on the command axis movements.
The backlash compensation is applied after a change in the direction of the
DPOS parameter. The backlash compensation can be seen in the
TRANS_DPOS parameter, which is equal to DPOS + backlash compensa-
Revision 5.0
tion.
Arguments•on/off
Either ON or OFF.
•distance
The offset distance, expressed in user units.
•speed
The speed of the compensation move, expressed in user units.
•accel
The acceleration or deceleration rate of the compensation move,
expressed in user units.
ExampleBACKLASH(ON,0.5,10,50) AXIS(0)
BACKLASH(ON,0.4,8,50) AXIS(1)
This applies backlash compensation on axes 0 and 1.
See alsoDPOS, TRANS_DPOS.
3.2.39 BACKLASH_DIST
/i
TypeAxis parameter
SyntaxBACKLASH_DIST
DescriptionBACKLASH_DIST is the amount of backlash compensation that is applied to
the axis when BACKLASH = ON.
ArgumentsN/A
ExampleIF BACKLASH_DIST>100 THEN
OP (10, ON) ' show that backlash compensation reached this value
ELSE
OP (10, OFF)
END IF
DescriptionThe BASE command is used to set the default base axis or to set a specified
axis sequence group. All subsequent motion commands and axis parameters
will apply to the base axis or the specified axis group unless the AXIS com-
mand is used to specify a temporary base axis. The base axis or axis group is
effective until it is changed again with BASE.
Each BASIC process can have its own axis group and each program can set
its own axis group independently. Use the PROC modifier to access the
parameters for a certain task.
The BASE order grouping can be set by explicitly assigning the order of axes.
This order is used for interpolation purposes in multi-axes linear and circular
moves. The default for the base axis group is
(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15) at start-up or when a program starts
running on a task. The BASE command without any arguments returns the
current base order grouping. This should be used
Note: If the BASE command does not specify all the axes, the BASE com-
mand will “fill in” the remaining values automatically. Firstly it will fill in any
remaining axes above the last declared value, then it will fill in any remaining
axes in sequence.
So BASE(2,6,10) sets the internal array of 16 axes to:
2,6,10,11,12,13,14,15,0,1,3,4,5,7,8,9.
ExampleBASE(1)
UNITS = 2000 ' Set unit conversion factor for axis 1
SPEED = 100 ' Set speed for axis 1
ACCEL = 5000 ' Set acceleration rate for axis 1
BASE(2)
UNITS = 2000 ' Set unit conversion factor for axis 2
SPEED = 125 ' Set speed for axis 2
ACCEL = 10000 ' Set acceleration rate for axis 2
It is possible to program each axis with its own speed, acceleration and other
parameters.
ExampleBASE(0)
MOVE(100,-23.1,1250)
In this example, axes 0, 1 and 2 will move to the specified positions at the
speed and acceleration set for axis 0. BASE(0) sets the base axis to axis 0,
which determines the three axes used by MOVE and the speed and acceleration rate.
Example>> BASE
(0,2,1)
On the command line the base group order can be shown by typing BASE.
Example>> RUN "PROGRAM", 3
>> BASE PROC(3)
(0,2,1)
Use the PROC modifier to show the base group order of a certain task.
Example>> BASE(2)
>> PRINT BASE
2.0000
Printing BASE will return the current selected base axis.
See alsoAXIS
Note: The BASE command without any arguments should only be used on
the Command Line Terminal.
ArgumentsThe command can take up to 16 arguments.
•axis_i
Revision 5.0
The number of the axis set as the base axis and any subsequent axes in
the group order for multi-axis moves.
3.2.41 BASICERROR
/i
TypeSystem command
SyntaxBASICERROR
PROGRAMMING MANUAL39
BASIC commands
DescriptionThe BASICERROR command can be used to run a routine when a run-time
error occurs in a program. BASICERROR can only be used as part of an ON ... GOSUB or ON ... GOTO command. This command is required to be executed once in the BASIC program. If several commands are used only the
one executed last is effective.
ArgumentsN/A
Example ON BASICERROR GOTO error_routine
...
no_error = 1
STOP
error_routine:
IF no_error = 0 THEN
PRINT "The error "; RUN_ERROR[0];
PRINT " occurred in line "; ERROR_LINE[0]
ENDIF
STOP
If an error occurs in a BASIC program in this example, the error routine will be
executed.
The IF statement is present to prevent the program going into error routine
when it is stopped normally.
See alsoERROR_LINE, ON, RUN_ERROR.
3.2.42 BATTERY_LOW
3.2.43 BREAK_RESET
/i
TypeSystem command
SyntaxBREAK_RESET "program_name"
DescriptionUsed by Trajexia Studio to remove all break points from the specified pro-
gram.
Arguments•program_name
The name of the program from which you want to remove all break
points.
ExampleBREAK_RESET "simpletest"
Will remove all break points from program simpletest.
See alsoN/A
/i
TypeSystem parameter (read-only)
SyntaxBATTERY_LOW
DescriptionThis parameter returns the current state of the battery condition. If
BATTERY_LOW=ON then the battery needs to be changed. If
BATTERY_LOW=OFF then battery condition is ok.
DescriptionThe CAM command is used to generate movement of an axis following a
position profile which is stored in the TABLE variable array. The TABLE values are absolute positions relative to the starting point and are specified in
encoder edges. The TABLE array is specified with the TABLE command.
The movement can be defined with any number of points from 3 to the maximum table size available (64000). The TJ1-MC__ moves continuously
between the values in the TABLE to allow a number of points to define a
smooth profile. Two or more CAM commands can be executed simultaneously using the same or overlapping values in the TABLE array. The TABLE
profile is traversed once.
CAM requires that the start element in the TABLE array has value zero. The
distance argument together with the SPEED and ACCEL parameters determine the speed moving through the TABLE array. Note that in order to follow
the CAM profile exactly the ACCEL parameter of the axis must be at least
1000 times larger than the SPEED parameter.
CAM works on the default basis axis (set with BASE) unless AXIS is used to
specify a temporary base axis.
Arguments•start_point
The address of the first element in the TABLE array to be used.
Being able to specify the start point allows the TABLE array to hold more
than one profile and/or other information.
•end_point
The address of the end element in the TABLE array.
•table_multiplier
The Table multiplier value used to scale the values stored in the TABLE.
As the Table values are specified in encoder edges, use this argument to
set the values for instance to the unit conversion factor (set by UNITS
parameter).
•distance
A factor given in user units that controls the speed of movement through
the Table. The time taken to execute CAM depends on the current axis
speed and this distance. For example, assume the system is being programmed in mm and the speed is set to 10 mm/s and the acceleration
sufficiently high. If a distance of 100 mm is specified, CAM will take 10
seconds to execute.
The SPEED parameter in the base axis allows modification of the speed
of movement when using the CAM move.
Note: When the CAM command is executing, the ENDMOVE parameter is
set to the end of the previous move.
Revision 5.0
PROGRAMMING MANUAL41
BASIC commands
ExampleMotion is required to follow the POSITION equation:
t(x) = x*25 + 10000(1-cos(x)), where x is in degrees. This example table provides a simple oscillation superimposed with a constant speed. To load the
table and cycle it continuously the program would be:
FOR deg=0 TO 360 STEP 20 'loop to fill in the table
rad = deg * 2 * PI/360 'convert degrees to radians
x = deg * 25 + 10000 * (1-COS(rad))
TABLE(deg/20,x) 'place value of x in table
NEXT deg
WHILE IN(2)=ON 'repeat cam motion while input 2 is on
CAM(0,18,1,200)
WAIT IDLE
WEND
Note: The subroutine camtable loads the data into the cam TABLE, as shown
in the figure and in the table below.
/i
TABLE positionDegreeValue
100
fig. 5/i
2201103
3403340
4606500
58010263
610014236
712018000
814021160
916023396
1018024500
1120024396
Revision 5.0
1222023160
1324021000
PROGRAMMING MANUAL42
BASIC commands
TABLE positionDegreeValue
1426018236
1528015263
1630012500
1732010340
183409103
193609000
Revision 5.0
PROGRAMMING MANUAL43
BASIC commands
ExampleA masked wheel is used to create a stencil for a laser to shine through for use
in a printing system for the ten numerical digits. The required digits are transmitted through port 1 serial port to the controller as ASCII text.
The encoder used has 4000 edges per revolution and so must move 400
between each position. The cam table goes from 0 to 1, which means that the
CAM multiplier needs to be a multiple of 400 to move between the positions.
The wheel is required to move to the pre-set positions every 0.25 seconds.
The speed is set to 10000 edges/second, and we want the profile to be complete in 0.25 seconds. So multiplying the axis speed by the required completion time (10000 x 0.25) gives the distance parameter equals 2500.
GOSUB profile_gen
WHILE IN(2)=ON
WAIT UNTIL KEY#1 'Waits for character on port 1
GET#1,k
IF k>47 AND k<58 THEN 'check for valid ASCII character
position=(k-48)*400 'convert to absolute position
multiplier=position-offset 'calculate relative movement
'check if it is shorter to move in reverse direction
IF multiplier>2000 THEN
multiplier=multiplier-4000
ELSEIF multiplier<-2000 THEN
multiplier=multiplier+4000
ENDIF
CAM(0,200,multiplier,2500) 'set the CAM movment
WAIT IDLE
OP(15,ON) 'trigger the laser flash
WA(20)
OP(15,OFF)
offset=(k-48)*400 'calculates current absolute position
ENDIF
WEND
profile_gen:
num_p=201
scale=1.0
Revision 5.0
FOR p=0 TO num_p-1
TABLE(p,((-SIN(PI*2*p/num_p)/(PI*2))+p/num_p)*scale)
NEXT p
RETURN
OP(15)
TRIGGER
fig. 6/i
LASER
MOTOR
PROGRAMMING MANUAL44
BASIC commands
ExampleA suction pick and place system must vary its speed depending on the load
carried. The mechanism has a load cell which inputs to the controller on the
analogue channel (AIN).
The move profile is fixed, but the time taken to complete this move must be
varied depending on the AIN. The AIN value varies from 100 to 800, which
must result in a move time of 1 to 8 seconds. If the speed is set to 10000 units
per second and the required time is 1 to 8 seconds, then the distance parameter must range from 10000 to 80000. (distance = speed x time).
The return trip can be completed in 0.5 seconds and so the distance value of
5000 is fixed for the return movement. The Multiplier is set to -1 to reverse the
motion.
GOSUB profile_gen 'loads the cam profile into the table
SPEED=10000:ACCEL=SPEED*1000:DECEL=SPEED*1000
WHILE IN(2)=ON
OP(15,ON) 'turn on suction
load=AIN(0) 'capture load value
distance = 100*load 'calculate the distance parameter
CAM(0,200,50,distance) 'move 50mm forward in time calculated
WAIT IDLE
OP(15,OFF) 'turn off suction
WA(100)
CAM(0,200,-50,5000) 'move back to pick up position
WEND
profile_gen:
num_p=201
scale=400 'set scale so that multiplier is in mm
FOR p=0 TO num_p-1
TABLE(p,((-SIN(PI*2*p/num_p)/(PI*2))+p/num_p)*scale)
NEXT p
RETURN
DescriptionThe CAMBOX command is used to generate movement of an axis following a
position profile in the TABLE variable array. The motion is linked to the measured motion of another axis to form a continuously variable software gearbox.
The TABLE values are absolute position relative to the starting point and are
specified in encoder edges.
The TABLE array is specified with the TABLE command. The movement can
be defined with any number of points from 3 to the maximum table size available (64000). Being able to specify the start point allows the TABLE array to
be used to hold more than one profile and/or other information. The TJ1MC__ moves continuously between the values in the TABLE to allow a
number of points to define a smooth profile. Two or more CAMBOX commands can be executed simultaneously using the same or overlapping values
in the TABLE array.
The CAMBOX command requires the start element of the TABLE to have
value zero. Note also that CAMBOX command allows traversing the TABLE
backwards as well as forwards depending on the Master axis direction.
The link_option argument can be used to specify different options to start the
command and to specify a continuous CAM. For example, if the link_option
is set to 4 then the CAMBOX operates like a "physical" CAM.CAMBOX works on the default basis axis (set with BASE) unless AXIS is
used to specify a temporary base axis.
Note: While CAMBOX is being executed, the ENDMOVE parameter will be
set to the end of the previous move. The REMAIN axis parameter will hold the
remainder of the distance on the link axis.
See also ACCEL, AXIS, CAMBOX, SPEED, TAB LE.
3.2.45 CAMBOX
/i
Revision 5.0
TypeAxis command
PROGRAMMING MANUAL45
BASIC commands
Arguments•start_point
The address of the first element in the TABLE array to be used.
•end_point
The address of the end element in the TABLE array.
•table_multiplier
The Table multiplier value used to scale the values stored in the TABLE.
As the TABLE values are specified in encoder edges, use this argument
to set the values for instance to the unit conversion factor (set by UNITS
parameter).
•link_distance
The distance in user units the link axis must move to complete the specified output movement. The link distance must be specified as a positive
distance.
•link_axis
The axis to link to.
•link_option
See the table below.
/i
link_option value Description
1Link starts when registration event occurs on link axis.
2Link starts at an absolute position on link axis (see link_position).
4CAMBOX repeats automatically and bidirectionally. This option is can-
celled by setting bit 1 of REP_OPTION parameter (REP_OPTION = REP_OPTION OR 2).
5Combination of options 1 and 4.
6Combination of options 2 and 4.
/i
•link_position
The absolute position where CAMBOX will start when link_option is set
to 2.
Note: When the CAMBOX command is executing, the ENDMOVE
Revision 5.0
parameter is set to the end of the previous move. The REMAIN axis
parameter holds the remainder of the distance on the link axis.
PROGRAMMING MANUAL46
BASIC commands
Example' Subroutine to generate a SIN shape speed profile
' Uses: p is loop counter
' num_p is number of points stored in tables pos 0..num_p
' scale is distance travelled scale factor
profile_gen:
num_p=30
scale=2000
FOR p=0 TO num_p
TABLE(p,((-SIN(PI*2*p/num_p)/(PI*2))+p/num_p)*scale)
NEXT p
RETURN
This graph plots TABLE contents against table array position. This corresponds to motor POSITION against link POSITION when called using
CAMBOX. The SPEED of the motor will correspond to the derivative of the
position curve above.
fig. 7/i
fig. 8
Revision 5.0
PROGRAMMING MANUAL47
BASIC commands
ExampleA pair of rollers feeds plastic film into a machine. The feed is synchronised to
a master encoder and is activated when the master reaches a position held in
the variable start. This example uses the table points 0...30 generated in the
example above:
start=1000
FORWARD AXIS(1)
WHILE IN(2)=OFF
CAMBOX(0,30,800,80,15,2,start)
WA(10)
WAIT UNTIL MTYPE=0 OR IN(2)=ON
WEND
CANCEL
CANCEL AXIS(1)
WAIT IDLE
The arguments of the CAMBOX command are:
•0 is the start of the profile shape in the TABLE
•30 is the end of the profile shape in the TABLE
•800 scales the TABLE values. Each CAMBOX motion therefore
totals 800*2000 encoder edges steps.
•80 is the distance on the product conveyor to link the motion to. The units
for this parameter are the programmed distance units on the link axis.
•15 specifies the axis to link to.
•2 is the link option setting. It means: Start at absolute position on the link
axis.
•The variable start holds a position. The motion will execute when this
position is reached on axis 15.
fig. 9/i
MOTOR
AXIS 0
Revision 5.0
PROGRAMMING MANUAL48
BASIC commands
ExampleA motor on Axis 0 is required to emulate a rotating mechanical CAM. The
position is linked to motion on axis 3. The “shape” of the motion profile is held
in TABLE values 1000..1035.
The table values represent the mechanical cam but are scaled to range from
0-4000.
TABLE(1000,0,0,167,500,999,1665,2664,3330,3497,3497)
TABLE(1010,3164,2914,2830,2831,2997,3164,3596,3830,3996,3996)
TABLE(1020,3830,3497,3330,3164,3164,3164,3330,3467,3467,3164)
TABLE(1030,2831,1998,1166,666,333,0)
BASE(3)
MOVEABS(130)
WAIT IDLE
'start the continuously repeating cambox
CAMBOX(1000,1035,1,360,3,4) AXIS(0)
FORWARD start camshaft axis
WAIT UNTIL IN(2)=OFF
REP_OPTION = 2 'cancel repeating mode by setting bit 1
WAIT IDLE AXIS(0) waits for cam cycle to finish
CANCEL 'stop camshaft axis
WAIT IDLE
Note: The system software resets bit 1 of REP_OPTION after the repeating
mode has been cancelled.
fig. 10/i
Setting bit 3 (value 8) of the link options parameter enables the CAMBOX pattern mode. This mode enables a sequence of scale values to be cycled automatically. This is normally combined with the automatic repeat mode, so the
options parameter must be set to 12. This diagram shows a typical repeating
pattern which can be automated with the CAMBOX pattern mode.
The parameters for this mode are treated differently to the standard CAMBOX
function:
CAMBOX(start, end, control block pointer, link dist, link axis,options)
The start and end parameters specify the basic shape profile ONLY. The pattern sequence is specified in a separate section of the TABLE memory. There
is a new TABLE block defined: The “Control Block”. This block of seven
Revision 5.0
TABLE values defines the pattern position, repeat controls etc. The block is
fixed at 7 values long.
Therefore in this mode only there are 3 independently positioned TABLE
blocks used to define the required motion:
PROGRAMMING MANUAL49
BASIC commands
/i
•SHAPE BLOCK: This is directly pointed to by the CAMBOX command as
in any CAMBOX.
•CONTROL BLOCK: This is pointed to by the third CAMBOX parameter
in this options mode only. It is of fixed length (7 table values). It is important to note that the control block is modified during the CAMBOX operation. It must therefore be re-initialised prior to each use.
•PATTERN BLOCK: The start and end of this are pointed to by 2 of the
CONTROL BLOCK values. The pattern sequence is a sequence of scale
factors for the SHAPE.
The table below gives the CONTROL BLOCK parameters
Note: READ/WRITE values can be written to by the user program during the
pattern CAMBOX execution.
/i
Value Parameter R/W Description
0CURRENT
POSITION
1FORCE
POSITION
RThe current position within the TABLE of the pattern sequence.
This value should be initialised to the START PATTERN
number.
R/W Normally this value is -1. If at the end of a SHAPE the user
program has written a value into this TABLE position the pattern will continue at this position. The system software will then
write -1 into this position. The value written must be inside the
pattern such that the value: CB(2)<=CB(1)<=CB(3)
Value Parameter R/W Description
5REPEAT
COUNT
6NEXT
CONTROL
BLOCK
R/W Required number of pattern repeats. If -1 the pattern
repeats endlessly. The number should be positive. When the
ABSOLUTE value of CB(4) reaches CB(5) the CAMBOX finishes if CB(6)=-1. The value can be set to 0 to terminate the
CAMBOX at the end of the current pattern.
The axis the CAMBOX is linked to can run in a positive or negative direction. In the case of a negative direction link the pattern will execute in reverse. In the case where a certain
number of pattern repeats is specified with a negative direction
link, the first control block will produce one repeat less than
expected. This is because the CAMBOX loads a zero link position which immediately goes negative on the next servo cycle
triggering a REPEAT COUNT. This effect only occurs when the
CAMBOX is loaded, not on transitions from CONTROL
BLOCK to CONTROL BLOCK. This effect can easily be compensated for either by increasing the required number of
repeats, or setting the initial value of REPEAT POSITION to 1.
R/W If set to -1 the pattern will finish when the required number of
repeats are done. Alternatively a new control block pointer can
be used to point to a further control block.
2START
PATTERN
3END
PATTERN
4REPEAT
POSITION
Revision 5.0
RThe position in the TABLE of the first pattern value.
RThe position in the TABLE of the final pattern value.
R/W The current pattern repeat number. Initialise this number to 0.
The number will increment when the pattern repeats if the link
axis motion is in a positive direction. The number will decrement when the pattern repeats if the link axis motion is in a
negative direction. Note that the counter runs starting at zero:
0,1,2,3...
PROGRAMMING MANUAL50
BASIC commands
ExampleA quilt stitching machine runs a feed cycle that stitches a plain pattern before
it starts a patterned stitch. The plain pattern must run for 1000 cycles. Then, it
must runs a pattern continuously, until requested to stop at the end of the pattern. The cam profile controls the motion of the needle bar between moves.
The pattern table controls the distance of the move to make the pattern.
The same shape is used for the initialisation cycles and the pattern. This
shape is held in TABLE values 100..150. The running pattern sequence is
held in TABLE values 1000..4999. The initialisation pattern is a single value
held in TABLE(160). The initialisation control block is held in
TABLE(200)..TABLE(206). The running control block is held in
TABLE(300)..TABLE(306).
' Set up Initialisation control block:
TABLE(200,160,-1,160,160,0,1000,300)
' Set up running control block:
TABLE(300,1000,-1,1000,4999,0,-1,-1)
' Run whole lot with single CAMBOX:
' Third parameter is pointer to first control block
CAMBOX(100,150,200,5000,1,20)
WAIT UNTIL IN(7)=OFF
TABLE(305,0) ' Set zero repeats: This will stop at end of pattern
Note: The axis to which the CAMBOX is linked can run in a positive or negative direction. In the case of a negative direction link, the pattern executes in
reverse. In the case where a certain number of pattern repeats is specified
with a negative direction link, the first control block produces one repeat less
than expected. This is because the CAMBOX loads a zero link position which
immediately goes negative on the next servo cycle triggering a REPEAT
COUNT. This effect only occurs when the CAMBOX is loaded, not on transitions from CONTROL BLOCK to CONTROL BLOCK. This effect can easily be
compensated for: either increase the required number of repeats, or set the
initial value of REPEAT POSITION to 1.
fig. 11/i
AXIS 0
AXIS 1
See alsoAXIS, CAM, REP_OPTION, TABLE
Revision 5.0
PROGRAMMING MANUAL51
BASIC commands
3.2.46 CAN_CORT
/i
TypeSystem command
SyntaxCAN_CORT(unit,4,0)
Retrieves the unit status. See the table in section 4.6.2.
CAN_CORT(unit,5,bit_rate)
Initialises the TJ1-CORT with the desired bit rate.
CAN_CORT(unit,6,node_ID,mandatory_flag)
Add a slave node to the TJ1-CORT and indicate whether it is permanently
available on the network.
Reads the value of a CANopen node object using an SDO (Service Data
Object) command into the VR array. Each byte of the returned value occupies
one VR address.
Write a value of a CANopen node object using an SDO command using the
VR array as source. Each VR address is interpreted as one byte of the value
that is written.
CAN_CORT(unit,14,node_ID,VR_address)
Reads the EMCY (emergency) message from a node into the VR array. Each
Revision 5.0
byte of the eight bytes occupies one VR address.
DescriptionThe CAN_CORT commands where the second argument is 4 through 10 are
normally used in a BASIC program that is run at startup. The sequence of the
CAN_CORT commands that configure a CANopen network is important.
Arguments•unit
The sequence number of the unit.
•bit_rate
The bit rate on the CAN bus. Valid values are 2 (500 Kbps), 3 (250
Kbps), 4 (125 Kbps), 5 (50 Kbps) and 6 (20 Kbps).
•node_ID
The CANopen node on the CAN bus.
•mandatory_flag
The mandatory flag of the node.
-0 = optional, no error occurs when the node is not in the network.
-1= mandatory, an error occurs when the node is not in the network.
•PDO_number
Identification of an individual PDO. PDO_number can range from 0 to 7.
•area_type
The memory area in Trajexia: 1 = VR, 2 = TABLE, 3 = Digital I/O, 4 =
Analog I/O.
•start_address
The array index in the VR, TABLE, IN, OP, AIN or AOUT array.
•COB_ID
The COB (Controller Object Identification) ID used to identify a PDO in a
CANopen network.
•inhibit_time
The minimum time in 0.1 ms units between two consecutive transmissions of a TPDO.
•event_timer
The maximum time in ms units that is observed between two consecutive transmissions of a TPDO. If this value is 0, the time is unlimited. The
TPDO is sent only when the contents changes.
•index
The index of the addressed CANopen object.
•subindex
The subindex within the addressed CANopen object.
DescriptionThe CANCEL command cancels the move on an axis or an interpolating axis
group. Speed-profiled moves (FORWARD, REVERSE, MOVE, MOVEABS, MOVECIRC, MHELICAL and MOVEMODIFY) will be decelerated at the
deceleration rate as set by the DECEL parameter and then stopped. Other
moves will be immediately stopped.
The CANCEL command cancels the contents of the current move buffer
(MTYPE). The command CANCEL(1) cancels the contents of the next move
buffer (NTYPE) without affecting the current move in the MTYPE buffer.
CANCEL works on the default basis axis (set with BASE) unless AXIS is used
to specify a temporary base axis.
Note:
•CANCEL cancels only the presently executing move. If further moves are
buffered they will then be loaded.
•During the deceleration of the current move additional CANCELs will be
ignored.
•CANCEL(1) cancels only the presently buffered move. Any moves stored
in the task buffers indicated by the PMOVE variable can be loaded into
Revision 5.0
ArgumentsN/A
the buffer as soon as the buffered move is cancelled.
PROGRAMMING MANUAL53
BASIC commands
ExampleFORWARD
WA(10000)
CANCEL ' Stop movement after 10 seconds
ExampleMOVE(1000)
MOVEABS(3000)
CANCEL ' Cancel the move to 3000 and move to 4000 instead.
MOVEABS(4000)
Note that the command MOVEMODIFY is a better solution for modifying end
points of moves in this case.
ExampleTwo axes are connected with a ratio of 1:2. Axis 0 is cancelled after 1 second,
then axis 1 is cancelled when the speed drops to a specified level. After the
first cancel axis 1 decelerates at the DECEL rate. When the CONNECT of
axis 1 is cancelled, axis 1 stops instantly.
DescriptionThe CLEAR_BIT command resets the specified bit in the specified VR varia-
ble. Other bits in the variable keep their values.
Arguments•bit_number
The number of the bit to be reset. Range: 0 - 23.
•vr_number
The number of the VR variable for which the bit will be reset. Range: 0 -
1023.
Example>>PRINT VR(17)
112.0000
>>CLEAR_BIT(5, 17)
>>PRINT VR(17)
80.0000
See alsoREAD_BIT, SET_BIT, VR.
TypeSystem command
Revision 5.0
SyntaxCLEAR
PROGRAMMING MANUAL55
BASIC commands
3.2.52 CLEAR_PARAMS
/i
TypeSystem command
SyntaxCLEAR_PARAMS
DescriptionClears all variables and parameters stored in Flash-ROM to their default val-
ues. The CLEAR_PARAM will erase (set to 0) all the VR’s stored using
FLASHVR command. This command cannot be performed if the controller is
locked.
ArgumentsN/A
ExampleNo example.
See alsoN/A
3.2.53 CLOSE_WIN
/i
TypeAxis parameter
SyntaxCLOSE_WIN
CW
DescriptionThe CLOSE_WIN axis parameter defines the end of the window inside or out-
side which a registration mark is expected. The value is in user units.
DescriptionThe CLUTCH_RATE axis parameter defines the change in connection ratio
when using the CONNECT command. The rate is defined as amount of ratio
per second.
The default value is set to a high value (1000000) in order to ensure compatibility with previous TJ1-MC__ units.
Note: The operation using CLUTCH_RATE is not deterministic in position. If
required, use the MOVELINK command instead to avoid unnecessary phase
difference between base axis and linked axis.
ArgumentsN/A
ExampleCLUTCH_RATE = 4
This setting will imply that when giving CONNECT(4,1), it will take one second to reach the full connection.
See alsoAXIS, CONNECT, MOVELINK.
3.2.55 COMMSERROR
/i
TypeSystem parameter (read-only)
SyntaxCOMMSERROR
DescriptionThe COMMSERROR parameter contains the communication errors that
have occurred since the last time that it was initialized.
The bits in COMMSERROR are given in the table below.
ArgumentsN/A
ExampleCLOSE_WIN=10
See alsoAXIS, OPEN_WIN, REGIST, UNITS.
3.2.54 CLUTCH_RATE
/i
TypeAxis parameter
SyntaxCLUTCH_RATE
Revision 5.0
/i
BitDescription Error location
8Port 1 Rx data readySerial port 1
9Port 1 Rx OverrunSerial port 1
10Port 1 Parity ErrorSerial port 1
11Port 1 Rx Frame ErrorSerial port 1
12Port 2 Rx data readySerial port 2
13Port 2 Rx OverrunSerial port 2
14Port 2 Parity ErrorSerial port 2
15Port 2 Rx Frame ErrorSerial port 2
PROGRAMMING MANUAL56
BASIC commands
/i
ArgumentsN/A
ExampleNo example.
See alsoN/A
3.2.56 COMMSTYPE
/i
TypeSlot parameter
SyntaxCOMMSTYPE SLOT(unit_number)
DescriptionThis parameter returns the type of unit in a controller unit. The table below
lists the return values.
/i
Return valueDescription
0Unused unit
31TJ1-ML__
33TJ1-FL02
34TJ1-PRT
35TJ1-DRT
38TJ1-CORT
/i
Arguments•unit_number
Unit numbers are 0 to 6, with 0 being the unit immediately to the right of
the TJ1-MC__.
ExampleNo example.
See alsoN/A
3.2.57 COMPILE
/i
TypeProgram command
SyntaxCOMPILE
DescriptionThe COMPILE command forces the compilation of the currently selected pro-
gram to intermediate code. Program are compiled automatically by the system software prior to program execution or when another program is selected.
This command is not therefore normally required.
ArgumentsN/A
ExampleNo example.
See alsoN/A
3.2.58 CONNECT
/i
TypeAxis command
SyntaxCONNECT(ratio, driving_axis)
CO(ratio, driving_axis)
DescriptionThe CONNECT command connects the demand position of the base axis to
the measured movements of the axis specified by driving_axis to achieve an
electronic gearbox.
The ratio can be changed at any time by executing another CONNECT command on the same axis. To change the driving axis the CONNECT command
needs to be cancelled first. CONNECT with different driving axis will be
ignored. The CONNECT command can be cancelled with a CANCEL or
RAPIDSTOP command. The CLUTCH_RATE axis parameter can be used to
set a specified connection change rate.
CONNECT works on the default basis axis (set with BASE) unless AXIS is
used to specify a temporary base axis.
Revision 5.0
PROGRAMMING MANUAL57
BASIC commands
Arguments•ratio
The connection ratio of the gearbox. The ratio is specified as the encoder
edge ratio (not units). It holds the number of edges the base axis is
required to move per edge increment of the driving axis. The ratio value
can be either positive or negative and has sixteen bit fractional resolution.
•driving_axis
The Master axis which will drive the base axis.
Note: To achieve an exact connection of fractional ratio’s of values such
as 1024/3072 the MOVELINK command can be used with the continu-
ous repeat link option set to ON.
ExampleIn a press feed, a roller is required to rotate at a speed that is equal to one
quarter of the measured rate from an encoder installed on the incoming conveyor. The roller is wired to the master axis 0. The reference encoder is connected to axis 1.
BASE(0)
SERVO=ON
CONNECT(0.25,1)
fig. 14/i
CONNECT (1,1)CONNECT (0.5,1)CONNECT (2,1)
fig. 15/i
ExampleA machine has an automatic feed on axis 1 that must move at a set ratio to
axis 0. This ratio is selected using inputs 0-2 to select a particular “gear”. This
ratio can be updated every 100 ms. Combinations of inputs select the intermediate gear ratios. For example, 1 ON and 2 ON gives a ratio of 6:1.
BASE(1)
FORWARD AXIS(0)
WHILE IN(3)=ON
WA(100)
gear = IN(0,2)
CONNECT(gear,0)
WEND
RAPIDSTOP cancel the FORWARD and the CONNECT
Revision 5.0
PROGRAMMING MANUAL58
BASIC commands
ExampleAxis 0 is required to run a continuous forward. Axis 1 must connect to axis 0.
If CONNECT is called, it results in a step change. Therefore, CLUTCH_RATE
is used, together with an initial and final connect ratio of zero, to get the
required motion.
FORWARD AXIS(0)
BASE(1)
CONNECT(0,0) 'set intitial ratio to zero
CLUTCH_RATE=0.5 'set clutch rate
CONNECT(2,0) 'apply the required connect ratio
WA(8000)
CONNECT(0,0) 'apply zero ratio to disconnect
WA(4000) 'wait for deceleration to complete
CANCEL 'cancel connect
See alsoAXIS, CANCEL, CLUTCH_RATE, CONNECT, RAPIDSTOP.
fig. 16/i
Revision 5.0
PROGRAMMING MANUAL59
BASIC commands
3.2.59 CONSTANT
/i
TypeSystem command
SyntaxCONSTANT "name", value
DescriptionDeclares the name as a constant for use both within the program containing
the CONSTANT definition and all other programs in the Trajexia Studio
project.
Note: The program containing the CONSTANT definition must be run before
the name is used in other programs. In addition, only that program should be
running at the time the CONSTANT is executed, otherwise the program error
will appear and the program will stop when trying to execute this command.
For fast startup the program should also be the only process running at
power-up.
Using CONSTANT with only the name will erase the specified constant.
Using CONSTANT with no parameters will erase all CONSTANT declarations.
This also happens when the TJ1-MC__ is reset by switching the power off and
back on, or by executing the EX command.
A maximum of 128 CONSTANTs can be declared.
Arguments•name
Any user-defined name containing lower case alpha, numerical or underscore characters.
•value
The value assigned to name.
ExampleCONSTANT "nak", $15
CONSTANT "start_button", 5
IF IN(start_button)=ON THEN OP(led1, ON)
IF key_char=nak THEN GOSUB no_ack_received
See alsoN/A
DescriptionThe CONTROL parameter returns the type of TJ1-MC__ in the system. The
value of this system parameter for the TJ1-MC16 is 262, and for the TJ1MC04 the value is 263.
Note: When the Motion Controller is locked, 1000 is added to above values,
so e.g. a locked TJ1-MC16 will return 1262.
ArgumentsN/A
ExampleNo example.
See alsoN/A
3.2.61 COPY
/i
TypeProgram command
SyntaxCOPY program_name new_program_name
DescriptionThe COPY command copies an existing program in the controller to a new
program with the specified name. The program name can be specified without
quotes.
Note: This command is implemented for the Command Line Terminal.
Arguments•program_name
Name of the program to be copied.
•new_program_name
Name to use for the new program.
Example>> COPY "prog" "newprog"
See alsoDEL, NEW, RENAME.
3.2.62 COS
/i
3.2.60 CONTROL
/i
Revision 5.0
TypeSystem parameter (read-only)
SyntaxCONTROL
TypeMathematical function
SyntaxCOS(expression)
DescriptionThe COS function returns the cosine of the expression. Input values are in
radians and may have any value. The result value will be in the range from -1
to 1.
PROGRAMMING MANUAL60
BASIC commands
Arguments•expression
Any valid BASIC expression.
Example>> PRINT COS(0)
1.0000
See alsoN/A
3.2.63 CREEP
/i
TypeAxis parameter
SyntaxCREEP
DescriptionThe CREEP axis parameter contains the creep speed for the axis. The creep
speed is used for the slow part of an origin search sequence. CREEP can
have any positive value, including 0.
The creep speed is entered in units/sec with the unit conversion factor
UNITS. For example, if the unit conversion factor is set to the number of
encoder edges/inch, the speed is set in inches/sec.
DescriptionThe D_GAIN axis parameter contains the derivative gain for the axis. The
derivative output contribution is calculated by multiplying the change in Following Error with D_GAIN. The default value is 0.
Add the derivative gain to a system to produce a smoother response and to
allow the use of a higher proportional gain that could not be used otherwise.
High values can cause oscillation.
Note: The servo gain must only be changed when the SERVO is off.
Note: Servo gains have no affect on stepper output axis, ATYPE=46.
ArgumentsN/A
ExampleD_GAIN=0.25
See also•AXIS, I_GAIN, OV_GAIN, P_GAIN, VFF_GAIN.
3.2.65 D_ZONE_MAX
/i
TypeSystem parameter
SyntaxD_ZONE_MAX=value
DescriptionThis parameter works in conjunction with D_ZONE_MIN to clamp the DAC
output to zero when the demand movement is complete and the magnitude of
the Following Error is less than the D_ZONE_MIN value. The servo loop will
be reactivated when either the Following Error rises above the
D_ZONE_MAX value, or a fresh movement is started.
ArgumentsN/A
ExampleD_ZONE_MIN=3
D_ZONE_MAX=10
With these 2 parameters set as above, the DAC output will be clamped at
Revision 5.0
zero when the movement is complete and the Following Error falls below 3.
When a movement is restarted or if the Following Error rises above a value of
10, the servo loop will be reactivated.
PROGRAMMING MANUAL61
BASIC commands
See alsoD_ZONE_MIN.
3.2.66 D_ZONE_MIN
/i
Typ eSy stem pa ram ete r
SyntaxD_ZONE_MIN=value
DescriptionThis parameter works in conjunction with D_ZONE_MAX to clamp the DAC
output to zero when the demand movement is complete and the magnitude of
the Following Error is less than the D_ZONE_MIN value. The servo loop will
be reactivated when either the Following Error rises above the
D_ZONE_MAX value, or a fresh movement is started.
ArgumentsN/A
ExampleD_ZONE_MIN=3
D_ZONE_MAX=10
With these 2 parameters set as above, the DAC output will be clamped at
zero when the movement is complete and the Following Error falls below 3.
When a movement is restarted or if the Following Error rises above a value of
10, the servo loop will be reactivated.
See alsoD_ZONE_MAX.
3.2.67 DAC
See S_REF.
DescriptionThe DAC_SCALE axis parameter is an integer multiplier which is applied
between the servo control loop output and the Digital to Analog Converter
which output is supplied to the Servo Driver. It value is set to 16 on axes with
a 16 bit Digital to Analog Converter, which are Flex axis types. This scales
the values applied to the higher resolution DAC so that the gains required on
the axis are similar to those required on the other controllers.
DAC_SCALE may be set negative (-16) to reverse the polarity of the DAC
output signal. This is useful in case if e.g. absolute SSI encoder used has no
capability of changing default CW/CCW rotation direction and the default
direction is opposite to the one of the Servo Driver used.
Note: When the SERVO is OFF for a given axis, the magnitude of
DAC_SCALE is not important as the voltage applied is controlled by the DAC
parameter. The polarity is still reversed however by DAC_SCALE.
Note: The default DAC_SCALE value for MECHATROLINK-II axis types is 1.
ArgumentsN/A
ExampleDAC_SCALE AXIS(3)=-16
See alsoDAC, S_REF.
3.2.70 DATE
/i
TypeSystem parameter
SyntaxDATE
3.2.68 DAC_OUT
See S_REF_OUT.
3.2.69 DAC_SCALE
/i
TypeAxis parameter
Revision 5.0
SyntaxDAC_SCALE
DescriptionReturns or sets the current date held by the Trajexia' s real time clock. The
number may be entered in DD:MM:YY or DD:MM:YYYY format.
ArgumentsN/A
ExampleDATE=20:10:05
or
DATE=20:10:2005
Example>>PRINT DATE
36956
This prints the number representing the current day. This number is the
number of days since 1st January 1900, with 1 Jan. 1900 represented as 1.
PROGRAMMING MANUAL62
BASIC commands
See alsoN/A
3.2.71 DATE$
/i
TypeSystem command
SyntaxDATE$
DescriptionPrints the current date DD/MM/YY as a string to the communication port. A 2-
digit year description is given.
ArgumentsN/A
ExamplePRINT #1, DATE$
This will print the date in format for example: 20/10/05
See alsoN/A
3.2.72 DATUM
/i
TypeAxis command
SyntaxDATUM(sequence)
DescriptionThe DATUM command performs one of 6 origin search sequences to position
an axis to an absolute position and also reset the error bits in AXISSTATUS
axis parameter.
DATUM uses both the creep and demand speed for the origin search. The
creep speed in the sequences is set with the CREEP axis parameter and the
demand speed is set with the SPEED axis parameter. The datum switch input
number, used for sequences 3 to 6, is set by the DATUM_IN parameter.DATUM works on the default basis axis (set with BASE) unless AXIS is used
to specify a temporary base axis.
Note: The origin input set with the DATUM_IN parameter is active low, i.e., the
origin switch is set when the input is OFF. The feedhold, reverse jog, forward
jog, forward and reverse limit inputs are also active low. Active low inputs are
Revision 5.0
Arguments•sequence
used to enable fail-safe wiring.
See the table below.
/i
sequence
value
0The DATUM(0) command will clear the motion error. The currently measured
1The axis moves at creep speed forward until the Z marker is encountered.
2The axis moves at creep speed in reverse until the Z marker is encountered.
3The axis moves at the demand speed forward until the datum switch is
4The axis moves at the demand speed in reverse until the datum switch is
5The axis moves at demand speed forward until the datum switch is reached.
Description
position is set as the demand position (this is especially useful on stepper
axes with position verification). DATUM(0) also clears the Following Error that
exceeded the FE_LIMIT condition in the AXISSTATUS register for ALL axes.
It sets these bits in AXXISSTATUS to zero:
Bit 1 : Following Error Warning.
Bit 2 : Remote Driver Comms Error.
Bit 3 : Remote Driver Error.
Bit 8 : Following Error Limit Exceeded.
Bit 11 : Cancelling Move.
Note that the status can not be cleared if the cause of the problem is still
present. DATUM(0) must only be used after the WDOG is set to OFF, other-
wise there will be unpredictable errors on the motion.
The demand position is then reset to 0 and the measured position corrected
so as to maintain the Following Error.
The demand position is then reset to 0 and the measured position corrected
so as to maintain the Following Error.
reached. The axis then moves reverse at creep speed until the datum switch
is reset. The demand position is then reset to 0 and the measured position
corrected so as to maintain the Following Error.
reached. The axis then moves forward at creep speed until the datum switch
is reset. The demand position is then reset to 0 and the measured position
corrected so as to maintain the Following Error.
The axis then reverses at creep speed until the datum switch is reset. The
axis continues in reverse at creep speed until the Z marker of the encoder is
encountered. The demand position is then reset to 0 and the measured position corrected so as to maintain the Following Error.
PROGRAMMING MANUAL63
BASIC commands
sequence
value
6The axis moves at demand speed reverse until the datum switch is reached.
ExampleA production line must stop if something blocks the product belt, which
Description
The axis then moves forward at creep speed until the datum switch is reset.
The axis continues forward at creep speed until the Z marker of the encoder is
encountered. The demand position is then reset to 0 and the measured position corrected so as to maintain the Following Error.
causes a motion error. The obstacle must be removed, and a reset button
must be pressed to restart the line.
FORWARD 'start production line
WHILE IN(2)=ON
IF MOTION_ERROR=0 THEN
OP(8,ON) 'green light on; line is in motion
ELSE
OP(8, OFF)
GOSUB error_correct
ENDIF
WEND
CANCEL
STOP
fig. 17/i
error_correct:
REPEAT
OP(10,ON)
WA(250)
OP(10,OFF) 'flash red light to show crash
WA(250)
UNTIL IN(1)=OFF
DATUM(0) 'reset axis status errors
SERVO=ON 'turn the servo back on
WDOG=ON 'turn on the watchdog
OP(9,ON) 'sound siren that line will restart
Revision 5.0
WA(1000)
OP(9,OFF)
FORWARD 'restart motion
RETURN
PROGRAMMING MANUAL64
BASIC commands
ExampleThe position of an axis must be defined by the Z marker. This position must
be set to zero. Then the axis must move to this position. Using the datum 1
the zero point is set on the Z mark. But the axis starts to decelerate at this
point, and therefore it stops after the mark. A move is used to bring it back to
the Z position.
SERVO=ON
WDOG=ON
CREEP=1000 'set the search speed
SPEED=5000 'set the return speed
DATUM(1) 'register on Z mark and sets this to datum
WAIT IDLE
MOVEABS (0) 'moves to datum position
ExampleA machine must return to its home position defined by the limit switch which is
found at the rear of the move before operation. This can be achieved through
using DATUM(4) which moves in reverse to find the switch.
SERVO=ON
WDOG=ON
REV_IN=-1 'temporarily turn off the limit switch function
DATUM_IN=5 'sets input 5 for registration
SPEED=5000 'set speed, for quick location of limit switch
CREEP=500 'set creep speed for slow move to find edge of switch
DATUM(4) 'find edge at creep speed and stop
WAIT IDLE
DATUM_IN=-1
REV_IN=5 'restore input 5 as a limit switch again
fig. 18/i
fig. 19/i
Revision 5.0
PROGRAMMING MANUAL65
BASIC commands
ExampleA machine similar to the machine in the example above must locate a home
switch, which is at the forward end of the move. The machine then moves
backwards to the next Z marker, and set this Z marker as the
datum. This is done with DATUM(5), which moves forward at SPEED to
locate the switch, then reverses at CREEP to the Z marker. If required, a
move is made to the datum Z marker.
SERVO=ON
WDOG=ON
DATUM_IN=7 'sets input 7 as home switch
SPEED=5000 'set speed, for quick location of switch
CREEP=500 'set creep speed for slow move to find edge of switch
DATUM(5) 'start the homing sequence
WAIT IDLE
See alsoACCEL, AXIS, AXISSTATUS, CREEP, DATUM_IN, DECEL,
MOTION_ERROR, SPEED.
3.2.73 DATUM_IN
/i
TypeAxis parameter
fig. 20/i
SyntaxDATUM_IN
DAT_IN
DescriptionThe DATUM_IN axis parameter contains the input number to be used as the
datum switch input for the DATUM command. The valid input range is given
by 0 to 31. Values 0 to 15 represent physically present inputs of TJ1-MC__ I/
O connector and are common for all axes.
Values 16 to 31 are mapped directly to driver inputs that are present on the
CN1 connector. They are unique for each axis. It depends on the type of
Servo Driver which Servo Driver inputs are mapped into inputs 16 to 31. For
more information on Servo Driver I/O mapping into the Trajexia I/O space,
refer to section 5.1.4.
Note: The origin input is active low, i.e., the origin switch is set when the input
Revision 5.0
ArgumentsN/A
is OFF. The feedhold, reverse jog, forward jog, forward and reverse limit
inputs are also active low. Active low inputs are used to enable fail-safe wiring.
PROGRAMMING MANUAL66
BASIC commands
ExampleDATUM_IN AXIS(0)=5
See alsoAXIS, DATUM.
3.2.74 DAY
/i
Typ eSy stem pa ram ete r
SyntaxDAY
DescriptionReturns the current day as a number 0..6, Sunday is 0. DAY can be set by
assignment.
ArgumentsN/A
Example>>DAY=3
>>? DAY
3.0000
See alsoN/A
3.2.75 DAY$
/i
TypeSystem command
SyntaxDAY$
DescriptionPrints the current day as a string.
ArgumentsN/A
Example>>DAY=3
>>? DAY$
Wednesday
See alsoN/A
SyntaxDECEL
DescriptionThe DECEL axis parameter contains the axis deceleration rate. The rate is
set in units/s
ArgumentsN/A
ExampleDECEL = 100 ' Set deceleration rate
PRINT " Deceleration rate is ";DECEL;" mm/s/s"
See alsoACCEL, AXIS, UNITS.
2
. The parameter can have any positive value including 0.
DescriptionThe DEFPOS command defines the current demand position (DPOS) as a
new absolute position. The measured position (MPOS) will be changed
accordingly in order to keep the Following Error. DEFPOS is typically used
after an origin search sequence (see DATUM command), as this sets the current position to 0. DEFPOS can be used at any time.
As an alternative also the OFFPOS axis parameter can be used. This parameter can be used to perform a relative adjustment of the current position.
DEFPOS works on the default basis axis or axis sequence group (set with
BASE) unless AXIS is used to specify a temporary base axis.
Note: The changes to the axis position made using DEFPOS or OFFPOS are
made on the next servo update. This can potentially cause problems when a
move is initiated in the same servo period as the DEFPOS or OFFPOS.
The following example shows how the OFFPOS parameter can be used to
avoid this problem. DEFPOS commands are internally converted into
OFFPOS position offsets, which provides an easy way to avoid the problem
by programming as follows:
DEFPOS(100): WAIT UNTIL OFFPOS = 0: MOVEABS(0)
3.2.76 DECEL
Revision 5.0
/i
TypeAxis parameter
ArgumentsThe command can take up to 16 arguments.
•pos_i
The absolute position for (base+i) axis in user units. Refer to the BASE
command for the grouping of the axes.
PROGRAMMING MANUAL67
BASIC commands
ExampleAfter 2 axes returned to their homing positions, it is required to change the
DPOS values so that the home positions are not zero, but some defined positions instead.
DATUM(5) AXIS(1) ' home both axes. At the end of the DATUM
DATUM(4) AXIS(3) ' procedure, the positions are 0,0.
WAIT IDLE AXIS(1)
WAIT IDLE AXIS(3)
BASE(1,3) ' set up the BASE array
DEFPOS(-10,-35) ' define positions of the axes to be -10 and -35
fig. 21/i
Revision 5.0
PROGRAMMING MANUAL68
BASIC commands
ExampleSet the axis position to 10, then start an absolute move, but make sure the
axis has updated the position before loading the MOVEABS.
DEFPOS(10.0)
WAIT UNTIL OFFPOS=0
' Makes sure that DEFPOS is complete before next line
MOVEABS(25.03)
fig. 22/i
fig. 23/i
ExampleFrom the Command Line of the Terminal window, quickly set the DPOS val-
ues of the first four axes to 0.
>>BASE(0)
>>DP(0,0,0,0)
See alsoAXIS, DATUM, DPOS, OFFPOS, MPOS, UNITS.
BEFOREAFTER
Revision 5.0
PROGRAMMING MANUAL69
BASIC commands
3.2.78 DEL
/i
TypeProgram command
SyntaxDEL [program_name]
RM [program_name]
DescriptionThe DEL command deletes a program from the controller. DEL without a pro-
gram name can be used to delete the currently selected program (using
SELECT). The program name can also be specified without quotes. DEL ALL
will delete all programs.
DEL can also be used to delete the Table: DEL "TABLE". The name
"TABLE" must be in quotes.
Note: This command is implemented for the Command Line Terminal.
Arguments•program_name
Name of the program to be deleted.
Example>> DEL oldprog
See alsoCOPY, NEW, RENAME, SELECT, TABLE.
3.2.79 DEMAND_EDGES
/i
TypeAxis parameter (read-only)
SyntaxDEMAND_EDGES
DescriptionThe DEMAND_EDGES axis parameter contains the current value of the
DescriptionDEVICENET function 2 configures the TJ1-DRT for data exchange with the
DeviceNet master unit and defines areas in the VR memory where I/O
exchange takes place. DEVICENET function 4 returns the data exchange status of the TJ1-DRT. Refer to the table below for the description of the bits in
the data exchange status word.
/i
BitValueDescription
00Command DEVICENET (unit_number, 2, ...) not executed yet
1Command DEVICENET (unit_number, 2, ...) executed without error
10No DeviceNet I/O connection
1DeviceNet I/O connection running
20VR variables in the output data range have been updated
1VR variables in the output data range have not been updated yet
30DeviceNet I/O connection size matches the DEVICENET
(unit_number, 2,…) command
1DeviceNet I/O connection size does not match the
DEVICENET(unit_number, 2,…) command
4-70Always zero
80Network power OK
1Network power failure
90No BUSOFF occurred
1BUSOFF occurred
PROGRAMMING MANUAL70
BASIC commands
BitValueDescription
100No node address duplication error
1Node address duplication error
/i
Arguments•unit_number
Specifies the unit number of the TJ1-DRT in the Trajexia system.
•VR_start_outputs
The starting address in VR memory of the controller where the output
data from the DeviceNet master is located.
•no_outputs
The number of output words from the DeviceNet master in VR memory.
•VR_start_inputs
The starting address in VR memory of the controller where the input data
for the DeviceNet master is located.
•no_inputs
The number of input words to the DeviceNet master in VR memory.
ExampleDEVICENET (0,2,1,10,16,150,31)
In this example, the TJ1-DRT is configured to exchange data with DeviceNet
master with 16 output words (received from the master) located at VR(10) to
VR(25), and 31 input words (sent to the master) located at VR(150) to
VR(180).
See alsoN/A
3.2.81 DIR
/i
TypeProgram command
SyntaxDIR
LS
DescriptionThe DIR command shows a list of the programs held in the controller, the
memory size and the RUNTYPE. DIR also shows the available memory size,
Revision 5.0
power up mode and current selected program of the controller.
Note: This command is implemented for the Command Line Terminal only.
ExampleNo example.
See alsoFREE, POWER_UP, PROCESS, RUNTYPE, SELECT.
3.2.82 DISABLE_GROUP
/i
TypeAxis command
SyntaxDISABLE_GROUP(-1)
DISABLE_GROUP(axis_1 [, axis_2 [, ...]] )
DescriptionThe DISABLE_GROUP is used to create a group of axes which will be disa-
bled if there is a motion error in any or more axes in the group. After the group
is made, when an error occurs on one they will all have their AXIS_ENABLE
set OFF and SERVO set OFF. Multiple groups can be made, although an axis
cannot belong to more than one group. All groupings can be cleared using
DISABLE_GROUP(-1).
Note: For use with MECHATROLINK-II only..
Arguments•axis_i
A BASIC expression that evaluates to an axis number.
ExampleA machine has 2 functionally separate parts, which have their own emergency
stop and operator protection guarding. If there is an error on one part of the
machine, the other part can continue to run while the cause of the error is
removed and the axis group restarted. For this, 2 separate axis groupings
must be set up.
DISABLE_GROUP(-1) ' remove any previous axis groupings
DISABLE_GROUP(0,1,2,6) ' group axes 0 to 2 and 6
DISABLE_GROUP(3,4,5,7) ' group axes 3 to 5 and 7
WDOG=ON ' turn on the enable relay and the remote drive enable
FOR ax=0 TO 7
AXIS_ENABLE AXIS(ax)=ON ' enable the 8 axes
SERVO AXIS(ax)=ON ' start position loop servo for each axis
NEXT ax
ArgumentsN/A
PROGRAMMING MANUAL71
BASIC commands
ExampleTwo conveyors operated by the same Motion Coordinator are required to run
independently, to make sure that the second conveyor does not stop if the
first conveyor is blocked.
DISABLE_GROUP(0) 'put axis 0 in its own group
DISABLE_GROUP(1) 'put axis 1 in another group
GOSUB group_enable0
GOSUB group_enable1
WDOG=ON
FORWARD AXIS(0)
FORWARD AXIS(1)
WHILE TRUE
IF AXIS_ENABLE AXIS(0)=0 THEN
PRINT "motion error axis 0"
reset_0_flag=1
ENDIF
IF AXIS_ENABLE AXIS(1)=0 THEN
PRINT "motion error axis 1"
reset_1_flag=1
ENDIF
IF reset_0_flag=1 AND IN(0)=ON THEN
GOSUB group_enable0
FORWARD AXIS(0)
reset_0_flag=0
ENDIF
IF reset_1_flag=1 AND IN(1)=ON THEN
GOSUB group_enable1
FORWARD AXIS(1)
reset_1_flag=0
ENDIF
WEND
group_enable0:
BASE(0)
DATUM(0) ' clear motion error on axis 0
WA(10)
ExampleOne group of axes in a machine must be reset if a motion error occurs, with-
out affecting the remaining axes. This must be done manually by clearing the
cause of the error, pressing a button to clear the error flags of the controllers
and re-enabling the motion.
DISABLE_GROUP(-1) 'remove any previous axis groupings
DISABLE_GROUP(0,1,2) 'group axes 0 to 2
GOSUB group_enable 'enable the axes and clear errors
WDOG=ON
SPEED=1000
FORWARD
WHILE IN(2)=ON
check axis 0, but all axes in the group will disable together
IF AXIS_ENABLE =0 THEN
PRINT "Motion error in group 0"
PRINT "Press input 0 to reset"
IF IN(0)=0 THEN 'checks if reset button is pressed
GOSUB group_enable 'clear errors and enable axis
FORWARD 'restarts the motion
ENDIF
ENDIF
WEND
STOP 'stop program running into sub routine
group_enable: 'Clear group errors and enable axes
DATUM(0) 'clear any motion errors
WA(10)
FOR axis_no=0 TO 2
AXIS_ENABLE AXIS(axis_no)=ON 'enable axes
SERVO AXIS(axis_no)=ON 'start position loop servo
NEXT axis_no
RETURN
See alsoN/A
Revision 5.0
3.2.83 DISPLAY
/i
TypeSystem parameter
SyntaxDISPLAY=value
DescriptionDetermines the I/O channels to be displayed on the front panel LEDs. The
DISPLAY parameter may be used to select which bank of I/O should be displayed. The parameter default value is 0.
The values are in the table below.
/i
valueDescription
0Inputs 0 to 7 (default)
1Inputs 8 to 15
2Inputs 16 to 23
3Inputs 24 to 31
4Outputs 0 to 7 (not used on Trajexia)
5Outputs 8 to 15
6Outputs 16 to 23
7Outputs 24 to 31
/i
ArgumentsN/A
ExampleDISPLAY=5
Shows outputs 8-15.
See alsoN/A
3.2.84 DPOS
/i
TypeAxis parameter (read-only)
SyntaxDPOS
PROGRAMMING MANUAL73
BASIC commands
DescriptionThe DPOS axis parameter contains the demand position in user units, which
is generated by the move commands in servo control. When the controller is
in open loop (SERVO=OFF), the measured position (MPOS) will be copied to
the DPOS in order to maintain a 0 Following Error.
The range of the demand position is controlled with the REP_DIST and
REP_OPTION axis parameters. The value can be adjusted without doing a
move by using the DEFPOS command or OFFPOS axis parameter. DPOS is
reset to 0 at start-up or controller reset.
ArgumentsN/A
Example>> PRINT DPOS AXIS(0)
34.0000
The above line will return the demand position in user units.
See alsoAXIS, DPOS, DEFPOS, DEMAND_EDGES, FE, MPOS, REP_DIST,
REP_OPTION, OFFPOS, UNITS.
3.2.85 DRIVE_ALARM
/i
TypeAxis command
SyntaxDRIVE_ALARM(VR)
DescriptionThe DRIVE_ALARM function reads the current alarm of the Servo Driver that
is connected to the Trajexia system via MECHATROLINK-II. Upon successful
execution, the command returns -1 and stores the value in the VR memory
location specified by the VR parameter. If the command cannot be executed,
the value 0 is returned. The command is executed on the driver for the base
axis set by BASE. The base axis can be changed with the AXIS modifier, as
with all the other axis commands and parameters.
This command waits for the response from the axis, The execution of the
command can be slow and variable in time. If you require a quick response
do not use this command.
Arguments•VR
The alarm value is stored on the VR address on successful execution.
Revision 5.0
ExampleIF NOT DRIVE_ALARM(10) AXIS(2)THEN
PRINT "Failed to readalarm for Servo Driver"
ELSE
IF VR(10) = 0THEN
PRINT "ServoDriver healthy"
ELSE
PRINT "Servoalarm code: "; VR(10)
ENDIF
ENDIF
This example reads an alarm of the Servo Driver driving axis 2 and present
that information to the user.
See alsoN/A
3.2.86 DRIVE_CLEAR
/i
TypeAxis command
SyntaxDRIVE_CLEAR
DescriptionThe DRIVE_CLEAR command clears the alarm status of the Servo Driver
connected via the MECHATROLINK-II bus. This command is not capable of
clearing all the possible alarm states. Some alarms can only be cancelled by
turning off the power supply (both the TJ1-MC__ and the Servo Driver), and
then turning it on again. Also, an alarm will not be cleared if the cause of the
alarm is still present. The command is executed on the driver for the base
axis set by BASE. The base axis can be changed with the AXIS modifier, as
with all the other axis commands and parameters.
ArgumentsN/A
ExampleNo example.
See alsoDRIVE_STATUS.
Caution
Be sure that no Parameter Unit or Personal Computer Software is
connected to the Servo Driver when executing this command.
Otherwise the program task will be paused until the connection of
the other device to the Servo Driver is removed.
PROGRAMMING MANUAL74
BASIC commands
3.2.87 DRIVE_CONTROL
/i
TypeAxis parameter
SyntaxDRIVE_CONTROL
DescriptionWhen applied to an axis driven by the Servo Driver connected to the system
via the MECHATROLINK-II bus, this parameter selects the data to be monitored by DRIVE_MONITOR according to the table below.
/i
CodeDescription
2Following error (this is the real FE when ATYPE=40 is used)
8Feedback speed (With ATYPE=41 Units=Max Speed/40000000H, with other
ATYPE Units= reference units/s)
9Command speed (units same as in Feedback Speed)
10Target speed (units same as in Feedback Speed)
11Torque (Force) reference (With ATYPE=42 Units=Max Torque/40000000H, with
other ATYPE Units= % over nominal Torque
14Monitor selected with Pn813.0 Useful to monitor servo monitors (Unxxx)
15Monitor selected with Pn813.1 Useful to monitor servo monitors (Unxxx)
/i
When applied to an axis driven by the Servo Driver connected to the system
via the TJ1-FL02, this parameter sets outputs of the TJ1-FL02. Set bit 8 of
this parameter to switch on OUT 0 for an axis. Set bit 9 of this parameter to
switch on OUT 1 for an axis. Keep in mind that the same outputs are used by
the HW_PSWITCH command.
The command is executed on the driver for the base axis set by BASE. The
base axis can be changed with the AXIS modifier, as with all the other axis
commands and parameters.
ArgumentsN/A
Revision 5.0
ExampleDRIVE_CONTROL AXIS(2) = 256
In this example, OUT 0 is switched on for axis 2, connected using the TJ1FL02.
See alsoN/A
3.2.88 DRIVE_INPUTS
/i
TypeAxis parameter
SyntaxDRIVE_INPUTS
DescriptionThis parameter monitors the status of the inputs of the Servo Driver con-
nected via the MECHATROLINK-II bus. The parameter value is updated each
SERVO_PERIOD cycle. It is a bit-wise word with the bits as listed in the table
below.
/i
Bit
Servo Driver input signalDescription
no.
Sigma-IISigma-VJunmaG-Series /
Accurax G5
0P_OTP_OTP_OTP_OTForward limit switch
1N_OTN_OTN_OTN_OT Reverse limit switch
2DECDEC/DECDECZero point return deceleration
3PAPANot usedNot usedEncoder A phase signal
4PBPBNot usedNot usedEncoder B phase signal
5PCPCNot usedPCEncoder C phase signal
6EXT1EXT1/EXT1EXT1First external latch signal
7EXT2EXT2Not usedEXT2Second external latch signal
8EXT3EXT3Not usedEXT3Third external latch signal
9BRKBRK/BRKBRKBrake output
10ReservedHBBE-STPE-STPEmergency stop switch
11ReservedReservedNot usedSI2General input 2
12IO12IO12Not usedPCLGeneral input 12 (Sigma-II
and Sigma-V), Torque limit
input in positive direction (GSeries and Accurax G5)
PROGRAMMING MANUAL75
BASIC commands
Bit
Servo Driver input signalDescription
no.
Sigma-IISigma-VJunmaG-Series /
Accurax G5
13IO13IO13Not usedNCLGeneral input 13 (Sigma-II
and Sigma-V), Torque limit
input in negative direction (GSeries and Accurax G5)
14IO14IO14Not usedSI0General input 14 (Sigma-II
and Sigma-V), General input
0 (G-Series and Accurax G5)
15IO15IO15Not usedSI1General input 15 (Sigma-II
and Sigma-V), General input
1 (G-Series and Accurax G5)
/i
For Sigma-II the recommended setting is: Pn81E=4321 & Pn511=654x. Refer
to section 5.1.4 for more information about mapping Servo Driver inputs and
outputs.
The command is executed on the driver for the base axis set by BASE. The
base axis can be changed with the AXIS modifier, as with all the other axis
commands and parameters.
ArgumentsN/A
ExampleNo example.
See alsoN/A
3.2.89 DRIVE_MONITOR
/i
TypeAxis parameter
SyntaxDRIVE_MONITOR
DescriptionThis parameter contains the monitored data of the Servo Driver connected
to the system via the MECHATROLINK-II bus. The data to be monitored is
selected using DRIVE_CONTROL and can be displayed in the Trajexia Stu-
dio scope or used inside a program. The monitored data is updated each
SERVO_PERIOD. The command is executed on the driver for the base axis
set by BASE. The base axis can be changed with the AXIS modifier, as with
all the other axis commands and parameters.
ArgumentsN/A
ExampleNo example.
See alsoN/A
3.2.90 DRIVE_READ
/i
TypeAxis command
SyntaxDRIVE_READ(parameter, size, VR)
DescriptionThe DRIVE_READ function reads the specified parameter of the Servo Driver
connected to the Trajexia system via the MECHATROLINK-II bus. Upon successful execution, this command returns -1 and puts the read value in the VR
memory location specified by the VR parameter. If the command cannot be
executed, the value 0 is returned. The command is executed on the driver for
the base axis set with BASE. It can be changed using the AXIS modifier, like
with all the other axis commands and parameters.
Note: This command waits for the response of the axis, therefore its execution
is slow and the time variable. Do not use this command together with other
commands that require quick execution.
Note: Executing a DRIVE_READ will temporarily disable the Servo Driver
Front Panel display.
Note: DRIVE_READ returns -1 on success. It also returns -1 with no parameter read if the parameter number does not exist or has the wrong size.
Revision 5.0
PROGRAMMING MANUAL76
BASIC commands
Arguments•parameter
The number of the parameter to be read. Note that the parameter numbers are hexadecimal. The format of the data can be found in the Servo
Driver manual.
•size
SIze of the parameter is specified in bytes. For most parameters the size
is normally 2 bytes. Some special parameters may be 4 bytes long. Sizes
for each parameter can be found in the Servo Driver manual.
•VR
The VR address where the read parameter is stored upon successful
execution.
ExampleIF DRIVE_READ($100,2,1) THEN
PRINT "The Speed loop gain is: ";VR(1)
ELSE
PRINT "The speed loop gain could not be read"
ENDIF
See alsoDRIVE_WRITE, HEX, $ (HEXADECIMAL INPUT).
Caution
Be sure that no Parameter Unit or Personal Computer Software is
connected to the Servo Driver when executing this command. Otherwise the program task will be paused until the connection of the
other device to the Servo Driver is removed.
3.2.91 DRIVE_RESET
See alsoN/A
Caution
Be sure that no Parameter Unit or Personal Computer Software is
connected to the Servo Driver when executing this command.
Otherwise the program task will be paused until the connection of
the other device to the Servo Driver is removed.
3.2.92 DRIVE_STATUS
/i
TypeAxis parameter (read-only)
SyntaxDRIVE_STATUS
DescriptionFor MECHATROLINK-II axes, this parameter is set from the STATUS field in
the MECHATROLINK-II communication frame and is updated every servo
period. Those bits can be seen in the Intelligent drives configuration window
in Trajexia Studio, and can be used in programs. The explanation of each bit
is given in the table below. (Note: Only bits relevant to MECHATROLINK-II
axes are listed.) For the detailed explanation for these status bits, see the
MECHATROLINK-II manual.
/i
BitDescription (MECHATROLINK-II)
0Alarm
/i
TypeAxis command
SyntaxDRIVE_RESET
DescriptionThe DRIVE_RESET command resets the Servo Driver connected via the
MECHATROLINK-II bus. The command is executed on the driver for the base
axis set by BASE. The base axis can be changed with the AXIS modifier, as
Revision 5.0
ArgumentsN/A
ExampleNo example.
with all the other axis commands and parameters.
1Warning
2Ready
3Servo on
4Power on
5Machine Lock
6Home Position
7At Position/Speed
8Output Completed
PROGRAMMING MANUAL77
BASIC commands
BitDescription (MECHATROLINK-II)
9Torque Limit
10Latch Completed
11In Range/Speed Limit
/i
For Flexible Axis axes, this parameter holds the status of registration and
auxiliary inputs, as well as registration selection. The explanation of each bit
is given in the second table below. (Note: Only bits relevant to Flexible axis
are listed.)
/i
BitDescription (Flexible Axis)
0MARK
1MARKB
2REG 0 selected current value
3REG 1 selected current value
4AUX IN current value
5REG 0 current value
6REG 1 current value
/i
ArgumentsN/A
ExamplePRINT DRIVE_STATUS AXIS(4)
This command will print the current value of DRIVE_STATUS for axis(4).
ExampleBASE(3)
ATYPE = 44
IF (DRIVE_STATUS AND 32)= 32 THEN
PRINT "REG 0 input is ON for axis(3)"
ENDIF
Revision 5.0
See alsoAXIS, MARK, MARKB, REGIST.
3.2.93 DRIVE_WRITE
/i
TypeAxis command
SyntaxDRIVE_WRITE(parameter, size, value [,mode])
DescriptionThe DRIVE_WRITE function writes to the specified parameter of the Servo
Driver via the MECHATROLINK-II bus. Upon successful execution, this command returns -1. If the command cannot be executed, the value 0 is returned.
The command is executed on the driver for the base axis set with BASE. It
can be changed using the AXIS modifier, as with all other axis commands and
parameters. For some parameters to be written the driver needs to be powered off and on again. The DRIVE_RESET command can be used for that
purpose.
Note: This command waits for the response of the axis so, its execution is
slow and the time variable. Do not use this command together with other commands that require quick execution.
Note: Executing a DRIVE_WRITE will temporarily disable the Servo Driver
Front Panel display.
Note: DRIVE_WRITE returns -1 on success. It also returns -1 with no parameter read if the parameter number does not exist or has the wrong size.
Arguments•parameter
The number of the parameter to write to. Note that the parameter numbers are hexadecimal. The format of the data can be found in the Refer to
the Servo Driver manual for the format of the data.
•size
SIze of the parameter is specified in bytes. For most parameters the size
is normally 2 bytes. Some special parameters may be 4 bytes long. Sizes
for each parameter can be found in the Servo Driver manual.
•value
The value to be written into driver parameter.
•mode
The write mode. Possible values: 0 (or omitted) - write and store in RAM;
1 - write and store in EPROM.
ExampleIF DRIVE_WRITE($100,2,90) THEN
PRINT "The new speed loop gain is: 90"
ELSE
PRINT "The speed loop gain could not be written in RAM"
ENDIF
PROGRAMMING MANUAL78
BASIC commands
See alsoDRIVE_READ, DRIVE_RESET, $ (HEXADECIMAL INPUT)
Caution
Be sure that no Parameter Unit or Personal Computer Software is
connected to the Servo Driver when executing this command. Otherwise the program task will be paused until the connection of the
other device to the Servo Driver is removed.
3.2.94 EDIT
/i
TypeProgram command
SyntaxEDIT [ line_number ]
ED [ line_number ]
DescriptionThe EDIT command starts the built in screen editor allowing a program in the
controller to be modified using a Command Line Terminal. The currently
selected program will be edited.
The editor commands are as follows:
•Quit Editor: [CTRL] K and D
•Delete Line: [CTRL] Y
This command is implemented for a Command Line Terminal.
Arguments•line_number
The number of the line at which to start editing.
ExampleNo example.
See alsoSELECT.
3.2.95 ELSE
See IF..THEN..ELSE..ENDIF.
3.2.96 ELSEIF
Revision 5.0
See IF..THEN..ELSE..ENDIF.
3.2.97 ENCODER
/i
TypeAxis parameter (read-only)
SyntaxENCODER
DescriptionThe ENCODER axis parameter contains a raw copy of the encoder hardware
register or the raw data received from the drive via MECHATROLINK-II. On
axes with absolute encoders, the ENCODER parameter contains a value
using a number of bits programmed with ENCODER_BITS.
The MPOS axis parameter contains the measured position calculated from
the ENCODER value automatically, allowing for overflows and offsets.
ArgumentsN/A
ExampleNo example.
See alsoAXIS, MPOS.
3.2.98 ENCODER_BITS
/i
TypeAxis parameter
SyntaxENCODER_BITS = value
DescriptionThis axis parameter configures the interface for the number of encoder bits for
Flexible axis SSI and EnDat absolute encoder axes. The parameter is applicable only to axes of ATYPE values 47 and 48.
When applied to Flexible axis EnDat absolute encoder axis, bits 0 - 7 of the
parameter should be set to the total number of encoder bits. Bits 8 - 14 should
be set to the number of multi-turn bits to be used.
When applied to Flexible axis SSI absolute encoder axis, bits 0 - 5 of the
parameter should be set to the number of encoder bits. Bit 6 should be 1 for
binary operation, or 0 for Gray code.
For SSI encoders of the “Balluff” brand bits 8..10 allow an additional hardware
shift to be specified. Normally bits 8..10 are 0.
Note: If using Flexible axis absolute encoder axis, it is essential to set this
parameter for the axis before setting the ATYPE.
ArgumentsN/A
PROGRAMMING MANUAL79
BASIC commands
ExampleENCODER_BITS = 25 + (256 * 12)
ATYPE = 47
In this example a 25 bit EnDat encoder is used, that has 12 bits for multi-turn
value and 13 bits per one revolution.
ExampleENCODER_BITS = 12 + (64 * 1)
ATYPE = 48
In this example a 12 bit (4096 positions per revolution) SSI encoder is used,
with binary output type.
See alsoAXIS.
3.2.99 ENCODER_CONTROL
/i
TypeAxis parameter
SyntaxENCODER_CONTROL = value
DescriptionThe ENCODER_CONTROL parameter is applicable only to Flexible axis
absolute EnDat axis with ATYPE value 47. The parameter controls the mode
in which EnDat encoder return its position. The encoder can be set to either
cyclically return its position, or it can be set to a parameter read/write mode.
The default after initialization is cyclic position return mode. For more information see EnDat absolute encoder interface specification.
ArgumentsN/A
ExampleENCODER_CONTROL AXIS(1) = 0
This command sets cyclic position return mode.
ExampleENCODER_CONTROL AXIS(1) = 1
This command sets parameter read/write mode.
See alsoAXIS, ENCODER, ENCODER_BITS.
3.2.100 ENCODER_ID
/i
TypeAxis parameter (read-only)
Revision 5.0
SyntaxENCODER_ID
DescriptionThis parameter returns the ID value of an absolute encoder for the axis.
This parameter is applicable only to Flexible axis absolute Tamagawa axis
with ATYPE value 46.
It returns ENID parameter from the encoder, which is set to 17. For more
information see Tamagawa absolute encoder interface specification.
If applied to axis of ATYPE value other than 46, this parameter returns 0.
ArgumentsN/A
Example>>PRINT ENCODER_ID AXIS (1)
17.0000
This command will print absolute encoder ID value for axis 1.
See alsoAXIS, ENCODER, ENCODER_BITS.
3.2.101 ENCODER_RATIO
/i
TypeAxis parameter
SyntaxENCODER_RATIO(numerator, denominator)
DescriptionThis command allows the incoming encoder count to be scaled by a non inte-
ger number, using the equation:
MPOS = (numerator / demoninator) x encoder_edges_input
Unlike the UNITS parameters, ENCODER_RATIO affects commands like
MOVECIRC and CAMBOX, since it affects the number of encoder edges
within the servo loop at the low level. It is necessary to change the position
loop gains after changing encoder ratio in order to maintain performance and
stability.
Note: Large ratios should be avoided as they will lead to either loss of resolution or much reduced smoothness in the motion. The actual physical encoder
count is the basic resolution of the axis and the use of this command may
reduce the ability of the Motion Controller to accurately achieve all positions.
Note: ENCODER_RATIO does not replace UNITS. Only use
ENCODER_RATIO where absolutely necessary. For all other axis scaling use
UNITS.
PROGRAMMING MANUAL80
BASIC commands
Arguments•denominator
A number between 0 and 16777215 that is used to define the denominator in the above equation.
•numerator
A number between 0 and 16777215 that is used to define the numerator
in the above equation.
Example' 7200 is the closest to the encoder resolution that can be devided by an
' integer to give degrees. (7200/20=360)
ENCODER_RATIO(8192,7200)
UNITS=20 ' axis calibrated in degrees, resolution is 0.05 deg.
A rotary table has a servo motor connected directly to its centre of rotation. An
encoder is mounted to the rear of the servo motor and returns a value of 8192
counts per revolution. The application requires the table to be calibrated in
degrees, but so that one degree is an integer number of counts.
See alsoN/A
3.2.102 ENCODER_STATUS
/i
TypeAxis parameter (read-only).
SyntaxENCODER_STATUS
DescriptionThis parameter returns the status of the absolute encoder.
This parameter is applicable only to Flexible axis absolute Tamagawa axis
with ATY PE value 46. It returns both the status field SF and the ALMC
encoder error field. The SF field is in bits 0 - 7, while the ALMC filed is in bits 8
- 15. For more information see Tamagawa absolute encoder interface specifi-
cation.
If applied to axis of ATYPE value other than 46, this parameter returns 0.
3.2.103 ENCODER_TURNS
/i
TypeAxis parameter (read-only)
SyntaxENCODER_TURNS
DescriptionThe ENCODER_TURNS parameter returns the number of multi-turn count
from the encoder.
This is applicable only to Flexible axis absolute Tamagawa axis with ATYPE
value 46 and Flexible axis absolute EnDat axis with ATYPE value 47.
The multi-turn data is not automatically applied to the axis MPOS parameter
after initialization. The application programmer must apply this from the program using OFFPOS or DEFPOS commands as required.
If applied to axis of ATYPE value other than 46 or 47, the parameter returns 0.
ArgumentsN/A
ExamplePRINT ENCODER_TURNS AXIS (1)
This command will print absolute encoder multi-turn counts for axis 1.
See alsoAXIS, ENCODER, ENCODER_BITS.
3.2.104 ENDIF
See IF..THEN..ELSE..ENDIF.
3.2.105 ENDMOVE
/i
TypeAxis parameter
SyntaxENDMOVE
ArgumentsN/A
ExamplePRINT (ENCODER_STATUS AXIS (1) AND 255)
This command will print SF field of the Tamagawa absolute encoder for axis 1.
See alsoAXIS, ENCODER, ENCODER_BITS.
Revision 5.0
DescriptionThe ENDMOVE axis parameter holds the position of the end of the current
move in user units. If the SERVO axis parameter is ON, the ENDMOVE
parameter can be written to produce a step change in the demand position
(DPOS).
Note: As the measured position is not changed initially, the Following Error
limit (FE_LIMIT) should be considered when writing to ENDMOVE to produce
a step change. If the change of demanded position is too big, the limit will be
exceeded.
PROGRAMMING MANUAL81
BASIC commands
ArgumentsN/A
ExampleNo example.
See alsoAXIS, DPOS, FE_LIMIT, UNITS.
3.2.106 EPROM
/i
TypeProgram command
SyntaxEPROM
DescriptionThe EPROM command stores the BASIC programs in the TJ1-MC__ battery
backed up RAM memory in the Flash-ROM memory. Whether the programs
stored in the Flash-ROM memory are copied to RAM at start-up is controlled
by the POWER_UP system parameter.
Note: Trajexia Studio offers this command as a command on the Online
menu.
Caution
To prevent program corruption due to an empty battery or due to
noise, it is strongly advised to store the programs in Flash-ROM
instead of RAM.
/i
ArgumentsN/A
ExampleNo example.
See alsoPOWER_UP, RUNTYPE.
DescriptionThe ERROR_AXIS axis parameter contains the number of the axis which has
caused the motion error.
A motion error occurs when the AXISSTATUS state for one of the axes
matches the ERRORMASK setting. In this case the enable switch (WDOG)
will be turned off, the MOTION_ERROR parameter will have value different
than 0 and the ERROR_AXIS parameter will contain the number of the first
axis to have the error.
ArgumentsN/A
ExampleNo example.
See alsoAXISSTATUS, ERRORMASK, MOTION_ERROR, WDOG.
3.2.108 ERROR_LINE
/i
TypeTask parameter (read-only)
SyntaxERROR_LINE
DescriptionThe ERROR_LINE parameter contains the number of the line which caused
the last BASIC run-time error in the program task. This value is only valid
when the BASICERROR parameter is TRUE.
Each task has its own ERROR_LINE parameter. Use the PROC modifier to
access the parameter for a certain task. Without PROC, the current task will
be assumed.
ArgumentsN/A
Example>> PRINT ERROR_LINE PROC(4)
23.0000
See alsoBASICERROR, PROC, RUN_ERROR.
3.2.107 ERROR_AXIS
/i
TypeSystem parameter (read-only)
Revision 5.0
SyntaxERROR_AXIS
3.2.109 ERRORMASK
/i
TypeAxis parameter
SyntaxERRORMASK
PROGRAMMING MANUAL82
BASIC commands
DescriptionThe ERRORMASK axis parameter contains a mask value that is ANDed bit
by bit with the AXISSTATUS axis parameter on every servo cycle to deter-
mine if a motion error has occurred. If the result of the AND operation is not
zero, the motion error has occurred.
When a motion error occurs the enable switch (WDOG) will be turned off, the
MOTION_ERROR parameter will have value different than 0 and the
ERROR_AXIS parameter will contain the number of the first axis to have the
error.
Check the AXISVALUES parameter for the status bit allocations. The default
setting of ERRORMASK is 268.
ArgumentsN/A
ExampleNo example.
See alsoAXIS, AXISSTATUS, MOTION_ERROR, WDOG.
Caution
It is up to the user to define in which cases a motion error is generated. For safe operation it is strongly recommended to generate a
motion error when the Following Error has exceeded its limit in all
cases. This is done by setting bit 8 of ERRORMASK
3.2.110 ETHERNET
/i
Arguments•function
0 = Read, 1 = Write.
•unit_number
-1.
•parameter
0 = IP Address
1 = Addressing mode: Static (1) or Dynamic (0) (Only static addressing is
supported)
2 = Subnet Mask
3 = MAC address
4 = Default Port Number (initialised to 23), see also section 4.2.1.
5 = Token Port Number (initialised to 3240)
7 = ModbusTCP mode: Integer (0) or IEEE floating point (1)
8 = Default Gateway
9 = Data configuration: VR variables (0) or TABLE (1)
10 = ModbusTCP Port Number (initialised to 502)
11 = ARP cache (read-only).
12 = Default FINS Port Number (initialised to 9600), see also section
DescriptionThe command ETHERNET is used to read and set certain functions of Ether-
net communications. The ETHERNET command should be entered on the
command line of the terminal window of Trajexia Studio in disconnected
mode.
Note: The commands with parameters 4,5,7,9,10 and 12 take effect immediately after execution. The commands with parameters 0,2,3 and 8 require a
power cycle to Trajexia to enable the new parameters.
Revision 5.0
3.2.111 EX
/i
TypeSystem command
SyntaxEX[(option)]
DescriptionResets the controller as if it were being powered up again.
There are two types of reset performed by the EX command. EX without the
argument, or EX(0) does the software reset of the controller. EX(1) does the
hardware reset of the controller
ArgumentsN/A
ExampleNo example.
PROGRAMMING MANUAL83
BASIC commands
See alsoN/A
3.2.112 EXP
/i
TypeMathematical function
SyntaxEXP(expression)
DescriptionThe EXP function returns the exponential value of the expression.
Arguments•expression
Any valid BASIC expression.
Example>>PRINT EXP(1.0)
2.7183
See alsoN/A
3.2.113 FALSE
/i
TypeConstant (read-only)
SyntaxFALSE
DescriptionThe FALSE constant returns the numerical value 0.
ArgumentsN/A
Exampletest:
res = IN(0) OR IN(2)
IF res = FALSE THEN
PRINT "Inputs are off"
ENDIF
See alsoN/A
SyntaxFAST_JOG
DescriptionThe FAST_JOG axis parameter contains the input number to be used as the
fast jog input. The number can be from 0 to 31. As default the parameter is set
to -1, no input is used for the fast jog.
The fast jog input controls the jog speed between two speeds. If the fast jog
input is set, the speed as given by the SPEED axis parameter will be used for
jogging. If the input is not set, the speed given by the JOGSPEED axis
parameter will be used.
Note: This input is active low.
ArgumentsN/A
ExampleNo example.
See alsoAXIS, FWD_JOG, JOGSPEED, REV_JOG, SPEED.
3.2.115 FASTDEC
/i
TypeAxis parameter
SyntaxFASTDE C
DescriptionThe FASTDEC axis parameter contains fast deceleration ration. Its default
value is zero. If a non-zero FASTDEC is specified, the axis will ramp to zero
at this deceleration rate when an axis limit switch or position is reached.
ArgumentsN/A
ExampleNo example.
See alsoN/A
3.2.116 FE
/i
TypeAxis parameter (read-only)
3.2.114 FAST_JOG
/i
Revision 5.0
TypeAxis parameter
SyntaxFE
PROGRAMMING MANUAL84
BASIC commands
DescriptionThe FE axis parameter contains the position error in user units. This is calcu-
lated by the demand position (DPOS axis parameter) minus the measured
position (MPOS axis parameter). The value of the Following Error can be
checked by using the axis parameters FE_LIMIT and FE_RANGE.
ArgumentsN/A
ExampleNo example.
See alsoAXIS, DPOS, FE_LIMIT, FE_RANGE, MPOS, UNITS.
3.2.117 FE_LATCH
/i
TypeAxis parameter (read-only)
SyntaxFE_LATCH
DescriptionContains the initial FE value which caused the axis to put the controller into
MOTION_ERROR. This value is only set when the FE exceeds the FE_LIMIT
and the SERVO parameter has been set to OFF. FE_LATCH is reset to 0
when the SERVO parameter of the axis is set back to ON.
ArgumentsN/A
ExampleNo example.
See alsoN/A
ArgumentsN/A
ExampleNo example.
See alsoAXIS, AXISSTATUS, ERRORMASK, FE, FE_RANGE, UNITS.
3.2.119 FE_LIMIT_MODE
/i
TypeAxis parameter
SyntaxFE_LIMIT_MODE=value
DescriptionWhen this parameter is set to 0, the axis will cause a MOTION_ERROR
immediately when the FE exceeds the FE_LIMIT value.
If FE_LIMIT_MODE is set to 1, the axis will only generate a
MOTION_ERROR when the FE exceeds FE_LIMIT during 2 consecutive
servo periods. This means that if FE_LIMIT is exceeded for one servo period
only, it will be ignored.
The default value for FE_LIMIT_MODE is 0.
ArgumentsN/A
ExampleNo example.
See alsoN/A
3.2.120 FE_RANGE
3.2.118 FE_LIMIT
/i
TypeAxis parameter
SyntaxFE_LIMIT
FELIMIT
DescriptionThe FE_LIMIT axis parameter contains the maximum allowed Following Error
in user units. When exceeded, bit 8 of the AXISSTATUS parameter of the axis
will be set. If the ERRORMASK parameter has been properly set, a motion
Revision 5.0
error will be generated and WDOG enable relay will be reset to 0.
This limit is used to guard against fault conditions, such as mechanical lockup, loss of encoder feedback, etc.
/i
TypeAxis parameter
SyntaxFE_RANGE
DescriptionThe FE_RANGE axis parameter contains the limit for the Following Error
warning range in user units. When the Following Error exceeds this value on
a servo axis, bit 1 in the AXISSTATUS axis parameter will be turned on.
This range is used as a first indication for fault conditions in the application
(compare FE_LIMIT).
ArgumentsN/A
ExampleNo example.
See alsoAXIS, AXISSTATUS, ERRORMASK, FE, UNITS.
PROGRAMMING MANUAL85
BASIC commands
3.2.121 FHOLD_IN
/i
TypeAxis parameter
SyntaxFHOLD_IN
FH_IN
DescriptionThe FHOLD_IN axis parameter contains the input number to be used as the
feedhold input. The valid input range is 0 to 31. Values 0 to 15 represent physically present inputs of TJ1-MC__ I/O connector and are common for all axes.
Values 16 to 31 are mapped directly to driver inputs that are present on the
CN1 connector. They are unique for each axis. It depends on the type of
Servo Driver which Servo Driver inputs are mapped into inputs 16 to 31. For
more information on Servo Driver I/O mapping into the Trajexia I/O space,
refer to section 5.1.4.
As default the parameter is set to -1, no input is used for feedhold.
Note: This input is active low.
If an input number is set and the feedhold input turns set, the speed of the
move on the axis is changed to the value set in the FHSPEED axis parameter.
The current move is not cancelled. Furthermore, bit 7 of the AXISSTATUS
parameter is set. When the input turns reset again, any move in progress
when the input was set will return to the programmed speed.
Note: This feature only works on speed controlled moves. Moves which are
not speed controlled (CAMBOX, CONNECT and MOVELINK) are not
affected.
ArgumentsN/A
DescriptionThe FHSPEED axis parameter contains the feedhold speed. This parameter
can be set to a value in user units/s and defines at which speed the axis will
move when the feedhold input turns on. The current move is not cancelled.
FHSPEED can have any positive value including 0. The default value is 0.
This default value is applicable to most applications as motion is usually
ramped down to zero speed when the freehold input is set. In some cases it
may be desirable for the axis to ramp to a known constant speed when the
freehold input is set.
Note: This feature only works on speed controlled moves. Moves which are
not speed controlled (CAMBOX, CONNECT and MOVELINK) are not
affected.
ArgumentsN/A
ExampleNo example.
See alsoAXIS, AXISSTATUS, FHOLD_IN, UNITS.
ExampleNo example.
See alsoAXIS, AXISSTATUS, FHSPEED, UNITS.
3.2.122 FHSPEED
/i
TypeAxis parameter
SyntaxFHSPEED
Revision 5.0
PROGRAMMING MANUAL86
BASIC commands
3.2.123 FINS_COMMS
/i
TypeCommunication command
SyntaxFINS_COMMS(type, network, node, unit, remote_area, remote_offset,
DescriptionFINS (Factory Interface Network Service) is a Proprietary OMRON communi-
cation protocol. A subset of this protocol has been implemented in Trajexia.
The FINS protocol has been implemented with the intention of enabling
seamless communication with other OMRON devices (PLCs, HMIs, etc.) and
software (CX-Drive, CX-Server, etc.). For more information on FINS communication protocol, see section 4.2.2 and the Communication Commands Reference Manual, cat. num. W342-E1, Sections 3 and 5.
Trajexia has built in FINS client capabilities, so it can initiate the FINS communications with FINS slave devices using FINS_COMMS. Only FINS 0101
(Read Memory) and FINS 0102 (Write Memory) commands are implemented
at the moment of this writing. With FINS 0101, memory can be read from
other devices with FINS server capability. FINS 0102 can be used to write
data to devices with FINS server capability.
This command returns one of the following values, depending on outcome of
the execution:
-1: The command executed successfully.
0: The command failed.
1: Request not sent because the client or the FINS protocol is busy.
2: One or more of the request parameters are invalid.
3: Invalid source memory area.
4: Request was sent, but no response from remote server received within
timeout period.
5: Error response code received from remote server.
Arguments•type
The type of the FINS command. 0 means FINS 0101, read memory from
remote FINS server. 1 means FINS 0102, write memory to the remote
server.
•network
The destination network. For more details, see the Communication Commands Reference Manual, cat. num. W342-E1, Section 3.
•node
The node of the destination FINS server. For more details, see the Communication Commands Reference Manual, cat. num. W342-E1, Section
3.
•unit
The unit number of the destination FINS server. For more details, see the
Communication Commands Reference Manual, cat. num. W342-E1,
Section 3.
•remote_area
The area of memory accessed on the destination FINS server. Range:
128..255. Note that this area must be one of the following values if the
destination is another Trajexia system: 0xB0: Integer VR value; 0x82:
Integer TABLE value; 0xC2: float TABLE value.
•remote_offset
The memory offset on the destination FINS server. Range: 0..65535.
Note that this range will be more limited to the maximum TABLE or VR
addresses if the destination is another Trajexia system.
•length
The number of items to be transferred. The range will depend upon the
FINS frame length and the capabilities of the client and remote servers.
The range for a Trajexia system is from 1 to 700 integer values, or 1 to
350 floating point values.
•local_area
The local (source) memory area. Note that this area must be one of the
following values: 0x00: Integer VR value; 0x01: Integer TABLE value;
0x02 : float TABLE value.
Revision 5.0
PROGRAMMING MANUAL87
BASIC commands
•local_offset
The offset of the first value in the local (source) memory area. The range
depends upon the VR or TABLE array size and value for the length argument.
•timeout
The number of milliseconds to wait for a response from the destination
FINS server, before timing out.
•IP1, IP2, IP3, IP4
Optional parameters that define the remote (destination) server IP
address. These arguments must be used if both the Trajexia system and
the destination FINS server do not belong to same network.
ExampleA Trajexia system and an OMRON CJ1 PLC with Ethernet Unit CJ1W-ETN11
system are connected to the same network. The IP address of Trajexia system is 192.168.0.5. The IP address of the PLC Ethernet Unit is 192.168.0.12.
When you execute the command FINS_COMMS(0,0,12,0,$82, 1000,20,0,500,5000,192,168,0,12), 20 words (length=20) of DM PLC memory area (remote_area=$82) is read, starting from DM1000
(remote_offset=1000), and is written in the Trajexia VR memory in integer
format (local_area=0), starting from VR(500) (local_offset=500). So, values
in PLC memory range DM1000 to DM1019 are placed in Trajexia memory
VR( 500) t o VR(5 19). T he time out is set to 5 secon ds.
When you execute the command FINS_COMMS(1,0,12,0,$80, 50,10,0,300,3000,192,168,0,12), 10 words (length=10) of Trajexia VR mem-
ory as integers (local_area=0), starting from VR(300) (local_offset=300), are
written to the CIO area of the PLC (remote_area=$80), starting from CIO50
(remote_offset=50). So, values in Trajexia memory range VR(300) to
VR(309) are placed in memory CIO50 to CIO59 of the PLC. The timeout is set
to 3 seconds.
See alsoN/A
3.2.124 FLAG
/i
TypeSystem command
SyntaxFLAG(flag_number [,value])
Revision 5.0
DescriptionThe FLAG command is used to set and read a bank of 24 flag bits. The FLAG
command can be used with one or two parameters. With one parameter specified the status of the given flag bit is returned. With two parameters specified
the given flag is set to the value of the second parameter. The FLAG com-
mand is provided to aid compatibility with earlier controllers and is not recommended for new programs.
Arguments•flag_number
The flag number is a value from 0..23.
•value
If specified this is the state to set the given flag to i.e. ON or OFF. This
can also be written as 1 or 0.
ExampleFLAG(21,ON)
Set flag bit 21 on.
See alsoN/A
3.2.125 FLAGS
/i
TypeSystem command
SyntaxFLAGS([value])
DescriptionRead and set the FLAGS as a block. The FLAGS command is provided to aid
compatibility with earlier controllers and is not recommended for new programs. The 24 flag bits can be read with FLAGS and set with FLAGS(value).
Arguments•value
The decimal equivalent of the bit pattern to which the flags must be set.
See the table below.
/i
Bit numberDecimal value
01
12
24
38
416
PROGRAMMING MANUAL88
BASIC commands
Bit numberDecimal value
532
664
7128
/i
ExampleFLAGS(146) ' 2 + 16 + 128
Set Flags 1,4 and 7 on, all others off.
ExampleIF (FLAGS and 8) <>0 then GOSUB somewhere
Test if Flag 3 is set.
See alsoN/A
3.2.126 FOR..TO..STEP..NEXT
/i
TypeProgram control command
SyntaxFOR variable = start TO end [STEP increment]
commands
NEXT variable
DescriptionThe FOR ... NEXT loop allows the program segment between the FOR and
the NEXT statement to be repeated a number of times.
On entering this loop, the variable is initialized to the value of start and the
block of commands is then executed. Upon reaching the NEXT command, the
variable is increased by the increment specified after STEP. The STEP value
can be positive or negative, if omitted the value is assumed to be 1.
While variable is less than or equal to end, the block of commands is repeatedly executed until variable is greater than end, at which time program execution will continue after NEXT.
Note: FOR ... NEXT statements can be nested up to 8 levels deep in a BASIC
program.
Arguments•variable
Any valid BASIC expression.
•start
Any valid BASIC expression.
•end
Any valid BASIC expression.
•increment
Any valid BASIC expression.
•commands
One or more BASIC commands.
ExampleFOR opnum = 8 TO 13
OP(opnum,ON)
NEXT opnum
This loop turns on outputs 8 to 13.
Exampleloop:
FOR dist = 5 TO -5 STEP -0.25
MOVEABS(dist)
GOSUB pick_up
NEXT dist
The STEP increment can be positive or negative.
Exampleloop1:
FOR l1 = 1 TO 8
loop2:
FOR l2 = 1 TO 6
MOVEABS(l1*100,l2*100)
GOSUB 1000
NEXT l2
NEXT l1
FOR..TO..STEP..NEXT statements can be nested (up to 8 levels deep) pro-vided the inner FOR and NEXT commands are both within the outer
FOR..TO..STEP..NEXT loop.
See alsoREPEAT..UNTIL, WHILE..WEND.
Revision 5.0
PROGRAMMING MANUAL89
BASIC commands
3.2.127 FORWARD
/i
TypeAxis command
SyntaxFORWARD
FO
DescriptionThe FORWARD command moves an axis continuously forward at the speed
set in the SPEED axis parameter. The acceleration rate is defined by the
ACCEL axis parameter.
FORWARD works on the default basis axis (set with BASE) unless AXIS is
used to specify a temporary base axis.
Note: The forward motion can be stopped by executing the CANCEL or
RAPIDSTOP command, or by reaching the forward limit. If stopped by execution of the CANCEL or RAPIDSTOP command, the axis decelerates to a stop
at the programmed DECEL rate.
ArgumentsN/A
ExampleRun an axis forwards. When an input signal is detected on input 12, bring the
axis to a stop.
FORWARD
' wait for stop signal
WAIT UNTIL IN(12)=ON
CANCEL
WAIT IDLE
fig. 25/i
IN(12)
NC
AXIS 0
Revision 5.0
PROGRAMMING MANUAL90
BASIC commands
ExampleMove an axis forward until it hits the end limit switch, then move it in the
reverse direction for 25 cm.
BASE(3)
FWD_IN=7 limit switch connected to input 7
FORWARD
WAIT IDLE ' wait for motion to stop on the switch
MOVE(-25.0)
WAIT IDLE
ExampleA machine that applies lids to cartons uses a simulated line shaft. This exam-
ple sets up a virtual axis running forward to simulate the line shaft. Axis 0 is
then connected, with the CONNECT command, to this virtual axis to run the
conveyor. Axis 1 controls a vacuum roller that feeds the lids on to the cartons
using the MOVELINK control.
BASE(4)
ATYPE=0 'Set axis 4 to virtual axis
REP_OPTION=1
SERVO=ON
FORWARD 'starts line shaft
BASE(0)
CONNECT(-1,4) 'Connects base 0 to virtual axis in reverse
WHILE IN(2)=ON
BASE(1)
'Links axis 1 to the shaft in reverse direction
MOVELINK(-4000,2000,0,0,4,2,1000)
WAIT IDLE
WEND
RAPIDSTOP
See alsoAXIS, CANCEL, RAPIDSTOP, REVERSE, UNITS.
AXIS 3
fig. 26/i
IN(7)
NC
Revision 5.0
PROGRAMMING MANUAL91
BASIC commands
3.2.128 FPGA_VERSION
/i
TypeSlot parameter
SyntaxFPGA_VERSION SLOT(unit_number)
DescriptionThis parameter returns the FPGA version of the unit with unit_number in a
controller system.
Arguments•unit_number
Unit numbers are -1 to 6, including 0, with -1 being the TJ1-MC__ and 0
being the unit immediately to the right of the TJ1-MC__.
ExampleN/A
See alsoN/A
3.2.129 FRAC
/i
TypeMathematical function
SyntaxFRAC(expression)
DescriptionThe FRAC function returns the fractional part of the expression.
Arguments•expression
Any valid BASIC expression.
Example>> PRINT FRAC(1.234)
0.2340
See alsoN/A
3.2.130 FRAME
/i
Typ eSy stem pa ram ete r
SyntaxFRAME=value
Revision 5.0
DescriptionUsed to specify which frame to operate within when employing frame transfor-
mations. Frame transformations are used to allow movements to be specified
in a multi-axis coordinate frame of reference which do not correspond one-toone with the axes. An example is a SCARA robot arm with jointed axes. For
the end tip of the robot arm to perform straight line movements in X-Y the
motors need to move in a pattern determined by the robots geometry.
Frame transformations to perform functions such as these need to be compiled from C language source and loaded into the controller system software.
Contact OMRON if you need to do this.
A machine system can be specified with several different frames. The currently active “frame” is specified with the FRAME System parameter.
The default FRAME is 0 which corresponds to a one-to-one transformation.
ArgumentsN/A
ExampleFRAME=1
See alsoN/A
3.2.131 FREE
/i
TypeSystem function
SyntaxFREE
DescriptionThe FREE function returns the remaining amount of memory available for
user programs and TABLE array elements.
Note: Each line takes a minimum of 4 characters (bytes) in memory. This is for
the length of this line, the length of the previous line, number of spaces at the
beginning of the line and a single command token. Additional commands
need one byte per token; most other data is held as ASCII.
The TJ1-MC__ compiles programs before they are executed, this means that
a little under twice the memory is required to be able to execute a program.
ArgumentsN/A
Example>> PRINT FREE
47104.0000
See alsoDIR, TABLE
PROGRAMMING MANUAL92
BASIC commands
3.2.132 FS_LIMIT
/i
TypeAxis parameter
SyntaxFS_LIMIT
FSLIMIT
DescriptionThe FS_LIMIT axis parameter contains the absolute position of the forward
software limit in user units.
A software limit for forward movement can be set from the program to control
the working range of the machine. When the limit is reached, the TJ1-MC__
will ramp down the speed of an axis to 0, and then cancel the move. Bit 9 of
the AXISSTATUS axis parameter will be turned on while the axis position is
greater than FS_LIMIT.FS_LIMIT is disabled when it has a value greater than REP_DIST.
ArgumentsN/A
ExampleNo example.
See alsoAXIS, AXISSTATUS, REP_DIST, UNITS.
3.2.133 FWD_IN
/i
TypeAxis parameter
SyntaxFWD_IN
DescriptionThe FWD_IN axis parameter contains the input number to be used as a for-
ward limit input. The valid input range is 0 to 31. Values 0 to 15 represent
physically present inputs of TJ1-MC__ I/O connector and are common for all
axes.
Values 16 to 31 are mapped directly to driver inputs that are present on the
CN1 connector. They are unique for each axis. It depends on the type of
Servo Driver which Servo Driver inputs are mapped into inputs 16 to 31. For
more information on Servo Driver I/O mapping into the Trajexia I/O space,
refer to section 5.1.4.
For more information on setting driver parameter Pn81E, see Servo Driver
manual. As default the parameter is set to -1, no inputs selected.
If an input number is set and the limit is reached, any forward motion on that
axis will be stopped. Bit 4 of the AXISSTATUS will also be set.
Note: This input is active low.
ArgumentsN/A
ExampleNo example.
See alsoAXIS, AXISSTATUS, REV_IN.
3.2.134 FWD_JOG
/i
TypeAxis parameter
SyntaxFWD_JOG
DescriptionThe FWD_JOG axis parameter contains the input number to be used as a jog
forward input. The input can be set from 0 to 31. As default the parameter is
set to -1, no input is selected.
Note: This input is active low.
ArgumentsN/A
ExampleNo example.
See alsoAXIS, FAST_JOG, JOGSPEED, REV_JOG.
Revision 5.0
PROGRAMMING MANUAL93
BASIC commands
3.2.135 GET
/i
TypeI/O command
SyntaxGET [#n,] variable
DescriptionThe GET command assigns the ASCII code of a received character to a varia-
ble. If the serial port buffer is empty, program execution will be paused until a
character has been received. Channels 5 to 7 are logical channels that are
superimposed on the programming port 0 when using Trajexia Studio.
Note: Channel 0 is reserved for the connection to Trajexia Studio and/or the
command line interface. Please be aware that this channel may give problems
for this function.
Arguments•n
The specified input device. When this argument is omitted, the port as
specified by INDEVICE will be used. See the table below.
/i
Input device
number
0Programming port 0
1RS-232C serial port 1
2RS-422A/485 serial port 2
5Trajexia Studio port 0 user channel 5
6Trajexia Studio port 0 user channel 6
7Trajexia Studio port 0 user channel 7
Description
3.2.136 GLOBAL
/i
TypeSystem command
SyntaxGLOBAL "name", vr_number
DescriptionDeclares the name as a reference to one of the global VR varia-
bles. The name can then be used both within the program containing the GLOBAL definition and all other programs in the Trajexia
Studio project.
Note: The program containing the GLOBAL definition must be run
before the name is used in other programs. In addition, only that
program should be running at the time the GLOBAL is executed,
otherwise the program error will appear and the program will stop
when trying to execute this command. For fast startup the program
should also be the only process running at power-up.
Using GLOBAL with only the name will erase the specified constant.
Using GLOBAL with no parameters will erase all GLOBAL declarations. This also happens when the TJ1-MC__ is reset by switching the power off and back on, or by executing the EX command.
In programs that use the defined GLOBAL, name has the same
meaning as VR(vr_number). Do not use the syntax: VR(name).
A maximum of 128 GLOBALs can be declared.
Arguments•name
Any user-defined name containing lower case alpha, numerical or underscore characters.
•vr_number
The number of the VR to be associated with name.
/i
•variable
The name of the variable to receive the ASCII code.
ExampleGET#5, k
Revision 5.0
See alsoINDEVICE, INPUT, KEY, LINPUT
This line stores the ASCII character received on the Trajexia Studio port channel 5 in k.