Omron TJ1-MC04, TJ1-MC16 PROGRAMMING Manual

Cat. No. I52E-EN-05
Trajexia motion control system
TJ1-MC04 TJ1-MC16
PROGRAMMING MANUAL
Notice
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.
Revision 5.0
/i
© OMRON, 2010
All rights reserved. No part of this publication may be reproduced, stored in a retrieval sys­tem, 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 MANUAL I
About this manual
Name Cat. 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
Name Cat. No. Contents
Trajexia motion con­trol system QUICK START GUIDE
Trajexia motion con­trol system HARD­WARE REFERENCE MAN­UAL
Trajexia motion con­trol 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
I50E Describes how to get quickly familiar
with Trajexia, moving a single axis using MECHATROLINK-II, in a test set-up.
I51E Describes the installation and hardware
specification of the Trajexia units, and explains the Trajexia system philosophy.
I52E Describes the BASIC commands to be
used for programming Trajexia, commu­nication protocols and Trajexia Studio software, gives practical examples and troubleshooting information.
SIEP S800000 15 Describes the installation and operation
of Sigma-II Servo Drivers
SIEP S800000 11 Describes the installation and operation
of Sigma-III Servo Drivers with MECHA­TROLINK-II interface
SIEP S800000-44-O-OY SIEP S800000-46-O-OY SIEP S800000-48-O-OY
TOEP-C71080603 01-OY Describes the installation and operation
Describes the installation and operation of Sigma-V Servo Drivers
of JUNMA Servo Drivers
V7 Inverter TOEP C71060605 02-OY Describes the installation and operation
of V7 Inverters
F7Z Inverter TOE S616-55 1-OY Describes the installation and operation
of F7Z Inverters
G7 Inverter TOE S616-60 Describes the installation and operation
of G7 Inverters
JUSP-NS115 man­ual
SI-T MECHATRO­LINK interface for the G7 & F7
ST-T/V7 MECHA­TROLINK interface for the V7
MECHATROLINK IO Modules
SYSMAC CS/CJ Series Communica­tions 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 C71080001 Describes the installation and operation
of the MECHATROLINK-II application module
SIBP-C730600-08 Describes the installation and operation
of MECHATROLINK-II interfaces for G7 and F7 Inverters
SIBP-C730600-03 Describes the installation and operation
of MECHATROLINK-II interfaces for V7 Inverters
SIE C887-5 Describes the installation and operation
of MECHATROLINK-II input and output modules and the MECHATROLINK-II repeater
W342 Describes FINS communications proto-
col and FINS commands
W455-E1 Describes the installation and operation
of Omron slice I/O units
I566-E1 Describes the installation and operation
of G-series Servo Drivers
I572-E1 Describes the installation and operation
of Accurax G5 Servo Drivers
I56E-EN Describes the use of Trajexia Studio
programming software
PROGRAMMING MANUAL II
WARNING
Failure to read and understand the information provided in this manual may result in personal injury or death, damage to the pro­duct, 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 opera­tions 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__.
Functionality TJ1-MC__ Firmware
version
Full support TJ1-FL02 V1.6509 21 and higher
Support BASIC commands FINS_COMMS V1.6509 All versions
Support TJ1-DRT V1.6509 All versions
Support TJ1-MC04 andTJ1-ML04 V1.6607 21 and higher
Support TJ1-CORT, GRT1-ML2, Mod­busTCP, 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 Drivers V1.6720 21 and higher
Revision 5.0
V1.6652 21 and higher
V1.6714 21 and higher
TJ1-MC__ FPGA version
Verify the firmware and FPGA versions of the TJ1-MC__
PROGRAMMING MANUAL III
Contents
1 Safety warnings and precautions................................................................................................................................................................1
1.1 Intended audience ............................................................................................................................................................................................................................1
1.2 General precautions .........................................................................................................................................................................................................................1
1.3 Safety precautions ...........................................................................................................................................................................................................................1
1.4 Operating environment precautions..................................................................................................................................................................................................2
1.5 Application precautions.....................................................................................................................................................................................................................3
1.6 Unit assembly precautions................................................................................................................................................................................................................5
2 Trajexia system ...........................................................................................................................................................................................6
2.1 Introduction .......................................................................................................................................................................................................................................6
2.2 Multitasking BASIC programming.....................................................................................................................................................................................................7
2.3 BASIC programming .........................................................................................................................................................................................................................8
2.4 Motion execution.............................................................................................................................................................................................................................12
2.5 Command line interface ..................................................................................................................................................................................................................13
2.6 BASIC programs .............................................................................................................................................................................................................................13
3 BASIC commands ......................................................................................................................................................................................15
3.1 Categories ......................................................................................................................................................................................................................................15
3.2 All BASIC commands .....................................................................................................................................................................................................................23
4 Communication protocols ......................................................................................................................................................................179
4.1 Available interfaces.......................................................................................................................................................................................................................179
4.2 Ethernet ....................................................................................................................................................................................................................................179
4.3 Serial protocol ...........................................................................................................................................................................................................................183
4.4 PROFIBUS ...................................................................................................................................................................................................................................191
4.5 DeviceNet .....................................................................................................................................................................................................................................196
4.6 CANopen ......................................................................................................................................................................................................................................202
4.7 MECHATROLINK-II ................................................................................................................................................................................................................205
4.8 GRT1-ML2 I/O mapping ...............................................................................................................................................................................................................206
5 Examples and tips .................................................................................................................................................................................... 212
5.1 How-to’s........................................................................................................................................................................................................................................212
5.2 Practical examples........................................................................................................................................................................................................................269
Revision 5.0
PROGRAMMING MANUAL IV
Contents
6 Troubleshooting........................................................................................................................................................................................ 293
6.1 Voltage and analysis tools ............................................................................................................................................................................................................293
6.2 TJ1-MC__ .....................................................................................................................................................................................................................................293
6.3 TJ1-PRT .......................................................................................................................................................................................................................................296
6.4 TJ1-DRT .......................................................................................................................................................................................................................................297
6.5 TJ1-CORT ....................................................................................................................................................................................................................................297
6.6 TJ1-ML__......................................................................................................................................................................................................................................298
6.7 GRT1-ML2 ....................................................................................................................................................................................................................................298
6.8 TJ1-FL02 ......................................................................................................................................................................................................................................301
A GRT1-ML2 timing ......................................................................................................................................................................................302
Revision history ..............................................................................................................................................................................................307
Revision 5.0
PROGRAMMING MANUAL V
Safety warnings and precautions

