Omron TJ1-MC04 - PROGRAMMING 1, TJ1-MC16 - PROGRAMMING 1, TJ1-MC04 1 Programming Manual

Note:
Although we do strive for perfection, Omron Europe BV and/or its subsidiary and affiliated companies do not warrant or make any representations regarding the correctness or completeness
of information described in this catalogue. Product information in this catalogue is provided ‚as is‘ without warranty of any kind, either express or implied, including, but not limited to, the
implied warranties of merchantability, fitness for a particular purpose, or non-infringement. In a jurisdiction where the exclusion of implied warranties is not valid, the exclusion shall be
deemed to be replaced by such valid exclusion, which most closely matches the intent and purpose of the original exclusion. Omron Europe BV and/or its subsidiary and affiliated companies
reserve the right to make any changes to the products, their specifications, data at its sole discretion at any time without prior notice. The material contained in this catalogue may be out of
date and Omron Europe BV and/or its subsidiary and affiliated companies make no commitment to update such material.
Cat. No. I52E-E N-03
PROGRAMMING MANUAL 2
Revision 3.0
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
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. Trajexia is a registered trademark of OMRON. Motion Perfect is a registered trademark of Trio Motion Technology Ltd.
/i
DANGER
Indicates an imminently hazardous situation, which, if not avoided, will result in death or serious injury.
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.
© OMRON, 2007
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.
I52E-EN-03.book Seite 2 Freitag, 29. Juni 2007 11:55 11
PROGRAMMING MANUAL 3
Revision 3.0
About this manual
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 control system QUICK START GUIDE
I50E Describes how to get quickly
familiar with Trajexia, moving a single axis using MECHA­TROLINK-II, in a test set-up.
Trajexia motion control system HARDWARE REFERENCE MANUAL
I51E Describes the installation and
hardware specification of the Trajexia units, and explains the Trajexia system philoso­phy.
Trajexia motion control system PROGRAMMING MANUAL
I52E Describes the BASIC com-
mands to be used for pro­gramming Trajexia, explains the communication protocols and Trajexia Tools software, gives practical examples and troubleshooting information.
Sigma-II Servo Driver manual SIEP S800000 15 Describes the installation and
operation of Sigma-II servo drives
JUNMA series servo drive manual
TOEP-C71080603 01-OY Describes the installation and
operation of JUNMA servo drives
JUSP-NS115 manual SIEP C71080001 Describes the installation and
operation of the MECHA­TROLINK-II application mod­ule
Sigma-III with MECHATRO­LINK interface manual
SIEP S800000 11 Describes the installation an d
operation of Sigma-III servo drives with MECHATRO­LINK interface
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
SI-T MECHATROLINK inter­face for the G7 & F7
SIBP-C730600-08 Describes the installation and
operation of MECHATRO­LINK interfaces for G7 and F7 inverters
ST-T/V7 MECHATROLINK interface for the V7
SIBP-C730600-03 Describes the installation and
operation of MECHATRO­LINK interfaces for V7 invert­ers
MECHATROLINK IO Modules SIE C887-5 Describes the installation and
operation of MECHATRO­LINK input and output mod­ules and the MECHATROLINK-II repeater
SYSMAC CS/CJ Series Com­munications Commands
W342 Describes FINS communica-
tions protocol and FINS com­mands
WARNING
Failure to read and understand the information provided in this manual may result in personal injury or death, damage to the prod­uct, 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.
Name Cat. No. Contents
I52E-EN-03.book Seite 3 Freitag, 29. Juni 2007 11:55 11
PROGRAMMING MANUAL 4
Revision 3.0
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
Verify the firmware and FPGA versions of the TJ1-MC__
Connect the TJ1-MC__ to Trajexia Tools 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
TJ1-MC__ FPGA 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 and TJ1-ML04
V1.6607 21 and higher
I52E-EN-03.book Seite 4 Freitag, 29. Juni 2007 11:55 11
Contents
PROGRAMMING MANUAL 5
Revision 3.0
1 Safety warnings and precautions..............................................................................................................................................................16
1.1 Intended audience ..........................................................................................................................................................................................................................16
1.2 General precautions .......................................................................................................................................................................................................................16
1.3 Safety precautions ......................................................................................................................................................................................................................... 16
1.4 Operating environment precautions................................................................................................................................................................................................ 17
1.5 Application precautions...................................................................................................................................................................................................................18
1.6 Unit assembly precautions..............................................................................................................................................................................................................21
2 Trajexia system ..........................................................................................................................................................................................22
2.1 Introduction .....................................................................................................................................................................................................................................22
2.1.1 Trajexia hardware ............................................................................................................................................................................................................ 23
2.1.2 This manual ......................................................................................................................................................................................................................23
2.2 Multitasking BASIC programming ...................................................................................................................................................................................................23
2.3 BASIC programming .......................................................................................................................................................................................................................24
2.3.1 Axis, system and task statements ....................................................................................................................................................................................24
2.3.2 Memory areas...................................................................................................................................................................................................................24
2.3.3 Data structures and variables........................................................................................................................................................................................... 25
2.3.4 Mathematical specifications..............................................................................................................................................................................................27
2.4 Motion execution.............................................................................................................................................................................................................................28
2.4.1 Motion generator .............................................................................................................................................................................................................. 28
2.4.2 Sequencing.......................................................................................................................................................................................................................29
2.4.3 Move loading ....................................................................................................................................................................................................................29
2.5 Command line interface ..................................................................................................................................................................................................................30
2.6 BASIC programs .............................................................................................................................................................................................................................30
2.6.1 Managing programs..........................................................................................................................................................................................................30
2.6.2 Program compilation.........................................................................................................................................................................................................31
2.6.3 Program execution ........................................................................................................................................................................................................... 31
3 BASIC commands ...................................................................................................................................................................................... 33
3.1 Categories ...................................................................................................................................................................................................................................... 33
3.1.1 Axis commands ...............................................................................................................................................................................................................33
3.1.2 Axis parameters ...............................................................................................................................................................................................................34
3.1.3 Communication commands and parameters ...................................................................................................................................................................36
3.1.4 Constants .........................................................................................................................................................................................................................36
3.1.5 I/O commands, functions and parameters ......................................................................................................................................................................36
3.1.6 Mathematical functions and operands .........................................................................................................................................................................37
3.1.7 Program commands ........................................................................................................................................................................................................37
3.1.8 Program control commands ............................................................................................................................................................................................38
3.1.9 Slot parameters and modifiers ........................................................................................................................................................................................ 38
3.1.10 System commands and functions ..................................................................................................................................................................................38
I52E-EN-03.book Seite 5 Freitag, 29. Juni 2007 11:55 11
Contents
PROGRAMMING MANUAL 6
Revision 3.0
3.1.11 System parameters .........................................................................................................................................................................................................39
3.1.12 Task commands and parameters .................................................................................................................................................................................... 40
3.2 All BASIC commands .....................................................................................................................................................................................................................41
3.2.1 + (Addition) ....................................................................................................................................................................................................................... 41
3.2.2 - (Subtraction)...................................................................................................................................................................................................................41
3.2.3 * (Multiplication) ................................................................................................................................................................................................................41
3.2.4 / (Division).........................................................................................................................................................................................................................41
3.2.5 ^ (Power) .......................................................................................................................................................................................................................... 42
3.2.6 = (Is equal to) ...................................................................................................................................................................................................................42
3.2.7 = (Assignment) .................................................................................................................................................................................................................42
3.2.8 <> (Is not equal to) ...........................................................................................................................................................................................................42
3.2.9 > (Is greater than).............................................................................................................................................................................................................43
3.2.10 >= (Is greater than or equal to).........................................................................................................................................................................................43
3.2.11 < (Is less than)..................................................................................................................................................................................................................43
3.2.12 <= (Is less than or equal to).............................................................................................................................................................................................. 43
3.2.13 $ (Hexadecimal input).......................................................................................................................................................................................................44
3.2.14 ' (Comment field) ..............................................................................................................................................................................................................44
3.2.15 : (Statement separator).....................................................................................................................................................................................................44
3.2.16 #........................................................................................................................................................................................................................................44
3.2.17 ABS ..................................................................................................................................................................................................................................45
3.2.18 ACC ..................................................................................................................................................................................................................................45
3.2.19 ACCEL..............................................................................................................................................................................................................................45
3.2.20 ACOS ...............................................................................................................................................................................................................................45
3.2.21 ADD_DAC ........................................................................................................................................................................................................................46
3.2.22 ADDAX .............................................................................................................................................................................................................................46
3.2.23 ADDAX_AXIS ...................................................................................................................................................................................................................47
3.2.24 AIN....................................................................................................................................................................................................................................47
3.2.25 AND ..................................................................................................................................................................................................................................47
3.2.26 AOUT................................................................................................................................................................................................................................48
3.2.27 ASIN .................................................................................................................................................................................................................................48
3.2.28 ATAN ................................................................................................................................................................................................................................48
3.2.29 ATAN2 ..............................................................................................................................................................................................................................48
3.2.30 ATYPE..............................................................................................................................................................................................................................49
3.2.31 AUTORUN........................................................................................................................................................................................................................49
3.2.32 AXIS .................................................................................................................................................................................................................................49
3.2.33 AXIS_DISPLAY ................................................................................................................................................................................................................50
3.2.34 AXIS_ENABLE .................................................................................................................................................................................................................50
3.2.35 AXISSTATUS ...................................................................................................................................................................................................................50
3.2.36 B_SPLINE ........................................................................................................................................................................................................................51
3.2.37 BASE ................................................................................................................................................................................................................................51
I52E-EN-03.book Seite 6 Freitag, 29. Juni 2007 11:55 11
Contents
PROGRAMMING MANUAL 7
Revision 3.0
3.2.38 BASICERROR..................................................................................................................................................................................................................52
3.2.39 BATTERY_LOW...............................................................................................................................................................................................................53
3.2.40 BREAK_RESET ...............................................................................................................................................................................................................53
3.2.41 CAM..................................................................................................................................................................................................................................53
3.2.42 CAMBOX ..........................................................................................................................................................................................................................55
3.2.43 CANCEL ...........................................................................................................................................................................................................................56
3.2.44 CHECKSUM .....................................................................................................................................................................................................................56
3.2.45 CHR..................................................................................................................................................................................................................................56
3.2.46 CLEAR..............................................................................................................................................................................................................................57
3.2.47 CLEAR_BIT ......................................................................................................................................................................................................................57
3.2.48 CLEAR_PARAMS ............................................................................................................................................................................................................57
3.2.49 CLOSE_WIN ....................................................................................................................................................................................................................57
3.2.50 CLUTCH_RATE ...............................................................................................................................................................................................................57
3.2.51 COMMSERROR...............................................................................................................................................................................................................58
3.2.52 COMMSTYPE ..................................................................................................................................................................................................................58
3.2.53 COMPILE .........................................................................................................................................................................................................................58
3.2.54 CONNECT........................................................................................................................................................................................................................59
3.2.55 CONSTANT......................................................................................................................................................................................................................59
3.2.56 CONTROL ........................................................................................................................................................................................................................59
3.2.57 COPY ...............................................................................................................................................................................................................................60
3.2.58 COS..................................................................................................................................................................................................................................60
3.2.59 CREEP .............................................................................................................................................................................................................................60
3.2.60 D_GAIN ............................................................................................................................................................................................................................ 60
3.2.61 D_ZONE_MAX .................................................................................................................................................................................................................61
3.2.62 D_ZONE_MIN ..................................................................................................................................................................................................................61
3.2.63 DAC ..................................................................................................................................................................................................................................61
3.2.64 DAC_OUT ........................................................................................................................................................................................................................61
3.2.65 DAC_SCALE ....................................................................................................................................................................................................................61
3.2.66 DATE ................................................................................................................................................................................................................................62
3.2.67 DATE$ ..............................................................................................................................................................................................................................62
3.2.68 DATUM.............................................................................................................................................................................................................................62
3.2.69 DATUM_IN ....................................................................................................................................................................................................................... 63
3.2.70 DAY .................................................................................................................................................................................................................................. 64
3.2.71 DAY$ ................................................................................................................................................................................................................................64
3.2.72 DECEL..............................................................................................................................................................................................................................64
3.2.73 DEFPOS...........................................................................................................................................................................................................................64
3.2.74 DEL...................................................................................................................................................................................................................................65
3.2.75 DEMAND_EDGES ...........................................................................................................................................................................................................65
3.2.76 DEVICENET .....................................................................................................................................................................................................................65
3.2.77 DIR ...................................................................................................................................................................................................................................67
I52E-EN-03.book Seite 7 Freitag, 29. Juni 2007 11:55 11
Contents
PROGRAMMING MANUAL 8
Revision 3.0
3.2.78 DISABLE_GROUP ...........................................................................................................................................................................................................67
3.2.79 DISPLAY ..........................................................................................................................................................................................................................67
3.2.80 DPOS ...............................................................................................................................................................................................................................68
3.2.81 DRIVE_ALARM ................................................................................................................................................................................................................68
3.2.82 DRIVE_CLEAR.................................................................................................................................................................................................................69
3.2.83 DRIVE_CONTROL ...........................................................................................................................................................................................................69
3.2.84 DRIVE_INPUTS ...............................................................................................................................................................................................................70
3.2.85 DRIVE_MONITOR............................................................................................................................................................................................................70
3.2.86 DRIVE_READ...................................................................................................................................................................................................................71
3.2.87 DRIVE_RESET.................................................................................................................................................................................................................71
3.2.88 DRIVE_STATUS ..............................................................................................................................................................................................................72
3.2.89 DRIVE_WRITE .................................................................................................................................................................................................................73
3.2.90 EDIT .................................................................................................................................................................................................................................73
3.2.91 ELSE ................................................................................................................................................................................................................................73
3.2.92 ELSEIF .............................................................................................................................................................................................................................73
3.2.93 ENCODER........................................................................................................................................................................................................................74
3.2.94 ENCODER_BITS..............................................................................................................................................................................................................74
3.2.95 ENCODER_CONTROL ....................................................................................................................................................................................................74
3.2.96 ENCODER_ID ..................................................................................................................................................................................................................75
3.2.97 ENCODER_RATIO...........................................................................................................................................................................................................75
3.2.98 ENCODER_READ............................................................................................................................................................................................................75
3.2.99 ENCODER_STATUS ....................................................................................................................................................................................................... 76
3.2.100 ENCODER_TURNS .........................................................................................................................................................................................................76
3.2.101 ENCODER_WRITE ..........................................................................................................................................................................................................76
3.2.102 ENDIF...............................................................................................................................................................................................................................76
3.2.103 ENDMOVE .......................................................................................................................................................................................................................77
3.2.104 EPROM ............................................................................................................................................................................................................................77
3.2.105 ERROR_AXIS ..................................................................................................................................................................................................................77
3.2.106 ERROR_LINE...................................................................................................................................................................................................................77
3.2.107 ERRORMASK ..................................................................................................................................................................................................................78
3.2.108 ETHERNET ......................................................................................................................................................................................................................78
3.2.109 EX.....................................................................................................................................................................................................................................79
3.2.110 EXP ..................................................................................................................................................................................................................................79
3.2.111 FALSE ..............................................................................................................................................................................................................................79
3.2.112 FAST_JOG .......................................................................................................................................................................................................................79
3.2.113 FASTDEC.........................................................................................................................................................................................................................80
3.2.114 FE .....................................................................................................................................................................................................................................80
3.2.115 FE_LATCH .......................................................................................................................................................................................................................80
3.2.116 FE_LIMIT..........................................................................................................................................................................................................................80
3.2.117 FE_LIMIT_MODE .............................................................................................................................................................................................................81
I52E-EN-03.book Seite 8 Freitag, 29. Juni 2007 11:55 11
Contents
PROGRAMMING MANUAL 9
Revision 3.0
3.2.118 FE_RANGE ......................................................................................................................................................................................................................81
3.2.119 FHOLD_IN........................................................................................................................................................................................................................81
3.2.120 FHSPEED.........................................................................................................................................................................................................................82
3.2.121 FINS_COMMS..................................................................................................................................................................................................................82
3.2.122 FLAG ................................................................................................................................................................................................................................84
3.2.123 FLAGS..............................................................................................................................................................................................................................84
3.2.124 FOR..TO..STEP..NEXT ....................................................................................................................................................................................................85
3.2.125 FORWARD .......................................................................................................................................................................................................................86
3.2.126 FPGA_VERSION..............................................................................................................................................................................................................86
3.2.127 FRAC................................................................................................................................................................................................................................86
3.2.128 FRAME .............................................................................................................................................................................................................................86
3.2.129 FREE ................................................................................................................................................................................................................................87
3.2.130 FS_LIMIT..........................................................................................................................................................................................................................87
3.2.131 FWD_IN............................................................................................................................................................................................................................87
3.2.132 FWD_JOG ........................................................................................................................................................................................................................88
3.2.133 GET ..................................................................................................................................................................................................................................88
3.2.134 GLOBAL ...........................................................................................................................................................................................................................89
3.2.135 GOSUB..RETURN............................................................................................................................................................................................................89
3.2.136 GOTO ...............................................................................................................................................................................................................................89
3.2.137 HALT ................................................................................................................................................................................................................................90
3.2.138 HEX ..................................................................................................................................................................................................................................90
3.2.139 HLM_COMMAND .............................................................................................................................................................................................................90
3.2.140 HLM_READ ......................................................................................................................................................................................................................91
3.2.141 HLM_STATUS..................................................................................................................................................................................................................92
3.2.142 HLM_TIMEOUT................................................................................................................................................................................................................93
3.2.143 HLM_WRITE ....................................................................................................................................................................................................................94
3.2.144 HLS_NODE ......................................................................................................................................................................................................................95
3.2.145 HW_PSWITCH .................................................................................................................................................................................................................95
3.2.146 I_GAIN..............................................................................................................................................................................................................................96
3.2.147 IDLE..................................................................................................................................................................................................................................96
3.2.148 IEEE_IN............................................................................................................................................................................................................................96
3.2.149 IEEE_OUT........................................................................................................................................................................................................................96
3.2.150 IF..THEN..ELSE..ENDIF...................................................................................................................................................................................................97
3.2.151 IN ......................................................................................................................................................................................................................................97
3.2.152 INDEVICE.........................................................................................................................................................................................................................98
3.2.153 INITIALISE........................................................................................................................................................................................................................98
3.2.154 INPUT...............................................................................................................................................................................................................................99
3.2.155 INT....................................................................................................................................................................................................................................99
3.2.156 INVERT_IN.......................................................................................................................................................................................................................99
3.2.157 INVERT_STEP ...............................................................................................................................................................................................................100
I52E-EN-03.book Seite 9 Freitag, 29. Juni 2007 11:55 11
Contents
PROGRAMMING MANUAL 10
Revision 3.0
3.2.158 INVERTER_COMMAND ................................................................................................................................................................................................100
3.2.159 INVERTER_READ ......................................................................................................................................................................................................... 101
3.2.160 INVERTER_WRITE........................................................................................................................................................................................................ 102
3.2.161 JOGSPEED.................................................................................................................................................................................................................... 103
3.2.162 KEY ................................................................................................................................................................................................................................103
3.2.163 LAST_AXIS ....................................................................................................................................................................................................................104
3.2.164 LINKAX...........................................................................................................................................................................................................................104
3.2.165 LINPUT...........................................................................................................................................................................................................................104
3.2.166 LIST ................................................................................................................................................................................................................................105
3.2.167 LIST_GLOBAL................................................................................................................................................................................................................105
3.2.168 LN ...................................................................................................................................................................................................................................106
3.2.169 LOCK..............................................................................................................................................................................................................................106
3.2.170 MARK .............................................................................................................................................................................................................................106
3.2.171 MARKB...........................................................................................................................................................................................................................107
3.2.172 MECHATROLINK ...........................................................................................................................................................................................................107
3.2.173 MERGE ..........................................................................................................................................................................................................................108
3.2.174 MHELICAL......................................................................................................................................................................................................................109
3.2.175 MOD ...............................................................................................................................................................................................................................109
3.2.176 MOTION_ERROR ..........................................................................................................................................................................................................109
3.2.177 MOVE .............................................................................................................................................................................................................................110
3.2.178 MOVEABS......................................................................................................................................................................................................................111
3.2.179 MOVECIRC ....................................................................................................................................................................................................................112
3.2.180 MOVELINK .....................................................................................................................................................................................................................114
3.2.181 MOVEMODIFY ...............................................................................................................................................................................................................115
3.2.182 MPOS .............................................................................................................................................................................................................................116
3.2.183 MSPEED ........................................................................................................................................................................................................................116
3.2.184 MTYPE ...........................................................................................................................................................................................................................116
3.2.185 NAIO...............................................................................................................................................................................................................................117
3.2.186 NEG_OFFSET................................................................................................................................................................................................................117
3.2.187 NEW ...............................................................................................................................................................................................................................117
3.2.188 NEXT ..............................................................................................................................................................................................................................117
3.2.189 NIO .................................................................................................................................................................................................................................117
3.2.190 NOT ................................................................................................................................................................................................................................118
3.2.191 NTYPE............................................................................................................................................................................................................................118
3.2.192 OFF ................................................................................................................................................................................................................................118
3.2.193 OFFPOS.........................................................................................................................................................................................................................118
3.2.194 ON ..................................................................................................................................................................................................................................119
3.2.195 ON.. GOSUB ..................................................................................................................................................................................................................119
3.2.196 ON.. GOTO.....................................................................................................................................................................................................................119
3.2.197 OP ..................................................................................................................................................................................................................................119
I52E-EN-03.book Seite 10 Freitag, 29. Juni 2007 11:55 11
Contents
PROGRAMMING MANUAL 11
Revision 3.0
3.2.198 OPEN_WIN ....................................................................................................................................................................................................................120
3.2.199 OR ..................................................................................................................................................................................................................................120
3.2.200 OUTDEVICE...................................................................................................................................................................................................................121
3.2.201 OUTLIMIT....................................................................................................................................................................................................................... 121
3.2.202 OV_GAIN........................................................................................................................................................................................................................121
3.2.203 P_GAIN ..........................................................................................................................................................................................................................122
3.2.204 PI ....................................................................................................................................................................................................................................122
3.2.205 PMOVE...........................................................................................................................................................................................................................122
3.2.206 POS_OFFSET................................................................................................................................................................................................................ 123
3.2.207 POWER_UP ...................................................................................................................................................................................................................123
3.2.208 PRINT.............................................................................................................................................................................................................................123
3.2.209 PROC .............................................................................................................................................................................................................................124
3.2.210 PROC_STATUS .............................................................................................................................................................................................................124
3.2.211 PROCESS ......................................................................................................................................................................................................................125
3.2.212 PROCNUMBER..............................................................................................................................................................................................................125
3.2.213 PROFIBUS .....................................................................................................................................................................................................................125
3.2.214 PSWITCH .......................................................................................................................................................................................................................126
3.2.215 RAPIDSTOP................................................................................................................................................................................................................... 127
3.2.216 READ_BIT ......................................................................................................................................................................................................................127
3.2.217 REG_POS ......................................................................................................................................................................................................................128
3.2.218 REG_POSB....................................................................................................................................................................................................................128
3.2.219 REGIST ..........................................................................................................................................................................................................................128
3.2.220 REMAIN..........................................................................................................................................................................................................................130
3.2.221 REMOTE_ERROR .........................................................................................................................................................................................................130
3.2.222 RENAME ........................................................................................................................................................................................................................130
3.2.223 REP_DIST ......................................................................................................................................................................................................................131
3.2.224 REP_OPTION ................................................................................................................................................................................................................131
3.2.225 REPEAT..UNTIL.............................................................................................................................................................................................................131
3.2.226 RESET............................................................................................................................................................................................................................132
3.2.227 RETURN.........................................................................................................................................................................................................................132
3.2.228 REV_IN...........................................................................................................................................................................................................................132
3.2.229 REV_JOG....................................................................................................................................................................................................................... 133
3.2.230 REVERSE ......................................................................................................................................................................................................................133
3.2.231 RS_LIMIT .......................................................................................................................................................................................................................133
3.2.232 RUN................................................................................................................................................................................................................................133
3.2.233 RUN_ERROR.................................................................................................................................................................................................................134
3.2.234 RUNTYPE ......................................................................................................................................................................................................................134
3.2.235 S_REF ............................................................................................................................................................................................................................135
3.2.236 S_REF_OUT ..................................................................................................................................................................................................................135
3.2.237 SCOPE ...........................................................................................................................................................................................................................136
I52E-EN-03.book Seite 11 Freitag, 29. Juni 2007 11:55 11
Contents
PROGRAMMING MANUAL 12
Revision 3.0
3.2.238 SCOPE_POS .................................................................................................................................................................................................................137
3.2.239 SELECT..........................................................................................................................................................................................................................137
3.2.240 SERVO ...........................................................................................................................................................................................................................137
3.2.241 SERVO_PERIOD ...........................................................................................................................................................................................................137
3.2.242 SET_BIT .........................................................................................................................................................................................................................138
3.2.243 SETCOM ........................................................................................................................................................................................................................138
3.2.244 SGN................................................................................................................................................................................................................................139
3.2.245 SIN..................................................................................................................................................................................................................................139
3.2.246 SLOT ..............................................................................................................................................................................................................................139
3.2.247 SPEED ...........................................................................................................................................................................................................................139
3.2.248 SQR................................................................................................................................................................................................................................140
3.2.249 SRAMP...........................................................................................................................................................................................................................140
3.2.250 STEP ..............................................................................................................................................................................................................................140
3.2.251 STEP_RATIO .................................................................................................................................................................................................................140
3.2.252 STEPLINE ......................................................................................................................................................................................................................141
3.2.253 STOP..............................................................................................................................................................................................................................141
3.2.254 SYSTEM_ERROR.......................................................................................................................................................................................................... 142
3.2.255 T_REF ............................................................................................................................................................................................................................142
3.2.256 TABLE ............................................................................................................................................................................................................................143
3.2.257 TABLEVALUES.............................................................................................................................................................................................................. 143
3.2.258 TAN ................................................................................................................................................................................................................................144
3.2.259 THEN..............................................................................................................................................................................................................................144
3.2.260 TICKS .............................................................................................................................................................................................................................144
3.2.261 TIME ...............................................................................................................................................................................................................................144
3.2.262 TIME$ .............................................................................................................................................................................................................................145
3.2.263 TO...................................................................................................................................................................................................................................145
3.2.264 TRANS_DPOS ...............................................................................................................................................................................................................145
3.2.265 TRIGGER .......................................................................................................................................................................................................................145
3.2.266 TROFF............................................................................................................................................................................................................................145
3.2.267 TRON .............................................................................................................................................................................................................................146
3.2.268 TRUE..............................................................................................................................................................................................................................146
3.2.269 TSIZE .............................................................................................................................................................................................................................146
3.2.270 UNITS.............................................................................................................................................................................................................................147
3.2.271 UNLOCK.........................................................................................................................................................................................................................147
3.2.272 UNTIL .............................................................................................................................................................................................................................147
3.2.273 VERIFY...........................................................................................................................................................................................................................147
3.2.274 VERSION .......................................................................................................................................................................................................................147
3.2.275 VFF_GAIN ......................................................................................................................................................................................................................148
3.2.276 VP_SPEED.....................................................................................................................................................................................................................148
3.2.277 VR...................................................................................................................................................................................................................................148
I52E-EN-03.book Seite 12 Freitag, 29. Juni 2007 11:55 11
Contents
PROGRAMMING MANUAL 13
Revision 3.0
3.2.278 VRSTRING .....................................................................................................................................................................................................................149
3.2.279 WA..................................................................................................................................................................................................................................149
3.2.280 WAIT IDLE......................................................................................................................................................................................................................150
3.2.281 WAIT LOADED............................................................................................................................................................................................................... 150
3.2.282 WAIT UNTIL ...................................................................................................................................................................................................................150
3.2.283 WDOG ............................................................................................................................................................................................................................151
3.2.284 WHILE..WEND ...............................................................................................................................................................................................................151
3.2.285 XOR................................................................................................................................................................................................................................152
4 Communication protocols ...................................................................................................................................................................... 153
4.1 Available interfaces.......................................................................................................................................................................................................................153
4.2 Ethernet ......................................................................................................................................................................................................................................153
4.2.1 Communicate with Trajexia directly from your computer ............................................................................................................................................... 154
4.2.2 Communicate with Trajexia remotely .............................................................................................................................................................................155
4.2.3 Trajexia Tools protocol ................................................................................................................................................................................................156
4.2.4 FINS server protocol ...................................................................................................................................................................................................156
4.2.5 FINS client protocol ........................................................................................................................................................................................................158
4.3 Serial protocol ............................................................................................................................................................................................................................158
4.3.1 Host Link master ............................................................................................................................................................................................................158
4.3.2 Host Link slave ...........................................................................................................................................................................................................163
4.3.3 User-defined protocol ...................................................................................................................................................................................................165
4.4 PROFIBUS ..............................................................................................................................................................................................................................167
4.4.1 Introduction.....................................................................................................................................................................................................................167
4.4.2 Communication set-up....................................................................................................................................................................................................167
4.4.3 Communication Status ...................................................................................................................................................................................................172
4.5 DeviceNet .....................................................................................................................................................................................................................................173
4.5.1 Introduction.....................................................................................................................................................................................................................173
4.5.2 Communication set-up....................................................................................................................................................................................................173
4.5.3 Communication Status ..................................................................................................................................................................................................178
4.6 MECHATROLINK-II ................................................................................................................................................................................................................. 179
5 Trajexia Tools interface ........................................................................................................................................................................... 180
5.1 Introduction ................................................................................................................................................................................................................................... 180
5.2 Specifications and connections ....................................................................................................................................................................................................180
5.2.1 PC Specifications ..........................................................................................................................................................................................................180
5.2.2 Install the Trajexia Tools software ................................................................................................................................................................................. 181
5.2.3 Connection to the TJ1-MC__ .........................................................................................................................................................................................186
5.3 Projects ........................................................................................................................................................................................................................................191
5.3.1 Trajexia Tools Projects ...................................................................................................................................................................................................191
5.3.2 Check Project window ................................................................................................................................................................................................192
5.4 Trajexia Tools application window ...............................................................................................................................................................................................194
I52E-EN-03.book Seite 13 Freitag, 29. Juni 2007 11:55 11
Contents
PROGRAMMING MANUAL 14
Revision 3.0
5.4.1 Control panel .................................................................................................................................................................................................................. 194
5.4.2 Menu bar ........................................................................................................................................................................................................................194
5.4.3 Toolbar ..........................................................................................................................................................................................................................195
5.5 Menu descriptions ........................................................................................................................................................................................................................196
5.5.1 Project menu ................................................................................................................................................................................................................ 196
5.5.2 Controller menu .............................................................................................................................................................................................................198
5.5.3 Program menu ............................................................................................................................................................................................................... 203
5.5.4 Tools menu .................................................................................................................................................................................................................... 205
5.5.5 Options menu ................................................................................................................................................................................................................221
5.5.6 Windows Menu ..............................................................................................................................................................................................................224
5.5.7 Help Menu .....................................................................................................................................................................................................................224
6 Examples and tips .................................................................................................................................................................................... 225
6.1 How-to’s ........................................................................................................................................................................................................................................ 225
6.1.1 Startup program .............................................................................................................................................................................................................225
6.1.2 Gain settings .................................................................................................................................................................................................................229
6.1.3 Setting the UNITS axis parameter and gear ratio...........................................................................................................................................................239
6.1.4 Mapping Servo Driver inputs and outputs ......................................................................................................................................................................251
6.1.5 Origin search ..................................................................................................................................................................................................................253
6.1.6 Registration ....................................................................................................................................................................................................................259
6.1.7 Tracing and monitoring...................................................................................................................................................................................................269
6.2 Practical examples........................................................................................................................................................................................................................279
6.2.1 Shell program ...............................................................................................................................................................................................................279
6.2.2 Initialization program ................................................................................................................................................................................................... 283
6.2.3 Single axis program ......................................................................................................................................................................................................286
6.2.4 Position with product detection ......................................................................................................................................................................................287
6.2.5 Position on a grid ..........................................................................................................................................................................................................289
6.2.6 Bag feeder program ......................................................................................................................................................................................................291
6.2.7 CAM table inside a program ........................................................................................................................................................................................ 293
6.2.8 Flying shear program ....................................................................................................................................................................................................295
6.2.9 Correction program .......................................................................................................................................................................................................298
7 Troubleshooting........................................................................................................................................................................................300
7.1 Voltage and analysis tools ............................................................................................................................................................................................................300
7.2 TJ1-MC__ ..................................................................................................................................................................................................................................... 300
7.2.1 System errors .................................................................................................................................................................................................................300
7.2.2 Axis errors ......................................................................................................................................................................................................................300
7.2.3 Unit errors....................................................................................................................................................................................................................... 301
7.2.4 Configuration errors........................................................................................................................................................................................................ 302
7.2.5 Replace the battery ........................................................................................................................................................................................................ 302
7.3 TJ1-PRT ....................................................................................................................................................................................................................................... 302
I52E-EN-03.book Seite 14 Freitag, 29. Juni 2007 11:55 11
Contents
PROGRAMMING MANUAL 15
Revision 3.0
7.3.1 System errors .................................................................................................................................................................................................................302
7.3.2 I/O data communication problems..................................................................................................................................................................................303
7.4 TJ1-DRT .......................................................................................................................................................................................................................................304
7.4.1 System errors .................................................................................................................................................................................................................304
7.4.2 I/O data communication problems..................................................................................................................................................................................304
7.5 TJ1-ML__......................................................................................................................................................................................................................................304
7.5.1 System errors .................................................................................................................................................................................................................304
7.5.2 Bus errors .......................................................................................................................................................................................................................304
7.6 TJ1-FL02 ...................................................................................................................................................................................................................................... 305
7.6.1 System errors .................................................................................................................................................................................................................305
I52E-EN-03.book Seite 15 Freitag, 29. Juni 2007 11:55 11
Safety warnings and precautions
PROGRAMMING MANUAL 16
Revision 3.0
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.
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.
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.
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.
I52E-EN-03.book Seite 16 Freitag, 29. Juni 2007 11:55 11
Safety warnings and precautions
PROGRAMMING MANUAL 17
Revision 3.0
1.4 Operating environment 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 Pay careful attention to the polarity (+/-) when wiring the DC power supply.A wrong connection may cause malfunction of the system.
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.
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.
I52E-EN-03.book Seite 17 Freitag, 29. Juni 2007 11:55 11
Safety warnings and precautions
PROGRAMMING MANUAL 18
Revision 3.0
1.5 Application 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.
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 Always use the power supply voltage specified in this manual. An incorrect voltage may result in malfunction or burning.
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­stand voltage tests. Not disconnecting the functional ground terminal may result in burning.
I52E-EN-03.book Seite 18 Freitag, 29. Juni 2007 11:55 11
Safety warnings and precautions
PROGRAMMING MANUAL 19
Revision 3.0
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 Leave the dust protective label attached to the Unit when wiring. Removing the dust protective label may result in malfunction.
Caution Remove the dust protective label after the completion of wiring to ensure proper heat dissipation. Leaving the dust protective label attached may result in malfunc­tion.
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.
I52E-EN-03.book Seite 19 Freitag, 29. Juni 2007 11:55 11
Safety warnings and precautions
PROGRAMMING MANUAL 20
Revision 3.0
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 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 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 Do not pull on the cables or bend the cables beyond their natural limit. Doing so may break the cables.
Caution 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 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. Do not install twisted-pair cables in locations subject to excessive dirt and dust or to oil mist or other contaminants.
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 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 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.
I52E-EN-03.book Seite 20 Freitag, 29. Juni 2007 11:55 11
Safety warnings and precautions
PROGRAMMING MANUAL 21
Revision 3.0
1.6 Unit assembly precautions
Caution
Install the unit properly. Improper installation of the unit may result in malfunction.
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.
I52E-EN-03.book Seite 21 Freitag, 29. Juni 2007 11:55 11
Trajexia system
PROGRAMMING MANUAL 22
Revision 3.0
2 Trajexia system
2.1 Introduction
fig. 1
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.
NS-series HMI
CJ-series PLC CX-one
Trajexia Tools
PROFIBUS-DP
Master
DEVICENET
Master
Ethernet
Digital I/O
Hostlink
MECHATROLINK-II
I52E-EN-03.book Seite 22 Freitag, 29. Juni 2007 11:55 11
Trajexia system
PROGRAMMING MANUAL 23
Revision 3.0
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:
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.
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 drives.
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 your machine.
DeviceNet
The DeviceNet slave allows connectivity to the DeviceNet 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 Tools 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.
I52E-EN-03.book Seite 23 Freitag, 29. Juni 2007 11:55 11
Trajexia system
PROGRAMMING MANUAL 24
Revision 3.0
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.
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.
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, 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. 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.
I52E-EN-03.book Seite 24 Freitag, 29. Juni 2007 11:55 11
Trajexia system
PROGRAMMING MANUAL 25
Revision 3.0
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.
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 TABLE( 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.
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 TA BLE 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
I52E-EN-03.book Seite 25 Freitag, 29. Juni 2007 11:55 11
Trajexia system
PROGRAMMING MANUAL 26
Revision 3.0
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.
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:
/i
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
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:
The TABLE and VR data can be accessed from the differ­ent running tasks. When using either VR or TABLE varia­bles, 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.
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
start: GOSUB Initial VR(length) = x ... ...
Initial: length = 3 RETURN
start: GOSUB Initial MOVE(VR(length)) PRINT(VR(length)) ...
Initial: length = 3 RETURN
I52E-EN-03.book Seite 26 Freitag, 29. Juni 2007 11:55 11
Trajexia system
PROGRAMMING MANUAL 27
Revision 3.0
/i
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
39
to
±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.
Hexadecimal format
The TJ1-MC__ supports assigning and printing hexadecimal values. A hexadecimal number is input by prefixing the number with the $ character. Valid range is from 0x0 to 0xFFFFFF. Example:
>> 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
The best way to ensure the precedence of various operators is through the use of parentheses.
'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) ...
All mathematical calculations are done in floating point format. This implies that for calculations of/with larger val­ues the results may have limited accuracy. The user should be aware of this when developing the motion con­trol application.
I52E-EN-03.book Seite 27 Freitag, 29. Juni 2007 11:55 11
Trajexia system
PROGRAMMING MANUAL 28
Revision 3.0
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.
I52E-EN-03.book Seite 28 Freitag, 29. Juni 2007 11:55 11
Trajexia system
PROGRAMMING MANUAL 29
Revision 3.0
fig. 2
2.4.2 Sequencing
On each servo cycle interrupt (see section 2.6.3), 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.
Move Loading
Sequencing
Axis
Task 1
MOVECIRC(..) AXIS(0) FORWARD AXIS(1)
MOVE(..) AXIS(0)
Task 2
Motion
Generator
Task 3
Next Move (NTYPE)
Move buffers
Task buffers
Next Move (NTYPE)
MOVE (1)
MOVECIRC (4)
FORWARD (10)
MOVECIRC (4)
IDLE (0)
IDLE (0)
012
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 Tools 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.
I52E-EN-03.book Seite 29 Freitag, 29. Juni 2007 11:55 11
Trajexia system
PROGRAMMING MANUAL 30
Revision 3.0
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 Tools when the TJ1-MC__ is connected. See section 5.5.4 for details. 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.
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 filing system on a computer. The Trajexia Tools 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. Refer to chapter 5.
2.6.1 Managing programs
Trajexia Tools automatically creates a project which contains the programs to be used for an application. The programs of the project are kept both in the controller and on the computer. Whenever a program is created or edited, Trajexia Tools edits both copies in order to always have an accurate backup outside the controller at any time. Trajexia Tools checks that the two versions of the project are identical using a cyclic redundancy check. If the two differ, Trajexia Tools allows copying the TJ1-MC__ version to disk or vice versa. Programs on the computer are stored in ASCII text files. They may therefore be printed, edited and copied using a simple text editor. The source programs are held in the TJ1-MC__ in a tokenised form and as a result, the sizes of the programs will be less on the TJ1-MC__ compared to the same programs on the computer.
Storing programs
Programs in the TJ1-MC__ are held in the battery powered RAM memory and are preserved during power off. This is similar to VR and TABLE memory. The content of the program RAM memory is preserved when the battery is in the TJ1-MC__. The programs are also preserved when changing the battery, if this is done quickly. To preserve programs without the battery for a longer period, the current programs must be copied to the Flash memory of the controller using the EPROM command, and read back during power up, which is determined by the POWER_UP system parameter.
Program commands
The TJ1-MC__ has a number of BASIC commands to allow creation, manipulation and deletion of programs. Trajexia Tools provides buttons which also perform these operations, so the use of those commands is normally not required in the programs.
/i
Command Function
SELECT Selects a program for editing, deleting etc.
NEW Deletes the current selected program, a specified program or all programs.
DIR Lists the directory of all programs.
COPY Duplicates a specified program.
RENAME Renames a specified program.
DEL Deletes the current selected program or a specified program.
LIST Lists the current selected program or a specified program.
I52E-EN-03.book Seite 30 Freitag, 29. Juni 2007 11:55 11
Trajexia system
PROGRAMMING MANUAL 31
Revision 3.0
2.6.2 Program compilation
The TJ1-MC__ system compiles programs automatically when required. It is not normally required to force the TJ1-MC__ to compile programs, but programs can be compiled under the Program menu in Trajexia Tools. The TJ1-MC__ automatically compiles programs at the following times.
The selected program is compiled before it is executed if it has been
edited.
The selected program is compiled if it has been edited before switching
the selected program to another program.
The selected program is compiled by using the COMPILE command.
The program syntax and structure are checked during compilation. If compilation is unsuccessful, a message will be provided and no program code will be generated. A red cross will appear in the Trajexia Tools directory box. Programs cannot be run when compilation errors occur. The errors should be corrected and the program recompiled. The compilation process also includes the following:
Removing comments.
Compiling numbers into the internal processor format.
Converting expressions into Reverse Polish Notation format for
execution.
Precalculating variable locations.
Calculating and embedding loop structure destinations.
2.6.3 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.
Relevant commands
Trajexia Tools 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
As the compiling process requires some free memory, un­expected compiling errors may be occurring when the amount of free memory is not sufficient.
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.
I52E-EN-03.book Seite 31 Freitag, 29. Juni 2007 11:55 11
Trajexia system
PROGRAMMING MANUAL 32
Revision 3.0
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 Tools to run automatically at start-up using the Set Power Up Mode... selection under the Program menu. This operation sets which program to run automatically and at which priority. This can also be accomplished by the RUNTYPE BASIC command. The current status 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.
I52E-EN-03.book Seite 32 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 33
Revision 3.0
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.
B_SPLINE Expands the profile stored in TABLE memory using the B-Spline
mathematical function.
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 axis specified for 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.
ENCODER_READ Reads a parameter of the EnDat absolute encoder.
ENCODER_WRITE Writes to a parameter of the EnDat absolute encoder.
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.
Name Description
I52E-EN-03.book Seite 33 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 34
Revision 3.0
3.1.2 Axis parameters
/i
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.
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.
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.
Name Description
CLOSE_WIN Defines the end of the window in which a registration mark is
expected.
CLUTCH_RATE Defines the change in connection ratio when using the
CONNECT command.
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 Driverr 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.
Name Description
I52E-EN-03.book Seite 34 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 35
Revision 3.0
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.
FAST_J OG Contains the input number to be used as the fast jog input.
FASTDE C 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.
LINKAX Contains the axis number of the link axis during any linked
move.
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.
Name Description
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.
OFFPOS Contains an offset that will be applied to the demand position
without affecting the move in any other way.
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.
REMOTE_ERROR Returns number of errors on MECHATROLINK-II connection of
the Servo Driver.
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.
Name Description
I52E-EN-03.book Seite 35 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 36
Revision 3.0
3.1.3 Communication commands and parameters
/i
3.1.4 Constants
/i
3.1.5 I/O commands, functions and parameters
/i
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.
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.
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.
Name Description
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.
Name Description
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.
PSWITCH Turns on an output when a predefined position is reached, and
turns off the output when a second position is reached.
I52E-EN-03.book Seite 36 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 37
Revision 3.0
3.1.6 Mathematical functions and operands
/i
3.1.7 Program commands
/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)
Checks two expressions to see if they are different.
> (IS GREATER THAN) Checks two expressions to see if the expression on the left is
greater than the expression on the right.
>= (IS GREATER THAN OR EQUAL TO)
Checks two expressions to see if the expression on the left is greater than or equal to the expression on the right.
< (IS LESS THAN) Checks two expressions to see if the expression on the left is
less than the expression on the right.
<= (IS LESS THAN OR EQUAL TO)
Checks two expressions to see if the expression on the left is less than or equal to the expression on the right.
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
parts of two expressions.
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
by two expressions.
COS Returns the cosine of an expression.
EXP Returns the exponential value of an expression.
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.
Name Description
' (COMMENT FIELD) Enables a line not to be executed.
: (STATEMENT SEPARATOR)
Enables more statements on one line.
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
program.
Name Description
I52E-EN-03.book Seite 37 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 38
Revision 3.0
3.1.8 Program control commands
/i
3.1.9 Slot parameters and modifiers
/i
3.1.10 System commands and functions
/i
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.
TRON Creates a breakpoint in a program.
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
execution returns to the next instruction after a “RETURN” on page 132 is given.
GOTO Jumps to the line containing the label.
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
Enables a conditional jump to one of several labels.
REPEAT..UNTIL Loop allows the program segment to be repeated until the con-
dition becomes “TRUE” on page 146.
WHILE..WEND Loop allows the program segment to be repeated until the con-
dition becomes FALS E.
Name Description
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
Name Description
$ (HEXADECIMAL INPUT)
Assigns a hexadecimal number to a variable.
AXIS Sets the axis for a command, axis parameter read, or assign-
ment to a particular axis.
BASICERROR Is used to run a specific routine when an error occurs in a
BASIC command.
CLEAR Clears all global variables and the local variables on the current
task.
CLEAR_BIT Clears the specified bit of the specified VR variable.
Name Description
I52E-EN-03.book Seite 38 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 39
Revision 3.0
3.1.11 System parameters
/i
CLEAR_PARAMS Clears all parameter sand variables stored in flash EPROM 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 frequency inverter.
INVERTER_READ Reads parameter, alarm, speed and torque reference of the fre-
quency inverter.
INVERTER_WRITE Writes to parameter, speed and torque reference of the fre-
quency 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
exchange I/O data with the master and returns the status of the TJ1-PRT.
READ_BIT Returns the value of the specified bit in the specified VR varia-
ble.
RESET Resets all local variables on a task.
Name Description
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.
TAB LE 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.
Name Description
AIN Holds the value of the analog channel.
AOUT Holds the value of the analog channel.
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.
D_ZONE_MAX Controls the DAC output in conjunction with the Following Error
value.
Name Description
I52E-EN-03.book Seite 39 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 40
Revision 3.0
3.1.12 Task commands and parameters
/i
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
EPROM on power up or reset.
POS_OFFSET Applies a positive offset to the DAC signal from the servo loop.
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.
WDOG The software switch that enables Servo Drivers.
Name Description
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.
I52E-EN-03.book Seite 40 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 41
Revision 3.0
3.2 All BASIC commands
3.2.1 + (Addition)
/i
3.2.2 - (Subtraction)
/i
3.2.3 * (Multiplication)
/i
3.2.4 / (Division)
/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
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
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
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
I52E-EN-03.book Seite 41 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 42
Revision 3.0
3.2.5 ^ (Power)
/i
3.2.6 = (Is equal to)
/i
3.2.7 = (Assignment)
/i
3.2.8 <> (Is not equal to)
/i
Type Mathematical function
Syntax expression_1 ^ expression_2
Description The power operator ^ raises expression_1 to the power of expression_2.
This operation uses floating point algorithms and may give small deviations for integer calculations.
Arguments expression_1
A BASIC expression.
expression_2 A BASIC expression.
Example result = 2^5
This assigns the value 32 to variable result.
See also N/A
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
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 variable var.
See also N/A
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
I52E-EN-03.book Seite 42 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 43
Revision 3.0
3.2.9 > (Is greater than)
/i
3.2.10 >= (Is greater than or equal to)
/i
3.2.11 < (Is less than)
/i
3.2.12 <= (Is less than or equal to)
/i
Type Mathematical function
Syntax expression1 > expression2
Description The operator > returns TRUE if expression1 is greater than expression2,
otherwise it returns FAL SE.
Arguments expression1
Any valid BASIC expression.
expression2 Any valid BASIC expression.
Example IF 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 state­ment.
See also N/A
Type Mathematical function
Syntax expression1 >= expression2
Description The 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.
Example IF 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 next statement.
See also N/A
Type Mathematical function
Syntax expression1 < expression2
Description The 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.
Example IF 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 state­ment.
See also N/A
Type Mathematical function
Syntax expression1 <= expression2
Description The operator <=
returns TRUE if expression1 is less than or equal to
expression2, otherwise it returns FAL SE.
Arguments expression1
Any valid BASIC expression.
expression2 Any valid BASIC expression.
Example IF a <= 10 THEN GOTO label1
If variable a contains a value less than or equal to 10, program execution con­tinues at label label1. Otherwise, program execution continues with the next statement.
See also N/A
I52E-EN-03.book Seite 43 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 44
Revision 3.0
3.2.13 $ (Hexadecimal input)
/i
3.2.14 ' (Comment field)
/i
3.2.15 : (Statement separator)
/i
3.2.16 #
/i
Type System command
Syntax $hex_num
Description The $ 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 also HEX (PRINT)
Type Program 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.
Arguments N/A
Example ' This line is not printed
PRINT "Start"
See also N/A
Type Program command
Syntax :
Description The statement separator : separates multiple BASIC statements on one line.
You can use it on the command line and in programs.
Arguments N/A
Example PRINT "THIS LINE": GET low : PRINT "DOES THREE THINGS"
See also N/A
Type Special character
Syntax #
Description The # 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 run­ning the Trajexia Tools software.
Arguments N/A
Example PRINT #1,"RS232"
PRINT #2,"Port 2"
Example IF KEY #1 THEN GET #1,k
Check keypad on RS232 port
See also N/A
I52E-EN-03.book Seite 44 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 45
Revision 3.0
3.2.17 ABS
/i
3.2.18 ACC
/i
3.2.19 ACCEL
/i
3.2.20 ACOS
/i
Type Mathematical function
Syntax ABS(expression)
Description The ABS function returns the absolute value of an expression.
Arguments expression
Any valid BASIC expression.
Example IF ABS(A) > 100 THEN PRINT "A is outside range -100 ... 100"
See also N/A
Type Axis command
Syntax ACC(rate)
Description Sets the acceleration and deceleration at the same time.
This command gives a quick method to set both ACCEL and DECEL. Accel­eration and deceleration rates are recommended to be set with the ACCEL and DECEL axis parameters.
Arguments rate
The acceleration rate in units/s
2
. You can define the units with the UNITS
axis parameter.
Example ACC(100)
Sets ACCEL and DECEL to 100 units/s
2
.
See also ACCEL, DECEL, UNITS
Type Axis parameter
Syntax ACCEL = expression
Description The ACCEL axis parameter contains the axis acceleration rate. The rate is
set in units/s2. The parameter can have any positive value including zero.
Arguments N/A
Example BASE(0)
ACCEL = 100 ' Set acceleration rate PRINT "Acceleration rate: ";ACCEL;" mm/s/s" ACCEL AXIS(2) = 100 ' Sets acceleration rate for axis (2)
See also ACCEL, DECEL, UNITS
Type Mathematical function
Syntax ACOS(expression)
Description The 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 also N/A
I52E-EN-03.book Seite 45 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 46
Revision 3.0
3.2.21 ADD_DAC
/i
3.2.22 ADDAX
/i
Type Axis command
Syntax ADD_DAC(axis)
Description The ADD_DAC command can provide dual feedback control by allowing a
secondary encoder to be used on the servo axis. The command allows the output of 2 servo loops to be summed to determine the speed reference to the Servo Driver. This command is typically used in applications such as a roll-feed where a secondary encoder would be required to compensate for slippage. For using ADD_DAC it is necessary for the two axes with physical feedback to link to a common axis on which the required moves are executed. Typically this would be achieved by running the moves on one of the two axes and using ADDAX or CONNECT to produce a matching demand position (DPOS) for both axes. The servo loop gains need to be set for both axes. The servo loop outputs are summed to the speed reference output of the servo axis. Use
ADD_DAC(-1) to cancel the link. 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.
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.
Example BASE(0)
OUTLIMIT AXIS(1) = 15000 ADD_DAC(1) AXIS(0) ADDAX(0) AXIS(1) WDOG = ON SERVO AXIS(0) = ON SERVO AXIS(1) = ON ' Execute moves on axis 0
This example shows controlling the Servo Driver axis 0 with dual feedback control using both axis 0 and axis 1.
Example BASE(0)
OUTLIMIT AXIS(1) = 15000 ADD_DAC(1) AXIS(0) ADDAX(0) AXIS(1) WDOG = ON SERVO = OFF S_REF = 0 BASE(1) SERVO = ON ' Execute moves on axis 1
This example shows controlling the Servo Driver axis 0 with using only encoder feedback on axis 1.
See also AXIS, ADDAX, OUTLIMIT
Type Axis command
Syntax ADDAX(axis)
Description The ADDAX command takes the demand position changes from the superim-
posed axis as specified by the axis argument and adds them to any move­ment running on the axis to which the command is issued. 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. Combina­tions of more than two axes can be made by applying ADDAX to the superim­posed axis as well. ADDAX works on the default basis axis (set with BASE) unless AXIS is used to specify a temporary base axis.
Arguments axis
The axis to be set as a superimposed axis. Set the argument to -1 to can­cel the link and return to normal operation.
I52E-EN-03.book Seite 46 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 47
Revision 3.0
3.2.23 ADDAX_AXIS
/i
3.2.24 AIN
/i
3.2.25 AND
/i
Example FORWARD ' Set continuous move
ADDAX(2) ' Add axis 2 for correction REPEAT GOSUB getoffset ' Get offset to apply MOVE(offset) AXIS(2) UNTIL IN(2) = ON ' Until correction is done
Pieces are placed onto a continuously moving belt and further along the line are picked up. A detection system gives an indication as to whether a piece is in front of or behind its nominal position, and how far. In this example, axis 0 is assumed to be the base axis and it executes a con­tinuous forward movement and a superimposed move on axis 2 is used to apply offsets according to the offset calculated in a subroutine.
See also 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 another and vice versa. This may cause instability in the system.
Type Axis parameter (read-only)
Syntax ADDAX_AXIS
Description The ADDAX_AXIS axis parameter returns the number of the axis to which
the base axis is currently linked to by ADDAX.
Arguments N/A
Example >> BASE(0)
>> ADDAX(2) >> PRINT ADDAX_AXIS
2.0000
See also ADDAX, AXIS
Type System parameter
Syntax AIN(analogue_chan)
Description +/-10V analogue input channels are provided by connecting JEPMC-AN2900
modules on the MECHATROLINK-II bus. 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.
Arguments analogue_chan.
Analogue input channel number 0.31
Example MOVE(-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.
See also N/A
Type Mathematical operation
Syntax expression1 AND expression2
I52E-EN-03.book Seite 47 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 48
Revision 3.0
3.2.26 AOUT
/i
3.2.27 ASIN
/i
3.2.28 ATAN
/i
3.2.29 ATAN2
/i
Description The 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.
Example VR(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.
Example IF MPOS AXIS(0) > 0 AND MPOS AXIS(1) > 0 THEN GOTO cycle1
See also N/A
Type System parameter
Syntax AOUT(analogue_chan)
Description This command sets the output value of the +/-10V analogue output channels
that are provided by connecting JEPMC-AN2910 modules on the MECHA­TROLINK-II bus. The range of the value set is [-32000, 32000] for voltage range [-10V, 10V].
Arguments analogue_chan.
Analogue output channel number 0.31
Example No example.
See also N/A
Type Mathematical function
Syntax ASIN(expression)
Description The 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 also N/A
Type Mathematical function
Syntax ATAN(expression)
Description The 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.
Arguments expression
Any valid BASIC expression.
Example >> PRINT ATAN(1)
0.7854
See also N/A
Type Mathematical function
Syntax ATAN2(expression1,expression2)
I52E-EN-03.book Seite 48 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 49
Revision 3.0
3.2.30 ATYPE
/i
/i
3.2.31 AUTORUN
/i
3.2.32 AXIS
/i
Description The ATAN 2 function returns the arc-tangent of the non-zero complex number
(expression2, expression1), 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 also N/A
Type Axis parameter
Syntax ATYPE = value
Description The ATYPE axis parameter sets the axis type for the axis. The valid values
depend on TJ1 module the Servo Driver controlling the axis is connected to. See the table below.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 (Mechatro Speed). For axes controlled by the Servo Drivers connected to the system via the TJ1­FL02, the default ATYPE value is 44 (Flexible axis Servo).
Arguments N/A
Example ATYPE AXIS(1) = 45
This command will set axis 1 as Flexible axis encoder output axis.
See also AXIS
AXIS type ATYPE value Applicable TJ1 unit
Virtual 0 All
Mechatro Position 40 TJ1-ML__ (MECHATRO-
LINK-II Master Unit)
Mechatro Speed 41 TJ1-ML__
Mechatro Torque 42 TJ1-ML__
Flexible axis Stepper Out 43 TJ1-FL02
Flexible axis Servo 44 TJ1-FL02
Flexible axis Encoder Out 45 TJ1-FL02
Flexible axis Absolute Tamagawa 46 TJ1-FL02
Flexible axis Absolute EnDat 47 TJ1-FL02
Flexible axis Absolute SSI 48 TJ1-FL02
Type Program command
Syntax AUTORUN
Description The AUTORUN command starts all the programs that have been set to run at
start-up.
Arguments N/A
Example No example.
See also RUNTYPE
Type System command
Syntax AXIS(axis_number)
AXIS type ATYPE value Applicable TJ1 unit
I52E-EN-03.book Seite 49 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 50
Revision 3.0
3.2.33 AXIS_DISPLAY
/i
/i
3.2.34 AXIS_ENABLE
/i
3.2.35 AXISSTATUS
/i
Description The 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 com­mand or program line in which it is programmed. Use the BASE command to change the base axis for all following command lines.
Arguments axis_number
Any valid BASIC expression specifying the axis number.
Example BASE(0)
PRINT VP_SPEED AXIS(2)
Example MOVE(300) AXIS(0)
Example REPDIST AXIS(1) = 100
See also BASE
Type Axis parameter
Syntax AXIS_DISPLAY = value
Description The AXIS_DISPLAY axis parameter enables different data to be displayed by
the LEDs on the front cover of the TJ1-FL02. 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.
Arguments N/A
Example AXIS_DISPLAY AXIS(2) = 2
This command will display status of OUT 0 and OUT 1 allocated to axis 2.
See also N/A
AXIS_DISPLAY value 0 1 2 3
A0 REG 0 AUX IN OUT 0 ENCODER A
A1 REG 1 ENCODER Z OUT 1 ENCODER B
B0 REG 0 AUX IN OUT 0 ENCODER A
B1 REG 1 ENCODER Z OUT 1 ENCODER B
Type Axis parameter
Syntax AXIS_ENABLE = ON/OFF
Description The 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.
Arguments N/A
Example AXIS_ENABLE AXIS(3) = OFF
This command will disable axis 3 independently of other axes in the system.
See also AXIS, DISABLE_GROUP
Type Axis parameter (read-only)
Syntax AXISSTATUS
Description The AXISSTATUS axis parameter contains the axis status. The
AXISSTATUS axis parameter definitions are shown in the table below. The AXISSTATUS parameter is used for the motion error handling of the unit.
Arguments N/A
Example IF (AXISSTATUS AND 16)>0 THEN PRINT "In forward limit"
See also AXIS, ERRORMASK
AXIS_DISPLAY value 0 1 2 3
I52E-EN-03.book Seite 50 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 51
Revision 3.0
/i
3.2.36 B_SPLINE
/i
3.2.37 BASE
/i
Bit number
Description Value Character (as used in
Trajexia Tools)
0- 1-
1 Following error warning 2 w
2 Servo driver communication error 4 a
3 Servo driver alarm 8 m
4 Forward limit 16 f
5Reverse limit 32r
6 Datuming 64 d
7 Feed hold input 128 h
8 Following error limit 256 e
9 Forward software limit 512 x
10 Reverse software limit 1024 y
11 Cancelling move 2048 c
12 Encoder out overspeed 4096 o
Type Axis command
Syntax B_SPLINE(type, data_in, number_in, data_out, #expand)
Description Expands an existing profile stored in the TABLE area using the B-Spline math-
ematical function by a configurable expansion factor 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.
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).
Example No example.
See also N/A
Type Axis command
Syntax BASE
BASE(axis_1 [ ,axis_2 [ , axis_3 [ , axis_4 [ , axis_...]]]]) BA BA(axis_1 [ ,axis_2 [ , axis_3 [ , axis_4 [ , axis_...]]]])
I52E-EN-03.book Seite 51 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 52
Revision 3.0
3.2.38 BASICERROR
/i
Description The 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 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 parameter 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.
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) will set the internal array of 16 axes to:
2,6,10,11,12,13,14,15,0,1,3,4,5,7,8,9.
Arguments The command can take up to 16 arguments.
axis_i The number of the axis set as the base axis and any subsequent axes in the group order for multi-axis moves.
Example BASE(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.
Example BASE(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 accelera­tion 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 also AXIS
Type System command
Syntax BASICERROR
Description The 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 exe­cuted once in the BASIC program. If several commands are used only the one executed last is effective.
Arguments N/A
I52E-EN-03.book Seite 52 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 53
Revision 3.0
3.2.39 BATTERY_LOW
/i
3.2.40 BREAK_RESET
/i
3.2.41 CAM
/i
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 command 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 also ERROR_LINE, ON, RUN_ERROR.
Type System parameter (read-only)
Syntax BATTERY_LOW
Description This 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.
Arguments N/A
Example No example.
See also N/A
Type System command
Syntax BREAK_RESET "program_name"
Description Used by Trajexia Tools to remove all break points from the specified program.
Arguments program_name
The name of the program from which you want to remove all break points.
Example BREAK_RESET "simpletest"
Will remove all break points from program simpletest.
See also N/A
Type Axis command
Syntax CAM(start_point, end_point, table_multiplier, distance)
Description The CAM command is used to generate movement of an axis following a
position profile which is stored in the TABLE variable array. The TABLE val­ues 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 2 to 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 deter­mine 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.
I52E-EN-03.book Seite 53 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 54
Revision 3.0
/i
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 pro­grammed 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.
Example Assume that a motion is required to follow the position equation t(x) = x*25 +
10000(1-cos(x)). Here, x is in degrees. This example is for a TABLE that pro­vides a simple oscillation superimposed with a constant speed. To load the TABLE and cycle it continuously the following code would be used.
GOSUB camtable loop: CAM(1,19,1,200) GOTO loop
The subroutine camtable would load the data in the table below into the TABLE array.
See also ACCEL, AXIS, CAMBOX, SPEED, TABLE.
TABLE position Degree Value
100
2 20 1103
3 40 3340
4 60 6500
5 80 10263
6 100 14236
7 120 18000
814021160
9 160 23396
10 180 24500
11 200 24396
12 220 23160
13 240 21000
14 260 18236
15 280 15263
16 300 12500
17 320 10340
18 340 9103
19 360 9000
I52E-EN-03.book Seite 54 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 55
Revision 3.0
3.2.42 CAMBOX
/i
/i
Type Axis command
Syntax CAMBOX(start_point, end_point, table_multiplier, link_distance,
link_axis [ , link_option [ , link_position ]])
Description The 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 meas­ured 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 2 to 64000. Being able to specify the start point allows the TABLE array to be used to hold more than one pro­file and/or other information. 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 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.
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 speci­fied 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.
link_position The absolute position where CAMBOX will start when link_option is set to 2.
Example No example.
See also AXIS, CAM, REP_OPTION, TABLE
link_option value Description
1 Link starts when registration event occurs on link axis.
2 Link starts at an absolute position on link axis (see link_position).
4
CAMBOX repeats automatically and bidirectionally. This option is can­celled by setting bit 1 of REP_OPTION parameter (REP_OPTION = REP_OPTION OR 2).
5 Combination of options 1 and 4.
6 Combination of options 2 and 4.
I52E-EN-03.book Seite 55 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 56
Revision 3.0
3.2.43 CANCEL
/i
3.2.44 CHECKSUM
/i
3.2.45 CHR
/i
Type Axis command
Syntax CANCEL[(1)]
CA[(1)]
Description The CANCEL command cancels the current move on an axis. 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 imme­diately stopped. The CANCEL command cancels the contents of the current move buffer (MTYPE). The command CANCEL(1) command 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 the buffer as soon as the buffered move is cancelled.
Arguments N/A
Example FORWARD
WA(10000) CANCEL
Example MOVE(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.
See also AXIS, MTYPE, NTYPE, PMOVE, RAPIDSTOP
Type System parameter (read-only)
Syntax CHECKSUM
Description The CHECKSUM parameter contains the checksum for the programs in RAM.
At start-up, the checksum is recalculated and compared with the previously held value. If the checksum is incorrect the program will not run.
Arguments N/A
Example No example.
See also N/A
Type I/O command
Syntax CHR(x)
Description The CHR command is used to send individual ASCII characters
which are referred to by number. PRINT CHR(x); is equivalent to PUT(x) in some other versions of BASIC.
Arguments x
A BASIC expression.
Example >>PRINT CHR(65);
A
See also N/A
I52E-EN-03.book Seite 56 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 57
Revision 3.0
3.2.46 CLEAR
/i
3.2.47 CLEAR_BIT
/i
3.2.48 CLEAR_PARAMS
/i
3.2.49 CLOSE_WIN
/i
3.2.50 CLUTCH_RATE
/i
Type System command
Syntax CLEAR
Description The CLEAR command resets all global VR variables to 0. When you use it in
a program it also resets the local variables on the current task to 0.
Arguments N/A
Example No example.
See also RESET, VR
Type System command
Syntax CLEAR_BIT(bit_number, vr_number)
Description The CLEAR_BIT command resets the specified bit in the specified VR varia-
ble to 0. 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 No example.
See also READ_BIT, SET_BIT, VR.
Type System command
Syntax CLEAR_PARAMS
Description Clears all variables and parameters stored in flash EPROM to their default
values. CLEAR_PARAM cannot be performed if the controller is locked.
Arguments N/A
Example No example.
See also N/A
Type Axis parameter
Syntax CLOSE_WIN
CW
Description The 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.
Arguments N/A
Example No example.
See also AXIS, OPEN_WIN, REGIST, UNITS.
Type Axis parameter
Syntax CLUTCH_RATE
Description The 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 compati­bility 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.
Arguments N/A
Example CLUTCH_RATE = 4
This setting will imply that when giving CONNECT(4,1), it will take one sec­ond to reach the full connection.
I52E-EN-03.book Seite 57 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 58
Revision 3.0
3.2.51 COMMSERROR
/i
/i
3.2.52 COMMSTYPE
/i
/i
3.2.53 COMPILE
/i
See also AXIS, CONNECT, MOVELINK.
Type System parameter (read-only)
Syntax COMMSERROR
Description The 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.
Arguments N/A
Example No example.
See also N/A
Bit Description Error location
8 Port 1 Rx data ready Serial port 1
9 Port 1 Rx Overrun Serial port 1
10 Port 1 Parity Error Serial port 1
11 Port 1 Rx Frame Error Serial port 1
12 Port 2 Rx data ready Serial port 2
13 Port 2 Rx Overrun Serial port 2
14 Port 2 Parity Error Serial port 2
15 Port 2 Rx Frame Error Serial port 2
Type Slot parameter
Syntax COMMSTYPE SLOT(unit_number)
Description This parameter returns the type of unit in a controller unit. The table below
lists the return values.
Arguments unit_number
Unit numbers are 0 to 6, with 0 being the unit immediately to the right of the TJ1-MC__.
Example No example.
See also N/A
Return value Description
0 Unused unit
31 TJ1-ML__
33 TJ1-FL02
34 TJ1-PRT
35 TJ1-DRT
Type Program command
Syntax COMPILE
Description The COMPILE command forces the compilation the current program to inter-
mediate code. Program are compiled automatically by the system software prior to program execution or when another program is selected.
Arguments N/A
Example No example.
See also N/A
I52E-EN-03.book Seite 58 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 59
Revision 3.0
3.2.54 CONNECT
/i
3.2.55 CONSTANT
/i
3.2.56 CONTROL
/i
Type Axis command
Syntax CONNECT(ratio, driving_axis)
CO(ratio, driving_axis)
Description The 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 com­mand 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.
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 resolu­tion.
driving_axis The Master axis which will drive the base axis.
Example In a press feed, a roller is required to rotate at a speed one quarter of the
measured rate from an encoder mounted on the incoming conveyor. The roller is wired to axis 0. An input channel monitors the encoder pulses from the conveyor and forms axis 1. This code can be used:
BASE(1) SERVO = OFF ' This axis is used to monitor the conveyor BASE(0) SERVO = ON CONNECT(0.25,1)
See also AXIS, CANCEL, CLUTCH_RATE, CONNECT, RAPIDSTOP.
Type System command
Syntax CONSTANT "name", value
Description Declares the name as a constant for use both within the program containing
the CONSTANT definition and all other programs in the Trajexia Tools 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. When the CONSTANT is declared, the declaration remains active until the next TJ1-MC__ 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 under­score characters.
value The value assigned to name.
Example CONSTANT "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 also N/A
Type System parameter (read-only)
Syntax CONTROL
Description The CONTROL parameter contains the type of TJ1-MC__ in the system. The
value of this system parameter for the TJ1-MC__ is 262.
I52E-EN-03.book Seite 59 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 60
Revision 3.0
3.2.57 COPY
/i
3.2.58 COS
/i
3.2.59 CREEP
/i
3.2.60 D_GAIN
/i
Arguments N/A
Example No example.
See also N/A
Type Program command
Syntax COPY program_name new_program_name
Description The 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 an offline (VT100) terminal. Within Trajexia Tools users can select the command from the Program menu.
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 also DEL, NEW, RENAME.
Type Mathematical function
Syntax COS(expression)
Description The 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.
Arguments expression
Any valid BASIC expression.
Example >> PRINT COS(0)
1.0000
See also N/A
Type Axis parameter
Syntax CREEP
Description The 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 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.
Arguments N/A
Example BASE(2)
CREEP = 10 SPEED = 500 DATUM(4) CREEP AXIS(1) = 10 SPEED AXIS(1) = 500 DATUM(4) AXIS(1)
See also AXIS, DATUM, UNITS.
Type Axis parameter
Syntax D_GAIN
Description The D_GAIN axis parameter contains the derivative gain for the axis. The
derivative output contribution is calculated by multiplying the change in Fol­lowing Error with D_GAIN. The default value is 0. Add the derivative gain to a system to produce a smoother response and the use of a higher proportional gain. High values can cause oscillation. Note: The servo gain must only be changed when the SERVO is off.
Arguments N/A
I52E-EN-03.book Seite 60 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 61
Revision 3.0
3.2.61 D_ZONE_MAX
/i
3.2.62 D_ZONE_MIN
/i
3.2.63 DAC
See S_REF.
3.2.64 DAC_OUT
See S_REF_OUT.
3.2.65 DAC_SCALE
/i
Example No example.
See also AXIS, I_GAIN, OV_GAIN, P_GAIN, VFF_GAIN.
Type System parameter
Syntax D_ZONE_MAX=value
Description This sets 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 Fol­lowing Error is less than the D_ZONE_MIN value. The servo loop will be reac­tivated when either the Following Error rises above the D_ZONE_MAX value, or a fresh movement is started.
Arguments N/A
Example D_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 also D_ZONE_MIN.
Type System parameter
Syntax D_ZONE_MIN=value
Description This sets 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.
Arguments N/A
Example D_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 also D_ZONE_MAX.
Type Axis parameter
Syntax DAC_SCALE
Description The parameter has 2 purposes:
1. It is set to value 16 on power up on the built-in axes of the system. 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.
2. DAC_SCALE may be set negative (-16) to reverse the polarity of the DAC output signal. When the servo is off the magnitude of DAC_SCALE is not important as the voltage applied is controlled by the DAC parame­ter. The polarity is still reversed however by DAC_SCALE.
Arguments N/A
Example DAC_SCALE AXIS(3)=-16
See also DAC, S_REF.
I52E-EN-03.book Seite 61 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 62
Revision 3.0
3.2.66 DATE
/i
3.2.67 DATE$
/i
3.2.68 DATUM
/i
Type System parameter
Syntax DATE
Description Returns 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.
Arguments N/A
Example DATE=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 as 1.
See also N/A
Type System command
Syntax DATE$
Description Prints the current date DD/MM/YY as a string to the port. A 2-digit year
description is given.
Arguments N/A
Example PRINT #1,DATE$
This will print the date in format for example: 20/10/05
See also N/A
Type Axis command
Syntax DATUM(sequence)
Description The DATUM command makes one of 6 origin searches to position an axis to
an absolute position and also reset the Following Errors: 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 used to enable fail-safe wiring.
Arguments sequence
See the table below.
Example No example.
See also ACCEL, AXIS, AXISSTATUS, CREEP, DATUM_IN, DECEL,
MOTION_ERROR, SPEED.
I52E-EN-03.book Seite 62 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 63
Revision 3.0
/i
3.2.69 DATUM_IN
/i
sequence value
Description
0The DATUM(0) command will clear the motion error. The currently measured
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.
1 The axis moves at creep speed forward until the Z marker is encountered.
The demand position is then reset to 0 and the measured position is corrected to maintain the Following Error.
2 The axis moves at creep speed reverse until the Z marker is encountered.
The demand position is then reset to 0 and the measured position is corrected to maintain the Following Error.
3 The axis moves at the demand speed forward until the datum switch is
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.
4 The axis moves at the demand speed reverse until the datum switch is
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.
5 The axis moves at demand speed forward until the datum switch is reached.
The axis then reverses at creep speed until the datum switch is reset. The axis continues at creep speed until the Z marker of the encoder is encoun­tered. The demand position is then reset to 0 and the measured position cor­rected so as to maintain the Following Error.
6 The axis moves at demand speed reverse until the datum switch is reached.
The axis then moves forward at creep speed until the datum switch is reset. The axis continues at creep speed until the Z marker of the encoder is encountered. The demand position is then reset to 0 and the measured posi­tion corrected so as to maintain the Following Error.
Type Axis parameter
Syntax DATUM_IN
DAT_IN
Description The 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 27 represent software inputs which can be freely used in programs and commands such as IN and OP. These are also common for all axes. Values 28 to 31 are directly mapped to driver inputs present on CN1 connector, and they are unique for each axis. Which driver inputs are mapped to inputs 28 to 31 depends on Servo Driver parameter Pn81E setting. Recommended setting is Pn81E = 0x4321, with the following mapping: Note: The origin input 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 used to enable fail-safe wiring.
Sigma II input 28: CN1-40
input 29: CN1-41
input 30: CN1-42
input 31: CN1-43
Sigma III input 28: CN1-13
input 29: CN1-7
input 30: CN1-8
input 31: CN1-9
sequence value
Description
I52E-EN-03.book Seite 63 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 64
Revision 3.0
3.2.70 DAY
/i
3.2.71 DAY$
/i
3.2.72 DECEL
/i
3.2.73 DEFPOS
/i
Junma input 26: CN1-2
input 27: CN1-1
For more information on setting driver parameter Pn81E, refer to the Servo Driver manual. As default the parameter is set to -1, no inputs selected.
Arguments N/A
Example DATUM_IN AXIS(0) = 5
See also AXIS, DATUM.
Type System parameter
Syntax DAY
Description Returns the current day as a number 0..6, Sunday is 0. DAY can be set by
assignment.
Arguments N/A
Example >>DAY=3
>>? DAY
3.0000
See also N/A
Type System command
Syntax DAY$
Description Prints the current day as a string.
Arguments N/A
Example >>DAY=3
>>? DAY$ Wednesday
See also N/A
Type Axis parameter
Syntax DECEL
Description The DECEL axis parameter contains the axis deceleration rate. The rate is
set in units/s
2
. The parameter can have any positive value including 0.
Arguments N/A
Example DECEL = 100 ' Set deceleration rate
PRINT " Deceleration rate is ";DECEL;" mm/s/s"
See also ACCEL, AXIS, UNITS.
Type Axis command
Syntax DEFPOS(pos_1 [ , pos_2 [ , pos_3 [ , pos_4 [, ...]]]])
DP(pos_1 [ , pos_2 [ , pos_3 [ , pos_4 [, ...]]]])
Description The 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 cur­rent position to 0. DEFPOS can be used at any time. As an alternative also the OFFPOS axis parameter can be used. This param­eter can be used to perform a relative adjustment of the current position. DEFPOS works on the default basis axis (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)
I52E-EN-03.book Seite 64 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 65
Revision 3.0
3.2.74 DEL
/i
3.2.75 DEMAND_EDGES
/i
3.2.76 DEVICENET
/i
Arguments The 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.
Example BASE(2)
DATUM(5) BASE(1) DATUM(4) WAIT IDLE DEFPOS(-1000,-3500)
The last line defines the current position to (-1000,-3500) in user units. The current position would have been reset to (0,0) by the two DATUM com­mands.
See also AXIS, DATUM, DPOS, OFFPOS, MPOS, UNITS.
Type Program command
Syntax DEL [program_name]
RM [program_name]
Description The 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 an offline (VT100) terminal. Within Trajexia Tools users can select the command from the Program menu.
Arguments program_name
Name of the program to be deleted.
Example >> DEL oldprog
See also COPY, NEW, RENAME, SELECT, TA BL E.
Type Axis parameter (read-only)
Syntax DEMAND_EDGES
Description The DEMAND_EDGES axis parameter contains the current value of the
DPOS axis parameter in encoder edge units.
Arguments N/A
Example No example.
See also AXIS, DPOS.
Type System command
Syntax DEVICENET(unit_number, 2, 1, VR_start_outputs, no_outputs,
VR_start_inputs, no_inputs) DEVICENET(unit_number, 4, 0)
Description DEVICENET 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 sta­tus of the TJ1-DRT. Refer to the table for the description of the bits in the data exchange status word.
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.
I52E-EN-03.book Seite 65 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 66
Revision 3.0
/i
Example DEVICENET (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 also N/A
Bit Value Description
00 DEVICENET (unit_number, 2, ...) not executed yet
1 DEVICENET (unit_number, 2, ...) executed without error
1 0 No DeviceNet I/O connection
1 DeviceNet I/O connection running
2 0 VR variables in the output data range have been updated
1 VR variables in the output data range have not been updated yet
3 0 DeviceNet I/O connection size matches the DEVICENET
(unit_number, 2,…) command
1 DeviceNet I/O connection size does not match the
DEVICENET(unit_number, 2,…) command
4-7 0 Always zero
8 0 Network power OK
1 Network power failure
9 0 No BUSOFF occurred
1 BUSOFF occurred
10 0 No node address duplication error
1 Node address duplication error
I52E-EN-03.book Seite 66 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 67
Revision 3.0
3.2.77 DIR
/i
3.2.78 DISABLE_GROUP
/i
3.2.79 DISPLAY
/i
/i
Type Program command
Syntax DIR
LS
Description The 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, power up mode and current selected program of the controller.
Arguments N/A
Example No example.
See also FREE, POWER_UP, PROCESS, RUNTYPE, SELECT.
Type Axis command
Syntax DISABLE_GROUP(-1)
DISABLE_GROUP(axis_1 [, axis_2 [, ...]] )
Description This is used to group any list of axes together for error disabling. If a group of
axes 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).
Arguments axis_i
A BASIC expression that evaluates to an axis number.
Example DISABLE_GROUP(-1)
DISABLE_GROUP(0,1,2,3) DISABLE_GROUP(4,5,6,7) WDOG=ON STOP enable_b: FOR ax=4 TO 7 AXIS_ENABLE AXIS(ax)=ON NEXT ax
A system of 8 axes requires that axes 4..7 keep running if axes 0..3 have an error and vice-versa. The axes would be grouped using DISABLE_GROUP. Note: For use with MECHATROLINK-II only.
See also N/A
Type System parameter
Syntax DISPLAY=value
Description Determines 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 dis­played. The values are in the table below.
Arguments N/A
Example DISPLAY=5
Shows outputs 8-15.
See also N/A
value Description
0 Inputs 0 to 7 (default)
1 Inputs 8 to 15
2 Inputs 16 to 23
3 Inputs 24 to 31
I52E-EN-03.book Seite 67 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 68
Revision 3.0
3.2.80 DPOS
/i
3.2.81 DRIVE_ALARM
/i
4 Outputs 0 to 7 (not used on Trajexia)
5 Outputs 8 to 15
6 Outputs 16 to 23
7 Outputs 24 to 31
Type Axis parameter (read-only)
Syntax DPOS
Description The 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.
Arguments N/A
Example >> PRINT DPOS AXIS(0)
34.0000
The above line will return the demand position in user units.
See also AXIS, DPOS, DEFPOS, DEMAND_EDGES, FE, MPOS, REP_DIST,
REP_OPTION, OFFPOS, UNITS.
value Description
Type Axis command
Syntax DRIVE_ALARM(VR)
Description The 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.
Example IF NOT DRIVE_ALARM(10) AXIS(2) THEN
PRINT "Failed to read alarm for Servo Driver" ELSE IF VR(10) = 0 THEN PRINT "Servo driver healthy" ELSE PRINT "Servo alarm 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 also N/A
I52E-EN-03.book Seite 68 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 69
Revision 3.0
3.2.82 DRIVE_CLEAR
/i
3.2.83 DRIVE_CONTROL
/i
/i
Type Axis command
Syntax DRIVE_CLEAR
Description The 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.
Arguments N/A
Example No example.
See also DRIVE_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.
Type Axis parameter
Syntax DRIVE_CONTROL
Description When applied to axis controlled by the Servo Driver connected to the system
via the MECHATROLINK-II bus, this parameter selects the data to be moni­tored by DRIVE_MONITOR according to the table below. If a Servo Driver for the axis is connected using 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.
Arguments N/A
Example DRIVE_CONTROL AXIS(2) = 256
In this example, OUT 0 is switched on for axis 2, connected using the TJ1­FL02.
See also N/A
Code Description
2 Following error (this is the real FE when ATYPE=40 is used)
8 Feedback speed (With Atype=41 Units=Max Speed/40000000H, with other Atype
Units= reference units/s)
9 Command speed (units same as in Feedback Speed)
10 Target speed (units same as in Feedback Speed)
11 Torque (Force) reference (With Atype=42 Units=Max Torque/40000000H, with
other Atype Units= % over nominal Torque
14 Monitor selected with Pn813.0 Useful to monitor servo monitors (Unxxx)
15 Monitor selected with Pn813.1 Useful to monitor servo monitors (Unxxx)
I52E-EN-03.book Seite 69 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 70
Revision 3.0
3.2.84 DRIVE_INPUTS
/i
/i
3.2.85 DRIVE_MONITOR
/i
Type Axis parameter
Syntax DRIVE_INPUTS
Description This 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. The recommended setting is: Pn81E=4321 & Pn511=654x.
Arguments N/A
Example All inputs can be monitored in this word as follows (Sigma-II Servo Driver):
CN1-40 DRIVE_INPUTS bit 12 CN1-41 DRIVE_INPUTS bit 13 CN1-42 DRIVE_INPUTS bit 14 CN1-43 DRIVE_INPUTS bit 15 CN1-44 DRIVE_INPUTS bit 06 CN1-45 DRIVE_INPUTS bit 07 CN1-46 DRIVE_INPUTS bit 08
Example All inputs can be monitored in this word as follows (Junma Servo Driver):
CN1-1 DRIVE_INPUTS bit 6 CN1-2 DRIVE_INPUTS bit 2 CN1-3 DRIVE_INPUTS bit 1 CN1-4 DRIVE_INPUTS bit 0
See also N/A
Bit number
Description Sigma-II Description Junma
0P_OT P_OT
1N_OT N_OT
2 DEC Signal (selected with Pn511.0) /DEC
3 Encoder Phase A N/C
4 Encoder Phase B N/C
5 Encoder Phase C N/C
6 EXT1 Signal (selected with Pn511.1) /EXT1
7 EXT2 Signal (selected with Pn511.2) N/C
8 EXT3 Signal (selected with Pn511.3) N/C
9 BRK Brake output /BK
10 Reserved E_STP
11 Reserved N/C
12 IO12 (CN1 input signal selected in Pn81E.0) N/C
13 IO13 (CN1 input signal selected in Pn81E.1) N/C
14 IO14 (CN1 input signal selected in Pn81E.2) N/C
15 IO15 (CN1 input signal selected in Pn81E.3) N/C
Type Axis parameter
Syntax DRIVE_MONITOR
Description This 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 Tools scope or used inside a program. The monitored data is updated each SERVO_PERIOD.
Arguments N/A
Example No example.
See also N/A
Bit number
Description Sigma-II Description Junma
I52E-EN-03.book Seite 70 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 71
Revision 3.0
3.2.86 DRIVE_READ
/i
3.2.87 DRIVE_RESET
/i
Type Axis command
Syntax DRIVE_READ(parameter,size,VR)
Description The DRIVE_READ function reads the specified parameter of the Servo Driver
connected to the Trajexia system via the MECHATROLINK-II bus. Upon suc­cessful 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 parame­ter read if the parameter number does not exist or has the wrong size.
Arguments paramet er
The number of the parameter to be read. Note that the parameter num­bers are hexadecimal. The format of the data can be found in the Servo Driver manual.
size For most parameters the size is normally 2 bytes. Some special parame­ters 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.
Example IF 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 also DRIVE_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. Oth­erwise the program task will be paused until the connection of the other device to the Servo Driver is removed.
Type Axis command
Syntax DRIVE_RESET
Description The DRIVE_RESET command resets the Servo Driver connected via the
MECHATROLINK-II bus.
Arguments N/A
Example No example.
See also N/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.
I52E-EN-03.book Seite 71 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 72
Revision 3.0
3.2.88 DRIVE_STATUS
/i
/i
/i
Type Axis parameter (read-only)
Syntax DRIVE_STATUS
Description For 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 Tools, 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 detailed explanation for these status bits see the MECHATROLINK-II manual. 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.)
Arguments N/A
Example PRINT DRIVE_STATUS AXIS(4)
This command will print the current value of DRIVE_STATUS for axis(4).
Example BASE(3)
ATYPE = 44 IF (DRIVE_STATUS AND 32)= 32 THEN PRINT "REG 0 input is ON for axis(3)"
ENDIF
See also AXIS, MARK, MARKB, REGIST.
Bit Description (MECHATROLINK-II)
0Alarm
1 Warning
2 Ready
3 Servo on
4 Power on
5 Machine Lock
6 Home Position
7 At Position/Speed
8 Output Completed
9 Torque Limit
10 Latch Completed
11 In Range/Speed Limit
Bit Description (Flexible axis)
0MARK
1 MARKB
2 REG 0 selected current value
3 REG 1 selected current value
4 AUX IN current value
5 REG 0 current value
6 REG 1 current value
Bit Description (MECHATROLINK-II)
I52E-EN-03.book Seite 72 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 73
Revision 3.0
3.2.89 DRIVE_WRITE
/i
3.2.90 EDIT
/i
3.2.91 ELSE
See IF..THEN..ELSE..ENDIF.
3.2.92 ELSEIF
See IF..THEN..ELSE..ENDIF.
Type Axis command
Syntax DRIVE_WRITE(parameter, size, value [,mode])
Description The DRIVE_WRITE function writes to the specified parameter of the Servo
Driver via the MECHATROLINK-II bus. Upon successful execution, this com­mand 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 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 com­mands 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 parame­ter read if the parameter number does not exist or has the wrong size.
Arguments paramet er
The number of the parameter to write to. Note that the parameter num­bers 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 For most parameters the size is normally 2 bytes. Some special parame­ters 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.
Example IF 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
See also DRIVE_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. Oth­erwise the program task will be paused until the connection of the other device to the Servo Driver is removed.
Type Program command
Syntax EDIT [ line_number ]
ED [ line_number ]
Description The EDIT command starts the built in screen editor allowing a program in the
controller to be modified using a VT100 Terminal. The currently selected pro­gram will be edited. The editor commands are as follows: This command is implemented for an offline (VT100) terminal. Within Trajexia Tools, users can select the command from the Program menu.
Quit Editor: [CTRL] K and D
Delete Line: [CTRL] Y
Arguments line_number
The number of the line at which to start editing.
Example No example.
See also SELECT.
I52E-EN-03.book Seite 73 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 74
Revision 3.0
3.2.93 ENCODER
/i
3.2.94 ENCODER_BITS
/i
3.2.95 ENCODER_CONTROL
/i
Type Axis parameter (read-only)
Syntax ENCODER
Description The ENCODER axis parameter contains a raw copy of the encoder.
The MPOS axis parameter contains the measured position calculated from the ENCODER value automatically, allowing for overflows and offsets.
Arguments N/A
Example No example.
See also AXIS, MPOS.
Type Axis parameter
Syntax ENCODER_BITS = value
Description This axis parameter configures the interface for the number of encoder bits for
Flexible axis SSI and EnDat absolute encoder axes. The parameter is appli­cable 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. Note: If using Flexible axis absolute encoder axis, it is essential to set this parameter for the axis before setting the ATYPE.
Arguments N/A
Example ENCODER_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.
Example ENCODER_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 also AXIS.
Type Axis parameter
Syntax ENCODER_CONTROL = value
Description The ENCODER_CONTROL parameter is applicable only applicable only to
Flexible axis absolute EnDat axis with ATYPE value 47. The parameter con­trols the mode in which EnDat encoder return their position. The encoder can be set to either cyclically return its position, of 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.
Arguments N/A
Example ENCODER_CONTROL AXIS(1) = 0
This command sets cyclic position return mode.
Example ENCODER_CONTROL AXIS(1) = 1
This command sets parameter read/write mode.
See also AXIS, ENCODER, ENCODER_BITS.
I52E-EN-03.book Seite 74 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 75
Revision 3.0
3.2.96 ENCODER_ID
/i
3.2.97 ENCODER_RATIO
/i
3.2.98 ENCODER_READ
/i
Type Axis parameter (read-only)
Syntax ENCODER_ID
Description This 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.
Arguments N/A
Example >>PRINT ENCODER_ID AXIS (1)
17.0000
This command will print absolute encoder ID value for axis 1.
See also AXIS, ENCODER, ENCODER_BITS.
Type Axis parameter
Syntax ENCODER_RATIO(denominator,numerator)
Description Allows the incoming encoder count to be scaled by a non integer number,
using the equation:
MPOS = (numerator)/(demoninator) x encoder edges input
Unlike the UNITS parameters, ENCODER_RATIO affects both MOVECIRC and CAMBOX.
Note: Large ratios should be avoided as they will lead to either loss of resolu­tion 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 t 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.
Arguments denominator
A number between 0 and 16777215 that is used to define the denomina­tor in the above equation.
numerator A number between 0 and 16777215 that is used to define the numerator in the above equation.
Example ENCODER_RATIO(8192,7200)
UNITS=20
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 rev. The application requires the table to be calibrated in degrees, but so that one degree is an integer number of counts.
See also N/A
Type Axis command
Syntax ENCODER_READ(address)
Description The ENCODER_READ command is applicable only to Flexible axis absolute
EnDat axis with ATYPE value 47. The parameter returns a 16-bit encoder parameter stored at specified address. Bits 8 -15 of the address are the EnDat MRS field settings and bits 0 - 7 are the offset within the EnDat MRS block. If a CRC error occurs, this command will return -1. For more information see EnDat absolute encoder interface specification.
Arguments address
Specifies the EnDat MRS field to read.
Example VR(100) = ENCODER_READ($A10D) AXIS(7)
This command will read the number of encoder bits and put that value in VR(10) memory location.
See also AXIS, ENCODER, ENCODER_BITS.
I52E-EN-03.book Seite 75 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 76
Revision 3.0
3.2.99 ENCODER_STATUS
/i
3.2.100 ENCODER_TURNS
/i
3.2.101 ENCODER_WRITE
/i
3.2.102 ENDIF
See IF..THEN..ELSE..ENDIF.
Type Axis parameter (read-only).
Syntax ENCODER_STATUS
Description This parameter returns the status of the absolute encoder.
This parameter is applicable only to Flexible axis absolute Tamagawa axis with ATYPE 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.
Arguments N/A
Example PRINT (ENCODER_STATUS AXIS (1) AND 255)
This command will print SF field of the Tamagawa absolute encoder for axis 1.
See also AXIS, ENCODER, ENCODER_BITS.
Type Axis parameter (read-only)
Syntax ENCODER_TURNS
Description The 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 pro­gram using OFFPOS or DEFPOS commands as required. If applied to axis of ATYPE value other than 46 or 47, the parameter returns 0.
Arguments N/A
Example PRINT ENCODER_TURNS AXIS (1)
This command will print absolute encoder multi-turn counts for axis 1.
See also AXIS, ENCODER, ENCODER_BITS.
Type Axis command
Syntax ENCODER_WRITE(address, value)
Description The ENCODER_WRITE command is applicable only to Flexible axis absolute
EnDat axis with ATYPE value 47. The command writes to an encoder param­eter specified by the address. Bits 8 -15 of the address are the EnDat MRS field settings and bits 0 - 7 are the offset within the EnDat MRS block. If a CRC error occurs, this command will return 0. Writing to address 0 performs an encoder reset function.For more information see EnDat absolute encoder interface specification.In order to successfully write an encoder parameter with this command, the ENCODER_WRITE parameter should b set to 1, encoder parameter read/write mode.
Arguments address
Specifies the EnDat MRS field to write to.
value A BASIC expression.
Example No example.
See also AXIS, ENCODER, ENCODER_BITS, ENCODER_CONTROL.
I52E-EN-03.book Seite 76 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 77
Revision 3.0
3.2.103 ENDMOVE
/i
3.2.104 EPROM
/i
3.2.105 ERROR_AXIS
/i
3.2.106 ERROR_LINE
/i
Type Axis parameter
Syntax ENDMOVE
Description The 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. If the change of demanded position is too big, the limit will be exceeded.
Arguments N/A
Example No example.
See also AXIS, DPOS, FE_LIMIT, UNITS.
Type Program command
Syntax EPROM
Description The EPROM command stores the BASIC programs in the TJ1-MC__ battery
backed up RAM memory in the flash EPROM memory. Whether the programs stored in the flash EPROM memory are copied to RAM at start-up is control­led by the POWER_UP system parameter. Note: Trajexia Tools offers this command as a button on the control panel. Also pop-up screens will prompt to write the program data into flash memory.
Arguments N/A
Example No example.
See also POWER_UP, RUNTYPE.
Type System parameter (read-only)
Syntax ERROR_AXIS
Description The 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 1 and the ERROR_AXIS parameter will contain the number of the first axis to have the error.
Arguments N/A
Example No example.
See also AXISSTATUS, ERRORMASK, MOTION_ERROR, WDOG.
Type Task parameter (read-only)
Syntax ERROR_LINE
Description The 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.
Arguments N/A
Example >> PRINT ERROR_LINE PROC(4)
23.0000
See also BASICERROR, PROC, RUN_ERROR.
I52E-EN-03.book Seite 77 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 78
Revision 3.0
3.2.107 ERRORMASK
/i
3.2.108 ETHERNET
/i
Type Axis parameter
Syntax ERRORMASK
Description The 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. When a motion error occurs the enable switch (WDOG) will be turned off, the MOTION_ERROR parameter will have value 1 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.
Arguments N/A
Example No example.
See also AXIS, AXISSTATUS, MOTION_ERROR, WDOG.
Caution
It is up to the user to define in which cases a motion error is gener­ated. 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
Type System command
Syntax ETHERNET(function, unit_number, parameter [,values])
Description The command ETHERNET is used to read and set certain functions of Ether-
net communications. The ETHERNET command should be entered on the command line with Trajexia Tools in disconnected mode via the serial port 0. Note: You will have to cycle power to Trajexia to enable the new parameters.
Arguments function
0 = Read, 1 = Write.
unit_number
-1.
parameter 0 = IP Address; 2 = Subnet Mask; 3 = MAC address; 8 = Gateway; 11 = ARP cache (read-only).
values The required parameter for a write.
Example ETHERNET(1,-1,0,192,200,185,2)
Set the Trajexia IP address to 192.200.185.002.
See also N/A
I52E-EN-03.book Seite 78 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 79
Revision 3.0
3.2.109 EX
/i
3.2.110 EXP
/i
3.2.111 FALSE
/i
3.2.112 FAST_JOG
/i
Type System command
Syntax EX[(option)]
Description Resets 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
Arguments N/A
Example No example.
See also N/A
Type Mathematical function
Syntax EXP(expression)
Description The EXP function returns the exponential value of the expression.
Arguments expression
Any valid BASIC expression.
Example >> print exp(1.0)
2.7183
See also N/A
Type Constant (read-only)
Syntax FAL SE
Description The FALS E constant returns the numerical value 0.
Arguments N/A
Example test:
res = IN(0) OR IN(2) IF res = FALSE THEN PRINT "Inputs are off" ENDIF
See also N/A
Type Axis parameter
Syntax FAS T_JOG
Description The FAST _JOG axis parameter contains the input number to be used as the
fast jog input. The number can be from 0 to 7. As default the parameter is set to -1, no input is selected. 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.
Arguments N/A
Example No example.
See also AXIS, FWD_JOG, JOGSPEED, REV_JOG, SPEED.
I52E-EN-03.book Seite 79 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 80
Revision 3.0
3.2.113 FASTDEC
/i
3.2.114 FE
/i
3.2.115 FE_LATCH
/i
3.2.116 FE_LIMIT
/i
Type Axis parameter
Syntax FAS TDEC
Description Defaults to zero. If a non-zero FAST DEC is specified the axis will ramp to
zero at this deceleration rate when an axis limit switch or position is reached.
Arguments N/A
Example No example.
See also N/A
Type Axis parameter (read-only)
Syntax FE
Description The 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.
Arguments N/A
Example No example.
See also AXIS, DPOS, FE_LIMIT, FE_RANGE, MPOS, UNITS.
Type Axis parameter (read-only)
Syntax FE_LATCH
Description Contains 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 0. FE_LATCH is reset to 0 when the SERVO parameter of the axis is set back to 1.
Arguments N/A
Example No example.
See also N/A
Type Axis parameter
Syntax FE_LIMIT
Description The FE_LIMIT axis parameter contains the limit for the maximum allowed Fol-
lowing Error in user units. When exceeded, bit 8 of the AXISSTATUS parame- ter of the axis will be set. If the ERRORMASK parameter has been properly set, a motion error will be generated. This limit is used to guard against fault conditions, such as mechanical lock­up, loss of encoder feedback, etc.
Arguments N/A
Example No example.
See also AXIS, AXISSTATUS, ERRORMASK, FE, FE_RANGE, UNITS.
I52E-EN-03.book Seite 80 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 81
Revision 3.0
3.2.117 FE_LIMIT_MODE
/i
3.2.118 FE_RANGE
/i
3.2.119 FHOLD_IN
/i
Type Axis parameter
Syntax FE_LIMIT_MODE=value
Description When 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.
Arguments N/A
Example No example.
See also N/A
Type Axis parameter
Syntax FE_RANGE
Description The 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).
Arguments N/A
Example No example.
See also AXIS, AXISSTATUS, ERRORMASK, FE, UNITS.
Type Axis parameter
Syntax FHOLD_IN
FH_IN
Description The 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 phys­ically present inputs of TJ1-MC__ I/O connector and are common for all axes. Values 16 to 27 represent software inputs which can be freely used in pro­grams and commands such as IN and OP. These are also common for all axes. Values 28 to 31 are directly mapped to driver inputs present on CN1 connector, and they are unique for each axis. Which driver inputs are mapped to inputs 28 to 31 depends on Servo Driver parameter Pn81E setting. Recom­mended setting is Pn81E = 0x4321, with the following mapping: As default the parameter is set to -1, no input is selected. Note: This input is active low.
Sigma II input 28: CN1-40
input 29: CN1-41
input 30: CN1-42
input 31: CN1-43
Sigma III input 28: CN1-13
input 29: CN1-7
input 30: CN1-8
input 31: CN1-9
Junma input 26: CN1-2
input 27: CN1-1
For more information on setting driver parameter Pn81E, see Servo Driver manual. As default the parameter is set to -1, no inputs selected.
I52E-EN-03.book Seite 81 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 82
Revision 3.0
3.2.120 FHSPEED
/i
3.2.121 FINS_COMMS
/i
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.
Arguments N/A
Example No example.
See also AXIS, AXISSTATUS, UNITS.
Type Axis parameter
Syntax FHSPEED
Description The FHSPEED axis parameter contains the feedhold speed. This parameter
can be set to a value in user units/s at which speed the axis will move when the feed-hold input turns on. The current move is not cancelled. FHSPEED can have any positive value including 0. The default value is 0. Note: This feature only works on speed controlled moves. Moves which are not speed controlled (CAMBOX, CONNECT and MOVELINK) are not affected.
Arguments N/A
Example No example.
See also AXIS, AXISSTATUS, FHOLD_IN, UNITS.
Type Communication command
Syntax FINS_COMMS(type, network, node, unit, remote_area, remote_offset,
length, local_area, local_offset, timeout [, ip1, ip2, ip3, ip4])
Description FINS (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 commu­nication protocol, see section 4.2.4 and the Communication Commands Ref­erence Manual, cat. num. W342-E1, Sections 3 and 5. Trajexia has built in FINS client capabilities, so it can initiate the FINS commu­nications with FINS slave devices using FINS_COMMS. Both FINS 0101 (Read Memory) and FINS 0102 (Write Memory) commands are implemented. 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 is 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.
I52E-EN-03.book Seite 82 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 83
Revision 3.0
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 Com­mands Reference Manual, cat. num. W342-E1, Section 3.
node The node of the destination FINS server. For more details, see the Com­munication 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 if the destination is another Trajexia system: 0x00: Inte­ger VR value; 0x01: Integer TABLE value; 0x02 : float TABLE value.
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 argu­ment.
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.
Example A Trajexia system and an OMRON CJ1 PLC with Ethernet Unit CJ1W-ETN11
system are connected to the same network. The IP address of Trajexia sys­tem 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 mem­ory 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 (50 0) t o VR (51 9). The time out is s et t o 5 s eco nds . 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 also N/A
I52E-EN-03.book Seite 83 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 84
Revision 3.0
3.2.122 FLAG
/i
3.2.123 FLAGS
/i
/i
Type System command
Syntax FLAG(flag_number [,value])
Description The FLAG command is used to set and read a bank of 32 flag bits. The FLAG
command can be used with one or two parameters. With one parameter spec­ified 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 recom­mended for new programs.
Arguments flag_number
The flag number is a value from 0..31.
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.
Example FLAG(27,ON)
Set flag bit 27 on.
See also N/A
Type System command
Syntax FLAGS([value])
Description Read and set the FLAGS as a block. The FLAGS command is provided to aid
compatibility with earlier controllers and is not recommended for new pro­grams. The 32 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.
Example FLAGS(146) ' 2 + 16 + 128
Set Flags 1,4 and 7 on, all others off.
Example IF (FLAGS and 8) <>0 then GOSUB somewhere
Test if Flag 3 is set.
See also N/A
Bit number Decimal value
01
12
24
38
416
532
664
7128
I52E-EN-03.book Seite 84 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 85
Revision 3.0
3.2.124 FOR..TO..STEP..NEXT
/i
Type Program control command
Syntax FOR variable = start TO end [STEP increment]
commands NEXT variable
Description The 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 repeat­edly executed until variable is greater than end, at which time program execu­tion will continue after NEXT. Note: FOR ... NEXT statements can be nested up to 8 levels deep in a BASIC program.
Arguments variable
A BASIC expression.
start A BASIC expression.
end A BASIC expression.
increment A BASIC expression.
commands One or more BASIC commands.
Example FOR opnum = 8 TO 13
OP(opnum,ON) NEXT opnum
This loop turns on outputs 8 to 13.
Example loop:
FOR dist = 5 TO -5 STEP -0.25 MOVEABS(dist) GOSUB pick_up NEXT dist
The STEP increment can be positive or negative.
Example loop1:
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 also REPEAT..UNTIL, WHILE..WEND.
I52E-EN-03.book Seite 85 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 86
Revision 3.0
3.2.125 FORWARD
/i
3.2.126 FPGA_VERSION
/i
3.2.127 FRAC
/i
3.2.128 FRAME
/i
Type Axis command
Syntax FORWARD
FO
Description The 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.
Arguments N/A
Example start:
FORWARD WAIT UNTIL IN(0) = ON ' Wait for stop signal CANCEL
See also AXIS, CANCEL, RAPIDSTOP, REVERSE, UNITS.
Type Slot parameter
Syntax FPGA_VERSION SLOT(unit_number)
Description This parameter returns the FPGA version of unit with unit_number in a con-
troller 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__.
Example N/A
See also N/A
Type Mathematical function
Syntax FRAC(expression)
Description The FRAC function returns the fractional part of the expression.
Arguments expression
Any valid BASIC expression.
Example >> PRINT FRAC(1.234)
0.2340
See also N/A
Type System parameter
Syntax FRAME=value
Description Used 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-to­one 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 com­piled 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 cur­rently active FRAME is specified with the FRAME System parameter. The default FRAME is 0 which corresponds to a one-to-one transformation.
Arguments N/A
Example FRAME=1
See also N/A
I52E-EN-03.book Seite 86 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 87
Revision 3.0
3.2.129 FREE
/i
3.2.130 FS_LIMIT
/i
3.2.131 FWD_IN
/i
Type System function
Syntax FREE
Description The 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 twice the memory is required to be able to execute a program.
Arguments N/A
Example >> PRINT FREE
47104.0000
See also N/A
Type Axis parameter
Syntax FS_LIMIT
FSLIMIT
Description The 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 decelerate 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.
Arguments N/A
Example No example.
See also AXIS, AXISSTATUS, UNITS.
Type Axis parameter
Syntax FWD_IN
Description The FWD_IN axis parameter contains the input number to be used
as a forward 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 27 represent software inputs which can be freely used in programs and commands such as IN and OP. These are also common for all axes. Values 28 to 31 are directly mapped to driver inputs present on CN1 connector, and they are unique for each axis. Which driver inputs are mapped to inputs 28 to 31 depends on Servo Driver parameter Pn81E setting. Recommended setting is Pn81E = 0x4321, with the following map­ping: 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.
Sigma II input 28: CN1-40
input 29: CN1-41
input 30: CN1-42
input 31: CN1-43
Sigma III input 28: CN1-13
input 29: CN1-7
input 30: CN1-8
input 31: CN1-9
Junma input 26: CN1-2
input 27: CN1-1
For more information on setting driver parameter Pn81E, see Servo Driver manual. As default the parameter is set to -1, no inputs selected.
Arguments N/A
Example No example.
I52E-EN-03.book Seite 87 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 88
Revision 3.0
3.2.132 FWD_JOG
/i
3.2.133 GET
/i
/i
See also AXIS, AXISSTATUS REV_IN.
Type Axis parameter
Syntax FWD_JOG
Description The FWD_JOG axis parameter contains the input number to be
used as a jog forward input. The input can be set from 0 to 7. As default the parameter is set to -1, no input is selected. Note: This input is active low.
Arguments N/A
Example No example.
See also AXIS, FA ST_J OG, JOGSPEED, REV_JOG.
Type I/O command
Syntax GET [#n,] variable
Description The 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 Tools. Note: Channel 0 is reserved for the connection to Trajexia Tools 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.
variable The name of the variable to receive the ASCII code.
Example GET#5, k
This line stores the ASCII character received on the Trajexia Tools port chan­nel 5 in k.
See also INDEVICE INDEVICE, INPUT, KEY, LINPUT
Input device number
Description
0 Programming port 0
1 RS-232C serial port 1
2 RS-422A/485 serial port 2
5 Trajexia Tools port 0 user channel 5
6 Trajexia Tools port 0 user channel 6
7 Trajexia Tools port 0 user channel 7
I52E-EN-03.book Seite 88 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 89
Revision 3.0
3.2.134 GLOBAL
/i
3.2.135 GOSUB..RETURN
/i
3.2.136 GOTO
/i
Type System command
Syntax GLOBAL "name", vr_number
Description Declares the name as a reference to one of the global VR varia-
bles. The name can then be used both within the program contain­ing the GLOBAL definition and all other programs in the Trajexia Tools 2 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. When the GLOBAL is declared, the declaration remains active until the next TJ1-MC__ 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, numeri­cal or underscore characters.
vr_number The number of the VR to be associated with name.
Example GLOBAL "srew_pitch",12
GLOBAL "ratio1",534 ratio1 = 3.56 screw_pitch = 23.0 PRINT screw_pitch, ratio1
See also N/A
Type Program control command
Syntax GOSUB label
... RETURN
Description The GOSUB structure enables a subroutine jump. GOSUB stores the position
of the line after the GOSUB command and then jumps to the specified label. Upon reaching the RETURN statement, program execution is returned to the stored position. Note: Subroutines on each task can be nested up to 8 levels deep.
Arguments label
A valid label that occurs in the program. An invalid label will give a compi­lation error before execution. Labels can be character strings of any length, but only the first 15 charac­ters are significant.
Example main:
GOSUB routine GOTO main routine: PRINT "Measured position=";MPOS;CHR(13); RETURN
See also GOTO
Type Program control command
Syntax GOTO label
Description The GOTO structure enables a jump of program execution. GOTO jumps pro-
gram execution to the line of the program containing the label.
I52E-EN-03.book Seite 89 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 90
Revision 3.0
3.2.137 HALT
/i
3.2.138 HEX
/i
3.2.139 HLM_COMMAND
/i
Arguments label
A valid label that occurs in the program. An invalid label will give a compi­lation error before execution. Labels can be character strings of any length, but only the first 15 char­acters are significant.
Example loop:
PRINT "Measured position = ";MPOS;CHR(13); GOTO loop
See also GOSUB..RETURN
Type System command
Syntax HALT
Description The HALT command stops execution of all program tasks currently running.
The command can be used both on command line as in programs. The STOP command can be used to stop a single program task.
Arguments N/A
Example No example.
See also PROCESS, STOP.
Type I/O command
Syntax HEX
Description This command is used in a print statement to output a number in hexadecimal
format.
Arguments N/A
Example PRINT#5,HEX(IN(8,16))
See also N/A
Type Communication command
Syntax HLM_COMMAND(command, port [ , node [ , mc_area/mode [ , mc_offset
]]])
Description The HLM_COMMAND command performs a specific Host link command
operation to one or to all Host Link Slaves on the selected port. Program execution will be paused until the response string has been received or the timeout time has elapsed. The timeout time is specified by using the HLM_TIMEOUT parameter. The status of the transfer can be monitored with the HLM_STATUS parameter. Notes:
When using the HLM_READ, be sure to set-up the Host Link Master pro­tocol by using the SETCOM command.
The Host Link Master commands are required to be executed from one program task only to avoid any multi-task timing problems.
Arguments command
The selection of the Host Link operation to perform. See the first table below.
port The specified serial port. 1 = RS-232C serial port 1; 2 = RS-422A serial port 2.
node (for HLM_MREAD, HLM_TEST, HLM_ABORT and HLM_STWR) The Slave node number to send the Host link command to. Range: [0, 31].
mode (for HLM_STWR) The specified CPU Unit operating mode. 0 = PROGRAM mode; 2 = MONITOR mode; 3 = RUN mode.
mc_area (for HLM_MREAD) The memory selection of the TJ1-MC__ to read the send data from. See the second table below.
mc_offset (for
HLM_MREAD) The address of the specified TJ1-MC__ memory area to read from. Range for VR variables: [0, 1023]. Range for TABLE variables: [0, 63999].
I52E-EN-03.book Seite 90 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 91
Revision 3.0
/i
/i
3.2.140 HLM_READ
/i
Example HLM_COMMAND(HLM_MREAD,1,12,MC_VR,233)
This command reads the CPU Unit model code of the Host Link Slave with node address 12 connected to the RS-232C port. The result is written to VR(233). If the connected Slave is a C200HX PC, the VR(233) will contain value 12 (hex) after successful execution.
Example HLM_COMMAND(HLM_TEST,2,23)
PRINT HLM_STATUS PORT(2)
This command will check the Host Link communication with the Host Link Slave (node 23) connected to the RS-422A port. If the HLM_STATUS parameter contains value 0, the communication is func- tional.
Example HLM_COMMAND(HLM_INIT,2)
HLM_COMMAND(HLM_ABORT,2,4)
These two commands perform the Host Link INITIALIZE and ABORT opera­tions on the RS-422A port 2. The Slave has node number 4.
Example HLM_COMMAND(HLM_STWR,2,0,2)
When data has to be written to a PC using Host Link, the CPU Unit can not be in RUN mode. The HLM_COMMAND command can be used to set it to MONITOR mode. The Slave has node address 0 and is connected to the RS­232C port.
See also HLM_READ, HLM_COMMAND, HLM_STATUS, HLM_TIMEOUT,
HLS_NODE, HLM_WRITE, SETCOM.
command value Description
HLM_MREAD
(or value 0)
This performs the Host Link PC MODEL READ (MM) command to read the CPU Unit model code. The result is written to the TJ1-MC__ variable specified by mc_area and mc_offset.
HLM_TEST
(or value 1)
This performs the Host Link TEST (TS) command to check correct com­munication by sending string "MCW151 TEST STRING" and checking the echoed string. Check the HLM_STATUS parameter for the result.
HLM_ABORT
(or value 2)
This performs the Host Link ABORT (XZ) command to abort the Host link command that is currently being processed. The ABORT command does not receive a response.
HLM_INIT
(or value 3)
This performs the Host Link INITIALIZE (**) command to initialize the transmission control procedure of all Slave Units.
HLM_STWR
(or value 4)
This performs the Host Link STATUS WRITE (SC) command to change the operating mode of the CPU Unit.
mc_area value Data area
MC_TABLE
(or value 8)
TABLE variable array
MC_VR
(or value 9)
Global (VR) variable array
Type Communication command
Syntax HLM_READ(port, node, pc_area, pc_offset, length, mc_area, mc_offset)
Description The HLM_READ command reads data from a Host Link Slave by sending a
Host link command string containing the specified node of the Slave to the serial port. The received response data will be written to either VR or TABLE variables. Each word of data will be transferred to one variable. The maximum data length is 30 words (single frame transfer). Program execution will be paused until the response string has been received or the timeout time has elapsed. The timeout time is specified by using the HLM_TIMEOUT parameter. The status of the transfer can be monitored with the HLM_STATUS parameter. Notes:
When using the HLM_READ, be sure to set-up the Host Link Master pro­tocol by using the SETCOM command.
The Host Link Master commands are required to be executed from one program task only to avoid any multi-task timing problems.
command value Description
I52E-EN-03.book Seite 91 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 92
Revision 3.0
/i
/i
3.2.141 HLM_STATUS
/i
Arguments port
The specified serial port. 1 = RS-232C serial port 1; 2 = RS-422A serial port 2.
node The Slave node number to send the Host link command to. Range: [0, 31].
pc_area The PC memory selection for the Host link command. See the first table below.
pc_offset The address of the specified PC memory area to read from. Range: [0, 9999].
length The number of words of data to be transferred. Range: [1, 30].
mc_area The memory selection of the TJ1-MC__ to read the send data from. See the second table below.
mc_offset The address of the specified TJ1-MC__ memory area to write to. Range for VR variables: [0, 1023]. Range for TABLE variables: [0, 63999].
Example HLM_READ(2,17,PLC_DM,120,20,MC_TABLE,4000)
This example shows how to read 20 words from the PC DM area addresses 120-139 to TJ1-MC__'s TABLE addresses 4000-4019. The PC has Slave node address 17 and is connected to the RS-422A port.
See also HLM_COMMAND, HLM_STATUS, HLM_TIMEOUT, HLS_NODE,
HLM_WRITE, SETCOM.
pc_area value Data area Host link command
PLC_DM
(or value 0)
DM area RD
PLC_IR
(or value 1)
CIO/IR area RR
PLC_LR
(or value 2)
LR area RL
PLC_HR
(or value 3)
HR area RH
PLC_AR
(or value 4)
AR area RJ
PLC_EM
(or value 6)
EM area RE
mc_area value Data area
MC_TABLE
(or value 8)
TABLE variable array
MC_VR
(or value 9)
Global (VR) variable array
Type Communication parameter
Syntax HLM_STATUS PORT(n)
Description The HLM_STATUS parameter contains the status of the last Host Link Master
command sent to the specified port. The parameter will indicate the status for the HLM_READ, HLM_WRITE and HLM_COMMAND commands. The sta­tus bits are defined in the table below. The HLM_STATUS will have value 0 when no problems did occur. In case of a non-0 value, any appropriate action such as a re-try or emergency stop needs to be programmed in the user BASIC program. Each port has an HLM_STATUS parameter. The PORT modifier is required to specify the port.
Arguments n
The specified serial port. 1 = RS-232C serial port 1; 2 = RS-422A serial port 2
Example >> HLM_WRITE(1,28,PLC_EM,50,25,MC_VR,200)
>> PRINT HEX(HLM_STATUS PORT(1)) 1
Apparently the CPU Unit is in RUN mode and does not accept the write oper­ation.
pc_area value Data area Host link command
I52E-EN-03.book Seite 92 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 93
Revision 3.0
/i
3.2.142 HLM_TIMEOUT
/i
Example >> HLM_COMMAND(HLM_TEST,2,0)
>> PRINT HLM_STATUS PORT(2)
256.0000
A timeout error has occurred.
See also HLM_READ, HLM_COMMAND, HLM_TIMEOUT, HLS_NODE,
HLM_WRITE, SETCOM.
Bit Name Description
0 - 7 End code The end code can be either the end code which is defined by
the Host Link Slave (problem in sent command string) or an end code defined because of a problem found by the Host Link Master (problem in received response string).
8 Timeout error A timeout error will occur if no response has been received
within the timeout time. This indicates communication has been lost.
9 Command not
recognized
This status indicates that the Slave did not recognize the com­mand and has returned a IC response.
Type Communication parameter
Syntax HLM_TIMEOUT
Description The HLM_TIMEOUT parameter specifies the fixed timeout time for
the Host Link Master protocol for both serial ports. A timeout error will occur when the time needed to both send the command and receive the response from the Slave is longer than the time speci­fied with this parameter. The parameter applies for the HLM_READ, HLM_WRITE and HLM_COMMAND commands. The HLM_TIMEOUT parameter is specified in servo periods.
Arguments N/A
Example >> HLM_TIMEOUT=2000
Consider the servo period of the TJ1-MC__ is set to 500 ms (SERVO_PERIOD=500). For both serial ports the Host Link Master timeout time has been set to 1 s.
See also HLM_READ, HLM_COMMAND, HLM_STATUS, HLS_NODE,
HLM_WRITE, SETCOM SERVO_PERIOD.
I52E-EN-03.book Seite 93 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 94
Revision 3.0
3.2.143 HLM_WRITE
/i
/i
Type Communication command
Syntax HLM_WRITE(port, node, pc_area, pc_offset, length, mc_area, mc_offset)
Description The HLM_WRITE command writes data from the TJ1-MC__ to a Host Link
Slave by sending a Host link command string containing the specified node of the Slave to the serial port. The received response data will be written from either VR or TABLE variables. Each variable will define the word or data that will be transferred. The maximum data length is 29 words (single frame trans­fer). Program execution will be paused until the response string has been received or the timeout time has elapsed. The timeout time is specified by using the HLM_TIMEOUT parameter. The status of the transfer can be monitored with the HLM_STATUS parameter. Notes:
When using the HLM_WRITE, be sure to set-up the Host Link Master protocol by using the SETCOM command.
The Host Link Master commands are required to be executed from one program task only to avoid any multi-task timing problems.
Arguments port
The specified serial port. 1 = RS-232C serial port 1; 2 = RS-422A serial port 2
node The Slave node number to send the Host link command to. Range: [0, 31].
pc_area The PC memory selection for the Host link command. See the first table below.
pc_offset The address of the specified PC memory area to write to. Range: [0, 9999].
length The number of words of data to be transferred. Range: [1, 29].
mc_area The memory selection of the TJ1-MC__ to read the send data from. See the second table below
mc_offset The address of the specified TJ1-MC__ memory area to read from. Range for VR variables: [0, 1023]. Range for TABLE variables: [0, 63999].
Example HLM_WRITE(1,28,PLC_EM,50,25,MC_VR,200)
This example shows how to write 25 words from TJ1-MC__ ' s VR addresses 200-224 to the PC EM area addresses 50-74. The PC has Slave node address 28 and is connected to the RS-232C port.
See also HLM_READ, HLM_COMMAND, HLM_STATUS, HLM_TIMEOUT,
HLS_NODE, SETCOM.
pc_area value Data area Host link command
PLC_DM
(or value 0)
DM area RD
PLC_IR
(or value 1)
CIO/IR area RR
PLC_LR
(or value 2)
LR area RL
I52E-EN-03.book Seite 94 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 95
Revision 3.0
/i
3.2.144 HLS_NODE
/i
3.2.145 HW_PSWITCH
/i
PLC_HR
(or value 3)
HR area RH
PLC_AR
(or value 4)
AR area RJ
PLC_EM
(or value 6)
EM area RE
mc_area value Data area
MC_TABLE
(or value 8)
Table variable array
MC_VR
(or value 9)
Global (VR) variable array
Type Communication parameter
Syntax HLS_NODE
Description The HLS_NODE parameter defines the Slave unit number for the Host Link
Slave protocol. The TJ1-MC__ will only respond to Host Link Master com­mand strings with the unit number as specified in this parameter. The valid range for this parameter is [0, 31]. The default value is 0.
Arguments N/A
Example No example.
See also N/A
pc_area value Data area Host link command
Type Axis command
Syntax HW_PSWITCH(mode, direction, opstate, table_start, table_end)
Description The HW_PSWITCH command turns on the OUT 0 output for the axis when
the predefined axis measured position is reached, and turns the output off when another measured position is reached. Positions are defined as sequence in the TABLE memory in range from table_start, to table_end, and on execution of the HW_PSWITCH command are stored in FIFO queue. This command is applicable only to Flexible axis axes with ATYPE values 43, 44 and 45. The command can be used with either or 5 parameters. Only 1 parameter is needed to disable the switch or clear FIFO queue. All five parameters are needed to enable switch. After loading FIFO and going through the sequence of positions in FIFO, if the same sequence has to be executed again, FIFO must be cleared before exe­cuting HW_PSWITCH command with the same parameters.
Arguments mode
0 = disable switch; 1 = on and load FIFO; 2 = clear FIFO.
direction 0 = decreasing; 1 = increasing.
opstate Output state to set in the first position in the FIFO; on or off.
tabl e_sta rt Starting Table address of the sequence.
table_end Ending Table address of the sequence.
Example HW_PSWITCH(1, 1, ON, 21, 50)
This command will load FIFO with 30 positions, stored in TABLE memory starting from TABLE(21) in increasing direction. When the position stored in TABLE(21) is reached, the OUT 0 output will be set on and then alternatively off and on on reaching following positions in the sequence, until the position stored in TABLE(50) reached.
Example HW_PSWITCH(0)
This command will disable switch if it was enabled previously, but will not clear the FIFO queue.
I52E-EN-03.book Seite 95 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 96
Revision 3.0
3.2.146 I_GAIN
/i
3.2.147 IDLE
See WAIT IDLE.
3.2.148 IEEE_IN
/i
3.2.149 IEEE_OUT
/i
Example HW_PSWITCH(2)
This command will clear FIFO queue if loaded previously.
See also AXIS
Type Axis parameter
Syntax I_GAIN
Description The I_GAIN parameter contains the integral gain for the axis. The integral out-
put contribution is calculated by multiplying the sums of the Following Errors with the value of the I_GAIN parameter. The default value is 0. Adding integral gain to a servo system reduces positioning error when at rest or moving steadily. It can produce or increase overshooting and oscillation and is therefore only suitable for systems working on constant speed and with slow accelerations. Note: In order to avoid any instability the servo gains should be changed only when the SERVO is off.
Arguments N/A
Example No example.
See also D_GAIN, I_GAIN, OV_GAIN, P_GAIN, VFF_GAIN.
Type Mathematical function
Syntax IEEE_IN(byte0,byte1,byte2,byte3)
Description The IEEE_IN function returns the floating point number represented by 4
bytes which typically have been received over a communications link.
Arguments byte0 - byte3
Any combination of 8 bit values that represents a valid IEEE floating point number.
Example VR(20) = IEEE_IN(b0,b1,b2,b3)
See also N/A
Type Mathematical function
Syntax byte_n = IEEE_OUT(value, n)
Description The IEEE_OUT function returns a single byte in IEEE format extracted from
the floating point value for transmission over a bus system. The function will typically be called 4 times to extract each byte in turn. Note: Byte 0 is the high byte of the 32 bit IEEE floating point format.
Arguments value
Any BASIC floating point variable or parameter.
n The byte number (0 - 3) to be extracted.
Example V=MPOS AXIS(2)
byte0 = IEEE_OUT(V, 0) byte1 = IEEE_OUT(V, 1) byte2 = IEEE_OUT(V, 2) byte3 = IEEE_OUT(V, 3)
See also N/A
I52E-EN-03.book Seite 96 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 97
Revision 3.0
3.2.150 IF..THEN..ELSE..ENDIF
/i
3.2.151 IN
/i
Type Program control command
Syntax IF condition_1 THEN commands {ELSEIF condition_i THEN commands}
[ ELSE commands ] ENDIF IF condition_1 THEN commands
Description This structure controls the flow of the program based on the results of the con-
dition. If the condition is TRUE the commands following THEN up to ELSEIF, ELSE or ENDIF is executed. If the condition is FAL SE and the command of a subsequent ELSEIF substructre is TRUE, the commands of this substructure are executed. If all conditions are FALSE the commands following ELSE will be executed or the program will resume at the line after ENDIF in case no ELSE is included. The ENDIF is used to mark the end of the conditional block. Note: IF..THEN..ELSE..ENDIF sequences can be nested without limit. For a multi-line IF..THEN construction, there must not be any statement after THEN. A single-line construction must not use ENDIF.
Arguments condition_i
A logical expression.
commands One or more BASIC commands.
Example IF MPOS > (0.22 * VR(0)) THEN GOTO exceeds_length
Example IF IN(0) = ON THEN
count = count + 1 PRINT "COUNTS = ";count fail = 0 ELSE fail = fail + 1 ENDIF
Example IF IN(stop)=ON THEN
OP(8,ON) VR(cycle_flag)=0 ELSEIF IN(start_cycle)=ON THEN VR(cycle_flag)=1 ELSEIF IN(step1)=ON THEN VR(cycle_flag)=99 ENDIF
Example IF key_char=$31 THEN
GOSUB char_1 ELSEIF key_char=$32 THEN GOSUB char_2 ELSEIF key_char=$33 THEN GOSUB char_3 ELSE PRINT "Character unknown" ENDIF
See also N/A
Type I/O function
Syntax IN(input_number [ ,final_input_number ])
IN
Description The IN function returns the value of digital inputs.
IN(input_number, final_input_number) will return the binary sum of the group of inputs. The two arguments must be less than 24 apart.
IN(input_number) with the value for input_number less than 32 will return the value of the particular channel.
IN (without arguments) will return the binary sum of the first 24 inputs (as IN(0,23)).
Arguments input_number
The number of the input for which to return a value. Value: An integer between 0 and 31.
final_ input_number The number of the last input for which to return a value. Value: An integer between 0 and 31.
I52E-EN-03.book Seite 97 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 98
Revision 3.0
3.2.152 INDEVICE
/i
/i
3.2.153 INITIALISE
/i
Example The following lines can be used to move to the position set on a thumb wheel
multiplied by a factor. The thumb wheel is connected to inputs 4, 5, 6 and 7, and gives output in BCD.
moveloop: MOVEABS(IN(4,7)*1.5467) WAIT IDLE GOTO moveloop
The MOVEABS command is constructed as follows: Step 1: IN(4,7) will get a number between 0 and 15. Step 2: The number is multiplied by 1.5467 to get required distance. Step 3: An absolute move is made to this position.
Example In this example a single input is tested:
test: WAIT UNTIL IN(4)=ON ' Conveyor is in position when ON GOSUB place
See also OP.
Type I/O parameter
Syntax INDEVICE
Description The INDEVICE parameter defines the default input device. This device will be
selected for the input commands when the #n option is omitted. The INDEVICE parameter is task specific. The supported values are listed in the table below.
Arguments N/A
Example No example.
See also GETGET, INPUT, LINPUT, KEY.
Value Description
0 Programming port 0 (default)
1 RS-232C serial port 1
2 RS-422A/485 serial port 2
5 Trajexia Tools port 0 user channel 5
6 Trajexia Tools port 0 user channel 6
7 Trajexia Tools port 0 user channel 7
Type System command
Syntax INITIALISE
Description Sets all axes, system and process parameters to their default values. The
parameters are also reset each time the controller is powered up, or when an
EX (software reset) command is performed. In Trajexia Tools the menu Reset the controller... under the Controller menu performs the equivalent of an EX
command.
Arguments N/A
Example No example.
See also EX
Value Description
I52E-EN-03.book Seite 98 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 99
Revision 3.0
3.2.154 INPUT
/i
3.2.155 INT
/i
3.2.156 INVERT_IN
/i
Type I/O command
Syntax INPUT [ #n ], variable { , variable }
Description The INPUT command will assign numerical input string values to the specified
variables. Multiple input string values can be requested on one line, sepa­rated by commas, or on multiple lines separated by carriage return. The pro­gram execution will be paused until the string is terminated with a carriage return after the last variable has been assigned. If the string is invalid, the user will be prompted with an error message and the task will be repeated. The maximum amount of inputs on one line has no limit other than the line length. Channels 5 to 7 are logical channels that are superimposed on the RS-232C programming port 0 when using Trajexia Tools. Note: Channel 0 is reserved for the connection to Trajexia Tools and/or the command line interface. Please be aware that this channel may give prob­lems for this function.
Arguments n
The specified input device. When this argument is omitted, the port as specified by INDEVICE will be used.
variable The variable to write to.
Example Consider the following program to receive data from the terminal.
INPUT#5, num PRINT#5, "BATCH COUNT=";num[0]
A possible response on the terminal could be:
123<CR> BATCH COUNT=123
See also INDEVICE, GET, LINPUT, KEY
Type Mathematical function
Syntax INT(expression)
Description The INT function returns the integer part of the expression.
Note: To round a positive number to the nearest integer value take the INT function of the value added by 0.5. Similarly, to round for a negative value subtract 0.5 to the value before applying INT.
Arguments expression
Any valid BASIC expression.
Example >> PRINT INT(1.79)
1.0000
See also N/A
Type System command
Syntax INVERT_IN(input,on/off)
Description The INVERT_IN command allows the input channels 0..31 to be individually
inverted in software. This is important as these input channels can be assigned to activate func­tions such as feedhold. The INVERT_IN function sets the inversion for one channel on or off. It can only be applied to inputs 0..31.
Arguments input
A BASIC expression
Example >>? IN(3)
0.0000 >>INVERT_IN(3,ON) >>? IN(3)
1.0000
See also N/A
I52E-EN-03.book Seite 99 Freitag, 29. Juni 2007 11:55 11
BASIC commands
PROGRAMMING MANUAL 100
Revision 3.0
3.2.157 INVERT_STEP
/i
3.2.158 INVERTER_COMMAND
/i
/i
Type Axis parameter
Syntax INVERT_STEP
Description INVERT_STEP is used to switch a hardware inverter into the stepper pulse
output circuit. This can be necessary in for connecting to some stepper driv­ers. The electronic logic inside the Trajexia stepper pulse generator assumes that the FALLING edge of the step output is the active edge which results in motor movement. This is suitable for the majority of stepper drivers. Setting INVERT_STEP=ON effectively makes the RISING edge of the step signal the active edge. INVERT_STEP should be set if required prior to enabling the controller with WDOG=ON. Default is off. Note: If the setting is incorrect. A stepper motor may lose position by one step when changing direction.
Arguments N/A
Example No example.
See also N/A
Type System command
Syntax INVERTER_COMMAND(module, station, 7, operation_signals)
INVERTER_COMMAND(module, station, 1, alarm_number)
Description INVERTER_COMMAND controls inputs and clears alarm of the frequency
inverter connected to the system via the MECHATROLINK-II bus. There are two INVERTER_COMMAND functions:
1: Clears an alarm.
7: Controls operation signals.
To use an inverter via MECHATROLINK-II you should put the command and the reference via communication option:
Inverter MV/V7: N3=3; N4=9
Inverter F7/G7: B1-01=3; B1-02=3.
Make you sure that the Inverter firmware supports the MECHATROLINK-II board. The command returns -1 if successfully executed and 0 if failed. The command sent to the inverter will correspond with the bits given in the table below.
Arguments module
The number of the TJ1-ML__ that the inverter is connected to.
station The MECHATROLINK-II station number of the inverter.
alarm_number The number of the alarm. See the inverter manual.
operation_signals A bitwise value to control the operation signals. See the table below.
Example No example.
See also N/A
Bit Value Command Description
0 Hex 1 Run forward
I52E-EN-03.book Seite 100 Freitag, 29. Juni 2007 11:55 11
Loading...