1 Safety warnings and precautions

1.1 Intended 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 bat­teries, 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.2 General 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.3 Safety 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 cir­cuits, 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 over­loaded 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 MANUAL 1
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 Tra­jexia 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 auto­matically backed up in the TJ1 flash memory (flash memory func­tion).
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.4 Operating 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 MANUAL 2
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 condi­tions during the life of the system.

1.5 Application 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 MECHATROLINK­II network errors occur during start-up or if the MECHATROLINK-II network configuration changes.
WARNING
Check the user program for proper execution before actually run­ning 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 MANUAL 3
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 install­ing 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 elec­tric 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 con­nector 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 malfunc­tion.
PROGRAMMING MANUAL 4
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 manu­als 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 transis­tor 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.6 Unit 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 TJ1­MC__ 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 MANUAL 5
Trajexia system

2 Trajexia system

2.1 Introduction

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 direct­drive servos as well as Inverters. The system is scalable up to 16 axes and 8 Inverters & I/O modules.
2.1.1 Trajexia 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 PLC CX-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 MANUAL 6
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.2 This 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.2 Multitasking 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 MANUAL 7
Trajexia system

2.3 BASIC 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.1 Axis, 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.2 Memory 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 MANUAL 8
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.3 Data 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 MANUAL 9
Trajexia system
/i
Note
The TABLE and VR data can be accessed from the different run­ning 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:
/i
start: GOSUB Initial VR(length) = x ... ...
Initial: length = 3 RETURN
start: GOSUB Initial MOVE(VR(length)) PRINT(VR(length)) ...
Initial: length = 3 RETURN
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 MANUAL 10
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.4 Mathematical 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:
>> TABLE(0,-10,65536) >> PRINT HEX(TABLE(0)),HEX(TABLE(1)) FFFFF6 10000
Positioning
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 MANUAL 11
Trajexia system

2.4 Motion execution

Every task on the TJ1-MC__ has a set of buffers that holds the information from the motion commands given.
2.4.1 Motion 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 Stu­dio 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 MANUAL 12
Trajexia system
2.4.2 Sequencing
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.3 Move 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.5 Command 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.1 Program 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.6 BASIC 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 file­handling instructions for managing these program files rather like the DOS
Revision 5.0
filing system on a computer.
PROGRAMMING MANUAL 13
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
Command Function
RUN Run the current selected program or a specified program, optionally on a
specified task number.
STOP Stop the current selected program or a specified program.
HALT Stop all programs on the system.
PROCESS Displays 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 MANUAL 14
BASIC commands

3 BASIC commands

3.1 Categories

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.1 Axis commands
/i
Name Description
ACC Changes the ACCEL and DECEL at the same time.
ADD_DAC Sum to the DAC value of one axis to the analogue output of the
base axis.
ADDAX Sets a link to a superimposed axis. All demand position movements
for the superimposed axis will be added to any moves that are cur­rently being executed.
Revision 5.0
B_SPLINE Expands the profile stored in TABLE memory using the B-Spline
mathematical function.
BACKLASH Allows the backlash compensation to be loaded.
Name Description
BASE Used to set the base axis to which the commands and parameters
are applied.
CAM Moves an axis according to values of a movement profile stored in
the TABLE variable array.
CAMBOX Moves 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 gear­box.
CANCEL Cancels the move on an axis.
CONNECT Connects the demand position of an axis to the measured move-
ments of the driving axis to produce an electronic gearbox.
DATUM Performs one of 7 origin search sequences to position an axis to an
absolute position or reset a motion error.
DEFPOS Defines the current position as a new absolute position.
DISABLE_GROUP Groups axes together for error disabling.
DRIVE_ALARM Monitors the current alarm.
DRIVE_CLEAR Clears the alarm status of the Servo Driver.
DRIVE_READ Reads the specified parameter of the Servo Driver.
DRIVE_RESET Resets the Servo Driver.
DRIVE_WRITE Writes a specific value to the specified parameter of the Servo
Driver.
FORWARD Moves an axis continuously forward at the speed set in the SPEED
parameter.
HW_PSWITCH Sets on and off the hardware switch on output 0 of the TJ1-FL02
when predefined positions are reached.
MECHATROLINK Initializes MECHATROLINK-II bus and performs various operations
on MECHATROLINK-II stations connected to the bus.
MHELICAL Interpolates 3 orthogonal axes in a helical move.
MOVE Moves one or more axes at the demand speed, acceleration and
deceleration to the position specified as increment from the current position.
PROGRAMMING MANUAL 15
BASIC commands
Name Description
MOVEABS Moves one or more axes at the demand speed, acceleration and
deceleration to the position specified as absolute position.
MOVECIRC Interpolates 2 orthogonal axes in a circular arc.
MOVELINK Creates a linear move on the base axis linked via a software gear-
box to the measured position of a link axis.
MOVEMODIFY Changes the absolute end position of the current single-axis linear
move (MOVE or MOVEABS).
RAPIDSTOP Cancels the current move on all axes.
REGIST Captures an axis position when a registration input or the Z mark on
the encoder is detected.
REVERSE Moves an axis continuously in reverse at the speed set in the
SPEED parameter.
STEP_RATIO Sets the ratio for the axis stepper output.
3.1.2 Axis parameters
/i
Name Description
ACCEL Contains the axis acceleration rate.
ADDAX_AXIS Contains the number of the axis to which the base axis is cur-
rently linked to by ADDAX.
ATYPE Contains the axis type.
AXIS_DISPLAY Selects information that are represented by the LEDs on the
front cover of the TJ1-FL02.
AXIS_ENABLE Enables and disables particular axis independently of other axis.
AXISSTATUS Contains the axis status.
BACKLASH_DIST Defines the amount of backlash compensation.
CLOSE_WIN Defines the end of the window in which a registration mark is
Revision 5.0
CLUTCH_RATE Defines the change in connection ratio when using the
expected.
CONNECT command.
Name Description
CREEP Contains the creep speed.
D_GAIN Contains the derivative control gain.
DAC_SCALE Sets scale and polarity applied to DAC values.
DATUM_IN Contains the input number to be used as the origin input.
DECEL Contains the axis deceleration rate.
DEMAND_EDGES Contains the current value of the DPOS axis parameter in
encoder edges.
DPOS Contains the demand position generated by the move com-
mands.
DRIVE_CONTROL Selects 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 TJ1­FL02.
DRIVE_INPUTS Holds I/O data of the driver connected to MECHATROLINK-II
bus. Data is updated every servo cycle.
DRIVE_MONITOR Monitors data of the Servo Driver connected to MECHATRO-
LINK-II bus. Data are updated every servo cycle.
DRIVE_STATUS Contains the current status of the Servo Driver.
ENCODER Contains a raw copy of the encoder hardware register.
ENCODER_BITS Sets the number of bits for the absolute encoder connected to
TJ1-FL02.
ENCODER_CONTROL Controls operating mode of the EnDat absolute encoder.
ENCODER_ID Returns the ID value of the absolute encoder connected to TJ1-
FL02.
ENCODER_RATIO Sets scaling value for incoming encoder counts.
ENCODER_STATUS Returns the status of the Tamagawa absolute encoder.
ENCODER_TURNS Returns the multi-turn count of the absolute encoder.
ENDMOVE Holds the position of the end of the current move.
ERRORMASK Contains the mask value that determines if MOTION_ERROR
occurs depending on the axis status.
PROGRAMMING MANUAL 16
BASIC commands
Name Description
FAST_JOG Contains the input number to be used as the fast jog input.
FASTDEC Defines ramp to zero deceleration ratio when an axis limit switch
or position is reached.
FE Contains the Following Error.
FE_LATCH Contains the FE value which caused the axis to put controller in
MOTION_ERROR state.
FE_LIMIT Contains the maximum allowable Following Error.
FE_LIMIT_MODE Defines how FE influences MOTION_ERROR state.
FE_RANGE Contains the Following Error warning range limit.
FHOLD_IN Contains the input number to be used as the feedhold input.
FHSPEED Contains the feedhold speed.
FS_LIMIT Contains the absolute position of the forward software limit.
FWD_IN Contains the input number to be used as a forward limit input.
FWD_JOG Contains the input number to be used as a jog forward input.
I_GAIN Contains the integral control gain.
INVERT_STEP Switches a hardware Inverter into the stepper output circuit.
JOGSPEED Sets the jog speed.
MARK Detects the primary registration event on a registration input.
MARKB Detects the secondary registration event on a registration input.
MERGE Is a software switch that can be used to enable or disable the
merging of consecutive moves.
MPOS Is the position of the axis as measured by the encoder.
MSPEED Represents the change in the measured position in the last
servo period.
MTYPE Contains the type of move currently being executed.
NTYPE Contains the type of the move in the Next Move buffer.
Revision 5.0
OFFPOS Contains an offset that will be applied to the demand position
without affecting the move in any other way.
Name Description
OPEN_WIN Defines the beginning of the window in which a registration
mark is expected.
OUTLIMIT Contains the limit that restricts the speed reference output from
the TJ1-MC__.
OV_GAIN Contains the output velocity control gain.
P_GAIN Contains the proportional control gain.
REG_POS Contains the position at which a registration event occurred.
REG_POSB Contains the position at which the secondary registration event
occurred.
REMAIN Is the distance remaining to the end of the current move.
REP_DIST Contains or sets the repeat distance.
REP_OPTION Controls the application of the REP_DIST axis parameter.
REV_IN Contains the input number to be used as a reverse limit input.
REV_JOG Contains the input number to be used as a jog reverse input.
RS_LIMIT Contains the absolute position of the reverse software limit.
S_REF Contains the speed reference value which is applied when the
axis is in open loop.
S_REF_OUT Contains the speed reference value being applied to the Servo
Driver for both open as closed loop.
SERVO Determines whether the axis runs under servo control or open
loop.
SPEED Contains the demand speed in units/s.
SPEED_SIGN Configures the voltage range of the analog speed reference out-
put of the TJ1-FL02.
SRAMP Contains the S-curve factor.
T_REF Contains the torque reference value which is applied to the
servo motor.
TRANS_DPOS Contains axis demand position at output of frame transforma-
tion.
UNITS Contains the unit conversion factor.
PROGRAMMING MANUAL 17
BASIC commands
Name Description
VERIFY Selects different modes of operation on a stepper output axis.
VFF_GAIN Contains the speed feed forward control gain.
VP_SPEED Contains the speed profile speed.
3.1.3 Communication commands and parameters
/i
Name Description
FINS_COMMS Sends FINS Read Memory and Write Memory to a designated
FINS server unit.
HLM_COMMAND Executes a specific Host Link command to the Slave.
HLM_READ Reads data from the Host Link Slave to either VR or TABLE var-
iable array.
HLM_STATUS Represents the status of the last Host Link Master command.
HLM_TIMEOUT Defines the Host Link Master timeout time.
HLM_WRITE Writes data to the Host Link Slave from either VR or TABLE var-
iable array.
HLS_NODE Defines the Slave unit number for the Host Link Slave protocol.
SETCOM Sets the serial communications.
3.1.4 Constants
/i
Name Description
FALSE Equal to the numerical value 0.
OFF Equal to the numerical value 0.
ON Equal to the numerical value 1.
PI Equal to the numerical value 3.1416.
TRUE Equal to the numerical value -1.
3.1.5 I/O commands, functions and parameters
/i
Name Description
AIN Holds the value of the analog channel.
AOUT Holds the value of the analog channel.
GET Waits for the arrival of a single character and assigns the ASCII
code of the character to variable.
IN Returns the value of digital inputs.
INDEVICE Parameter defines the default input device.
INPUT Waits for a string to be received and assigns the numerical value
to variable.
KEY Returns TRUE or FALSE depending on if character is received.
LINPUT Waits for a string and puts it in VR variables.
OP Sets one or more outputs or returns the state of the first 24 out-
puts.
OUTDEVICE Defines the default output device.
PRINT Outputs a series of characters to a serial port.
Revision 5.0
PSWITCH Turns on an output when a predefined position is reached, and
turns off the output when a second position is reached.
READ_OP Returns the value of the digital outputs.
PROGRAMMING MANUAL 18
BASIC commands
3.1.6 Mathematical functions and operands
/i
Name Description
+ (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)
ABS Returns the absolute value of an expression.
ACOS Returns the arc-cosine of an expression.
AND Performs an AND operation on corresponding bits of the integer
ASIN Returns the arc-sine of an expression.
ATAN Returns the arc-tangent of an expression.
ATAN2 Returns the arc-tangent of the non-zero complex number made
Revision 5.0
COS Returns the cosine of an expression.
EXP Returns 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.
Name Description
FRAC Returns the fractional part of an expression.
IEEE_IN Returns floating point number in IEEE format, represented by 4
bytes.
IEEE_OUT Returns single byte extracted from the floating point number in
IEEE format.
INT Returns the integer part of an expression.
LN Returns the natural logarithm of an expression.
MOD Returns the modulus of two expressions.
NOT Performs a NOT operation on corresponding bits of the integer
part of the expression.
OR Performs an OR operation between corresponding bits of the
integer parts of two expressions.
SGN Returns the sign of an expression.
SIN Returns the sine of an expression.
SQR Returns the square root of an expression.
TAN Returns the tangent of an expression.
XOR Performs an XOR function between corresponding bits of the
integer parts of two expressions.
3.1.7 Program commands
/i
Name Description
' (COMMENT FIELD) Enables a line not to be executed.
: (STATEMENT SEPARATOR)
AUTORUN Starts all the programs that have been set to run at start-up.
COMPILE Compiles the current program.
COPY Copies an existing program in the motion controller to a new
Enables more statements on one line.
program.
PROGRAMMING MANUAL 19
BASIC commands
Name Description
DEL Deletes a program from the motion controller.
DIR Displays a list of the programs in the motion controller, their size
and their RUNTYPE on the standard output.
EDIT Allows a program to be modified using a VT100 Terminal.
EPROM Stores a program in the flash memory.
LIST Prints the program on the standard output.
NEW Deletes all lines of the program in the motion controller.
PROCESS Returns the running status and task number for each current
task.
RENAME Changes the name of a program in the motion controller.
RUN Executes a program.
RUNTYPE Determines if a program is run at start-up, and which task it is to
run on.
SELECT Specifies the current program.
STEPLINE Executes a single line in a program.
STOP Halts program execution.
TROFF Suspends a trace at the current line and resumes normal pro-
gram execution.
Name Description
IF..THEN..ELSE..ENDIF Controls the flow of the program base on the results of the con-
dition.
ON.. GOSUB or ON.. GOTO
REPEAT..UNTIL Loop allows the program segment to be repeated until the con-
WHILE..WEND Loop 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.9 Slot parameters and modifiers
/i
Name Description
ALL Is a modifier that specifies that all items in the controller are con-
cerned.
COMMSTYPE Contains the type of unit in a controller slot.
FPGA_VERSION Returns the FPGA version of unit with unit_number in a control-
ler system.
SLOT Is a modifier that specifies slot number of unit.
TRON Creates a breakpoint in a program.
3.1.8 Program control commands
/i
Name Description
FOR..TO..STEP..NEXT Loop allows a program segment to be repeated with increasing/
decreasing variable.
GOSUB..RETURN Jumps to a subroutine at the line just after label. The program
Revision 5.0
GOTO Jumps 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
Name Description
$ (HEXADECIMAL INPUT)
AXIS Sets the axis for a command, axis parameter read, or assign-
BASICERROR Is used to run a specific routine when an error occurs in a
CAN_CORT Configures 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 MANUAL 20
BASIC commands
Name Description
CLEAR Clears all global variables and the local variables on the current
task.
CLEAR_BIT Clears the specified bit of the specified VR variable.
CLEAR_PARAMS Clears all parameter sand variables stored in Flash-ROM to
their default values.
CONSTANT Declares a constant for use in BASIC program.
DATE$ Prints the current date as a string.
DAY$ Prints the current day as a string
DEVICENET Configures the TJ1-DRT (DeviceNet Slave Unit) for data
exchange, or returns the data exchange status of the TJ1-DRT.
ETHERNET Reads and sets various parameters of TJ1-MC__ Ethernet port.
EX Resets the controller.
FLAG Sets and reads a bank of 32 bits.
FLAGS Read and sets FLAGS as a block.
FREE Returns the amount of available memory.
GLOBAL Declares a reference to one of VR variables.
HALT Stops execution of all programs currently running.
INITIALISE Sets all axes and parameters to their default values.
INVERT_IN Inverts input channels 0 - 31 in the software.
INVERTER_COMMAND Reads I/O and clears alarm of the Inverter.
INVERTER_READ Reads parameter, alarm, speed and torque reference of the
Inverter.
INVERTER_WRITE Writes to parameter, speed and torque reference of the Inverter.
LIST_GLOBAL Shows all GLOBAL and CONSTANT variables.
LOCK Prevents the programs from being viewed or modified.
PROFIBUS Configures 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.
Name Description
READ_BIT Returns the value of the specified bit in the specified VR varia-
ble.
RESET Resets all local variables on a task.
SCOPE Programs the system to automatically store up to 4 parameters
every sample period to the TABLE variable array.
SET_BIT Sets the specified bit in the specified VR variable to one.
TABLE Writes and reads data to and from the TABLE variable array.
TABLEVALUES Returns list of values from the TABLE memory.
TIME$ Prints the current time as a string.
TRIGGER Starts a previously set SCOPE command.
VR Writes and reads data to and from the global (VR) variables.
VRSTRING Combines VR memory values so they can be printed as a string.
WA Holds program execution for the number of milliseconds speci-
fied.
WAIT IDLE Suspends program execution until the base axis has finished
executing its current move and any buffered move.
WAIT LOADED Suspends program execution until the base axis has no moves
buffered ahead other than the currently executing move.
WAIT UNTIL Repeatedly evaluates the condition until it is TRUE.
3.1.11 System parameters
/i
Name Description
BATTERY_LOW Returns the current status of the battery condition.
CHECKSUM Contains the checksum for the programs in RAM.
COMMSERROR Contains all the communications errors that have occurred since
the last time that it was initialised.
CONTROL Contains the type of TJ1-MC__ in the system.
PROGRAMMING MANUAL 21
BASIC commands
Name Description
D_ZONE_MAX Controls the DAC output in conjunction with the Following Error
value.
D_ZONE_MIN Controls the DAC output in conjunction with the Following Error
value.
DATE Sets or returns the current date held by the real time clock.
DAY Sets or returns the current day.
DISPLAY Determines I/O channels to be displayed on the front panel
LEDs.
ERROR_AXIS Contains the number of the axis which caused the motion error.
FRAME Specifies operating frame for frame transformations.
LAST_AXIS Contains the number of the last axis processed by the system.
MOTION_ERROR Contains an error flag for axis motion errors.
NAIO Returns the number of analogue channels connected on the
MECHATROLINK-II bus.
NEG_OFFSET Applies a negative offset to the DAC signal from the servo loop.
NIO Contains the number of inputs and outputs connected to the
system.
POWER_UP Determines whether programs should be read from Flash-ROM
on power up or reset.
POS_OFFSET Applies a positive offset to the DAC signal from the servo loop.
3.1.12 Task commands and parameters
/i
Name Description
ERROR_LINE Contains the number of the line which caused the last BASIC
program error.
PMOVE Contains the status of the task buffers.
PROC Lets a process parameter from a particular process to be
accessed.
PROC_STATUS Returns the status of the process specified.
PROCNUMBER Contains the number of the task in which the currently selected
program is running.
RUN_ERROR Contains the number of the last BASIC error that occurred on the
specified task.
TICKS Contains the current count of the task clock pulses.
SCOPE_POS Contains the current TABLE position at which the SCOPE com-
mand is currently storing its first parameter.
SERVO_PERIOD Sets the servo cycle period of the TJ1-MC__.
SYSTEM_ERROR Contains the system errors since the last initialization.
TIME Returns the current time held by the real time clock.
TSIZE Returns the size of the currently defined Table.
VERSION Returns the version number of the controller firmware.
Revision 5.0
WDOG The software switch that enables Servo Drivers.
PROGRAMMING MANUAL 22
BASIC commands

3.2 All BASIC commands

3.2.1 + (Addition)
/i
Type Mathematical function
Syntax expression1 + expression2
Description The operator + adds two expressions.
Arguments expression1
Any valid BASIC expression.
expression2 Any valid BASIC expression.
Example result = 4 + 3
Assigns the value 7 to the variable result.
See also N/A
3.2.2 - (Subtraction)
/i
Type Mathematical function
Syntax expression1 - expression2
Description The operator - subtracts expression2 from expression1.
Arguments expression1
Any valid BASIC expression.
expression2 Any valid BASIC expression.
Example result = 10 - 2
Assigns the value 8 to the variable result.
See also N/A
3.2.3 * (Multiplication)
/i
Type Mathematical function
Syntax expression1 * expression2
Description The operator * multiplies two expressions.
Arguments expression1
Any valid BASIC expression.
expression2 Any valid BASIC expression.
Example result = 3 * 7
Assigns the value 21 to the variable result.
See also N/A
3.2.4 / (Division)
/i
Type Mathematical function
Syntax expression1 / expression2
Description The operator / divides expression1 by expression2.
Arguments expression1
Any valid BASIC expression.
expression2 Any valid BASIC expression.
Example result = 11 / 4
Assigns the value 2.75 to the variable result.
See also N/A
Revision 5.0
PROGRAMMING MANUAL 23
BASIC commands
3.2.5 ^ (Power)
/i
Type Mathematical function
Syntax expression1 ^ expression2
Description The 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.
Example result = 2^5
Assigns the value 32 to the variable result.
See also N/A
3.2.6 = (Is equal to)
/i
Type Mathematical function
Syntax expression1 = expression2
Description The 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.
Example IF 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 also N/A
Revision 5.0
3.2.7 = (Assignment)
/i
Type Mathematical function
Syntax variable = expression
Description The operator = assigns the value of the expression to the variable.
Arguments variable
A variable name.
expression Any valid BASIC expression.
Example var = 18
Assigns the value 18 to the variable var.
See also N/A
3.2.8 <> (Is not equal to)
/i
Type Mathematical function
Syntax expression1 <> expression2
Description The 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.
Example IF 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 state­ment.
See also N/A
PROGRAMMING MANUAL 24
Loading...
+ 284 hidden pages