0% found this document useful (0 votes)
82 views348 pages

Rcx-Pro e

This document is a programming manual for YAMAHA robot controllers that provides instructions on: 1. Programming commands and syntax for YAMAHA robot controllers including the RCX40, RCX141, and RCX142 models. 2. Safety precautions that must be followed when using the robot controllers to ensure safe operation. 3. Descriptions of programming commands related to robot motion and configuration including MOVE, ARCH, ACCEL, and more. The document provides details on command syntax and parameters.

Uploaded by

rcloesen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
82 views348 pages

Rcx-Pro e

This document is a programming manual for YAMAHA robot controllers that provides instructions on: 1. Programming commands and syntax for YAMAHA robot controllers including the RCX40, RCX141, and RCX142 models. 2. Safety precautions that must be followed when using the robot controllers to ensure safe operation. 3. Descriptions of programming commands related to robot motion and configuration including MOVE, ARCH, ACCEL, and more. The document provides details on command syntax and parameters.

Uploaded by

rcloesen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 348

YAMAHA MOTOR CO., LTD.

Programming Manual
MEMO
Introduction
Our sincere thanks for your purchase of this YAMAHA robot controller.

This manual describes robot program commands and related information for using
YAMAHA RCX40, RCX141 and RCX142 robot controllers. Be sure to read this manual
2
carefully as well as related manuals and comply with their instructions for using the
YAMAHA robot controllers safely and correctly.

For details on how to operate YAMAHA robot controllers, refer to the separate “YAMAHA
robot controller owner’s manual”.

1
Safety precautions (Be sure to read before using)
Before using the YAMAHA robot controller, be sure to read this manual and related manu-
als, and follow their instructions to use the robot controller safely and correctly.
Warning and caution items listed in this manual relate to YAMAHA robot controllers.
2 When this robot controller is used in a robot controller system, please take appropriate
safety measures as required by the user’s individual system.

This manual classifies safety caution items and operating points into the following levels,
along with symbols for signal words “WARNING”, “CAUTION” and “NOTE”.

w "WARNING"
WARNING
indicates a potentially hazardous situation which, if not avoided, could
result in death or serious injury.

c "CAUTION"
CAUTION
indicates a potentially hazardous situation which, if not avoided, could result in
minor or moderate injury or damage to the equipment or software.

n Explains
NOTE
key points in the operation in a simple and clear manner.

Note that the items classified into “CAUTION” might result in serious injury depending
on the situation or environmental conditions. So always comply with CAUTION and
WARNING instructions since these are essential to maintain safety.

Keep this manual carefully so that the operator can refer to it when needed. Also make
sure that this manual reaches the end user.

[System design precautions]


c CAUTION
• When the program execution stops before it is complete, the program re-executes the command
that has stopped. Keep this point in mind when re-executing the program, for example, when
using an arch motion with the MOVE command, a relative movement command such as the
MOVEI or DRIVEI command, or a communication command such as the SEND command.

This manual does not constitute a concession of rights or a guarantee of industrial rights. Please
acknowledge that we bear no liability whatsoever for conflicts with industrial rights arising from
the contents of this manual.

2006 YAMAHA MOTOR CO., LTD.

2
Contents
1. The YAMAHA Robot Language .......................................................... 1
2. Characters......................................................................................... 2
3. Program Names ................................................................................ 3
4. Identifiers.......................................................................................... 7
5. Command Statement Format ............................................................ 8
6. Constants .......................................................................................... 9
6.1 Character constants ...................................................................................... 9
6.2 Numeric constants ........................................................................................ 9
6.2.1 Integer constants .......................................................................................................... 9
6.2.2 Real constants .............................................................................................................. 9

7. Variables ......................................................................................... 10
7.1 Valid range of variables .............................................................................. 11
7.1.1 Valid range of dynamic variables ................................................................................ 11
7.1.2 Valid range of static variables ...................................................................................... 11
7.1.3 Valid range of dynamic array variables ........................................................................ 11
7.2 Character variables ..................................................................................... 12
7.3 Numeric variables ...................................................................................... 12
7.3.1 Integer variables ......................................................................................................... 12
7.3.2 Real variables ............................................................................................................. 12
7.4 Array variables ........................................................................................... 12
7.5 Clearing variables ....................................................................................... 13
7.5.1 Clearing dynamic variables ........................................................................................ 13
7.5.2 Clearing static variables ............................................................................................. 13

8. Other Variables ............................................................................... 14


9. Expressions and Operations ............................................................ 24
9.1 Arithmetic operations ................................................................................. 24
9.1.1 Arithmetic operators ................................................................................................... 24
9.1.2 Relational operators ................................................................................................... 24
9.1.3 Logic operations ......................................................................................................... 25
9.1.4 Priority of arithmetic operation ................................................................................... 25
9.1.5 Data format conversion .............................................................................................. 26
9.2 Character string operations ......................................................................... 26
9.2.1 Character string connection ....................................................................................... 26
9.2.2 Character string comparison ....................................................................................... 26
9.3 Point data format ........................................................................................ 27
9.3.1 Joint coordinate format ............................................................................................... 27
9.3.2 Cartesian coordinate format ....................................................................................... 27
9.4 DI/DO conditional expressions ................................................................... 27
10. Multiple Robot Control ................................................................... 28
10.1 Overview ................................................................................................... 28
10.2 Command list for each group ..................................................................... 29

i
11. Command Statements ..................................................................... 30
ABSRST statement ................................................................................................. 30
ACCEL statement
(Acceleration setting statement for main group) .................................................... 31
ACCEL2 statement
(Acceleration setting statement for sub group) ....................................................... 32
ARCH statement
(Arch position setting statement for main group) ................................................... 33
ARCH2 statement
(Arch position setting statement for sub group) ...................................................... 34
ASPEED statement
(Automatic movement speed setting statement for main group) ............................. 35
ASPEED2 statement
(Automatic movement speed setting statement for sub group) ............................... 36
AXWGHT statement
(Axis tip weight setting statement for main group) ................................................. 37
AXWGHT2 statement
(Axis tip weight setting statement for sub group) ................................................... 38
CALL statement ..................................................................................................... 39
CHGPRI statement ................................................................................................ 40
CUT statement ...................................................................................................... 41
DECEL statement
(Deceleration setting statement for main group) .................................................... 42
DECEL2 statement
(Deceleration setting statement for sub group) ...................................................... 43
DECLARE statement .............................................................................................. 44
DEF FN statement ................................................................................................. 46
DELAY statement .................................................................................................. 47
DIM statement
(Array variable declaration statement) ................................................................... 48
DO statement (Parallel output) .............................................................................. 49
DRIVE statement ................................................................................................... 50
DRIVE2 statement ................................................................................................. 54
DRIVEI statement .................................................................................................. 58
DRIVEI2 statement ................................................................................................ 60
EXIT FOR statement .............................................................................................. 62
EXIT SUB statement .............................................................................................. 63
EXIT TASK statement ............................................................................................. 64
FOR statement, NEXT statement ........................................................................... 65
GOSUB statement, RETURN statement ................................................................. 66
GOTO statement .................................................................................................. 67
HALT statement .................................................................................................... 68
HAND definition statement, CHANGE statement (Main robot hand selection) ...... 69
HAND2 definition statement, CHANGE2 statement (Sub robot hand selection) .... 73
HOLD statement ................................................................................................... 77
IF statement .......................................................................................................... 78
INPUT statement .................................................................................................. 80
LET statement (Assignment statement) ................................................................... 81
LO statement (Arm lock output) ............................................................................ 83
MO statement (Internal output) ............................................................................. 84
MOVE statement
(Absolute position movement command) .............................................................. 85

ii
MOVE2 statement
(Absolute position movement command) .............................................................. 93
MOVEI statement
(Relative position movement command) ............................................................... 97
MOVEI2 statement
(Relative position movement command) ............................................................... 99
ON ERROR GOTO statement ............................................................................. 101
ON to GOTO statement ...................................................................................... 102
ON to GOSUB statement .................................................................................... 103
ONLINE statement, OFFLINE statement .............................................................. 104
ORGORD statement
(Return-to-origin sequence setting statement for main group) .............................. 105
ORGORD2 statement
(Return-to-origin sequence setting statement for sub group) ................................ 106
ORIGIN statement .............................................................................................. 107
OUT statement ................................................................................................... 108
OUTPOS statement
(OUT position setting statement for main group) ................................................. 109
OUTPOS2 statement
(OUT position setting statement for sub group) ................................................... 110
PATH-related statements ......................................................................................111
What is a PATH function? ........................................................................................................ 111
PATH statement (PATH-related statements) .............................................................................. 113
PATH END statement (PATH-related statements) ...................................................................... 117
PATH SET statement (PATH-related statements) ....................................................................... 118
PATH START statement (PATH-related statements) .................................................................. 120
PDEF statement ................................................................................................... 121
PMOVE statement (Pallet movement command) ................................................. 122
PMOVE2 statement (Pallet movement command) ............................................... 126
PRINT statement ................................................................................................. 130
Pn (Point definition statement) ............................................................................ 131
REM (Comment statement) .................................................................................. 132
RESET statement ................................................................................................. 133
RESTART statement ............................................................................................. 134
RESUME statement ............................................................................................. 135
RIGHTY statement, LEFTY statement ................................................................... 136
RIGHTY2 statement, LEFTY2 statement ............................................................... 137
Sn (Shift coordinate definition statement) ............................................................ 138
SELECT CASE statement, END SELECT statement ................................................ 139
SEND statement .................................................................................................. 140
SERVO statement ................................................................................................ 142
SERVO2 statement .............................................................................................. 143
SET statement ..................................................................................................... 144
SHARED statement ............................................................................................. 145
SHIFT statement
(Shift coordinate setting statement for main robot) .............................................. 146
SHIFT2 statement
(Shift coordinate setting statement for sub robot) ................................................. 147
SO statement (Serial output) ................................................................................ 148
SPEED statement
(Speed setting statement for main group) ............................................................. 149
SPEED2 statement
(Speed setting statement for sub group) ............................................................... 150

iii
START statement ................................................................................................. 151
SUB statement, END SUB statement ................................................................... 152
SUSPEND statement ........................................................................................... 154
SWI statement ..................................................................................................... 155
TO statement ...................................................................................................... 156
TOLE statement
(Tolerance setting statement for main group) ....................................................... 157
TOLE2 statement
(Tolerance setting statement for sub group) ......................................................... 158
TORQUE statement ............................................................................................ 159
TORQUE2 statement .......................................................................................... 160
WAIT statement .................................................................................................. 161
WEIGHT statement
(Tip weight parameter setting statement for main robot) ...................................... 163
WEIGHT2 statement
(Tip weight parameter setting statement for sub robot) ........................................ 164
WHILE statement, WEND statement ................................................................... 165
Label statement ................................................................................................... 166
12. Functions ...................................................................................... 167
12.1 Arithmetic functions ................................................................................. 167
12.2 Character string functions ......................................................................... 183
12.3 Point functions ......................................................................................... 186
13. Multi-tasking ................................................................................. 189
13.1 Outline ..................................................................................................... 189
13.2 Task definition .......................................................................................... 189
13.3 Task status and transition .......................................................................... 190
13.4 Starting tasks ............................................................................................. 191
13.5 Task scheduling ........................................................................................ 191
13.6 Condition wait in task ............................................................................... 192
13.7 Suspending and restarting tasks ................................................................ 193
13.8 Deleting tasks ........................................................................................... 193
13.9 Stopping tasks ........................................................................................... 194
13.10 Multi-task program example ..................................................................... 195
13.11 Sharing the data ........................................................................................ 196
14. Data file description ..................................................................... 197
14.1 Program file .............................................................................................. 198
14.1.1 All programs ............................................................................................................ 198
14.1.2 One program ........................................................................................................... 199
14.2 Point file ................................................................................................... 200
14.2.1 All points ................................................................................................................. 200
14.2.2 One point ................................................................................................................ 201
14.3 Point comment file ................................................................................... 202
14.3.1 All point comments .................................................................................................. 202
14.4 Parameter file ........................................................................................... 203
14.4.1 All parameters .......................................................................................................... 203
14.4.2 One parameter ......................................................................................................... 205
14.5 Shift coordinate definition file ................................................................... 206
14.5.1 All shift data ............................................................................................................. 206
14.5.2 One shift definition .................................................................................................. 207
14.6 Hand definition file .................................................................................. 208
14.6.1 All hand data ........................................................................................................... 208

iv
14.6.2 One hand definition ................................................................................................. 209
14.7 Pallet definition file .................................................................................. 210
14.7.1 All pallet definitions ................................................................................................. 210
14.7.2 One pallet definition ................................................................................................ 212
14.8 All file ...................................................................................................... 213
14.8.1 All files ..................................................................................................................... 213
14.9 Program directory file ............................................................................... 214
14.9.1 Entire program directory ........................................................................................... 214
14.9.2 One program ........................................................................................................... 215
14.10 Parameter directory file ............................................................................ 216
14.10.1 Entire parameter directory ........................................................................................ 216
14.11 Variable file .............................................................................................. 217
14.11.1 All variables ............................................................................................................. 217
14.11.2 One variable ............................................................................................................ 219
14.12 Constant file ............................................................................................. 220
14.12.1 One character string ................................................................................................. 220
14.13 Array variable file ..................................................................................... 221
14.13.1 All array variables .................................................................................................... 221
14.13.2 One array variable ................................................................................................... 223
14.14 DI file ....................................................................................................... 224
14.14.1 All DI information .................................................................................................... 224
14.14.2 One DI port ............................................................................................................. 225
14.15 DO file ..................................................................................................... 226
14.15.1 All DO information .................................................................................................. 226
14.15.2 One DO port ........................................................................................................... 227
14.16 MO file ..................................................................................................... 228
14.16.1 All MO information .................................................................................................. 228
14.16.2 One MO port ........................................................................................................... 229
14.17 LO file ...................................................................................................... 230
14.17.1 All LO information ................................................................................................... 230
14.17.2 One LO port ............................................................................................................ 231
14.18 TO file ...................................................................................................... 232
14.18.1 All TO information ................................................................................................... 232
14.18.2 One TO port ............................................................................................................ 233
14.19 SI file ........................................................................................................ 234
14.19.1 All SI information ..................................................................................................... 234
14.19.2 One SI port .............................................................................................................. 235
14.20 SO file ...................................................................................................... 236
14.20.1 All SO information ................................................................................................... 236
14.20.2 One SO port ............................................................................................................ 237
14.21 Error message history file .......................................................................... 238
14.21.1 All error message history .......................................................................................... 238
14.22 Machine reference file .............................................................................. 239
14.22.1 All machine reference data ...................................................................................... 239
14.23 EOF file .................................................................................................... 240
14.23.1 EOF data .................................................................................................................. 240
14.24 Serial port communication file .................................................................. 241
14.24.1 Serial port communication file ................................................................................. 241
14.25 SIW file .................................................................................................... 242
14.25.1 All SIW .................................................................................................................... 242
14.25.2 One SIW data .......................................................................................................... 243
14.26 SOW file .................................................................................................. 244
14.26.1 All SOW .................................................................................................................. 244
14.26.2 One SOW data ........................................................................................................ 245

v
15. User program examples ................................................................ 246
15.1 Basic operation ......................................................................................... 246
15.1.1 Directly writing point data in program ..................................................................... 246
15.1.2 Using point numbers ................................................................................................ 247
15.1.3 Using shift coordinates ............................................................................................. 248
15.1.4 Palletizing ................................................................................................................ 249
15.1.4.1 Utilizing the shift coordinates .................................................................................... 249
15.1.4.2 Utilizing pallet movement .......................................................................................... 250
15.1.5 DI/DO (digital input and output) operation .............................................................. 252
15.2 Application ............................................................................................... 253
15.2.1 Pick and place between 2 points .............................................................................. 253
15.2.2 Palletizing ................................................................................................................ 255
15.2.3 Pick and place of stacked parts ................................................................................ 257
15.2.4 Parts inspection (Multi-tasking example) .................................................................. 259
15.2.5 Sealing ..................................................................................................................... 262
15.2.6 Connection to an external device through RS-232C (example 1) .............................. 263
15.2.7 Connection to an external device through RS-232C (example 2) .............................. 264

16. Sequence function ........................................................................ 265


16.1 Creating a sequence program ................................................................... 265
16.1.1 Programming method ............................................................................................... 265
16.1.2 Compiling ................................................................................................................ 266
16.2 Executing a sequence program ................................................................. 267
16.2.1 Sequence program STEP execution .......................................................................... 268
16.3 Creating a sequence program ................................................................... 268
16.3.1 Assignment statements used with sequence program ................................................ 268
16.3.2 Input/output variables used in sequence program ..................................................... 269
16.3.3 Timer definition statement ........................................................................................ 271
16.3.4 Logical operators used with sequence program ........................................................ 271
16.3.5 Priority of logic operations ....................................................................................... 272

17. Online commands ......................................................................... 273


17.1 Key operation ........................................................................................... 275
17.1.1 Changing the mode .................................................................................................. 275
17.1.2 AUTO mode operation ............................................................................................ 275
17.1.2.1 Program execution ..................................................................................................... 275
17.1.2.2 Setting a break point .................................................................................................. 276
17.1.2.3 Switching the execution task ...................................................................................... 277
17.1.3 MANUAL mode operation ....................................................................................... 277
17.1.3.1 Changing the MANUAL mode speed ......................................................................... 277
17.1.3.2 Absolute reset ............................................................................................................ 278
17.2 Utility operation ....................................................................................... 279
17.2.1 Acquiring the program execution status ................................................................... 279
17.2.2 Copy ........................................................................................................................ 279
17.2.2.1 Copying a program .................................................................................................... 279
17.2.2.2 Copying point data .................................................................................................... 280
17.2.2.3 Copying point comments ........................................................................................... 280
17.2.3 Erase ........................................................................................................................ 281
17.2.3.1 Erasing a program ...................................................................................................... 281
17.2.3.2 Erasing point data ...................................................................................................... 281
17.2.3.3 Erasing point comments ............................................................................................. 282
17.2.3.4 Erasing pallet data ...................................................................................................... 282
17.2.4 Rename .................................................................................................................... 283
17.2.5 Changing the attribute .............................................................................................. 283
17.2.6 Initialize ................................................................................................................... 284
17.2.6.1 Initializing the memory .............................................................................................. 284
17.2.6.2 Initializing the communication port ........................................................................... 285
17.2.7 Setting the display language ..................................................................................... 285
17.2.8 Setting the coordinates and units in MANUAL mode ................................................ 286
17.2.9 Clearing the MPB error message ............................................................................... 286

vi
17.2.10 Setting the UTILITY mode ........................................................................................ 287
17.2.10.1 Setting the access level .............................................................................................. 287
17.2.10.2 Setting the execution level ......................................................................................... 287
17.2.10.3 Setting the sequence program execution flag ............................................................. 288
17.2.10.4 Setting the SCARA robot hand system ........................................................................ 288
17.2.10.5 Resetting the internal emergency stop flag ................................................................. 289
17.3 Data handling ........................................................................................... 290
17.3.1 Acquiring the display language ................................................................................ 290
17.3.2 Acquiring the access level ........................................................................................ 290
17.3.3 Acquiring the arm status ........................................................................................... 291
17.3.4 Acquiring the break point status ............................................................................... 291
17.3.5 Acquiring the controller configuration status ............................................................ 292
17.3.6 Acquiring the execution level ................................................................................... 292
17.3.7 Acquiring the mode status ........................................................................................ 293
17.3.8 Acquiring the message ............................................................................................. 293
17.3.9 Acquiring return-to-origin status ............................................................................... 294
17.3.10 Acquiring the absolute reset status ........................................................................... 295
17.3.11 Acquiring the servo status ........................................................................................ 295
17.3.12 Acquiring the sequence program execution status .................................................... 296
17.3.13 Acquiring the speed setting status ............................................................................. 296
17.3.14 Acquiring the point coordinates and units ................................................................ 297
17.3.15 Acquiring the version information ............................................................................ 297
17.3.16 Acquiring the current positions ................................................................................ 298
17.3.16.1 Acquiring the current positions on pulse unit coordinates .......................................... 298
17.3.16.2 Acquiring the current positions on XY coordinates ..................................................... 298
17.3.17 Acquiring the tasks in RUN or SUSPEND status ....................................................... 299
17.3.18 Acquiring the tasks operation status ......................................................................... 299
17.3.19 Acquiring the shift status .......................................................................................... 300
17.3.20 Acquiring the hand status ......................................................................................... 300
17.3.21 Acquiring the remaining memory capacity ............................................................... 301
17.3.22 Acquiring the emergency stop status ........................................................................ 301
17.3.23 Acquiring the error status by self-diagnosis ............................................................... 302
17.3.24 Acquiring the option slot status ................................................................................ 303
17.3.25 Data readout processing ........................................................................................... 304
17.3.26 Data write processing ............................................................................................... 305
17.4 Executing the robot language independently ............................................ 306
17.4.1 Switching the program ............................................................................................. 306
17.4.2 Other robot language command processing ............................................................. 307
17.5 Control codes ........................................................................................... 307
17.5.1 Interrupting the command execution ........................................................................ 307

18. IO commands ............................................................................... 308


18.1 IO command format ................................................................................. 308
18.2 Sending and receiving IO commands ....................................................... 309
18.3 IO command list ....................................................................................... 310
18.4 IO command description .......................................................................... 311
18.4.1 MOVE command ...................................................................................................... 311
18.4.1.1 PTP designation .......................................................................................................... 311
18.4.1.2 Linear interpolation ..................................................................................................... 311
18.4.2 MOVEI command ..................................................................................................... 311
18.4.2.1 PTP designation .......................................................................................................... 311
18.4.3 Pallet movement command ...................................................................................... 312
18.4.3.1 PTP designation ......................................................................................................... 312
18.4.4 Jog movement command ......................................................................................... 312
18.4.5 Inching movement command ................................................................................... 313
18.4.6 Point teaching command ......................................................................................... 313
18.4.7 Absolute reset movement command ........................................................................ 314
18.4.8 Absolute reset command .......................................................................................... 314
18.4.9 Return-to-origin command ....................................................................................... 315

vii
18.4.10 Servo command ....................................................................................................... 315
18.4.11 Manual movement speed change command ............................................................ 316
18.4.12 Auto movement speed change command ................................................................. 316
18.4.13 Program speed change command ............................................................................ 316
18.4.14 Shift designation change command .......................................................................... 317
18.4.15 Hand designation change command ........................................................................ 317
18.4.16 Arm designation change command .......................................................................... 317
18.4.17 Point display unit designation command .................................................................. 317

Appendix ............................................................................................ 318


A. Reserved word list .......................................................................................... 318
B. Robot language lists ........................................................................................ 319

viii
1. The YAMAHA Robot Language

The YAMAHA robot language was developed by Yamaha Motor Co., Ltd. IM Company for simple
and efficient programming to control YAMAHA industrial robots. The YAMAHA robot language is
similar to BASIC (Beginner’s All-purpose Symbolic Instruction Code) and makes even complex
robot movements easy to program. This manual explains how to write robot control programs with
the YAMAHA robot language, including actual examples on how its commands are used.
2

1
2. Characters

The YAMAHA robot language uses the following characters and symbols.

Alphabetic characters
2 A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z

Numbers
0, 1, 2, 3, 4, 5, 6, 7, 8, 9

Symbols
( ) [ ] + - * / ^ = < > & | ~ _ % ! # $ : ; , . ” ’ @ ?

n Katakana
NOTE
(Japanese phonetic
katakana (Japanese phonetic characters)
characters) cannot be entered from the
MPB. Katakana can only be used when
communicating with a host computer
(if it handles katakana).

2
3. Program Names

Each program to be created in the robot controller must have its own name. The same program
name cannot be given to other programs. Program names can be up to 8 characters consisting of
a combination of alphanumeric characters and underscores ( _ ).

Functions and examples of program names having special meaning are shown below.
a) FUNCTION 2
b) SEQUENCE
c) _SELECT
d) COMMON

a) FUNCTION
Functions:
Pressing the USER key in “PROGRAM” mode or “MANUAL” mode allows the
user function to be used.
When used in “PROGRAM” mode, commands (MOVE, GOTO, etc.) frequently
used during program editing can be entered with the function keys.
When used in “MANUAL” mode, DO output is available with the function keys
without running the program.

Program example:
’ FOR MANUAL MODE
* M_F1:’DO(20)ALTERNATE
DO(20)=~DO(20)
* M_F2:’DO(21)ALTERNATE
DO(21)=~DO(21)
:
* M_F6:’DO(25)MOMENTARY
DO(25)=1
DO(25)=0
:
’ FOR PROGRAM MODE
* P_F1:’MOVE P,
* P_F6:’MOVE L,
* P_F2:’GOTO *
:

For more details, see the YAMAHA robot controller owner's manual.

3
3. Program Names

b) SEQUENCE
Functions:
As distinct from the robot programs, this program processes the robot input/output
(DI, DO, MO, LO, TO, SI, SO) signals in fixed cycles. The cycle is determined by
the program capacity.
Using this function allows the controller to operate as if it had a built-in PLC
(programmable logic controller).

Program example:
DO(20)=~DO(20)
DO(25)=DI(21) AND DI(22)
MO(26)=DO(26) OR DO(25)
:

For more details, see "16. Sequence function" in this manual.

4
3. Program Names

c) _SELECT
Functions:
The system will always select a certain program if available when the robot program
is reset. This function is for selecting a program by DI input and that program is
then always selected when reset.
Differences in processing by each type of reset:
· When reset from the teaching pendant, the system awaits a response to a query to
switch the program to “_SELECT”.
· When reset by the HALT command in a program, dedicated DI (reset signal) or online
command, the system switches to the “_SELECT” program.
· When the execution level is selected so that the program is reset at power ON, the
program resets when power is turned on and then switches to the “_SELECT”
program.

Program example:
A program is selected according to the value input from DI3( ).
When DI3( ) is 0, the system repeatedly monitors the DI input.
When DI3( ) is from 1 to 3, the matching program is selected.
When DI3( ) is other than the above cases, the system quits the program that is
currently running.

ON ERROR GOTO *ER1


*ST:
SELECT CASE DI3( )
CASE 0
GOTO *ST
CASE 1
SWI <PART1>
CASE 2
SWI <PART2>
CASE 3
SWI <PART3>

n· NOTE
CASE ELSE
GOTO *FIN
Using an ON ERROR statement END SELECT
allows running the program in a loop GOTO *ST
not ending in an error even without *FIN:
the program name specified by a SWI HALT
statement. *ER1:
· An error code issued during execution IF ERR=&H0303 THEN *NEXT_L
of the program is input into a variable ON ERROR GOTO 0
ERR. “ERR=&0303” means *NEXT_L:
“Program doesn’t exist”. RESUME NEXT

See the description of each command in this manual for details.

5
3. Program Names

d) COMMON
Functions:
Using two or more robot programs for the same processing is usually a waste of
programming area. So the COMMON program can be used to perform the same
task in multiple robot programs.

Program examples:
Program name: SAMPLE1
DECLARE SUB *DISTANCE(A!,B!,C!)
DECLARE *AREA
X!=2.5
Y!=1.2
CALL *DISTANCE(X!,Y!,REF C!)
GOSUB *AREA
PRINT C!,Z!
HALT

Program name: SAMPLE2


DECLARE SUB *DISTANCE(A!,B!,C!)
DECLARE *AREA
X!=5.5
Y!=0.2
CALL *DISTANCE(X!,Y!,REF C!)
GOSUB *AREA
PRINT C!,Z!
HALT

Program name: COMMON


SUB *DISTANCE(A!,B!,C!)
C!=SQR(A!^2+B!^2)
END SUB
*AREA:
Z!=X!*Y!
RETURN

See the description of each command in this manual for details.

6
4. Identifiers

The groups of characters used to express the names of labels, variables, procedures and so on are
referred to as “identifiers.”
Identifier length can be up to 16 characters composed of a combination of alphanumeric characters
and underscores ( _ ). Identifiers must begin with an alphabetic character. If an identifier exceeds
16 characters, the characters from the 17th on are ignored and deleted. A maximum of 500 identifiers
can be used.

Examples: LOOP, SUBROUTINE, GET_DATA

7
5. Command Statement Format
One robot language command must be written on a single line within 75 characters and
arranged in the format shown below:

n· NOTE
Items enclosed in [ ] can be omitted. [<label>:] <statement> [<operand>]
· Items enclosed in < > must be
written in a specific format.
· Items not enclosed in < > should be
written directly as shown.
· Items surrounded by | | are
selectable.
· Labels can be omitted from the
command. All labels must begin with
an asterisk ( * ) and end with a colon
( : ).
· Operands may be unnecessary for
some commands.
· Programs are executed in order from
top to bottom unless a branching
instruction is given.

8
6. Constants
Constants are basically classified as follows:
Character type Character string

Constants Binary constants


Integer type Decimal constants
Numeric type Hexadecimal constants

Real type Single-precision real numbers

6.1 Character constants


Character constants are character string data of up to 75 bytes surrounded by double
quotation marks ( ” ). Character strings may include upper case alphabetic characters,
numbers, symbols and katakana (Japanese phonetic characters). To include a double
quotation mark in a string, enter two double quotation marks in succession.

Examples:
”YAMAHA ROBOT”
”EXAMPLE OF””A”””
PRINT ”COMPLETED”
”YAMAHA ROBOT”

6.2 Numeric constants


6.2.1 Integer constants
1. Decimal constants
Integers from –1,073,741,824 to 1,073,741,823 may be used.

2. Binary constants
Unsigned binary numbers of 8 bits or less may be used. The prefix “&B” is attached
to the number to define it as a binary number.
&B0 (0) to &B11111111 (255)

3. Hexadecimal constants
Signed hexadecimal numbers of 32 bits or less may be used. The prefix “&H” is
attached to the number to define it as a hexadecimal number.
&H80000000 (–2,147,483,648) to &H7FFFFFFF (2,147,483,647)

6.2.2 Real constants


1. Single-precision real numbers
Real numbers from -999999.9 to +999999.9 may be used (7 digits including integers
and decimals). For example, “.0000001” may be used.

2. Single-precision real numbers in exponent form


Numbers from -1.0*1038 to +1.0*1038 may be used. Mantissas should be 7 digits or
less, including integers and decimals.

Examples:
-1.23456E-12
3.14E0
1.E5

9
7. Variables
Variables are classified as follows:
Character Character Character string variables
type string variables
Dynamic
variables
Simple Numeric Arithmetic Integer variables
variables type variables Real variables (single-precision)
Variable

Static Numeric Arithmetic Integer variables


variables type variables
Real variables (single-precision)

Character Character Character string array variables


type string array
Array Dynamic variables
variables arrays
Numeric Arithmetic Integer array variables
type array variables
Real number array variables
(single-precision)
Input-output Input variables
variables
Output variables
Point data variables
Shift coordinate variables
Element variables Point element variables
Shift element variables

Variables with the same names as reserved words and variables starting with FN, DIn,
DOn, MOn, LOn, TOn, SIn, SOn, Pn, Sn or Hn (n=numerical value) cannot be used.

Examples:
COUNT ............. permitted
ABS .................... not permitted
FNAME ............. not permitted
S91 ..................... not permitted

The type of variable is specified by the type declaration character attached at the end of
the variable name. If no type declaration character is attached, the variable is viewed as a
real type.
$ (Character type)
Type declaration characters % (Integer type)
! (Real type)

Examples:
CNT0% ................................. Integer variable
CNT1 .................................... Real variable
STR1$ ................................... Character variable
ACT%(1) .............................. Integer array

Names of static variables are predetermined as follows:


Integer type ....... S G I n (n: 0 to 7)
Real type ........... S G R n (n: 0 to 7)

10
7. Variables

7.1 Valid range of variables


7.1.1 Valid range of dynamic variables
Dynamic variables are classified into global variables and local variables according to
their declaration position in the program.
• Dynamic global variables are declared outside of sub-procedures (outside of
program areas enclosed by a SUB statement and END SUB statement).
• Dynamic local variables are declared within sub-procedures and are valid only in
these sub-procedures.

7.1.2 Valid range of static variables


Static variables are always valid in the entire program regardless of program statements.

7.1.3 Valid range of dynamic array variables


Dynamic array variables are classified into global array variables and local array variables
according to their declaration position in the program.
• Dynamic global array variables are declared outside of sub-procedures (outside of
program areas enclosed by a SUB statement and END SUB statement).
• Dynamic local array variables are declared within sub-procedures and are valid
only in these sub-procedures.

An array variable can express multiple elements. The elements of an array can be integers
or subscript expressions following the variable name (see below). The length of an array
variable is defined by the DIM statement. The actual number of array elements will be the
DIM statement subscript number plus 1, as subscripts begin with 0.

Format :

<variable name> [ % ] (<expression>, [<expression>, <expression>] )


!
$

Examples:
C%(2) ........................ Integer variable
N!(1,2) ...................... Real variable
R1$(A) ...................... Character variable

The length of an array variable that can be declared with the DIM statement depends on
the program size.

11
7. Variables

7.2 Character variables


Character variables and character array elements can handle a character string of up to 75
characters. Character strings may include alphabetic characters, numbers, symbols and
katakana (Japanese phonetic characters).

Examples:
R1$ = “YAMAHA“
R2$(2) = R1$ + “ MOTOR“

7.3 Numeric variables


n Integers
NOTE
from -1,073,741,824 to
1,073,741,823 can be expressed in 7.3.1 Integer variables
signed hexadecimal numbers from
&HC0000000 to &H3FFFFFFF. Integer variables and integer array elements can handle an integer from –1,073,741,824
to 1,073,741,823.

Examples:
R1% = 10
R2%(2) = R1% + 10000

7.3.2 Real variables


Real variables and real array elements can handle a real number from –1.0*1038 to 1.0*1038.

Examples:
R1! = 10.31
R2!(2)= R1% + 1.98E3

7.4 Array variables


An array variable can be used to reference multiple elements. Each element in an array is
referenced by its index or subscript in <expression> (see below). The length of an array
variable is declared by using the DIM statement. The actual number of elements will be
the number of the DIM statement subscripts plus 1, as subscripts begin with 0. The
subscripts can be used in up to three dimensions. All arrays are dynamic variables.

Format :

<variable name> [ % ] (<expression>, [<expression>, <expression>] )


!
$

n The
NOTE
length of an array variable that Examples:
can be declared with the DIM A%(1) .......................................................... Integer array variable
statement depends on the program size. DATA!(1,10,3) ............................................. Single-precision real number array variable
STRING$(10) .............................................. Character array variable

12
7. Variables

7.5 Clearing variables


7.5.1 Clearing dynamic variables
In the cases below, numeric variables are cleared to zero, and character variables are
cleared to a null string. Array variables are cleared in the same way.

■ When the program was edited in PROGRAM mode.


■ When the program was switched.
■ When compiling was performed in PROGRAM mode.
■ When the program was compiled in AUTO mode.
■ When the program was reset in AUTO mode.
■ When dedicated input signal DI15 (program reset input) was turned on while the
program was stopped in AUTO mode.
■ When either of the following was initialized in SYSTEM mode.
1. Program memory (SYSTEM>INIT>MEMORY>PROGRAM)
2. Entire memory (SYSTEM>INIT>MEMORY>ALL)
■ When the SWI command was executed in AUTO mode.
■ When any of the following online commands was executed.
c Definitions
CAUTION
of dynamic variables are
@RESET, @INIT PGM, @INIT MEM, @INIT ALL, @SWI
cleared when the program was edited ■ When the SWI statement was executed in the program.
in PROGRAM mode.
■ When the HALT statement was executed in the program.

7.5.2 Clearing static variables


In the cases below, integer variables and real variables are cleared to zero.

■ When the following was initialized in SYSTEM mode.


Entire memory (SYSTEM>INIT>MEMORY>ALL)
■ When any of the following online commands was executed.
@INIT MEM, @INIT ALL

13
8. Other Variables

c InCAUTION
controllers whose software version
1. Point data variable
This variable specifies a point data number with a numeric constant or expression. A
is earlier than V8.28, point numbers
from 0 to 4000 can be specified with
point data number is expressed with a “P” followed by a number of 4 digits or less, or an
point variables. expression surrounded by brackets ( [ ] ).
Point numbers from 0 to 9999 can be specified with point variables.

Format :

Pnnnn or P ”[”<expression>”]”

n = 0 to 9

Each bracket in quotation marks (" ") must be written. (Brackets are not used to indicate
an item that may be omitted.)

Examples:
P0,P110
P[A],P[START_POINT],P[A(10)]

2. Shift coordinate variable


This variable specifies a shift coordinate number with a numeric constant or expression.
A shift coordinate number is expressed with an “S” followed by a 1-digit number or an
expression surrounded by brackets ( [ ] ).

Format :

Sn or S ”[”<expression>”]”

n = 0 to 9

Each bracket in quotation marks (" ") must be written. (Brackets are not used to indicate
an item that may be omitted.)

Examples:
S1
S[A],S[BASE],S[A(10)]

3. Point element variable


This variable handles point data for each axis and hand system flag.

Format :
c Hand
CAUTION
system flags are enabled only
LOCx

when the software version is V8.08 or LOCx (<point expression>)


later.

x : X, Y, Z, R, A, B (axis definition), F (hand system flag definition)


n The
NOTE
hand system flag is enabled when
the point data unit is set to the "mm" Examples:
units. A(1)=LOCX(P10)
Note that the hand system flag is ----------- The X-axis data of P10 is assigned to array variable A(1).
enabled only for the SCARA robot. LOCZ(P[A])=100.0
The hand system flag value may be 0 ----------- The Z-axis data of P[A] is set to 100.0.
(no designation), 1 (right-handed LOCF(P100)=1
system) or 2 (left-handed system).
----------- Sets the P100 hand system flag to RIGHTY (a right-handed
system).
(The P100 point data must be in "mm" units.)

14
8. Other Variables

4. Shift element variable


This variable is used with shift data for each element.

Format :

LOCx (<shift expression>)

x : X, Y, Z, R

Examples:
A(1)=LOCX(S1)
----------- The X data of S1 is assigned to array variable A(1).
LOCR(S[A])=45.0
----------- The R data of S[A] is set to 45.0°.

5. Parallel input variable


This variable is used to indicate the status of parallel input signals.

Format 1:

DIm ( [b, · · ·, b] )

m : port number 0 to 7, 10 to 17, 20 to 27


b : bit definition 0 to 7
If the bit definition is omitted, bits 0 to 7 are all selected.

Format 2:

DI ( mb, · · ·, mb )
n Bits must be specified in ascending
NOTE

order from the right. m : port number 0 to 7, 10 to 17, 20 to 27


A “0” is entered if there is no actual b : bit definition 0 to 7
input board.
Examples:
A%=DI1()
----------- Input status of ports DI(17) to DI(10) is assigned to variable
A%.
A%=DI5(7,4,0)
----------- Input status of DI(57), DI(54) and DI(50) is assigned to
variable A%.
(If all above signals are 1(ON), then A%=7.)
A%=DI(27,15,10)
----------- Input status of DI(27), DI(15) and DI(10) is assigned to
variable A%.
(If all above signals except DI(10) are 1 (ON), then A%=6.)

15
8. Other Variables

6. Parallel output variable


This variable is used to specify the parallel output signals and indicate the output status.

Format 1:

DOm ( [ b, · · ·, b ] )

m : port number 0 to 7, 10 to 17, 20 to 27


b : bit definition 0 to 7
If the bit definition is omitted, bits 0 to 7 are all selected.

Format 2:

n Bits
NOTE
must be specified in ascending
DO ( mb, · · ·, mb )

order from the right. m : port number 0 to 7, 10 to 17, 20 to 27


External output is unavailable if there
is no output board. b : bit definition 0 to 7

Examples:
A%=DO2()
----------- Output status of DO(27) to DO(20) is assigned to variable
A%.
A%=DO5(7,4,0)
----------- Output status of DO(57), DO(54) and DO(50) is assigned to
variable A%.
(If all above signals are 1(ON), then A%=7.)
A%=DO(37,25,20)
----------- Output status of DO(37), DO(25) and DO(20) is assigned to
variable A%.
(If all above signals except DO(20) are 1 (ON), then A%=6.)

16
8. Other Variables

7. Internal output variable


This variable is used to exchange signals with a sequence program.
The contents of this variable can be changed and referred to as needed.
Ports 0 and 1 are used for dedicated internal output variables that can only be referred to.
1) Port 0 indicates the status of origin sensors for axes 1 to 8 (in order from bit 0).
Each bit sets to “1” when the origin sensor turns ON, and to “0” when OFF.
2) Port 1 indicates the HOLD status of axes 1 to 8 (in order from bit 0).
Each bit sets to “1” when the axis is in HOLD status, and to “0” when not.
Being in HOLD status means that the axis movement is stopped and positioned
within the target point tolerance while the servo is still turned ON.
When the servo turns OFF, the HOLD status is released.
Axes not being used are set to “1”.

Format 1:

MOm ( [ b, · · ·, b ] )

m : port number 0 to 7, 10 to 17, 20 to27


b : bit definition 0 to 7
If the bit definition is omitted, bits 0 to 7 are all selected.

Format 2:

n Bits
NOTE
must be specified in ascending MO ( mb, · · ·, mb )
order from the right.
m : port number 0 to 7, 10 to 17, 20 to 27
b : bit definition 0 to 7

Examples:
A=MO2 ()
----------- Internal output status of MO(27) to MO(20) is assigned to
variable A.
A=MO5(7,4,0)
----------- Internal output status of MO(57), MO(54) and MO(50) is
assigned to variable A.
(If all above signals are 1 (ON), then A=7.)
A=MO(37,25,20)
----------- Internal output status of MO(37), MO(25) and MO(20) is
assigned to variable A.
(If all above signals except MO(25) are 1 (ON), then A=5.)

17
8. Other Variables

8. Arm lock output variable


This variable is used to prohibit axis movement.
The contents of this variable can be output and referred to as needed.
There is only 1 port, and bits 0 to 7 respectively correspond to axes 1 to 8.
When this variable is ON, movement on the corresponding axis is prohibited.

Format 1:

LOm ( [ b, · · ·, b ] )

m : port number 0
b : bit definition 0 to 7
If the bit definition is omitted, bits 0 to 7 are all selected.

Format 2:
n Bits
NOTE
must be specified in ascending LO ( mb, · · ·, mb )
order from the right.

m : port number 0
b : bit definition 0 to 7

Examples:
A%=LO0()
----------- Arm lock status of LO(07) to LO(00) is assigned to variable
A%.
A%=LO0(7,4,0)
----------- Arm lock status of LO(07), LO(04) and LO(00) is assigned
to variable A%.
(If all above signals are 1 (ON), then A%=7.)
A%=LO0(06,04,01)
----------- Arm lock status of LO(06), LO(04) and LO(01) is assigned
to variable A%.
(If all above signals except LO(01) are 1 (ON), then A%=6.)

18
8. Other Variables

9. Timer output variable


This variable is used in the timer function of a sequence program.
The contents of this variable can be changed and referred to as needed.
Timer function can be used only in the sequence program. If this variable is output in a
normal program, it is an internal output like the MO variable.

Format 1:

TOm ( [ b, · · ·, b ] )

m : port number 0
b : bit definition 0 to 7
If the bit definition is omitted, bits 0 to 7 are all selected.

Format 2:
n Bits must be specified in ascending
NOTE

order from the right.


TO ( mb, · · ·, mb )

m : port number 0
b : bit definition 0 to 7

Examples:
A%=TO0()
----------- Status of TO(07) to TO(00) is assigned to variable A%.
A%=TO0(7,4,0)
----------- Status of TO(07), TO(04) and TO(00) is assigned to variable
A%.
(If all above signals are 1 (ON), then A%=7.)
A%=TO(06,04,01)
----------- Status of TO(06), TO(04) and TO(01) is assigned to variable
A%.
(If all above signals except TO(01) are 1 (ON), then A%=6.)

19
8. Other Variables

10. Serial input variable


This variable is used to indicate the status of serial input signals.

Format 1:

SIm ( [ b, · · ·, b ] )

m : port number 0 to 7, 10 to 17, 20 to 27


b : bit definition 0 to 7
If the bit definition is omitted, bits 0 to 7 are all selected.

Format 2:
n Bits
NOTE
must be specified in ascending
order from the right. SI ( mb, · · ·, mb )
A “0” is entered if there is no actual
serial board.
m : port number 0 to 7, 10 to 17, 20 to 27
b : bit definition 0 to 7

Examples:
A%=SI1()
----------- Input status of ports SI(17) to SI(10) is assigned to variable
A%.
A%=SI5(7,4,0)
----------- Input status of SI(57), SI(54) and SI(50) is assigned to variable
A%.
(If all above signals are 1(ON), then A%=7.)
A%=SI(27,15,10)
----------- Input status of SI(27), SI(15) and SI(10) is assigned to variable
A%.
(If all above signals except SI(10) are 1 (ON), then A%=6.)
WAIT SI(21)=1
----------- Waits until SI(21) sets to 1 (ON).

20
8. Other Variables

11. Serial output variable


This variable is used to define the serial output signals and indicate the output status.

Format 1:

SOm ( [ b, · · ·, b ] )

m : port number 0 to 7, 10 to 17, 20 to 27


b : bit definition 0 to 7
If the bit definition is omitted, bits 0 to 7 are all selected.

Format 2:
n Bits
NOTE
must be specified in ascending
order from the right. SO ( mb, · · ·, mb )
External output is unavailable if there
is no serial board.
m : port number 0 to 7, 10 to 17, 20 to 27
b : bit definition 0 to 7

Examples:
A%=SO2()
----------- Output status of SO(27) to SO(20) is assigned to variable
A%.
A%=SO5(7,4,0)
----------- Output status of SO(57), SO(54) and SO(50) is assigned to
variable A%.
(If all above signals are 1(ON), then A%=7.)
A%=SO(37,25,20)
----------- Output status of SO(37), SO(25) and SO(20) is assigned to
variable A%.
(If all above signals except SO(25) are 1 (ON), then A%=5.)

21
8. Other Variables

c Serial
CAUTION
word input is enabled only
12. Serial word input
This variable indicates the status of the serial input word information.
when the software version is V8.08 or
later.
Format 1:

2 n The
NOTE
information is handled as SIW (m)
unsigned word data.
0 is input if the serial board does not m : Port No. 2 to 15
actually exist.
The acquisition range is 0 (&H0000) to 65535 (&HFFFF).

Example:
A%=SIW (2)
----------- The input state from SIW (2) is assigned to variable A%.
A%=SIW (15)
----------- The input state from SIW (15) is assigned to variable A%.

c Serial
CAUTION
double word input is enabled
13. Serial double word input
This variable indicates the state of the serial input word information as a double word.
only when the software version is
V8.08 or later.
Format 1:

n The
NOTE
information is handled as signed
SID (m)
double word data.
0 is input if the serial board does not m : Port No. 2, 4, 6, 8, 10, 12, 14
actually exist. The acquisition range is -1073741824 (&HC0000000) to 1073741823 (&H3FFFFFFF).
An error will occur if the value is not
within the acquisition range
(&H80000000 to &HBFFFFFFF, Example:
&H40000000 to &H7FFFFFFF.) A%=SID (2)
----------- The input state from SIW (2) , SIW (3) is assigned to variable
A%.
A%=SID (14)
----------- The input state from SIW (14), SIW (15) is assigned to
variable A%.

22
8. Other Variables

c Serial
CAUTION
word output is enabled only
14. Serial word output
This variable outputs the serial output word information, and indicates the output status.
when the software version is V8.08 or
later.
Format 1:

n The
NOTE
information is handled as SOW (m) 2
unsigned word data.
If a serial board does not actually m : Port No. 2 to 15
exist, the information is not output The output range is 0 (&H0000) to 65535 (&HFFFF).
externally.
If a value exceeding the output range Note that if a negative value is output, the low-order word information will be output after
is assigned, the low-order 2-byte being converted to hexadecimal.
information is output.
Example:
A%=SOW (2)
----------- The output status from SOW (2) is assigned to variable A%.
SOW (15)=A%
----------- The contents of variable A% are assigned in SOW (15).
If the variable A% value exceeds the output range, the low-
order word information will be assigned.
SOW (15)=-255
----------- The contents of -255 (&HFFFFFF01) are assigned to SOW
(15).
-255 is a negative value, so the low-order word information
(&HFF01) will be assigned.

c Serial
CAUTION
double word output is enabled
15. Serial double word output
This variable outputs the serial output word information status as a double word, and
only when the software version is indicates the output status.
V8.08 or later.

Format 1:

n The
NOTE
information is handled as signed SOD (m)
double word data.
If a serial board does not actually m : Port No. 2, 4, 6, 8, 10, 12, 14
exist, the information is not output The output range is -1073741824 (&HC0000000) to 1073741823 (&H3FFFFFFF).
externally.
An error will occur if the value is not Note that if a negative value is output, the low-order word information will be output after
within the output range (&H80000000 being converted to hexadecimal.
to &HBFFFFFFF, &H40000000 to
&H7FFFFFFF.) Example:
A%=SOD (2)
----------- The input status from SOW (2), SOW (3) is assigned to
variable A%.
SOD (14)=A%
----------- The contents of variable A% are assigned in SOD (14).

23
9. Expressions and Operations

9.1 Arithmetic operations


9.1.1 Arithmetic operators
^ Exponent operation
- Minus sign
*, / Multiplication and division
+, - Addition and subtraction
MOD Remainder

When the values used in remainder calculations are real numbers, they are converted into
integers (all decimal fractions are truncated) and the calculation is then performed with
the integers. The result is the remainder of a division operation using the integers.

Examples:
A=15 MOD 2
----------- This becomes: A=1 (15/2 = 7 .... 1)
A=17.34 MOD 5.98
----------- This becomes: A=2 (17/5 = 3 .... 2)

9.1.2 Relational operators

n The
NOTE
expected result might not always
= Equal to
<>, >< Not equal to
be maintained if equivalent relational
operators were used with real < Less than
variables or real array variables. > Greater than
Examples:
A=2 <=, =< Less than or equal to
B = SQR (A!) >=, => Greater than or equal to
IF A! = B!*B ! THEN
:
In this case, A! will be unequal to Relational operators are used to compare 2 values. If the result is true, a “-1” is obtained.
B!*B!. If it is false, a “0” is obtained.

Example:
A=10>5
----------- Since 10 > 5 is true, A = -1.

24
9. Expressions and Operations

9.1.3 Logic operations


NOT, ~ Logical NOT
AND, & Logical AND
OR, | Logical OR
XOR Exclusive OR

Logic operators are used to manipulate 1 or 2 values bit by bit. For example, the status of
an I/O port can be manipulated. Depending on the logic operation performed, the results
generated are either “0” or “1”. Logic operations with real numbers convert the values
into integers before they are executed.

Examples:
A%=NOT 13.05
----------- Each bit of 13 is reversed, and the result “–14” is assigned to
A%.
A%=3 AND 10
----------- The logical product of 3 and 10 is calculated (“1” is obtained
when both bits are “1”), and the result is assigned to A%, so
A% becomes 2.
A%=3 OR 10
----------- The logical sum of 3 and 10 is calculated (“1” is obtained
when either bit is “1”), and the result is assigned to A%, so
A% becomes 11.
A%=3 XOR 10
----------- The exclusive OR of 3 and 10 is calculated (“1” is obtained
when both bits are different from each other), and the result
is assigned to A%, so A% becomes 9.

9.1.4 Priority of arithmetic operation


1. Expressions included in parentheses
2. Functions, variables
3. ^ (exponents)
4. Independent “+” and “-” signs (monominal operators)
5. * (multiplication), / (division)
6. MOD
7. + (addition), - (subtraction)
8. Relational operators
9. NOT, ~ (Logical NOT)
10. AND, & (logical AND)
11. OR, |, XOR (Logical OR, exclusive OR)

Operations are performed in the above order of priority. When two operations of equal
priority appear in the same statement, the operations are executed in order from left to
right.

25
9. Expressions and Operations

9.1.5 Data format conversion


Data format is converted in cases where two values of different formats are involved in
the same operation.

1) When a real number is assigned to an integer, decimal places are rounded off.
Example: A %=125.67 ------------- A% = 126
2) When integers and real numbers are involved in the same operation, the result
becomes a real number.
Example: A (0) =125* 0.25 ------- A (0) =31.25
3) When an integer is divided by an integer, the result is an integer.
Example: A (0) =100/3 ------------- A (0) = 33

9.2 Character string operations


9.2.1 Character string connection
Character strings may be combined by using the “+” sign.

Examples:
A$=”YAMAHA”
B$=”ROBOT”
C$=”LANGUAGE”
D$=”MOUNTER”
E$=A$+” ”+B$+” ”+C$
F$=A$+” ”+D$
PRINT E$
PRINT F$

Results: YAMAHA ROBOT LANGUAGE


YAMAHA MOUNTER

9.2.2 Character string comparison


Characters can be compared with the same relational operators as used for numeric values.
In the case of character strings, the comparison is performed from the beginning of each
string, character by character. If all characters match in both strings, they are considered
to be equal. Even if only one character in the string differs from its corresponding character
in the other string, then the string with the larger (higher) character code is treated as the
larger string.
If one string is shorter than the other, it is judged to be the string of lesser value.

All examples below are “true”.

Examples:
”AA”<”AB”
”X&”>”X #”
”DESK"<”DESKS”

Character string comparison can be used to find out the contents of character strings, or to
sort character strings into alphabetical order.

26
9. Expressions and Operations

c InCAUTION
controllers whose software version
9.3 Point data format
is earlier than V8.28, the range of There are two types of point data formats: joint coordinate format and Cartesian coordinate
point numbers is from 0 to 4000.
format.
Point numbers are in the range of 0 to 9999.

9.3.1 Joint coordinate format


± n n n n n n n (same for X, Y, Z, R, A, B axes)
This is a decimal integer constant of 7 digits or less with a plus or minus sign, and can be
specified from –6144000 to 6144000. (Unit: pulses)

9.3.2 Cartesian coordinate format


± n n n . n n to ± n n n n n n n. (same for X, Y, Z, R, A, B axes)
This is a decimal fraction of a total of 7 digits including 2 or less decimal places. (Unit:
n Plus
NOTE
(+) signs can be omitted.
mm or degrees)
When setting an extended hand system flag for SCARA robots, set either 1 or 2 at the end
c Hand
CAUTION
system flags are enabled only
of the data. If a value other than 1 or 2 is set, or if no value is designated, 0 will be set to
indicate that no hand system flag is set.
when the software version is V8.08 or 1: RIGHTY (right-handed system) 2: LEFTY (left-handed system)
later.

9.4 DI/DO conditional expressions


DI/DO conditional expressions may be used to set conditions for WAIT statements and
STOPON options in MOVE statements. Numeric constants, variables and arithmetic
operators that may be used with DI/DO conditional expressions are shown below.

a. Constant
Decimal integer constant, binary integer constant, hexadecimal integer constant
b. Variables
Global integer type, global real number type, input/output type
c. Operators
Relational operators, logic operators
d. Operation priority
1. Relational operators
2. NOT, ~
3. AND, &
4. OR, |, XOR

Example:
WAIT DI(31)=1 OR DI(34)=1
----------- The program waits until either DI31 or DI34 turns ON.

27
10. Multiple Robot Control

10.1 Overview
The YAMAHA robot controller can be used to control multiple robots.
The multitask function also enables multiple robots to move asynchronously. To use this
function, settings for two robots or settings for auxiliary axes must be made in the system
prior to shipment.

A robot axis is classified into one of the groups below.


Main group (4 axes)
Main group (2 axes) + sub group (2 axes)

A main group is composed of one main robot and main auxiliary axes, and a sub group is
composed of one sub robot and sub auxiliary axes.
When using one robot without auxiliary axis, settings are made only for the main group
robot.
When no settings have been made for main auxiliary axes and sub auxiliary axes, the
main group is composed only of the one main robot, and the sub group is composed only
of the one sub robot.
Main group Main robot (Number of axes: 1 to 4)
(Number of axes: Main auxiliary axis (Number of axes: 1 to 4)
1 to 4)

Sub group Sub robot (Number of axes: 1 or 2)


(Number of axes: Sub auxiliary axis (Number of axes: 1 or 2)
1 or 2)

28
10. Multiple Robot Control

10.2 Command list for each group


n1. The
NOTE
MOVE (MOVE2) and MOVEI
The special commands and functions for robot movement and coordinate control are shown
below.
(MOVEI2) commands are used to
move a main robot (a sub robot). Classification Main group Sub group
Robot movement DRIVE, DRIVEI, MOVE, MOVEI, DRIVE2, DRIVEI2, MOVE2,
An axis specified as an auxiliary axis
cannot be moved with the MOVE PMOVE, SERVO, WAIT ARM MOVEI2, PMOVE2, SERVO2,
(MOVE2), MOVEI (MOVEI2) and WAIT ARM2
PMOVE (PMOVE2) commands. Use Coordinate control CHANGE, HAND, LEFTY/RIGHTY, CHANGE2, HAND2,
the DRIVE (DRIVE2) or DRIVEI
(DRIVEI2) command to move it. SHIFT LEFTY2/RIGHTY2, SHIFT2
Status change ACCEL, ARCH, ASPEED, ACCEL2, ARCH2, ASPEED2,
2. Linear interpolation or circular AXWGHT, DECEL, ORGORD, AXWGHT2, DECEL2, ORGORD2,
interpolation using the MOVE
statement can only be executed with OUTPOS, SPEED, TOLE, OUTPOS2, SPEED2, TOLE2,
task 1 (main task) or direct command. WEIGHT. WEIGHT2
3. PTP control is possible with the Point operation JTOXY, WHERE, XYTOJ JTOXY2, WHERE2, XYTOJ2
MOVE2 statement. Linear
interpolation and circular Parameter change ACCEL, ARCH, AXWGHT, ACCEL2, ARCH2, AXWGHT2,
interpolation are inoperable. DECEL, ORGORD, OUTPOS, DECEL2, ORGORD2, OUTPOS2,
4. When specifying all axes with the TOLE, WEIGHT TOLE2, WEIGHT2
SERVO or SERVO2 command, the
servos of all axes in the main group
and sub group can be switched ON or
OFF.

29
11. Command Statements

ABSRST statement

Format:

ABSRST

Explanation:
This statement executes return-to-origin along the robot absolute motor axes. Return-to-
origin will fail if the robot stops en route.
In the case of two-robot setting, first the main robot group return-to-origin is run, then sub
n· NOTE
This command applies to axes whose
robot group run and finally absolute reset performed.

return-to-origin method is not Example:


specified as “MARK”. ABSRST
· This command cannot be executed if
return-to-origin is incomplete for an
----------- Performs return-to-origin along absolute motor axes.
axis whose return-to-origin method is
specified as “MARK”. Related commands: ORIGIN, ORGORD, ORGORD2, MCHREF, MCHREF2

30
11. Command Statements

ACCEL statement
(Acceleration setting statement for main group)

Format 1:
2
ACCEL <expression>

Format 2:

ACCEL (<expression 1>) = <expression 2>

The value of <expression 1> must be from 1 to 6 (axis number).


The value of <expression> and <expression 2> must be from 1 to 100. (Unit: %)

n· NOTE
This command changes the
Explanation:
This statement changes the acceleration coefficient of the main group parameters to the
acceleration parameters for the main value specified in <expression>.
axes and auxiliary axes of the robot. Format 1 changes all axes in the main group. Format 2 changes the acceleration coefficient
· If an axis that is set to “no axis” in
the system generation is specified, of the axis specified in <expression 1> to the value specified in <expression 2>.
then an error message “Specification
mismatch” appears and execution of Example:
the command will stop. A=50
ACCEL A
ACCEL(3)=100
’CYCLE WITH INCREASING ACCELERATION
FOR A=10 TO 100 STEP 10
ACCEL A
MOVE P,P0
MOVE P,P1
NEXT A
HALT “END TEST”

31
11. Command Statements

ACCEL2 statement
(Acceleration setting statement for sub group)

Format 1:
2
ACCEL2 <expression>

Format 2:

ACCEL2 (<expression 1>) = <expression 2>

n· This
NOTE
statement can be used only when
The value of <expression 1> must be from 1 to 4 (axis number).
The value of <expression> and <expression 2> must be from 1 to 100. (Unit: %)
the sub group is set in the system
generation.
· If an axis that is set to “no axis” in Explanation:
the system generation is specified, This command changes the acceleration coefficient of the sub group parameter to the
then an error message “Specification value specified in <expression>.
mismatch” appears and execution of
the command will stop.
Format 1 changes all axes in the sub group. Format 2 changes the acceleration coefficient
of the axis specified in <expression 1> to the value specified in <expression 2>.

Example:
A=50
ACCEL2 A
ACCEL2(3)=100
’CYCLE WITH INCREASING ACCELERATION
FOR A=10 TO 100 STEP 10
ACCEL2 A
MOVE2 P,P0
MOVE2 P,P1
NEXT A
HALT “END TEST”

32
11. Command Statements

ARCH statement
(Arch position setting statement for main group)

Format 1:
2
ARCH <expression>

Format 2:

ARCH (<expression 1>) = <expression 2>

The value of <expression 1> must be from 1 to 6 (axis number).


The value of <expression> and <expression 2> must be from 1 to 6144000. (Unit: pulses)

n IfNOTE
an axis that is set to “no axis” in the
Explanation:
This statement changes the arch position parameter for the main group to the value specified
system generation is specified, then an in <expression>. Format 1 changes all axes of the main group. Format 2 changes the arch
error message “Specification position parameter for the axis specified in <expression 1> to the value specified in
mismatch” appears and execution of
the command will stop. <expression 2>.

Example:
’CYCLE WITH INCREASING ARCH POSITION
DIM SAV(3)
GOSUB *SAVE_ARCH
FOR A=1000 TO 10000 STEP 1000
GOSUB *CHANGE_ARCH
MOVE P,P0,Z=0
DO3(0)=1 --------- Chuck (or gripper) closes.
MOVE P,P1,Z=0
DO3(0)=0 --------- Chuck (or gripper) opens.
NEXT A
GOSUB *RESTORE_ARCH
HALT
*CHANGE_ARCH:
FOR B=1 TO 4
ARCH(B)=A
NEXT B
RETURN
*SAVE_ARCH:
FOR B=1 TO 4
SAV(B-1)=ARCH(B)
NEXT B
RETURN
*RESTORE_ARCH:
FOR B=1 TO 4
ARCH(B)=SAV(B-1)
NEXT B
RETURN

33
11. Command Statements

ARCH2 statement
(Arch position setting statement for sub group)

Format 1:
2
ARCH2 <expression>

Format 2:

ARCH2 (<expression 1>) = <expression 2>

n· NOTE
This statement can be used only when
The value of <expression 1> must be from 1 to 4 (axis number).
The value of <expression> and <expression 2> must be from 1 to 6144000. (Unit: pulses)
the sub group is set in the system
generation.
· If an axis that is set to “no axis” in Explanation:
the system generation is specified, This statement changes the arch position parameter for the sub group to the value specified
then an error message “Specification in <expression>. Format 1 changes all axes of the sub group. Format 2 changes the arch
mismatch” appears and execution of
the command will stop.
position parameter for the axis specified in <expression 1> to the value specified in
<expression 2>.

Example:
’CYCLE WITH INCREASING ARCH POSITION
DIM SAV(3)
GOSUB *SAVE_ARCH
FOR A=1000 TO 10000 STEP 1000
GOSUB *CHANGE_ARCH
MOVE2 P,P0,Z=0
DO3(0)=1 --------- Chuck (or gripper) closes.
MOVE2 P,P1,Z=0
DO3(0)=0 --------- Chuck (or gripper) opens.
NEXT A
GOSUB *RESTORE_ARCH
HALT
*CHANGE_ARCH:
FOR B=1 TO 4
ARCH2(B)=A
NEXT B
RETURN
*SAVE_ARCH:
FOR B=1 TO 4
SAV(B-1)=ARCH2(B)
NEXT B
RETURN
*RESTORE_ARCH:
FOR B=1 TO 4
ARCH2(B)=SAV(B-1)
NEXT B
RETURN

34
11. Command Statements

ASPEED statement
(Automatic movement speed setting statement for main group)

Format:
2
ASPEED <expression>

n· NOTE
This statement changes all the
The value of <expression> must be from 1 to 100. (Unit: %)

movement speed parameters for the Explanation:


main axes and auxiliary axes of the
This statement changes the automatic movement speed for the main group to the value
robot.
· Robot operating speed is determined specified in <expression>.
by the product of the automatic
movement speed (specified by the Example:
MPB or ASPEED command) and the SPEED 70
program speed (specified by the ASPEED 100
SPEED command). MOVE P,P0
Example: ----------- Moves at 70% (=100*70) of maximum speed from the current
When the automatic movement speed
is 80% and the program speed set by
position to P0.
the SPEED command is 50%, then: ASPEED 50
Robot operating speed = 80%*50% = MOVE P,P1
40% ----------- Moves at 35% (=50*70) of maximum speed from the current
position to P1.
MOVE P,P2,S=10
----------- Moves at 5% (=50*10) of maximum speed from the current
position to P2.
HALT

Related commands: ASPEED2, SPEED, SPEED2

35
11. Command Statements

ASPEED2 statement
(Automatic movement speed setting statement for sub group)

Format:
2
ASPEED2 <expression>

n· NOTE
This command changes all the
The value of <expression> must be from 1 to 100. (Unit: %)

movement speed parameters for the Explanation:


main axes and auxiliary axes of the This statement changes the automatic movement speed for the sub group to the value
robot.
· Robot operating speed is determined specified in <expression>.
by the product of the automatic
movement speed (specified by the Example:
MPB or ASPEED2 command) and the SPEED2 70
program speed (specified by the ASPEED2 100
SPEED2 command). MOVE2 P,P0
Example: ----------- Moves at 70% (=100*70) of maximum speed from the current
When the automatic movement speed
position to P0.
is 80% and the program speed set by
ASPEED2 50
the SPEED2 command is 50%, then:
MOVE2 P,P1
Robot operating speed = 80%*50% =
40% ----------- Moves at 35% (=50*70) of maximum speed from the current
position to P1.
MOVE2 P,P2,S=10
----------- Moves at 5% (=50*10) of maximum speed from the current
n This
NOTE
statement can be used only when
position to P2.
the sub group is set in the system
generation. Related commands: ASPEED, SPEED, SPEED2

36
11. Command Statements

AXWGHT statement
(Axis tip weight setting statement for main group)

Format:
2
AXWGHT (<expression 1>) = <expression 2>

The value of <expression 1> must be from 1 to 6 (axis number).


The range of <expression 2> differs depending on the selected robot model.

n· NOTE
This statement changes the axis tip
Explanation:
This statement changes the axis tip weight parameter for the main group axis specified in
weight parameter of a specified axis. <expression 1> to the value specified in <expression 2>.
· This statement is valid only for
“MULTI” axes or auxiliary axes of
the main robot. Example:
· Robot type and auxiliary axes are A=5
preset prior to shipping. B=0
C=AXWGHT(1) --------- Escape
AXWGHT(1)=A
DRIVE(1,P0)
AXWGHT(1)=B
DRIVE(1,P1)
AXWGHT(1)=C --------- Restore
HALT

Related commands: WEIGHT, WEIGHT2, AXWGHT2

37
11. Command Statements

AXWGHT2 statement
(Axis tip weight setting statement for sub group)

Format:
2
AXWGHT2 (<expression 1>) = <expression 2>

n· NOTE
This statement changes the axis tip
The value of <expression 1> must be from 1 to 4 (axis number).
weight parameter of a specified axis. The range of <expression 2> differs depending on the selected robot model.
· This statement is valid only for
“MULTI” axes or auxiliary axes of Explanation:
the sub robot.
· Robot type and auxiliary axes are
This statement changes the axis tip weight parameter for the sub group axis specified in
preset prior to shipping. <expression 1> to the value specified in <expression 2>.

Example:
A=5
B=0
C=AXWGHT2(1) --------Escape
AXWGHT2(1)=A
DRIVE2(1,P0)
AXWGHT2(1)=B
DRIVE2(1,P1)
AXWGHT2(1)=C --------Restore
HALT

Related commands: WEIGHT, WEIGHT2, AXWGHT

38
11. Command Statements

CALL statement

Format:

CALL <label> [(<actual argument> [, <actual argument >, ...] )] 2


n· NOTE
When a value is passed on to the sub-
Explanation:
This statement calls up sub-procedures defined by the SUB and END SUB statements.
procedure, the value of the real The <label> is the name of the sub-procedure defined by the SUB statement. The arguments
argument will not change even if it is used here are defined as follows:
changed in the sub-procedure.
· When a reference is passed on to the 1. When a constant or expression is specified as an actual argument, its value is passed
sub-procedure, the value of the real on to the sub-procedure.
argument will also change if it is 2. When an element of variable or array variable is specified as an actual argument,
changed in the sub-procedure.
its value is passed on to the sub-procedure but can also be passed on as a reference
by adding “REF” to the head of the real argument.
n· NOTE
CALL statements containing one 3. When an entire array variable (array name followed by parentheses) is specified as
actual argument can be used up to 15 an argument, then this is passed along as a reference.
times in succession.
Note that the number of times will
drop if commands containing a stack Example 1:
such as an IF statement or GOSUB X%=4
statement are used, or depending on Y%=5
the number of arguments in the CALL CALL *COMPARE( REF X%, REF Y% )
statement. HALT
· To end a sub-procedure which has ’SUB ROUTINE: COMPARE
been called with the CALL statement, SUB *COMPARE( A%, B% )
always use the END SUB statement. If IF A% < B% THEN
another statement such as GOTO is TEMP%=A%
used to jump out of the subroutine, an A%=B%
error such as “Stack overflow” may B%=TEMP%
occur. ENDIF
END SUB
Example 2:
I=1
CALL *TEST( I )
HALT
’SUB ROUTINE: TEST
SUB *TEST
X=X+1
IF X < 15 THEN
CALL *TEST( X )
ENDIF
END SUB

Related commands: SUB, END SUB, CALL, DECLARE, EXIT SUB

39
11. Command Statements

CHGPRI statement

n· NOTE
The priority of task 1 (main task) is
Format:

2 32.
· The smaller the priority number, the
higher the priority level.
CHGPRI Tn, p

· When a task with a higher priority is n : Task number 2 to 8.


set “READY”, all tasks with lower p : Task priority 17 to 47
priority levels also stay “READY”.

Explanation:
This statement changes the priority ( p ) of the specified task ( n ).

Example:
START *SUBTASK,T2,33
*ST:
MOVE P,P0,P1
IF DI(20) = 1 THEN
CHGPRI T2,32
ELSE
CHGPRI T2,33
ENDIF
GOTO *ST
HALT
’SUBTASK ROUTINE
*SUBTASK:
IF LOCZ(WHERE) > 10000 THEN
DO(20) = 1
GOTO *SUBTASK
ENDIF
DO(20) = 0
GOTO *SUBTASK
EXIT TASK

Related commands: CUT, EXIT TASK, RESTART, SUSPEND, START

40
11. Command Statements

CUT statement

Format:

CUT Tn 2
n : task number 2 to 8

Explanation:
This statement terminates a task currently being executed or temporarily stopped.
This statement cannot terminate its own task.

Example:
’TASK1 ROUTINE
*ST:
MO(20) = 0
START *SUBTASK2,T2
MOVE P,P0
MOVE P,P1
WAIT MO(20) = 1
CUT T2
GOTO *ST
HALT
’TASK2 ROUTINE
*SUBTASK2:
P100=JTOXY(WHERE)
IF LOCZ(P100) >= 100.0 THEN
MO(20) = 1
ELSE
DELAY 100
ENDIF
GOTO *SUBTASK2
EXIT TASK

Related commands: EXIT TASK, CUT, RESTART, START, SUSPEND

41
11. Command Statements

c The
CAUTION
DECEL statement is enabled
DECEL statement
only when the software version is
V8.15 or later.
(Deceleration setting statement for main group)
Format 1:

2 DECEL <expression>

Format 2:

DECEL (<expression 1>) = <expression 2>

The value of <expression 1> must be from 1 to 6 (axis number).


The value of <expression> and <expression 2> must be from 1 to 100. (Unit: %)

n• NOTE
The deceleration set in the axis
Explanation:
This statement changes the deceleration rate of the main group parameter to the value
parameters for the robot specified in <expression>.
configuration axis and auxiliary axis
is changed.
Format 1 changes all axes in the main group. Format 2 changes the deceleration rate of
• If an axis that is set to "no axis" in the the axis specified in <expression 1> to the value specified in <expression 2>.
system generation is specified, then an
error message "Specification Example:
mismatch" appears and execution of A =50
the command will stop. DECEL A
DECEL(3)=100
'CYCLE WITH INCREASING DECELERATION
FOR A =10 TO 100 STEP 10
DECEL A
MOVE P ,P0
MOVE P ,P1
NEXT A
HALT "END TEST"

42
11. Command Statements

c The
CAUTION
DECEL2 statement is enabled
DECEL2 statement
only when the software version is
V8.15 or later.
(Deceleration setting statement for sub group)
Format 1:

DECEL2 <expression> 2
Format 2:

DECEL2 (<expression 1>) = <expression 2>

The value of <expression 1> must be from 1 to 4 (axis number).


The value of <expression> and <expression 2> must be from 1 to 100. (Unit: %)
n• NOTE
The deceleration set in the axis Explanation:
parameters for the robot This statement changes the deceleration rate of the sub group parameter to the value
configuration axis and auxiliary axis
is changed.
specified in <expression>.
• This statement can be used only when Format 1 changes all axes in the sub group. Format 2 changes the deceleration rate of the
the sub group is set in the system axis specified in <expression 1> to the value specified in <expression 2>.
generation.
• If an axis that is set to "no axis" in the
system generation is specified, then an
Example:
error message "Specification A =50
mismatch" appears and execution of DECEL2 A
the command will stop. DECEL2(3)=100
'CYCLE WITH INCREASING DECELERATION
FOR A =10 TO 100 STEP 10
DECEL2 A
MOVE2 P ,P0
MOVE2 P ,P1
NEXT A
HALT "END TEST"

43
11. Command Statements

DECLARE statement

Format 1:

2 DECLARE <label> [, <label>...]

<label>: Label defined by an external program.

Format 2:

DECLARE SUB <label> [(<dummy argument> [, <dummy argument>]...) ]

<label> : Name of sub-procedure defined by an external program.


<dummy argument> : Argument for sub-procedure. This format is significant only for
the number of arguments and data type.

n· NOTE
External programs can only use
Explanation:
This statement declares that a label or sub-procedure is in an external program. In the
“COMMON”. case of a sub-procedure, the data type of the argument is also checked.
· Only the GOSUB, CALL, ON ~ The DECLARE statement can be written in programs other than the COMMON program
GOSUB statements can use external
labels. (but cannot be defined in a sub-procedure) and is effective over the entire program.

Example:
Labels shared with an external program.
Program name: DIST1
’===============================
’ MAIN PROGRAM
’===============================
DECLARE *DISTANCE,*AREA
X!=2.5
Y!=1.2
GOSUB *DISTANCE
GOSUB *AREA
HALT
Program name: COMMON
’===============================
’ ’COMMON’PROGRAM
’===============================
*DISTANCE:
PRINT X!^2+Y!^2
RETURN
*AREA:
PRINT X!*Y!
RETURN

44
11. Command Statements

Example:
Sub-procedures shared with an external program
Program name: DIST2
’===========================
’ MAIN PROGRAM
’===========================
DECLARE SUB *DISTANCE(X!,Y!,D!)
DECLARE SUB *AREA(X!,Y!,A!)
CALL *DISTANCE(2.5,1.2,REF D!)
2
PRINT D!
CALL *AREA(2.5,1.2,REF A!)
PRINT A!
HALT
Program name: COMMON
’===========================
’ ’COMMON’ PROGRAM
’===========================
SUB *DISTANCE(X!,Y!,D!)
D!=X!^2+Y!^2
END SUB
SUB *AREA(X!,Y!,A!)
A!=X!*Y!
END SUB

Related commands: CALL, EXIT SUB, GOSUB, ON~GOSUB, SUB, END SUB

45
11. Command Statements

DEF FN statement

Format:

2 DEF FN <name> [ % ] [(<dummy argument>, [< dummy argument >...]) ] = <function definition expression>
!
$

n· NOTE
You may specify numeral variables or
Explanation:
The DEF FN statement defines functions available to the user. The functions defined here
character type variables in the
can be called in the format of “FN name (variable)”.
<dummy arguments>.
· If a variable used in the <function The name can be up to 16 characters including the characters “FN”.
definition expression> is not included The <dummy arguments> are the names of the variables used in the <function definition
in the list of arguments, the value expression>. The names of these variables are effective only when the <function definition
assigned to that particular variable is
expression> is evaluated. There may be other variables with the same name in the program.
used for the calculation.
· Be sure to put a space between When calling a function that uses a <dummy argument>, specify the constant, variable or
“DEF”and “FN”, otherwise expression that has the same type as the <dummy argument> type.
“DEFFN” will be viewed as a
variable.
Example:
· The DEF FN statement cannot be
DEF FNPAI=3.141592
used within procedures.
DEF FNASIN(X)=ATN(X/SQR(-X^2+1))
· Definition by the DEF FN statement
·
must be declared before inserting
·
statements using functions.
A=FNASIN(B)*10

46
11. Command Statements

DELAY statement

Format:

DELAY <expression> 2
The value of <expression> must be from 1 to 3600000. (Unit: ms)

Explanation:
The DELAY statement allows the program to wait for the period of time (milliseconds)
specified by the <expression> before executing the next command. The minimum waiting
time is 10 milliseconds.

Example:
DELAY 3500
----------- Waits for 3500ms (3.5 seconds).
DELAY A*10

47
11. Command Statements

DIM statement
(Array variable declaration statement)

Format:
2
DIM <array definition> [, <array definition>, .....]

Array definition:

<name> [ % ] (<constant> [, < constant> [, < constant>] ] )


!
$

The value of <constant> must be a positive integer from 0 to 32767.

Explanation:
This statement declares the name and length (number of elements) of an array variable. A
maximum of 3 dimensions may be used for the array subscripts. Multiple arrays can be
declared in one line by differentiating them with a comma ( , ).

Examples:
DIM A%(10)
----------- Defines an integer array variable A%(0) to A%(10). (Number
n· The size of each dimension in an
NOTE of elements: 11)
DIM B(2,3,4)
array is equal to the DIM constant
----------- Defines a real array variable B(0, 0, 0) to B(2, 3, 4). (Number
+1. Each element of an array variable
begins with 0. of elements: 60)
· An error “Memory full” may occur DIM C%(2,2),D!(10)
depending on the size of each ----------- Defines an integer array C%(0,0) to C%(2,2) and a real array
dimension defined in an array. D!(0) to D!(10).

48
11. Command Statements

DO statement (Parallel output)

Format:

[ LET ] DOm ([b, · · · , b ] )


DO (mb , · · · , mb )
= <expression>
2
m : port number 2 to 7, 10 to 17, 20 to 27
b : bit definition 0 to 7
The value of <expression> should be an integer or it will be converted to an integer. The
lower bits corresponding to the bits specified on the left side will be valid.

Explanation:
This statement outputs the specified value to the DO ports.

Examples:
n· NOTE
Output to the DO0 ( ) and DO1 ( )
DO2() = &B10111000
ports is not allowed. ----------- DO (27, 25, 24, 23) are turned ON, and DO (26, 22, 21, 20)
· Bits must be specified in ascending are turned OFF.
order from the right. DO2(6,5,1) = &B010
· External output is unavailable to DO ----------- DO (25) is turned ON, and DO (26, 21) are turned OFF.
ports not connected to hardware. DO3() = 15
----------- DO (33, 32, 31, 30) are turned ON, and DO (37, 36, 35, 34)
are turned OFF.
DO(37,35,27,20) = A
----------- The contents of the 4 lower bits obtained when variable A is
converted to an integer are output to DO (37, 35, 27, 20),
respectively.

Related commands: RESET, SET

49
11. Command Statements

DRIVE statement

Format:

2 DRIVE (<expression 1>, <expression 2>


<point expression>
) [, (<expression 1>, <expression 2>
<point expression>
) ...] [, option]

Explanation:
The DRIVE statement executes an absolute movement of each axis in the main group,
including auxiliary axes in the main group.
Movement type : PTP movement on specified axis
Point data setting : Direct coordinate data input, point definition
Options : Speed setting, STOPON condition setting, torque limit setting, XY
setting

Movement type
· PTP (point to point) movement on specified axis
PTP movement begins after positioning on all axes specified in <expression 1> is complete
(within the tolerance range), and the command terminates when the specified axes enter
the OUT position range. When two or more axes are specified, they will reach their target
positions simultaneously.
To execute the next command after waiting for the axes to enter the target position tolerance
range, use the WAIT ARM statement.

Example:
DRIVE(1,P0)
----------- Axis 1 moves from the current position to the point specified
by P0.

Point data setting


· Direct coordinate data input
Directly specify the coordinate data in <expression 2> with an integer or real number.
When the coordinate data is an integer, the movement units are viewed as “pulses”. When
the coordinate data is a real number containing a decimal point, the units are viewed as
“mm” or “deg” and the robot will move to a position converted for each axis relative to
the 0 pulse position.

Examples:
DRIVE(1,10000)
----------- Axis 1 moves from the current position to the “10000 pulses”
position.
DRIVE(4,90.00)
----------- Axis 4 moves from the current position to the “+90 degrees”
position from the 0 pulse position. (When axis 4 is a rotating
axis.)

· Point definition
Specify the point expression in <expression 2>, while using the data for the axis specified
in <expression 1>.
The robot moves to the position determined by the units used for point expression. When
the units are viewed as “mm” or “deg”, the robot moves to the position converted for each
axis relative to the 0 pulse position.

50
11. Command Statements

n IfNOTE
point data is specified with both
Examples:
DRIVE(1,P1)
integers and real numbers in the same ----------- Axis 1 moves from the current position to the position
statement, all axes move in “mm” or specified by P1.
“deg” units. DRIVE(4,P90)
----------- Axis 4 moves from the current position to the position
specified by P90 (deg) relative to the 0 pulse position. (When
axis 4 is a rotating axis.)
2
Option types
· Speed setting
Format:

SPEED = <expression>
S

The value of <expression> must be from 1 to 100. (Unit: %)

Explanation:
Specify the program speed in <expression>. Robot operating speed is determined by the
product of the automatic movement speed and the program speed. This option is enabled
only for the specified DRIVE statement.

Example:
DRIVE(1,10000),S=10
----------- Axis 1 moves from the current position to the “10000 pulses”
position at 10% of normal program speed.

· STOPON condition setting


Format:

STOPON <conditional expression>

Explanation:
This command option stops the robot movement when the conditional expression is met.
The robot will move a slight distance while slowing down before coming to a stop after
the condition is met.
If the conditional expression is already satisfied before the robot begins to move, the
command will terminate without moving the robot. This option is enabled only during
program execution.

Example:
DRIVE(1,10000),STOPON DI(20)=1
----------- Axis 1 moves from the current position to the “10000 pulses”
position and stops when the condition “DI (20) = 1” is met.

51
11. Command Statements

· Torque limit setting


Format 1:

c· CAUTION
The torque offset setting is enabled
T = <expression 1>
only when the software version is
2 V8.18 or later.
· The torque limit setting range differs
Format 2:
depending on the robot model, so
always set the torque limit within the T = (<expression 1> [,<expression 2>] )
specified range. Setting a torque
limit higher than the maximum level The value of <expression 1> is the torque limit and must be from 1 to 100.
may cause robot malfunctions or
The value of <expression 2> is the torque offset and must be from -100 to 100.
breakdowns. To find the torque limit
setting range for each robot, refer to
the robot owner's manual. Explanation:
· If any points about the torque setting The robot moves at a torque specified by “rated torque” × <expression 1> / 100 as the
are unclear then please contact our
maximum torque setting. After the time specified to reach a target position has elapsed,
sales office.
the movement command terminates when the target position is reached or when the
specified torque value has been held for 1 seconds.
The value of <expression 2> determines the torque offset for compensating a load constantly
applied, for example, to a vertical axis. When using this command option, display the
current command monitor (see "13. MONITOR mode" in the robot controller owner's
manual) while the robot is stopped with the axis servo turned on, and check the torque
value being constantly generated. Specify the checked value in <expression 2>. If
<expression 2> is omitted, then the offset is set to "0".

Note the following limitations when using this command option.


1. This torque limit option cannot be used for multiple axes.
2. Maximum speed is 10% of normal operating speed.
c· CAUTION
If the specified value is too small, the 3. The movement command will not terminate until the time specified to reach the
axis may not move. In this case, target position has elapsed.
press the emergency stop button and 4. The maximum torque setting does not change once the torque limit option was
then continue operation.
· An error might not occur even if the used. Use the TORQUE command to change the maximum torque setting. In this
robot bumps into an obstacle. case, before executing the TORQUE statement, make sure that the axes are in the
· When changing the maximum torque target position.
setting by using the TORQUE
statement, make sure that the The maximum torque setting is initialized at the following timings independent of
workpiece does not interfere with the the TORQUE statement.
robot arm or hand and also that the
robot axes are at their target
· When the power is turned on.
positions. If not, the robot might · When parameters are changed or initialized.
move to the target positions at
maximum speed and maximum
· When return-to-origin operation starts.
torque when the TORQUE statement · When the servo turns off.
is executed.
5. When a stop command is received during execution of the torque limit option, the
torque mode still continues without canceling the torque limit setting, but no manual
movement along the axis in torque mode is possible.

52
11. Command Statements

Examples 1:
DRIVE(3,P0)
----------- Axis 3 moves from the current position to the position
specified by P0.
DRIVE(3,P1),T=50
----------- Axis 3 moves from the current position to the position

WAIT ARM(3)
specified by P1 at 50% of rated torque. 2
----------- Monitors movement and stopping of axis 3.
IF MO(12)=1 THEN
----------- Checks the current mode of axis 3.
TORQUE(3)=100
----------- Sets the torque on axis 3 to a maximum (100%) since the
target position was reached.
ELSE
DRIVE(3,P0),T=50
----------- Axis 3 moves from the current position to the point specified
by P0 at 50% of rated torque.
WAIT MO(12) = 1
----------- Waits until axis 3 is held (at the target position).
TORQUE(3)=100
----------- Sets the torque on axis 3 to a maximum (100%).
ENDIF

Examples 2:
DRIVE(3,P2),T=(50,20)

· XY setting
Format:

XY

Explanation:
This option moves the specified multiple axes to the position specified on the XY
coordinates.
The following are limitation items when using this command option.
1. Axes specified in <expression 1> must include axes 1 and 2.
2. Robots that can be specified with this option are SCARA robots and Cartesian
robots.
3. Point setting must be in “mm” or “deg” units (real number setting).

Examples:
DRIVE(1,P100),(2,P100),(4,P100),XY
----------- Axes 1, 2 and 4 move from the current position to the position
on the XY coordinates specified by P100.

53
11. Command Statements

DRIVE2 statement

Format:

2 DRIVE2 (<expression 1>, <expression 2>


<point expression>
) [, (<expression 1>, <expression 2>
<point expression>
) ...] [, option]

Explanation:
The DRIVE2 statement executes an absolute movement of each axis in the sub group,
including auxiliary axes in the sub group.
Movement type : PTP movement on specified axis
Point data setting : Direct coordinate data input, point definition
Options : Speed setting, STOPON condition setting, torque limit setting, XY
setting

Movement type
· PTP (point to point) movement on specified axis
PTP movement begins after positioning on all axes specified in <expression 1> is complete
(within the tolerance range), and the command terminates when the specified axes enter
the OUT position range. When two or more axes are specified, they will reach their target
positions simultaneously.
To execute the next command after waiting for the axes to enter the target position tolerance
range, use the WAIT ARM2 statement.

Example:
DRIVE2(1,P0)
----------- Axis 1 moves from the current position to the point specified
by P0.

Point data setting


· Direct coordinate data input
Directly specify the coordinate data in <expression 2> with an integer or real number.
When the coordinate data is an integer, the movement units are viewed as “pulses”. When
the coordinate data is a real number containing a decimal point, the units are viewed as
“mm” or “deg” and the robot will move to a position converted for each axis relative to
the 0 pulse position.

Examples:
DRIVEI2(1,10000)
----------- Axis 1 moves from the current position to the “10000 pulses”
position.
DRIVEI2(2,90.00)
----------- Axis 2 moves from the current position to the point at +90
degrees from the 0 pulse position. (When axis 2 is a rotating
axis.)

· Point definition
Specify the point expression in <expression 2>, while using the data for the axis specified
in <expression 1>.
The robot moves to the position determined by the units used for point expression. When
the units are viewed as “mm” or “deg”, the robot moves to the position converted for each
axis relative to the 0 pulse position.

54
11. Command Statements

n IfNOTE
point data is specified with both
Examples:
DRIVE2(1,P1)
integers then all real numbers in the ----------- Axis 1 moves from the current position to the position
same statement, then all axes move in specified by P1.
“mm” or “deg” units. DRIVE2(4, P90)
----------- Axis 2 moves from the current position to the position
specified (degrees) by P90 relative to the 0 pulse position.
(When axis 2 is a rotating axis.)
2
Option types
· Speed setting
Format:

SPEED = <expression>
S

The value of <expression> must be from 1 to 100. (Unit: %)

Explanation:
Specify the program speed in <expression>. Robot operating speed is determined by the
product of the automatic movement speed and the program speed. This option is enabled
only for the specified DRIVE2 statement.

Example:
DRIVE2(1,10000),S=10
----------- Axis 1 moves from the current position to the “10000 pulses”
position at 10% of normal program speed.

· STOPON condition setting


Format:

STOPON <conditional expression>

Explanation:
This command option stops the robot movement when the conditional expression is met.
The robot will move a slight distance while slowing down before coming to a stop after
the condition is met.
If the conditional expression is already satisfied before the robot begins to move, the
command will terminate without moving the robot. This option is enabled only during
program execution.

Example:
DRIVE2(1,10000),STOPON DI(20)=1
----------- Axis 1 moves from the current position to the “10000 pulses”
position and stops when the condition “DI (20) = 1” is met.

55
11. Command Statements

· Torque limit setting


Format 1:

c· CAUTION
The torque offset setting is enabled
T = <expression 1>
only when the software version is
2 V8.18 or later.
· The torque limit setting range differs
Format 2:
depending on the robot model, so
always set the torque limit within the T = (<expression 1> [,<expression 2>] )
specified range. Setting a torque
limit higher than the maximum level The value of <expression 1> is the torque limit and must be from 1 to 100.
may cause robot malfunctions or
The value of <expression 2> is the torque offset and must be from -100 to 100.
breakdowns. To find the torque limit
setting range for each robot, refer to
the robot owner's manual. Explanation:
· If any points about the torque setting The robot moves at a torque specified by “rated torque” × <expression 1> / 100 as the
are unclear then please contact our
maximum torque setting. After the time specified to reach a target position has elapsed,
sales office.
the movement command terminates when the target position is reached or when the
specified torque value has been held for 1 seconds.
The value of <expression 2> determines the torque offset for compensating a load constantly
applied, for example, to a vertical axis. When using this command option, display the
current command monitor (see "13. MONITOR mode" in the robot controller owner's
manual) while the robot is stopped with the axis servo turned on, and check the torque
value being constantly generated. Specify the checked value in <expression 2>. If
<expression 2> is omitted, then the offset is set to "0".

Note the following limitations when using this command option.


1. This torque limit option cannot be used for multiple axes.
2. Maximum speed is 10% of normal operating speed.
c· CAUTION
If the specified value is too small, the
3. The movement command will not terminate until the time specified to reach the
target position has elapsed.
axis may not move. In this case,
press the emergency stop button and 4. The maximum torque setting does not change once the torque limit option was
then continue operation. used. Use the TORQUE2 command to change the maximum torque setting. In this
· An error might not occur even if the
case, before executing the TORQUE2 statement, make sure that the axes are in the
robot bumps into an obstacle
· When changing the maximum torque target position.
setting by using the TORQUE2 The maximum torque setting is initialized at the following timings independent of
statement, make sure that the
workpiece does not interfere with the
the TORQUE2 statement.
robot arm or hand and also that the · When the power is turned on.
robot axes are at their target
positions. If not, the robot might · When parameters are changed or initialized.
move to the target positions at · When return-to-origin operation starts.
maximum speed and maximum
torque when the TORQUE statement · When the servo turns off.
is executed. 5. When a stop command is received during execution of the torque limit option, the
torque mode still continues without canceling the torque limit setting, but no manual
movement along the axis in torque mode is possible.

56
11. Command Statements

Examples 1:
DRIVE2(2, P0)
----------- Axis 2 moves from the current position to the point specified
by P0.
DRIVE2(2, P1),T=50
----------- Axis 2 moves from the current position to the point specified

WAIT ARM2(2)
by P1 at 50% of rated torque. 2
----------- Monitors movement and stopping of axis 2.
IF MO(13)=1 THEN
----------- Checks the current mode of axis 2.
TORQUE2(2)=100
----------- Sets the torque on axis 2 to a maximum (100%) because the
target position was reached.
ELSE
DRIVE2(2,P0),T=50
----------- Axis 2 moves from the current position to the point specified
by P0 at 50% of rated torque.
WAIT MO(13)=1
----------- Waits until axis 2 is held (at the target position).
TORQUE2(2)=100
----------- Sets the torque on axis 2 to a maximum (100%).
ENDIF

Examples 2:
DRIVE2(2, P2),T=(50,20)

· XY setting
Format:

XY

Explanation:
This option moves the specified multiple axes to the position specified on the XY
coordinates.
Comply with the following conditions when using this command option.
1. Axes specified in <expression 1> must include axes 1 and 2.
2. Robots that can be specified with this option are SCARA robots and Cartesian
robots.
3. Point setting must be in “mm” or “deg” units (real number setting).

Examples:
DRIVE2(1,P100),(2,P100), XY
----------- Axes 1 and 2 move from the current position to the position
on the XY coordinates specified by P100.

57
11. Command Statements

DRIVEI statement

Format:

2 DRIVEI (<expression 1>, <expression 2>


<point expression>
) [, (<expression 1>, <expression 2>
<point expression>
) ...] [, option]

Explanation:
c IfCAUTION
the robot is stopped during
The DRIVEI statement executes a relative movement of each axis in the main group,
including auxiliary axes in the main group.
execution of the DRIVEI statement
and then restarted, the robot will
Movement type : PTP movement on specified axis
move the specified distance from the Point data setting : Direct coordinate data input, point definition
stopped position. Options : Speed setting, STOPON condition setting

Movement type
· PTP (point to point) movement on specified axis
PTP movement begins after positioning on all axes specified in <expression 1> is complete
(within the tolerance range), and the command terminates when the specified axes enter
the OUT position range. When two or more axes are specified, they will reach their target
positions simultaneously.
To execute the next command after waiting for the axes to enter the target position tolerance
range, use the WAIT ARM statement.

Example:
DRIVEI(1,P0)
----------- Axis 1 moves a distance specified by P0 from the current
position.

Point data setting


· Direct coordinate data input
Directly specify the coordinate data in <expression 2> with an integer or real number.
When the coordinate data is an integer, the movement units are viewed as “pulses”. When
the coordinate data is a real number containing a decimal point, the units are viewed as
“mm” or “deg” and the robot will move a certain distance converted for each axis.

Examples:
DRIVEI(1,10000)
----------- Axis 1 moves a distance “+10000 pulses” from the current
position.
DRIVEI(4,90.00)
----------- Axis 4 moves through “+90 degrees” from the current
position. (When axis 4 is a rotating axis.)

· Point definition
Specify the point expression in <expression 2>, while using the data for the axis specified
in <expression 1>.
The robot moves to the position determined by the units used for point expression. When
the units are viewed as “mm” or “deg”, the robot moves a certain distance converted for
each axis.

Examples:
DRIVEI(1, P1)
----------- Axis 1 moves a distance specified by P1 from the current
n If point data is specified with both
NOTE
DRIVEI(4, P90)
position.
integers and real numbers in the same ----------- Axis 4 moves a distance (degrees) specified by P90 from the
statement, then all axes move in “mm”
current position. (When axis 4 is a rotating axis.)
or “deg” units.

58
11. Command Statements

Option types
· Speed setting
Format:

SPEED = <expression>
S 2
The value of <expression> must be from 1 to 100. (Unit: %)

Explanation:
Specify the program speed in <expression>. Robot operating speed is determined by the
product of the automatic movement speed and the program speed. This option is enabled
only for the specified DRIVEI statement.

Example:
DRIVEI(1,10000),S=10
----------- Axis 1 moves a distance “+10000 pulses” from the current
position at 10% of normal program speed.

· STOPON condition setting


Format:

STOPON <conditional expression>

Explanation:
This command option stops the robot movement when the conditional expression is met.
The robot will move a slight distance while slowing down before coming to a stop after
c When
CAUTION
execution of the DRIVEI the condition is met.
statement is halted with the STOPON If the conditional expression is already satisfied before the robot begins to move, the
option, executing the DRIVEI command will terminate without moving the robot. This option is enabled only during
statement again on the same axis
program execution.
moves the robot the specified distance
from the stopped position.
When executing consecutive relative Example:
movement commands, take DRIVEI(1,10000),STOPON DI(20)=1
precautions to prevent the moving ----------- Axis 1 moves a distance “+10000 pulses” from the current
sections of the robot from bumping or
position and stops when the condition “DI (20) = 1” is met.
binding on each other.

59
11. Command Statements

DRIVEI2 statement

Format:

2 DRIVEI2 (<expression 1>, <expression 2>


<point expression>
) [, (<expression 1>, <expression 2>
<point expression>
) ...] [, option]

Explanation:
c IfCAUTION
the robot is stopped during
The DRIVEI2 statement executes a relative movement of each axis in the sub group,
including auxiliary axes in the sub group.
execution of the DRIVEI2 statement Movement type : PTP movement on specified axis
and then restarted, the robot will Point data setting : Direct coordinate data input, point definition
move the specified distance from the
stopped position. Options : Speed setting, STOPON condition setting

Movement type
· PTP (point to point) movement on specified axis
PTP movement begins after positioning on all axes specified in <expression 1> is complete
(within the tolerance range), and the command terminates when the specified axes enter
the OUT position range. When two or more axes are specified, they will reach their target
positions simultaneously.
To execute the next command after waiting for the axes to enter the target position tolerance
range, use the WAIT ARM2 statement.

Example:
DRIVEI2(1,P0)
----------- Axis 1 moves a distance specified by P0 from the current
position.

Point data setting


· Direct coordinate data input
Directly specify the coordinate data in <expression 2> with an integer or real number.
When the coordinate data is an integer, the movement units are viewed as “pulses”. When
the coordinate data is a real number containing a decimal point, the units are viewed as
“mm” or “deg” and the robot will move a certain distance converted for each axis.

Examples:
DRIVEI2(1,10000)
----------- Axis 1 moves from the current position to the “+10000 pulses”
position.
DRIVEI2(2,90.00)
-------- --- Axis 2 moves from the current position to the “+90 degrees”
position. (When axis 2 is a rotating axis.)

· Point definition
Specify the point expression in <expression 2>, while using the data for the axis specified
in <expression 1>.
The robot moves to the position determined by the units used for point expression. When
the units are viewed as “mm” or “deg”, the robot moves a certain distance converted for
each axis.

Examples:
DRIVEI2(1,P1)
n If point data is specified with both
NOTE ----------- Axis 1 moves a distance specified by P1 from the current
position.
integers and real numbers in the same
DRIVEI2(2,P90)
statement, then all axes move in “mm”
or “deg” units. ----------- Axis 2 moves a distance specified by P90 (degrees) from the
current position. (When axis 2 is a rotating axis.)

60
11. Command Statements

Option types
· Speed setting
Format:

SPEED = <expression>
S 2
The value of <expression> must be from 1 to 100. (Unit: %)

Explanation:
Specify the program speed in <expression>. Robot operatimg speed is determined by the
product of the automatic movement speed and the program speed. This option is enabled
only for the specified DRIVEI2 statement.

Example:
DRIVEI2(1,10000),S=10
----------- Axis 1 moves a distance “+10000 pulses” from the current
position at 10% of normal program speed.

· STOPON condition setting


Format:

STOPON <conditional expression>

Explanation:
This command option stops the robot movement when the conditional expression is met.
c When
CAUTION
execution of the DRIVEI2
The robot will move a slight distance while slowing down before coming to a stop after
the condition is met.
statement is halted with the STOPON If the conditional expression is already satisfied before the robot begins to move, the
option, executing the DRIVEI2 command will terminate without moving the robot. This option is enabled only during
statement again on the same axis
moves the robot the specified distance program execution.
from the stopped position.
When executing consecutive relative Example:
movement commands, take DRIVEI2(1,10000),STOPON DI(20)=1
precautions to prevent the moving ----------- Axis 1 moves a distance “+10000 pulses” from the current
sections of the robot from bumping or
binding on each other. position, and stops when the condition “DI (20) = 1” is met.

61
11. Command Statements

EXIT FOR statement

Format:

2 EXIT FOR

Explanation:
The EXIT FOR statement terminates the loop of the FOR and NEXT statements and then
jumps to the command following the NEXT statement.
This statement is valid only between the FOR and NEXT statements.

Example:
*ST:
WAIT DI(20)=1
FOR A%=101 TO 109
MOVE P,P100,Z=0
DO(20)=1

n The
NOTE
loop of the FOR and NEXT
MOVE P,P[A%],Z=0
DO(20)=0
IF DI(20)=0 THEN EXIT FOR
statements will end when the FOR
NEXT A%
statement condition is satisfied or the
GOTO *ST
EXIT FOR statement is executed. If
HALT
another statement such as GOTO is
used to jump out of the loop, an error
such as “Stack overflow” may occur. Related commands: FOR, NEXT

62
11. Command Statements

EXIT SUB statement

Format:

EXIT SUB 2
Explanation:
The EXIT SUB statement terminates the sub-procedure defined by the SUB and END
SUB statements and then jumps to the next command in the CALL statement that called
up the sub-procedure.
This statement is valid only within the sub-procedure defined by the SUB and END SUB
statements.

Example:
’MAIN ROUTINE
CALL *SORT2(REF X%,REF Y%)
n ToNOTE
end the sub-procedure defined by
HALT
’SUB ROUTINE: SORT
the SUB and END SUB statements, use SUB *SORT2(X%, Y%)
the END SUB statement or EXIT SUB IF X%>=Y% THEN EXIT SUB
statement. If another statement such as TMP%=Y%
GOTO is used to jump out of the sub- Y%=X%
procedure, an error such as “Stack X%=TMP%
overflow” may occur. END SUB

Related commands: CALL, SUB, END SUB

63
11. Command Statements

EXIT TASK statement

Format:

2 EXIT TASK

Explanation:
This statement terminates its own task currently being executed.
This statement is valid for all tasks other than task 1.

Example:
’TASK1 ROUTINE
*ST:
MO(20)=0
START *SUBTASK2,T2
MOVE P,P0,P1
WAIT MO(20)=1
GOTO *ST
HALT
’TASK2 ROUTINE
*SUBTASK2:
P100=JTOXY(WHERE)
IF LOCZ(P100)>=100.0 THEN
n IfNOTE
a task that has started as a subtask
MO(20)=1
EXIT TASK
jumps to another task processing ENDIF
routine with a statement such as GO DELAY 100
TO, that processing routine is then GOTO *SUBTASK2
executed as this subtask processing. EXIT TASK

Related commands: CUT, RESTART, START, SUSPEND, CHGPRI

64
11. Command Statements

FOR statement, NEXT statement

Format:

FOR <control variable> = <expression 1> TO <expression 2> [STEP <expression 3>]
<command block>
2
NEXT [<control variable>]

n· NOTE
If the value of <expression 3> in the
Explanation:
These statements repeatedly execute commands between the FOR and NEXT statements
FOR statement is 1, then STEP for the number of times equal to the difference between <expression 1> and <expression
<expression 3> can be omitted. 2>, while changing the value of <control variable> in steps specified by <expression 3>.
· The FOR and NEXT statements must
always be used together as a set. The value of <expression 3> may be either positive or negative.
The value of <control variable> must be a numeric <simple variable> or <array variable>.

Examples:
’CYCLE WITH CYCLE NUMBER OUTPUT TO DISPLAY
FOR A=1 TO 10
MOVE P,P0
MOVE P,P1
MOVE P,P2
PRINT “CYCLE NUMBER=”;A
NEXT A
HALT

Related command: EXIT FOR

65
11. Command Statements

GOSUB statement, RETURN statement

Format:

2 GOSUB
GO SUB
<label>

<command block>
<label> :
<command block>
RETURN

Explanation:
The GOSUB statement makes a jump to the subroutine of <label> defined by the GOSUB
statement.
When a RETURN statement is found in the subroutine, a jump is made to the next line in
the GOSUB statement.

n· NOTE
The GOSUB statement can be used up
Example:
*ST:
to 29 times in succession. MOVE P,P0
Note that the number of times will GOSUB *CLOSEHAND
drop if commands containing a stack MOVE P,P1
such as an IF statement or CALL GOSUB *OPENHAND
statement are used. GOTO *ST
· When a jump to a subroutine was HALT
made with the GOSUB statement, ’SUB ROUTINE
always use the RETURN statement to *CLOSEHAND:
end the subroutine. If another DO(20) = 1
statement such as GOTO is used to RETURN
jump out of the subroutine, an error *OPENHAND:
such as “Stack overflow” may occur. DO(20) = 0
RETURN

66
11. Command Statements

GOTO statement

Format:

GOTO
GO TO
<label>
2
Explanation:
This statement makes an unconditional jump to the line specified in <label>.

Example:
’MAIN ROUTINE
*ST:
MOVE P,P0,P1
IF DI(20) = 1 THEN
GOTO *FIN
ENDIF
GOTO *ST
*FIN:
HALT

67
11. Command Statements

HALT statement

Format:

2 HALT [ <expression>
<character string>
]

Explanation:
This statement stops the program and resets it. The program will run again the beginning
when restarted.

n· IfNOTE
an <expression> or <character
Examples:
’MAIN ROUTINE
string> is written in the statement, the *ST:
contents of the <expression> or MOVE P,P0,P1
<character string> are displayed on IF DI(20) = 1 THEN
the MPB screen. GOTO *FIN
· If a program name “_SELECT” exists ENDIF
among the programs that were GOTO *ST
created, then the selected program *FIN:
will switch to “_SELECT”. HALT “PROGRAM FIN”

68
11. Command Statements

HAND definition statement, CHANGE statement


(Main robot hand selection)

These statements are used to define or switch the main robot hands.

Format 1: For SCARA robots


2
Definition statement:
HAND Hn = <1st parameter> <2nd parameter> <3rd parameter> [R]
Selection statement:
CHANGE Hn

n : 0 to 3

a. If the 4th parameter “R” is not specified, then hands installed on the second arm
tip are selected (see below).
<1st parameter> : Number of offset pulses between the standard second arm
position and the imaginary second arm position of hand “n”.
[pulse] (The “+” number indicates the counterclockwise di-
rection.)
<2nd parameter> : Difference between the imaginary second arm length of hand
“n” and the standard second arm length. [mm]
<3rd parameter> : Z-axis offset value for hand “n”. [mm]

Hand1 Hand2
20.00mm
es
0puls
-500
m
m
00
0.

nd
15

h o
gt ec
s
len rd
m a
ar tand
s

HAND H1= 0 150.0 0.0


HAND H2= -5000 20.00 0.0
P1=150.00 300.00 0.00 0.00 0.00 0.00
CHANGE H2
MOVE P,P1 --------- The tip of hand 2 moves to P1. (1)
CHANGE H1
MOVE P,P1 --------- The tip of hand 1 moves to P1. (2)
HALT

(1) Y
(2) Y

hand 2 (150.00, 300.00)


(150.00, 300.00) Hand1

X X

69
11. Command Statements

b. When the 4th parameter “R” is specified and the R-axis uses a servo motor, those
hands that are offset from the R-axis rotating center are selected (see below).
<1st parameter> : When the current position of R-axis is 0.00, this parameter
shows the angle of hand “n” from the X-axis plus direction
of a Cartesian coordinate system. [degree] (The “+” number
2 indicates the counterclockwise direction.)
<2nd parameter> : Length of hand “n”. [mm] (>0)
<3rd parameter> : Z-axis offset value for hand “n”. [mm]

standard second
arm length 150.00mm

X
Hand1
-90.00degrees
100.00mm Hand2

HAND H1= 0.00 150.0 0.0 R


HAND H2= -90.00 100.00 0.0 R
P1=150.00 300.00 0.00 0.00 0.00 0.00
CHANGE H1
MOVE P,P1 --------- The tip of hand 1 moves to P1. (1)
CHANGE H2
MOVE P,P1 --------- The tip of hand 2 moves to P1. (2)
HALT

(2)
(1) Y Y

Hand1 Hand2

(150.00, 300.00) (150.00, 300.00)

X
X

70
11. Command Statements

Format 2: For Cartesian robots

Definition statement:
HAND Hn = <1st parameter> <2nd parameter> <3rd parameter> [R]
Selection statement:
CHANGE Hn 2
n: 0 to 3

a. If the 4th parameter “R” is not specified, hands installed on the second arm tip are
selected (see below).
<1st parameter> : X-axis offset value for hand “n”. [mm]
<2nd parameter> : Y-axis offset value for hand “n”. [mm]
<3rd parameter> : Z-axis offset value for hand “n”. [mm]

X
Hand2

-100.00mm
Hand1

100.00mm

Y
HAND H1= 0.00 0.00 0.00
HAND H2= 100.0 -100.0 -100.0
P1=200.00 250.00 0.00 0.00 0.00 0.00
CHANGE H2
MOVE P,P1 --------- The tip of hand 2 moves to P1. (1)
CHANGE H1
MOVE P,P1 --------- The tip of hand 1 moves to P1. (2)
HALT

(1) (2)

X X

Hand2 Hand1

(200.00, 250.00) (200.00, 250.00)

Y Y

71
11. Command Statements

b. When the 4th parameter “R” is specified and the R-axis uses a servo motor, those
hands that are offset from the R-axis rotating center are selected (see below).
<1st parameter> : When the current position of R-axis is 0.00, this parameter
shows the angle of hand “n” along the X-axis plus direction
of a Cartesian coordinate system. [degree] (The “+” number
2 indicates the counterclockwise direction.)
<2nd parameter> : Length of hand “n”. [mm] (> 0)
<3rd parameter> : Z-axis offset value for hand “n”. [mm]
(R-axis position is 0.00)

Hand1

150.00mm 90degrees
Hand2

100.00mm
Y
HAND H1= 0.00 100.00 0.00 R
HAND H2= 90.00 150.00 0.00 R
P1=200.00 250.00 0.00 0.00 0.00 0.00
CHANGE H2
MOVE P,P1 --------- The tip of hand 2 moves to P1. (1)
CHANGE H1
MOVE P,P1 --------- The tip of hand 1 moves to P1. (2)

(1) (2)

c IfCAUTION
power is turned off during X X
execution of a hand definition
statement, an error “9.7: Hand data
destroyed” may occur. Hand2 Hand1

(200.00, 250.00) (200.00, 250.00)

Y Y

72
11. Command Statements

HAND2 definition statement, CHANGE2 statement


(Sub robot hand selection)

These statements are used to define or switch the sub robot hands.

Format 1: For SCARA robots


2
Definition statement:
HAND 2 Hn = <1st parameter> <2nd parameter> <3rd parameter> [R]
Selection statement:
CHANGE2 Hn

n : 4 to 7

n This
NOTE
statement can be used only when
a. If the 4th parameter “R” is not specified, those hands installed on the second arm
tip are selected (see below).
the sub group is set in the system
generation. <1st parameter> : Number of offset pulses between the standard second arm
position and the imaginary second arm position of hand “n”.
[pulse] (The “+” number indicates the counterclockwise di-
rection.)
<2nd parameter> : Difference between the imaginary second arm length of hand
“n” and the standard second arm length. [mm]
<3rd parameter> : Z-axis offset value for hand “n”. [mm]

Hand5 Hand6
20.00mm

es
0puls
m

-500
m
00
0.

nd
15

h o
gt sec
len rd
m a
ar tand
s

HAND2 H5= 0 150.0 0.0


HAND2 H6= -5000 20.00 0.0
P1=150.00 300.00 0.00 0.00 0.00 0.00
CHANGE2 H6
MOVE2 P,P1 --------- The tip of hand 6 moves to P1. (1)
CHANGE2 H5
MOVE2 P,P1 --------- The tip of hand 5 moves to P1. (2)
HALT

(1) Y
(2) Y

Hand6 (150.00, 300.00)


(150.00, 300.00) Hand5

X X

73
11. Command Statements

b. When the 4th parameter “R” is specified and the R-axis uses a servo motor, those
hands that are offset from the R-axis rotating center are selected (see below).
<1st parameter>: When the current position of R-axis is 0.00, this parameter
shows the angle of hand “n” along the X-axis plus direction
of a Cartesian coordinate system. [degree] (The “+” number
2 indicates the counterclockwise direction.)
<2nd parameter>: Length of hand “n”. [mm] (>0)
<3rd parameter>: Z-axis offset value for hand “n”. [mm]
Examples:
HAND2 H5= 0.00 150.00 0.0 R
HAND2 H6= -90.00 100.00 0.0 R

standard second
arm length 150.00mm

X
Hand5
-90.00degrees
100.00mm Hand6

HAND2 H5= 0.00 150.0 0.0 R


HAND2 H6= -90.00 100.00 0.0 R
P1=150.00 300.00 0.00 0.00 0.00 0.00
CHANGE2 H5
MOVE2 P,P1 --------- The tip of hand 5 moves to P1. (1)
CHANGE2 H6
MOVE2 P,P1 --------- The tip of hand 6 moves to P1. (2)
HALT

(2)
(1) Y Y

Hand5 Hand6

(150.00, 300.00) (150.00, 300.00)

X
X

74
11. Command Statements

Format 2: For Cartesian robots

Definition statement:
HAND 2 Hn = <1st parameter> <2nd parameter> <3rd parameter> [R]
Selection statement:
CHANGE2 Hn 2
n : 4 to 7

a. If the 4th parameter “R” is not specified, hands installed on the second arm tip are
selected (see below).
<1st parameter> : X-axis offset value for hand “n”. [mm]
<2nd parameter> : Y-axis offset value for hand “n”. [mm]
<3rd parameter> : Z-axis offset value for hand “n”. [mm]

X
Hand6

-100.00mm
Hand5

100.00mm

Y
HAND2 H5= 0.00 0.00 0.00
HAND2 H6= 100.0 -100.0 -100.0
P1=200.00 250.00 0.00 0.00 0.00 0.00
CHANGE2 H6
MOVE2 P,P1 --------- The tip of hand 6 moves to P1. (1)
CHANGE2 H5
MOVE2 P,P1 --------- The tip of hand 5 moves to P1. (2)
HALT

(1) (2)

X X

Hand6 Hand5

(200.00, 250.00) (200.00, 250.00)

Y Y

75
11. Command Statements

b. When the 4th parameter “R” is specified and the R-axis uses a servo motor, those
hands that are offset from the R-axis rotating center are selected (see below).
<1st parameter> : When the current position of R-axis is 0.00, this parameter
shows the angle of hand “n” along the X-axis plus direction
of a Cartesian coordinate system. [degree] (The “+” number
2 indicates the counterclockwise direction.)
<2nd parameter> : Length of hand “n”. [mm] (> 0)
<3rd parameter> : Z-axis offset value for hand “n”. [mm]
(R-axis position is 0.00)

Hand5

150.00mm 90degrees
Hand6

100.00mm
Y
HAND2 H5= 0.00 100.00 0.00 R
HAND2 H6= 90.00 150.00 0.00 R
P1=200.00 250.00 0.00 0.00 0.00 0.00
CHANGE2 H6
MOVE2 P,P1 --------- The tip of hand 6 moves to P1. (1)
CHANGE2 H5
MOVE2 P,P1 --------- The tip of hand 5 moves to P1. (2)
HALT

(1) (2)

X X
c IfCAUTION
power is turned off during
execution of a hand definition Hand6 Hand5
statement, an error “9.7: Hand data
destroyed” may occur. (200.00, 250.00) (200.00, 250.00)

Y Y

76
11. Command Statements

HOLD statement

Format:

HOLD [ <expression>
<character string>
]
2
Explanation:
This statement temporarily pauses execution of the program. When the program is re-
executed, it begins from the line following the HOLD statement.

Example:
’MAIN ROUTINE
*ST:
n IfNOTE
an <expression> or <character
MOVE P,P0,P1
IF DI(20)=1 THEN
string> is written in the statement, the HOLD “PROGRAM STOP”
contents of the <expression> or ENDIF
<character string> are displayed on GOTO *ST
the MPB screen. HALT

77
11. Command Statements

IF statement

a. Simple IF statement
Format 1:
2 IF <conditional expression> THEN <label 1> [ELSE <label 2> ]
<statement 1> <statement 2>

Explanation:
When the condition specified by <conditional expression> is met, this statement allows a
jump to the line specified by <label 1> or executes the <statement 1> and jumps to the
next line. If the condition is not met, the command jumps to the line specified by <label
2> or executes the <statement 2> and then jumps to the next line.

Example:
’MAIN ROUTINE
*ST:
MOVE P,P0,P1
IF DI(20)=1 THEN *L1
DO(20)=1
DELAY 100
*L1:
IF DI(21)=1 THEN *ST ELSE *FIN
*FIN:
HALT

78
11. Command Statements

b. Block IF statement
n• The IF statement can be used up to 48
NOTE Format 2:

times in succession. IF <conditional expression 1> THEN


Note that the maximum number of
times will drop if commands <command block 1>
containing a stack such as an GOSUB
statement or CALL statement are
[ ELSEIF <conditional expression 2> THEN
<command block 2>]
2
used.
[ ELSE
<command block n>]
ENDIF

Explanation:
If the condition specified by <conditional expression 1> is met, this statement executes
the instructions specified in <command block 1> and makes a jump to the line under
ENDIF. When an ELSEIF statement is present and the condition specified by <conditional
expression 2> is met, the instructions specified in <command block 2> are executed.
Unless all conditions specified by <conditional expression n> are satisfied, the instructions
specified in <command block n> are executed and a jump is made to the line under ENDIF.

Example:
’MAIN ROUTINE
*ST:
MOVE P,P0,P1
IF DI(21,20)=1 THEN
DO(20)= 1
DELAY 100
WAIT DI(20)=0
ELSEIF DI(21,20)=2 THEN
DELAY 100
ELSE
GOTO *FIN
ENDIF
GOTO *ST
*FIN:
HALT

79
11. Command Statements

INPUT statement

Format:

2 INPUT [<prompt statement> ; ] <variable>


, <point variable>
[, <variable>
<point variable>
,…]

<shift variable> <shift variable>

Explanation:
This statement assigns a value to the variable specified by the MPB. The input definitions
are as follows:
1. When two or more variables are specified by separating them with a comma ( , ),
the specified pieces of input data must also be separated with a comma ( , ).
2. In <prompt statement>, enter a character string enclosed in quotation marks (“ ”)
that will appear as a message requiring data input. When a semicolon ( ; ) is entered
following the prompt statement, a question mark ( ? ) and a space will appear at the
end of the message. When a comma ( , ) is entered, nothing will be displayed
following the message.
3. When <prompt statement> is omitted, only a question mark ( ? ) and a space will
be displayed.
4. The input data type must match the type of the corresponding variables. When
data is input to a point variable or shift variable, insufficient elements are set to
“0”.
5. If only the Enter key is pressed without making any entry, the program has
determined that “0” or “null string” was input. However, if specifying two or more
variables, a comma ( , ) must be used to separate them.
6. If the specified variable is a character type and you want to enter a significant
space before and after a comma ( , ), double quotation mark ( “ ) or character
n· NOTE
If assignment data type differs from
string, the character variable must be enclosed in double quotation marks ( “ ).
Note in this case, you must enter two double quotation marks in succession so that
type of variable, a message “? Input they will be identified as a double quotation mark input.
again” appears and awaits data
input. 7. Pressing the ESC key skips input of this statement.
· When assigning alphabetic characters
and numbers to a character variable, Example:
enclosing the character string in
INPUT A
double quotation marks ( “ ) is not
INPUT ”INPUT POINT NUMBER”;A1
necessary.
INPUT ”INPUT STRING”,B$(0),B$(1)
INPUT P100
HALT

80
11. Command Statements

LET statement (Assignment statement)

Format:

n IfNOTE
the controller power is turned off
[LET] <arithmetic statement >
2
during execution of a point assignment <character string assignation statement >
statement or shift assignment <point data assignation statement >
statement, a memory-related error
such as “Point data destroyed” and <shift data assignation statement >
“Shift data destroyed” may occur.
Explanation:
The LET statement executes the specified assignment statement.

a. Arithmetic statement
Format:

[LET] <arithmetic variable> = <expression>


<point element variable>
<shift element variable>
<parallel output variable>
<internal output variable>
<arm lock output variable>
<timer output variable>
<serial output variable>

Explanation:
The value of <expression> is assigned to the variable on the left side.

Example:
A!=B!+1
B%(1,2,3)=INT(10.88)
LOCZ(P0)=A!
LOCX(S1)=100.00
DO2()=&B00101101
MO(21,20)=2
LO(00)=1
TO(01)=0
SO12()=255

81
11. Command Statements

b. Character string assignment statement


Format:

[LET ] <character string variable> = <character string expression>

2 Explanation:
The value of <character string expression> is assigned to the character string variable.

n Only
NOTE
“+” sign can be used as
Example:
A$ = “YAMAHA”
arithmetic operators in <character B$ = “ROBOT”
string expression>. Other arithmetic D$ = A$ + “-“ + B$
operators and parentheses cannot be
used.
c. Point assignment statement
Format:

[ LET ] <point variable> = <point expression>


n· NOTE
Only 4 arithmetic operators “+”, “-”, Explanation:
“*”, “/” can be used in <point
The value of <point expression> is assigned to the point variable.
expression>. Multiplication and
division are performed only with
constants or variables. Example:
Valid examples: P15*5, P [E] / A P1 =P10
Invalid examples: P10*P11, 3 / P10 ----------- Point 10 is assigned to P1.
· Multiplication and division results P20=P20+P5
will differ depending on the type of
----------- Each element of point 20 and point 5 is summed and assigned
point data.
When the point data is in “pulses”, to P20.
each element of the arithmetic result P30=P30-P3
is converted to an integer and ----------- Each element of point 3 is subtracted from point 30 and
assigned to the point variable. assigned to P30.
When the point data is in “mm”, each P80=P70*4
element of the arithmetic result is
----------- Each element of point 70 is multiplied by 4 and assigned to
converted to a real number up to the
second decimal places and then P80.
assigned to the point variable. P60=P5/3
----------- Each element of point 5 is divided by 3 and assigned to P60.

d. Shift assignment statement


Format:

[ LET ] <shift variable> = <shift expression>

Explanation:
The value of <shift expression> is assigned to the shift variable.

n· NOTE
Only “+” and “-“ signs can be used Example:
as arithmetic operators in <shift S1=S1
expression>. Other arithmetic ----------- Shift 0 is assigned to shift 1.
operators and parentheses cannot be S2=S1+S0
used. ----------- Each element of shift 1 and shift 0 are summed and assigned
· The only element that can be used in
to shift 2.
<shift expression> is a shift element.
Invalid example: S 1 + 3

82
11. Command Statements

LO statement (Arm lock output)

Format:

[ LET ] LO0 ( [b, · · ·, b ] ) = <expression>


LO ( 0b, · · ·, 0b )
2
b : bit definition 0 to 7
The value of <expression> should be an integer or it will be converted to an integer. The
lower bits corresponding to the bits specified on the left side will be valid.

Explanation:
This statement outputs the specified value to the LO port to prohibit axis movement or
allow axis movement.
LO(00) to LO(07) respectively correspond to axes 1 to 8. Axis movement is prohibited in
ON status.

n· NOTE
This statement can be used for the
Example:
LO0()=&B00001010
axis that starts to move. ----------- Prohibits movement of axes 2 and 4.
· Bits must be specified in ascending LO0(2,1)=&B10
order from the right. ----------- Prohibits movement of axis 3.

Related commands: RESET, SET

83
11. Command Statements

MO statement (Internal output)

Format:

2 [LET ] MOm ( [b, · · ·, b ] ) = <expression>


MO ( mb, · · ·, mb )

m : port number 2 to 7, 10 to 17, 20 to 27


b : bit definition 0 to 7
The value of <expression> should be an integer or it will be converted to an integer and
the lower bits corresponding to the bits specified on the left side will be valid.

Explanation:
This statement outputs the specified value to the MO ports.

n· NOTE
Output to the MO0 ( ) and MO1 ( )
Examples:
MO2()=&B10111000
ports is not allowed. ----------- MO (27, 25, 24, 23) are turned ON, and MO (26, 22, 21, 20)
· The output status of origin sensors for are turned OFF.
axes 1 to 8 (in order from bit 0) is
MO2(6,5,1)=&B010
available to the MO0 ( ) port. Each
bit sets to “1” when the origin sensor ----------- MO (25) is turned ON, and MO (26, 21) are turned OFF.
turns ON, and to “0” when OFF. MO3() = 15
· The HOLD status of axes 1 to 8 (in ----------- MO (33, 32, 31, 30) are turned ON, and MO (37, 36, 35, 34)
order from bit 0) is output to the MO1 are turned OFF.
( ) port. Each bit sets to “1” when the MO(37,35,27,20)=A
axis is in a HOLD status, and to “0” ----------- The contents of the 4 lower bits obtained when variable A is
when not. Being in HOLD status
means that the axis has already converted to an integer are output to MO (37, 35, 27, 20),
reached the target position. respectively.
· Bits must be specified in ascending
order from the right. Related commands: RESET, SET

84
11. Command Statements

MOVE statement
(Absolute position movement command)

Format:
2
MOVE PTP , <point definition> [, option [, option] … ]
P
L
C

Explanation:
This statement executes an absolute movement of main robot axes. This statement will
not move the sub robot axes and auxiliary axes.
Movement type : PTP, linear interpolation, circular interpolation
Point data setting : Direct coordinate data input, point definition
Options : Speed setting, arch motion setting, STOPON condition
setting, CONT setting, acceleration setting, deceleration
setting, coordinate plane setting, port output setting

Movement type
· PTP (point to point) movement
PTP movement begins after positioning on all movable axes is complete (within the
tolerance range), and the command terminates when all movable axes enter the OUT
position range. All movable axes will reach the target positions simultaneously, but their
paths are not guaranteed.
To execute the next command after waiting for the axes to enter the target position tolerance
range, use the WAIT ARM statement.

Example:
MOVE P,P0
MOVE PTP,P0
----------- Main robot axes move from the current position to the position
specified by P0.

· Linear interpolation movement


Linear interpolation movement begins after positioning on all movable axes is complete
(within the tolerance range), and the command terminates immediately afterwards. Other
commands placed immediately after the MOVE statement are therefore executed
immediately after linear interpolation movement begins.
If the preceding command is also a MOVE command for linear interpolation or circular
interpolation, the traveling paths made with the two MOVE commands are connected at
the deceleration/acceleration point to allow smooth, continuous axis movement. All
movable axes will reach the specified position simultaneously.
However, if a STOPON condition setting option was inserted, axis movement begins and
then waits for all movable axes to complete the operation (reach within target position
tolerance range).
To execute the next command after waiting for the axes to enter the target position tolerance
range, use the WAIT ARM statement.

85
11. Command Statements

n· Linear
NOTE
interpolation can be
Example:
MOVE L,P0,P1
performed by task 1 only. ----------- Main robot axes move from the current position to the position
· Smooth travel paths might not always specified by P0 and then to the position specified by P1.
be possible depending on the axis
movement speed, acceleration and P0 P1

2 distance between the target points.


· Movement speed between the target
points might not be constant
depending on the axis movement
speed, acceleration and distance
Current position
between the target points.
· On robots having an R-axis, the R- · Circular interpolation movement
axis speed may become too fast and Circular interpolation movement begins after positioning on all movable axes is complete
cause an error depending on the R-
axis movement distance. (within the tolerance range), and the command terminates immediately afterwards. Other
commands placed immediately after the MOVE statement are therefore executed
immediately after circular interpolation movement begins.
If the preceding command is also a MOVE command for linear interpolation or circular
interpolation, the traveling paths made with the two MOVE commands are connected at
the deceleration/acceleration point to allow smooth, continuous axis movement. All
movable axes will reach the target positions simultaneously.
One circular arc is formed by 3 points consisting of the current position, intermediate
position and target position.
To execute the next command after waiting the axes to enter the target position tolerance
range, use the WAIT ARM statement.

n· The
NOTE
movable range for circular
Example:
MOVE L,P20
interpolation is 5000.00mm to MOVE C,P21,P22,P23,P20
1.00mm in radius. MOVE L,P24
· Circular interpolation can be ----------- Moves linearly from the current position to P20, then moves
performed by task 1 only.
along a circle formed by points P20, P21, P22, P23 and P20,
· Circular interpolation must be
specified by an even number of points. and moves again linearly to P24.
· Circular arc may become distorted
depending on the axis movement P22
speed, acceleration and the circular
arc radius.
· On robots having an R-axis, the R- P23 P21
axis speed may become too fast and
cause an error depending on the R-
axis movement distance. Current position P20 P24

Point data setting


· Direct coordinate data input
Format:

X Y Z R A B

X, Y, Z, R, A and B are coordinate values on respective axes and must be separated from
each other by a space.

n IfNOTE
point data is specified with both
Explanation:
Directly specify the coordinate data on each axis with an integer or a real number. When
integers and real numbers in the same the coordinate data is an integer, the movement units are viewed as “pulses”. When the
statement, all axes move in “mm” or coordinate data is a real number, the units are viewed as “mm” or “deg”.
“deg” units.
PTP movement and linear interpolation movement can be used with this coordinate data
setting.

Hand system flags can be specified when directly specifying the coordinate data in "mm"
units for SCARA robots.

86
11. Command Statements

n· When
NOTE
a SCARA robot is used and a
When setting an extended hand system flag for SCARA robots, set either 1 or 2 at the data
end of B. If a number other than 1 or 2 is set, or if no number is designated, then 0 will be
hand system flag is set for the target set to indicate that there is no hand system flag.
position data, that hand system has
priority over the current arm type.
· Hand system flags are enabled only 1 : Right-handed system is used to move to a specified position.
when the software version is V8.08 or
later.
2 : Left-handed system is used to move to a specified position.
2
c When
CAUTION
performing linear interpolation
Example:
MOVE P,10000 10000 1000 1000 0 0
while specifying a hand system flag, ----------- Moves by PTP from the current position to the specified
make sure that the same hand system
is used at the current position and positions.
target position. If the same hand
system is not used, then an error will
occur and robot movement will not be
allowed.
· Point definition
Format:

<point expression> [, <point expression> …]


n· Circular
NOTE
interpolation must be Explanation:
specified by an even number of points. Specify the point data in <point expression>. Two or more pieces of data can be designated
· When a SCARA robot is used and a by separating them with a comma ( , ).
hand system flag is set for the point
data you specify, that hand system has
priority over the current arm type. Example:
MOVE P,P1
c When
CAUTION
moving the robot by linear or
----------- Moves from the current position to the position specified by
P1.
circular interpolation to a point MOVE P,P20,P0,P100
where a hand system flag is specified,
----------- Moves in order from the current position to the positions
make sure that the same hand system
is used at the current position and specified by P20, P0 and P100.
target position. If the same hand
system is not used, then an error will
occur and robot movement will not be
allowed.

Option types
· Speed setting
Format 1:

SPEED = <expression>
S

The value of <expression> must be from 1 to 100. (Unit: %)

Explanation:
Specify the program speed in <expression>. Robot operating speed is determined by the
product of the automatic movement speed and the program speed. This option is enabled
only for the specified MOVE statement.

n This
NOTE
option merely specifies the
Example:
MOVE P,P10,S=10
maximum speed and does not ----------- Moves from the current position to the position specified by
guarantee the specified speed. P10 at 10% of normal program speed.

87
11. Command Statements

Format 2:

VEL = <expression>

The value of <expression> must be from 1 to 750 for SCARA robots, and from 1 to 1000
2 for Cartesian robots. (Unit: mm/sec)

Explanation:
Specify the maximum composite speed of the XYZ axes in <expression> in “mm/sec”
units. This option can be used for linear interpolation movement of SCARA robots or
Cartesian robots and is enabled only for the specified MOVE statement.

n This
NOTE
option merely specifies the
Example:
MOVE L,P10,VEL=100
maximum composite speed and does ----------- Moves at a maximum XYZ composite speed of 100mm/sec
not guarantee the specified speed. from the current position to the position specified by P10.

· Arch motion setting


Format:

x = <expression>, [ x = <expression> … ]

x : Axis X, Y, Z, R, A or B

When the value of <expression> is an integer, the movement units are viewed as “pulses”.
When the value is a real number containing a decimal point, the units are viewed as “mm”
or “deg”.

Explanation:
The specified “x” axis first moves toward the position specified in <expression>. Then,
when the specified “x” axis enters the arch position range, all axes other than the “x” axis
move toward the target position. Finally, all axes other than the “x” axis enter the arch
position range and also the specified “x” axis enters within the tolerance range of the
position specified in <expression>, the specified “x” axis moves toward the target position,
and when it enters the OUT position range, the command terminates.
This option can be used for PTP movement.
If the specified “x” axes include an X-axis or Y-axis, the target position and the
<expression> must be specified by an integer (in “pulse” units).

Example:
MOVE P,P1,Z=0
----------- The Z-axis first moves from the current position to the “0
pulse” position and then other axes move to P1. Finally the
Z-axis moves to P1.
Z=0

Current position P1

88
11. Command Statements

· STOPON condition setting


Format:

STOPON <conditional expression>

Explanation:
This command option stops the robot movement when the conditional expression is met.
2
The robot will move a slight distance while slowing down before coming to a stop after
the condition is met.
If the conditional expression is already satisfied before the robot begins to move, the
command will terminate without moving the robot. This option can be used for PTP
movement or linear interpolation movement and is enabled only during program execution.

Example:
MOVE P,P100,STOPON DI(20)=1
----------- Moves from the current position to the position specified by
P100, and slows down and stops when the condition “DI (20)
= 1” is met.

· CONT setting
Format:

CONT

Explanation:
When PTP movement is executed with the CONT setting option, PTP movement (to be
executed immediately after all movable axes enter the OUT position range and the
command terminates) will begin without waiting for the movable axes to complete the
operation (reach within target position tolerance range).
This option can be used for PTP movement and is enabled only for the specified MOVE
statement.

n· NOTE
The positioning time for starting PTP
Example:
MOVE P,P10,P11,CONT
movement can be reduced by CONT ----------- Moves from the current position to the position specified by
setting. P10, and then moves to P11 without waiting for the movable
· The path to the target point is not axes to enter the tolerance range.
guaranteed.

P10 P11

OUT position range

Current position

89
11. Command Statements

· Acceleration setting
Format:

ACC = <expression>

2 The value of <expression> must be from 1 to 100. (Unit: %)

Explanation:
Specify the robot acceleration rate in <expression>. The actual robot acceleration
is determined by the product of the acceleration coefficient parameter setting and this
acceleration rate.
This option can be used for linear interpolation movement and is enabled only for the
specified MOVE statement.

Example:
MOVE L,P100,ACC=10
----------- Moves from the current position to the position specified by
P100 at 10% acceleration rate.

· Deceleration setting
Format:

DEC = <expression>

The value of <expression> must be from 1 to 100. (Unit: %)

Explanation:
Specify the robot deceleration rate in <expression>. The actual robot deceleration is determined
by the product of the acceleration coefficient parameter setting and this deceleration rate.
This option can be used for linear interpolation movement and is enabled only for the
specified MOVE statement.

Example:
MOVE L,P100,DEC=20
----------- Moves from the current position to the position specified by
P100 at 20% deceleration rate.

90
11. Command Statements

· Coordinate plane setting


Format:

XY
YZ
ZX 2
n· NOTE
If no coordinate plane is specified, the
XY : XY coordinate plane
YZ : YZ coordinate plane
robot moves along a 3-dimensional ZX : ZX coordinate plane
circle.
· When a 2-axis robot is used, it moves
along a circle on the XY plane. Explanation:
When a circular interpolation is executed by setting the coordinates, this option executes
circular interpolation so that the projection on the specified coordinate plane becomes a
circle.
This option can be used for circular interpolation movement and is enabled only for the
specified MOVE statement.

Example:
P10 = 100.00 100.00 20.00 0.00 0.00 0.00
P11 = 150.00 100.00 0.00 0.00 0.00 0.00
P12 = 150.00 150.00 20.00 0.00 0.00 0.00
P13 = 100.00 150.00 40.00 0.00 0.00 0.00
MOVE P,P10
MOVE C,P11,P12
MOVE C,P13,P10
----------- Continuously moves along a 3-dimensional circle formed by
P10, P11 and P12, and also P12, P13 and P10.
MOVE C,P11,P12,XY
MOVE C,P13,P10,XY
----------- Continuously moves along a circle on the XY plane, formed
by P10, P11 and P12, and also P12, P13 and P10. At this
point, the Z-axis moves to a position specified by P12 and
P10 as the target position of the circular movement.

91
11. Command Statements

c The
CAUTION
port output setting is enabled
· Port output setting
Format 1:
only when the software version is
V8.22 or later.
DO m ( [b, … ,b] ) =<expression 1>@<expression 2>
MO
2 SO

Format 2:

DO (mb, … ,mb) =<expression 1>@<expression 2>


MO
SO

m : port number 2 to 7, 10 to 17, 20 to 27


b : bit position 0 to 7

The value of <expression 1> should be an integer or it will be converted to an integer. The
lower bits corresponding to the bits specified on the left side will be valid.
The value of <expression 2> must be in "mm" units.

Explanation:
During linear interpolation or circular interpolation movement, this command option
outputs the value of <expression 1> to the specified port when the robot reaches a position
that is away from the start position by a distance specified in <expression 2>.
This command option can only be used with linear interpolation or circular interpolation
movement. Up to 2 options can be set in one MOVE statement.

n· NOTE
Output to the DO0 ( ) and DO1 ( )
Example 1:
MOVE P,P0
ports is not allowed. MOVE L,P1,DO2()[email protected]
· Output to the MO0 ( ) and MO1 ( ) ----------- Outputs 105 (&B01101001) to DO2( ) at a position 25.85mm
ports is not allowed. away from P0 during liner interpolation movement toward
· Output to the SO0 ( ) and SO1 ( )
ports is not allowed. P1.
· Bits must be specified in ascending
order from the right. Example 2:
· External output is unavailable to DO/ A!=10
SO ports not connected to hardware. B!=20
MOVE L,P2,MO(22)=1@A!,MO(22)=0@B!
----------- Turns MO(22) ON at a position 10mm away from the start
position and then turns MO(22) OFF at a position 20mm away
from the start position during movement toward P2.

Related commands: MOVEI, DRIVE, DRIVEI, WAIT ARM

92
11. Command Statements

MOVE2 statement
(Absolute position movement command)

Format:
2
MOVE2 PTP , <point definition> [, option [, option] … ]
P

Explanation:
This statement executes an absolute movement of all sub robot axes. This statement will
not move the main robot axes and auxiliary axes.
Movement type : PTP
Point data setting : Direct coordinate data input, point definition
Options : Speed setting, arch motion setting, STOPON condition
setting, CONT setting

Movement type
· PTP (point to point) movement
PTP movement begins after positioning on all movable axes is complete (within the
tolerance range), and the command terminates when all movable axes enter the OUT
position range. All movable axes will reach the target positions simultaneously, but their
paths are not guaranteed.
To execute the next command after waiting for the axes to enter the target position tolerance
range, use the WAIT ARM2 statement.

Example:
MOVE2 P,P0
MOVE2 PTP,P0
----------- Sub robot axes move from the current position to the position
specified by P0.

Point data setting


· Direct coordinate data input
Format:

X Y Z R A B

X, Y, Z, R, A and B are the coordinate values on respective axes, and must be separated
from each other by a space.

Explanation:
n IfNOTE
point data is specified with both Directly specify the coordinate data on each axis with an integer or a real number. When
integers and real numbers in the same the coordinate data is an integer, the movement units are viewed as “pulses”. When the
statement, all axes move in “mm” or coordinate data is a real number, the units are viewed as “mm” or “deg”.
“deg” units.

Hand system flags can be specified when directly specifying the coordinate data in "mm"
units for SCARA robots.

93
11. Command Statements

n· When
NOTE
a SCARA robot is used and a
When setting an extended hand system flag for SCARA robots, set either 1 or 2 at the data
end of B. If a number other than 1 or 2 is set, or if no number is designated, then 0 will be
hand system flag is set for the target set to indicate that there is no hand system flag.
position data, that hand system has
priority over the current arm type.
· Hand system flags are enabled only 1 : Right-handed system is used to move to a specified position.

2 when the software version is V8.08 or


later.
2 : Left-handed system is used to move to a specified position.

Example:
MOVE2 P,10000 10000 1000 1000 0 0
----------- Moves by PTP from the current position to the specified
positions.

· Point definition
Format:

<point expression> [, <point expression> …]

n When
NOTE
a SCARA robot is used and a
Explanation:
Specify the point data in <point expression>. Two or more pieces of data can be designated
hand system flag is set for the point by separating them with a comma ( , ).
data you specify, that hand system has
priority over the current arm type.
Example:
MOVE2 P,P1
----------- Moves from the current position to the position specified by
P1.
MOVE2 P,P20,P0,P100
----------- Moves in order from the current position to the positions
specified by P20, P0 and P100.

Option types
· Speed setting
Format 1:

SPEED = <expression>
S

The value of <expression> must be from 1 to 100. (Unit: %)

Explanation:
Specify the program speed in <expression>. Robot operating speed is determined by the
product of the automatic movement speed and the program speed. This option is enabled
only for the specified MOVE2 statement.

n This
NOTE
option merely specifies the
Example:
MOVE2 P,P10,S=10
maximum speed and does not ----------- Moves from the current position to the position specified by
guarantee the specified speed. P10 at 10% of normal program speed.

94
11. Command Statements

· Arch motion setting


Format:

x = <expression>, [ x = <expression> … ]

x : Axis X, Y, Z, R, A or B
2
When the value of <expression> is an integer, the movement units are viewed as “pulses”.
When the value is a real number containing a decimal point, the units are viewed as “mm”
or “deg”.

Explanation:
The specified “x” axis first moves toward the position specified in <expression>. Then,
when the specified “x” axis enters the arch position range, all axes other than the “x” axis
move toward the target position. Finally, all axes other than the “x” axis enter the arch
position range and also the specified “x” axis enters within the tolerance range of the
position specified in <expression>, the specified “x” axis moves toward the target position,
and when it enters the OUT position range, the command terminates.
This option can be used for PTP movement.
If the specified “x” axes include an X-axis or Y-axis, the target position and the <expression>
must be specified by an integer (in “pulse” units).

Example:
MOVE2 P,P1,Z=0
----------- The Z-axis first moves from the current position to the “0
pulse” position and then other axes move to P1. Finally the
Z-axis moves to P1.
Z=0

Current position P1

· STOPON condition setting


Format:

STOPON <conditional expression>

Explanation:
This command option stops the robot movement when the conditional expression is met.
The robot moves a slight distance while slowing down before coming to a stop after the
condition is met.
If the conditional expression is already satisfied before the robot begins to move, the
command will terminate without moving the robot. This option is enabled only for PTP
movement or linear interpolation movement during program execution.

Example:
MOVE2 P,P100,STOPON DI(20)=1
----------- Moves from the current position to the position specified by
P100, and slows down and stops when the condition “DI (20)
= 1” is met.

95
11. Command Statements

· CONT setting
Format:

CONT

2 Explanation:
When PTP movement is executed with the CONT setting option, PTP movement (to be
executed immediately after all movable axes enter the OUT position range and the
command terminates) will begin without waiting for the movable axes to complete the
operation (reach within target position tolerance range). This option can be used for PTP
movement and is enabled only for the specified MOVE2 statement.

n· NOTE
Positioning time for starting PTP
Example:
MOVE2 P,P10,P11,CONT
movement can be reduced by CONT ----------- Moves from the current position to the position specified by
setting. P10, and then moves to P11 without waiting for the movable
· The path to the target point is not
guaranteed.
axes to enter the tolerance range.

P10 P11

OUT position range

Current position

Related commands: MOVEI2, DRIVE2, DRIVEI2, WAIT ARM2

96
11. Command Statements

MOVEI statement
c• If the robot is stopped during
CAUTION
(Relative position movement command)
execution of the MOVEI statement
and then restarted, the robot will
Format:
move the specified distance from the
stopped position. 2
MOVEI PTP , <point definition> [, option [, option] … ]
P

Explanation:
This statement executes a relative movement of all main robot axes. This statement will
not move the sub robot axes and auxiliary axes.
Movement type : PTP
Point data setting : Direct coordinate data input, point definition
Options : Speed setting

Movement type
· PTP (point to point) movement
PTP movement begins after positioning on all movable axes is complete (within the
tolerance range), and the command then terminates when all movable axes enter the OUT
position range. All movable axes will reach the target positions simultaneously, but their
paths are not guaranteed.
To execute the next command after waiting for the axes to enter the target position tolerance
range, use the WAIT ARM statement.

Example:
MOVEI P,P0
MOVEI PTP,P0
----------- Main robot axes move by PTP a distance specified by P0
from the current position.

Point data setting


· Direct coordinate data input
Format:

X Y Z R A B

X, Y, Z, R, A and B are the coordinate values on respective axes and must be separated
from each other by a space.

n IfNOTE
point data is specified with both
Explanation:
Directly specify the coordinate data on each axis with an integer or a real number. When
integers and real numbers in the same the coordinate data is an integer, the movement units are viewed as “pulses”. When the
statement, all axes move in “mm” or coordinate data is a real number, the units are viewed as “mm” or “deg”.
“deg” units.

Hand system flags can be specified when directly specifying the coordinate data in "mm"
units for SCARA robots.

97
11. Command Statements

n· When
NOTE
a SCARA robot is used and a
When setting an extended hand system flag for SCARA robots, set either 1 or 2 at the data
end of B. If a number other than 1 or 2 is set, or if no number is designated, then 0 will be
hand system flag is set for the target set to indicate that there is no hand system flag.
position data, that hand system has
priority over the current arm type.
· Hand system flags are enabled only 1 : Right-handed system is used to move to a specified position.

2 when the software version is V8.08 or


later.
2 : Left-handed system is used to move to a specified position.

Example:
MOVEI P, 10000 10000 1000 1000 0 0
----------- Moves by PTP the specified distances from the current
position.

· Point definition
Format:

<point expression> [, <point expression> …]

n When
NOTE
a SCARA robot is used and a
Explanation:
Specify the point data in <point expression>. Two or more pieces of data can be designated
hand system flag is set for the point by separating them with a comma ( , ).
data you specify, that hand system has
priority over the current arm type.
Example:
MOVEI P,P1
----------- Moves by PTP a distance specified by P1 from the current
position.

Option type
· Speed setting
Format 1:

SPEED = <expression>
S

The value of <expression> must be from 1 to 100. (Unit: %)

Explanation:
Specify the program speed in <expression>. Robot operating speed is determined by the
product of the automatic movement speed and the program speed. This option is enabled
only for the specified MOVEI statement.
n This
NOTE
option merely specifies the Example:
maximum speed and does not MOVEI P,P10,S=10
guarantee the specified speed. ----------- Moves by PTP a distance specified by P1 from the current
position at 10% of normal program speed.

Related commands: MOVE, DRIVE, DRIVEI, WAIT ARM

98
11. Command Statements

MOVEI2 statement
c• If the robot is stopped during
CAUTION
(Relative position movement command)
execution of the MOVEI2 statement
and then restarted, the robot will
Format:
move the specified distance from the
stopped position. 2
MOVEI2 PTP , <point definition> [, option [, option] … ]
P

Explanation:
This statement executes a relative movement of all sun robot axes. This statement will not
move the main robot axes and auxiliary axes.
Movement type : PTP
Point data setting : Direct coordinate data input, point definition
Options : Speed setting

Movement type
· PTP (point to point) movement
PTP movement begins after positioning on all movable axes is complete (within the
tolerance range), and the command terminates when all movable axes enter the OUT
position range. All movable axes will reach the target positions simultaneously, but their
paths are not guaranteed.
To execute the next command after waiting for the axes to enter the target position tolerance
range, use the WAIT ARM2 statement.

Example:
MOVEI2 P,P0
MOVEI2 PTP,P0
----------- Sub robot axes move by PTP a distance specified by P0 from
the current position.

Point data setting


· Direct coordinate data input
Format:

X Y Z R A B

X, Y, Z, R, A and B are the coordinate values on respective axes and must be separated
from each other by a space.

Explanation:
n IfNOTE
point data is specified with both Directly specify the coordinate data on each axis with an integer or a real number. When
integers and real numbers in the same the coordinate data is an integer, the movement units are viewed as “pulses”. When the
statement, all axes will move in “mm” coordinate data is a real number, the units are viewed as “mm” or “deg”.
or “deg” units.

Hand system flags can be specified when directly specifying the coordinate data in "mm"
units for SCARA robots.

99
11. Command Statements

n· When
NOTE
a SCARA robot is used and a
When setting an extended hand system flag for SCARA robots, set either 1 or 2 at the data
end of B. If a number other than 1 or 2 is set, or if no number is designated, then 0 will be
hand system flag is set for the target set to indicate that there is no hand system flag.
position data, that hand system has
priority over the current arm type.
· Hand system flags are enabled only 1 : Right-handed system is used to move to a specified position.

2 when the software version is V8.08 or


later.
2 : Left-handed system is used to move to a specified position.

Example:
MOVEI2 P,10000 10000 1000 1000 0 0
----------- Moves by PTP the specified distances from the current
position.

· Point definition
Format:

<point expression> [, <point expression> …]

n When
NOTE
a SCARA robot is used and a
Explanation:
Specify the point data in <point expression>. Two or more pieces of data can be designated
hand system flag is set for the point by separating them with a comma ( , ).
data you specify, that hand system has
priority over the current arm type.
Example:
MOVEI2 P,P1
----------- Moves by PTP a distance specified by P1 from the current
position.

Option type
· Speed setting
Format 1:

SPEED = <expression>
S

The value of <expression> must be from 1 to 100. (Unit: %)

Explanation:
Specify the program speed in <expression>. Robot operating speed is determined by the
product of the automatic movement speed and the program speed. This option is enabled
only for the specified MOVEI2 statement.
n This
NOTE
option merely specifies the Example:
maximum speed and does not MOVEI2 P,P10,S=10
guarantee the specified speed. ----------- Moves by PTP a distance specified by P1 from the current
position at 10% of normal program speed.

Related commands: MOVE2, DRIVE2, DRIVEI2, WAIT ARM2

100
11. Command Statements

ON ERROR GOTO statement

Format:

ON ERROR GOTO <label>


0
2
Error output information ERR : Error number
ERL : Line number of error

Explanation:
Even if an error occurs during execution of the robot language, this statement allows the
program to jump to the error processing routine specified by <label>, so that the program
still continues without being suspended. (Some serious errors are excluded.) If “0” is
specified for <label> in this statement, the program stops when an error is issued and the
error message is displayed.
The error processing routine processes the error using the RESUME statement and handles
the error output information.

n· NOTE
If a serious error such as “Over
Example:
ON ERROR GOTO *ER1
load” occurs, the program execution FOR A = 0 TO 9
stops. P[A+10] = P[A]
· The last “ON ERROR GOTO NEXT A
<label>” statement that was used is *L99: HALT
valid. ’ERROR ROUTINE
· If an error occurs while an error *ER1:
processing routine is being executed, IF ERR = &H0604 THEN *NEXT1
the program will stop. ----------- Checks whether an error “Point doesn't exist” has occurred.
· “ON ERROR GOTO <label>” IF ERR = &H0606 THEN *NEXT2
statements cannot be executed within ----------- Checks whether an error “Subscript out of range” has
error processing routines.
occurred.
ON ERROR GOTO 0
----------- Displays the error message and stops the program execution.
*NEXT1:
RESUME NEXT
----------- Jumps to the next command line after the line where the error
occurred, and continues executing the program.
*NEXT2:
RESUME *L99
----------- Jumps to the label “*L99” and continues executing the
program.

Related commands: RESUME

101
11. Command Statements

ON to GOTO statement

Format:

2 ON <expression> GOTO <label 1> [, <label 2>. . .]


GO TO

The value of <expression> must be “0” or a positive integer.

Explanation:
In this statement, the value of <expression> determines where the program will jump.
When the value of <expression> is “1”, the program will jump to <label 1>. When it is
“2”, the program will jump to <label 2>. Likewise, when it is “n”, the program will jump
to <label n>.
If the value of <expression> is “0” or greater than the number of labels specified, the next
command is executed without making a jump.

Example:
’MAIN ROUTINE
*ST:
ON DI3() GOTO *L1,*L2,*L3
GOTO *ST
HALT
’SUB ROUTINE
*L1:
MOVE P,P10,Z=0
GOTO *ST
*L2:
DO(30) = 1
GOTO *ST
*L3:
DO(30) = 0
GOTO *ST

Related commands: GOTO, DECLARE

102
11. Command Statements

ON to GOSUB statement

Format:

ON <expression> GOSUB <label 1> [, <label 2>. . .]


GO SUB
2
The value of <expression> must be “0” or a positive integer.

Explanation:
In this statement, the value of <expression> determines where the program will jump.
When the value of <expression> is “1”, the program will jump to <label 1>. When it is
“2”, the program will jump to <label 2>. Likewise, when it is “n”, the program will jump
to <label n>.
After the subroutine at the destination jumped to has been executed, the next command
following the ON to GOSUB statement is executed.
If the value of <expression> is “0” or greater than the number of labels, the next command
is executed without making a jump.

Example:
’MAIN ROUTINE
*ST:
ON DI3() GOSUB *SUB1,*SUB2,*SUB3
GOTO *ST
HALT
’SUB ROUTINE
*SUB1:
MOVE P,P10,Z=0
RETURN
*SUB2:
DO(30) = 1
RETURN
*SUB3:
DO(30) = 0
RETURN

Related commands: GOSUB, RETURN, DECLARE

103
11. Command Statements

ONLINE statement, OFFLINE statement


Format:

ONLINE
2 OFFLINE

Explanation:
These statements change the communication mode and initialize the communication port.

n Initializing
NOTE
the communication port
Example:
OFFLINE
clears the communication error and SEND CMU TO A$
receiving buffer. SEND CMU TO P10
ONLINE
HALT

104
11. Command Statements

ORGORD statement
(Return-to-origin sequence setting statement for main group)

Format:
2
ORGORD <expression>

The value of <expression> must be an integer from 0 to 654321.

Explanation:
This statement sets the axis sequence parameter to perform return-to-origin movement
for the main group.

Example:
A=3
ORGORD A
ABSRST
----------- After return-to-origin operation on axis 3 of the main group
is complete, absolute reset is executed by performing
simultaneous return-to-origin on the remaining axes.
MOVE P,P0
HALT

Related commands: ABSRST, ORIGIN, ORGORD2

105
11. Command Statements

ORGORD2 statement
(Return-to-origin sequence setting statement for sub group)

Format:
2
ORGORD2 <expression>

The value of <expression> must be an integer from 0 to 4321.

Explanation:
This statement sets the axis sequence parameter to perform return-to-origin movement
for the sub group.

Example:
A=1234
ORGORD2 A
ABSRST
MOVE2 P,P0
HALT

Related commands: ABSRST, ORIGIN, ORGORD

106
11. Command Statements

ORIGIN statement
Format:

ORIGIN

n This
NOTE Explanation:
2
command cannot be executed if This statement moves the robot to the origin position on an incremental motor axis.
the return-to-origin method of an If the movement to the origin position is interrupted, return-to-origin will be incomplete.
incremental motor axis is set to
"Mark". When two robots are specified, return-to-origin is first performed on the main group and
then on the sub group.

Example:
ORIGIN
……Performs return-to-origin on an incremental motor axis.

Related commands: ABSRST, ORGORD, ORGORD2, MCHREF, MCHREF2

107
11. Command Statements

c The
CAUTION
OUT statement is enabled only
OUT statement
when the software version is V8.22 or Format:
later.

OUT DOm ([b,· · ·,b]) [,<expression>]


2 DO (mb,· · ·,mb)
MOm ([b,· · ·,b])
MO (mb,· · ·,mb)
SOm ([b,· · ·,b])
SO (mb,· · ·,mb)
LO0 ([b,· · ·,b])
LO (0b,· · ·,0b)
TO0 ([b,· · ·,b])
TO (0b,· · ·,0b)

m : port number 2 to 7, 10 to 17, 20 to 27


b : bit definition 0 to 7
The value of <expression> must be from 1 to 3600000. (Unit: ms) Note that the minimum
run time is 10ms.

Explanation:
This statement turns ON the specified port and terminates. (The program proceeds to the
next line.) The output to that port is then turned OFF when automatic operation has
continued for the time specified by <expression>. If the operation is stopped temporarily
and then restarted, the output to the specified port is turned OFF when the remainder of
the specified time has elapsed.

Figures below 10 in the <expression> value are rounded down. If a value below 10 is
specified, then it is set to 10. If this expression is omitted, then the specified port is kept
turned ON.
Up to 16 OUT statements using <expression> can be executed at the same time. If attempt
is made to execute 17 or more OUT statements, an error "6.26: No sufficient memory for
OUT" occurs.

n· NOTE
Output to the DO0 ( ) and DO1 ( )
Example:
OUT DO2(),200
ports is not allowed. ----------- DO (27 to 20) are turned ON and then turned OFF after 200ms.
· Output to the MO0 ( ) and MO1 ( ) OUT DO(37,35,27,20)
ports is not allowed. ----------- DO (37, 35, 27, 20) are turned ON.
· Output to the SO0 ( ) and SO1 ( )
ports is not allowed.
· Bits must be specified in ascending Related commands: DO, MO, SO, TO, LO
order from the right.
· External output is unavailable to DO/
SO ports not connected to hardware.

108
11. Command Statements

OUTPOS statement
(OUT position setting statement for main group)

Format 1:
2
OUTPOS <expression>

Format 2:

OUTPOS (<expression 1>) = <expression 2>

The value of <expression 1> must be from 1 to 6 (axis number).


The value of <expression> and <expression 2> must be from 1 to 6144000. (Unit: pulses)

n IfNOTE
an axis that is set to “no axis” in the
Explanation:
This statement changes the OUT position parameter for the main group to the value
system generation is specified, then an
error message “Specification
specified in <expression>. Format 1 changes all main group axes. Format 2 changes the
mismatch” appears and execution of OUT position parameter for the axis specified in <expression 1> to the value specified in
the command will stop. <expression 2>.

Example:
’CYCLE WITH DECREASING OUTPOS
DIM SAV(3)
GOSUB *SAVE_OUTPOS
FOR A=1000 TO 10000 STEP 1000
GOSUB *CHANGE_OUTPOS
MOVE P,P0
DO3(0)=1
MOVE P,P1
DO3(0)=0
NEXT A
GOSUB *RESTORE_OUTPOS
HALT
*CHANGE_OUTPOS:
FOR B=1 TO 4
OUTPOS(B)=A
NEXT B
RETURN
*SAVE_OUTPOS:
FOR B=1 TO 4
SAV(B-1)=OUTPOS(B)
NEXT B
RETURN
*RESTORE_OUTPOS:
FOR B=1 TO 4
OUTPOS(B)=SAV(B-1)
NEXT B
RETURN

109
11. Command Statements

OUTPOS2 statement
(OUT position setting statement for sub group)

Format 1:
2
OUTPOS2 <expression>

Format 2:

OUTPOS2 (<expression 1>)=<expression 2>

The value of <expression 1> must be from 1 to 4 (axis number).


The value of <expression> and <expression 2> must be from 1 to 6144000. (Unit: pulses)

n· NOTE
This statement can be used only when
Explanation:
This statement changes the OUT position parameter for the sub group to the value specified
the sub group is set in the system
in <expression>. Format 1 changes all sub group axes. Format 2 changes the OUT position
generation.
· If an axis that is set to “no axis” in parameter for the axis specified in <expression 1> to the value specified in <expression
the system generation is specified, 2>.
then an error message “Specification
mismatch” appears and execution of
Example:
the command will stop.
’CYCLE WITH DECREASING OUTPOS
DIM SAV(3)
GOSUB *SAVE_OUTPOS
FOR A=1000 TO 10000 STEP 1000
GOSUB *CHANGE_OUTPOS
MOVE2 P,P0
DO3(0)=1
MOVE2 P,P1
DO3(0)=0
NEXT A
GOSUB *RESTORE_OUTPOS
HALT
*CHANGE_OUTPOS:
FOR B=1 TO 4
OUTPOS2(B)=A
NEXT B
RETURN
*SAVE_OUTPOS:
FOR B=1 TO 4
SAV(B-1)=OUTPOS2(B)
NEXT B
RETURN
*RESTORE_OUTPOS:
FOR B=1 TO 4
OUTPOS2(B)=SAV(B-1)
NEXT B
RETURN

110
11. Command Statements (PATH-related statements)

PATH-related statements
What is a PATH function?

Overview 2
This is a function for moving the robot at a specified speed along a path made up of
straight lines and circular arcs. The PATH function is ideal for applications such as seal-
ing since there is little speed fluctuation during movement.

Features
• Moves the robot at a constant speed along the entire movement path (except the
acceleration zone from stop state and the deceleration zone before the movement
ends).
• Makes point teaching easy because the robot speed does not depend on how fine or
coarse the point teaching positions settings were made.
• Changes the speed the robot moves along the entire path. Speed option can be used
here to change the speed at just a section of the movement path.
• Using the DO option allows outputting a signal to a specified port at any desired
position during movement.

How to use
The following robot language commands must be used as a set in order to use the PATH
function.
• PATH statement (PATH L, PATH C)
• PATH SET statement
• PATH END statement
• PATH START statement

Example:
The PATH statements are used to set the motion path by means of sections enclosed by
the PATH SET and PATH END statements. The robot does not move by just setting the
motion path. It starts moving along the specified motion path when the PATH START
statement is executed.

MOVE P,P0,Z=0
PATH SET ------ Start of path setting
PATH L,P1,DO(20)[email protected]
PATH L,P2



PATH C,P12,P13
PATH L,P14,DO(20)[email protected]
PATH END ------ End of path setting
MOVE P,P1,Z=0



MOVE P,P0,Z=0
PATH START ------ Executes the specified PATH motion
HALT

111
11. Command Statements (PATH-related statements)

Cautions when using this function


• The path is a total of up to 300 segments of both straight lines and circular arcs.
• To execute PATH motion (run the PATH START statement), the robot must be
positioned at the start point of the path that was set.
• At points where the arc and straight line connect, make their movement directions
2 match as much as possible. If there is a large difference in their directions, vibra-
tions or robot errors might occur.

Good example Poor Example

• During movement, the robot moves along the inner side of the contact point where
a straight line connects with another straight line. Also, the higher the speed, the
more the robot shifts to the inner side (1). To avoid large path changes due to the
speed, increase the number of points as shown in (2). However, in some cases,
errors will occur unless the speed is lowered so use caution.

(1) (2)
Low speed Increase the number
High speed of points

• When unable to move at the specified speed and an error occurs:


The robot will accelerate or decelerate when a PATH motion starts or stops, or
when the specified speed is changed during movement along the path. When the
robot cannot reach the specified speed or decelerate because the distance between
points is too small at this time, an error occurs prior to starting movement. In this
case, the PATH motion might be executed by lowering the specified speed. If an
error still occurs even after lowering the speed, then change the points to make
longer straight lines or circular arcs that include the acceleration/deceleration zones.
• During PATH motion, make the hand system the same as the hand system at the
PATH start point. Do this also when using PATH motion to move to points where
a hand system flag is set. If the hand system is different then errors will occur and
operation will be disabled.
• If the robot stops due to an interlock during PATH motion, this is seen as termina-
tion of operation and movement on the remaining path is impossible even if re-
started.
Carefully read the caution items for each command.

112
11. Command Statements (PATH-related statements)

n PATH
NOTE
statement is enabled only when
PATH statement (PATH-related statements)
the software versions is V8.38 or later.
Format:

PATH L , <point definition> [, option [, option...] ]


C
2
Explanation:
This command statement sets the PATH motion path for the main robot axis.
Executing this command without first running the PATH SET command will cause an
error.
PATH motion type : Linear interpolation, circular interpolation
Point data setting : Direct coordinate data input, point definition
Options : Speed setting, coordinate plane setting (circular interpola-
tion only), port output setting

PATH motion type


• Linear interpolation movement -------- Sets linear interpolation movement with
"PATH L...".
• Circular interpolation movement ------ Sets circular interpolation movement with
"PATH C...".
PATH motion is only valid for the X, Y and Z coordinate values of the specified
points. The other coordinates use the coordinate value of the start point on the
PATH motion path.
Movement path can be connected by repeated use of PATH commands ("PATH L",
"PATH C") to allow movement without stopping.

Point data setting


· Direct coordinate data input
Format:

X Y Z R A B

X, Y, Z, R, A, and B are coordinate values on respective axes and must be separated from
each other by a space.

n When
NOTE
a SCARA robot is used and a
Explanation:
Directly specify the coordinate data. When the coordinate data is an integer, it is viewed
hand system flag is set for the target as "pulses" units. When the coordinate data is a real number, it is viewed as "mm" units.
position data, that hand system has
If both integers and real numbers are used, then all coordinates are handled in "mm"
priority over the current arm type.
units.
With this format, only one point can be specified as the movement destination coordi-
nates. The only type of movement specified by this point data setting is linear interpola-
tion.

c SetCAUTION
the hand system for PATH motion
Hand system flags can be specified when directly specifying the coordinate data in "mm"
units for SCARA robots.
to the same hand system as that at the When setting an extended hand system flag for SCARA robots, set either 1 or 2 at the data
start point of the PATH motion. When
moving by specifying a hand system
end of B. If a number other than 1 or 2 is set, or if no number is designated, then 0 will be
flag, also set the hand system to be set to indicate that there is no hand system flag.
the same as that at the start point for
the path. If the hand system is 1 : Right-handed system is used to move to a specified position.
different, then an error occurs and
operation is impossible. 2 : Left-handed system is used to move to a specified position.

113
11. Command Statements (PATH-related statements)

Example:
PATH L,10000 10000 1000 1000 0 0
----------- Sets for movement by linear interpolation to the specified
position.
PATH L,150.00 250.00 10.00 30.00 0.00 0.00 1
----------- Sets for movement by linear interpolation to the position speci-
2 fied in the right-handed system.

· Point definition
Format:

<point expression> [, <point expression> …]


n When
NOTE
a SCARA robot is used and a Explanation:
hand system flag is set for the point In <point expression>, specify the point to move to. Two or more points can be specified
data you specify, that hand system has
by separating them with a comma (,).
priority over the current arm type.
When the PATH motion type is circular interpolation, two points must be specified for
each single circular arc.

c SetCAUTION
the hand system for PATH motion
Example:
PATH L,P1,P2,P3
to the same hand system as that at the ----------- Sets for movement by linear interpolation in sequence to po-
start point of the PATH motion. When sitions specified by P1, P2 and P3.
moving by specifying a hand system
PATH C P5,P6,P7,P8
flag, also set the hand system to be
the same as that at the start point of ----------- Sets for movement by circular interpolation including the
the PATH motion. If the hand system current position, P5, P6 and P6, P7 and P8.
is different, then an error occurs and
operation is impossible.
Option types
· Speed setting
Format 1:

SPEED = <expression>
S

The value in <expression> must be from 1 to 100. (Unit: %)

Explanation:
Specify the program speed in <expression> (unit: %).
Actual speed is as follows.
Robot maximum speed (mm/sec.) × automatic movement speed (%) × program speed (%)
This option is enabled only for the specified PATH statement.

Example:
PATH L, P5, S=40
----------- Moves to the position specified by P5 at 40% of normal pro-
gram speed.

114
11. Command Statements (PATH-related statements)

Format 2:

VEL = <expression>

The value of <expression> varies according to the robot. (Unit: mm/sec)

Explanation:
2
Specify the movement speed in <expression> (unit: mm/sec). Error occurs if specified
speed is too high.
This option is enabled only for the specified PATH statement.

Example:
PATH L,P10,VEL=150
----------- Moves at speed of 150mm/sec to the position specified by
P10.

· Coordinate plane setting


Format:

XY
YZ
ZX

XY: XY coordinate plane


YZ: YZ coordinate plane
ZX: ZX coordinate plane

Explanation:
Specify the coordinate plane on which to draw a circular arc for circular interpolation
movement. If no coordinate plane is specified, then 3-dimensional circular interpolation
movement is used.
The only type of movement specified by this coordinate plane setting is circular interpo-
lation.
This option is enabled for only for specified PATH statement.

Example:
PATH C, P1, P2, XY
----------- Moves the robot to the Z coordinate position of P2 while per-
forming circular interpolation within XY coordinate plane.

115
11. Command Statements (PATH-related statements)

· Port output setting


Format 1:

DO m ( [b, … ,b] ) =<expression 1>@<expression 2>


MO
2 SO

Format 2:

DO (mb, … ,mb) =<expression 1>@<expression 2>


MO
SO

m : port number 2 to 7, 10 to 17, 20 to 27


b : bit position 0 to 7

The value in <expression 1> is output to the specified port. Only the integer portion is
valid.
The value in <expression 2> indicates the position for port output and can be specified to
2 digits below the decimal point in "mm" units.

n· Output
NOTE
to the DO0 ( ) and DO1 ( )
Explanation:
This command option outputs the value of <expression 1> to the specified output port
ports is not allowed. during PATH motion at the position specified in <expression 2>.
· Output to MO0 ( ) and MO1 ( )ports
is not allowed.
· Output to SO0 ( ) and SO1 ( )ports is Example:
not allowed. PATH SET
· Bits must be specified in ascending PATH L,P1,DO(20)=1@10
order from the right. PATH L,P2,DO(21)[email protected]
· External output is unavailable to DO/ PATH END
SO ports not connected to hardware. PATH START

P1 12.
5

DO(21)=1
10

P2
DO(20)=1

Related commands: PATH SET, PATH END, PATH START

116
11. Command Statements (PATH-related statements)

n PATH
NOTE
END statement is enabled only
PATH END statement (PATH-related statements)
when the software versions is V8.38 or
later.
Format:

PATH END 2
Explanation:
This is used to terminate the path setting for PATH motion.
The PATH END command must always be used as a pair along with the PATH SET
command. The final point of the PATH command ("PATH L" or "PATH C") that was
executed last between the PATH SET and PATH END commands is the end point of the
PATH motion.
An error will occur if the PATH END command is executed without first running PATH
SET.

Example:
See the "What is a PATH function?" description.

Related commands: PATH, PATH SET, PATH START

117
11. Command Statements (PATH-related statements)

n PATH
NOTE
SET statement is enables only
PATH SET statement (PATH-related statements)
when the software version is V8.38 or
later.
Format:

2 PATH SET [<Point definition>]

Explanation:
Starts the path setting for PATH motion.
Sets the position specified in <point definition> as the PATH motion start point. (This
only sets the PATH motion start point and does not mean the robot actually operates.) If
<point definition> is omitted, then the current robot position is set as the start point.
However, during robot movement, the target position for that movement becomes the
start point. (Example: OUT position range with MOVE command is wide prior to PATH
SET command, so robot still moves during execution of the PATH SET command.)
The PATH SET command must always be used as a pair along with the PATH END
command.
When the PATH SET command is executed, the previously set PATH motion data is de-
leted.
Point data setting : Direct coordinate data input, point definition

Example:
See the "What is a PATH function?" description.

Point data setting


· Direct coordinate data input
Format:

X Y Z R A B

X, Y, Z, R, A, and B are the coordinate values on respective axes and must be separated
from each other by a space.

n When
NOTE
a SCARA robot is used and a
Explanation:
Directly specify the start position coordinates for PATH motion path. When the coordi-
hand system flag is set for the start nate data is an integer, it is viewed as "pulses" units. When the coordinate data is a real
point data of the PATH motion path,
number, it is viewed as "mm" units (valid to 2 digits below the decimal point.) If both
that hand system has priority over the
current arm type. integers and real numbers are used, then all coordinates are handled in "mm" units.

c SetCAUTION
the hand system for PATH motion
Hand system flags can be specified when directly specifying the coordinate data in "mm"
units for SCARA robots.
to the same hand system as that at the
When setting an extended hand system flag for SCARA robots, set either 1 or 2 at the data
start point of the PATH motion. If the
hand system is different, then an end of B. If a number other than 1 or 2 is set, or if no number is designated, then 0 will be
error occurs and operation is set to indicate that there is no hand system flag.
impossible.
1 : Hand system at PATH motion start point is set to the right-handed system.
2 : Hand system at PATH motion start point is set to the left-handed system.

118
11. Command Statements (PATH-related statements)

Example:
PATH SET 120 250.00 55.2 20.33 0 0
----------- PATH motion start point is set to (120.00 250.00 55.20 20.33
0.00 0.00) in "mm" units.
PATH SET -51200 80521 7045 204410 0 0
----------- PATH motion start point is set in "pulses" units.

· Point definition
2
Format:

<point expression>
n When a SCARA robot is used and a
NOTE
Explanation:
hand system flag is set for the point Specify the PATH motion start point in <point expression>.
data you specify, that hand system has
priority over the current arm type.
PATH SET P10
----------- Sets the PATH motion start point to P10.
c SetCAUTION
the hand system for PATH motion
to the same hand system as that at the PATH SET WHERE
start point of the PATH motion. If the ----------- Sets the PATH motion start point the current robot position.
hand system is different, then an
error occurs and operation is
Related commands: PATH, PATH END, PATH START
impossible.

119
11. Command Statements (PATH-related statements)

PATH START statement (PATH-related statements)


n PATH
NOTE
START statement is enabled
only when the software version is Format:
V8.38 or later.

2 PATH START

Explanation:
Starts the PATH motion. PATH motion settings must be made beforehand with the PATH
SET command, PATH commands ("PATH L", "PATH C") and PATH END command
before executing the PATH START command. Also, before starting PATH motion, the
robot must also be positioned beforehand at the PATH motion start point specified by the
PATH SET command.
The robot PATH motion speed is the product of the automatic movement speed (%) when
the PATH START command is executed and the program speed (%) specified by the
SPEED command or speed option (SPEED or S) for the PATH command. Robot speed
does not rely on automatic movement speed, if the speed was specified with the speed
option (VEL)for the PATH command.
After PATH motion starts, this command terminates when the robot reaches the PATH
motion end point or when the robot stops due to an interlock.
This command can only be executed in Task 1 (main task).

Example:
See the "What is a PATH function?" description.

Related commands: PATH, PATH SET, PATH END

120
11. Command Statements

PDEF statement

Format:

PDEF (<expression 1>) = <expression 2>, <expression 3> [, <expression 4>] 2


The value of <expression 1> must be from 0 to 19.
The value of <expression 2>, <expression 3> and <expression 4> can be 1 to 32767 as
long as the value of <expression 2> * <expression 3> * <expression 4> is equal to or less
than 32767.

n· NOTE
Point data used in pallet definition
Explanation:
This statement defines the pallet used to execute a pallet movement command.
uses the data area as follows.
Pallet definition 0: P[1] to P[5] 22 23 24
----- P3996 to P4000 19 20 21
Pallet definition 1: P[1] to P[5]
16 17 18
----- P3991 to P3995 P [5]
:
13 14 15
Pallet definition 19:P[1] to P[5]
----- P3901 to P3905 P [3] P [4]
NZ
10 11 12
NY 7 8 9
4 5 6

1 2 3
P [1] P [2]
NX

<expression 1> : Pallet definition number (0 to 19)


<expression 2> : Number of points between P[1] and P[2]
<expression 3> : Number of points between P[1] and P[3]
<expression 4> : Number of points between P[1] and P[5]

Example:
PDEF(1) = 3,4,2
----------- Pallet definition 1 is defined as 3×4×2.

121
11. Command Statements

PMOVE statement (Pallet movement command)

Format:

2 PMOVE (pallet definition number, pallet position number) [,option [,option] …]

n· NOTE
The pallet definition number must be
Explanation:
This statement executes a pallet movement command for all main robot axes. This statement
designated to execute a PMOVE will not move the sub robot axes and auxiliary axes.
statement.
Movement type : PTP
· The XYZ axes move to the positions
determined by the calculated values. Pallet definition number : Numerical expression
However, the R-axis moves to the Pallet position number : Numerical expression
position specified by pallet point data Options : Speed setting, arch motion setting, STOPON
P[1].
condition setting
· In each pallet definition, pallet
position numbers are designated as
follows:
Movement type
NX*NY*NZ
· PTP (point to point) movement
NY PTP movement begins after positioning on all movable axes is complete (within the
NX*NY*(NZ-1)+1
NX*NY
NX NY*(NZ-1)+1
(NZ-1)+1 NX NY*(NZ-1)+NX
NX*NY*(NZ-1)+NX
NX*NY (NZ-1)+NX tolerance range), and the command terminates when all movable axes enter the OUT
P [3] P [4]
P [5]
NX*(NY-1)+1 NX*NY
position range. All movable axes will reach the target positions simultaneously, but their
NZ
NX+1 NX*2
paths are not guaranteed.
P [2] To execute the next command after waiting for the axes to enter the tolerance range of the
P [1] 1 2 ... NX

NX
target position, use the WAIT ARM statement.

Example:
PMOVE(1,16)
----------- Main robot axes move from the current position to the position
specified by pallet position number 16 of pallet definition
number 1.

122
11. Command Statements

Pallet definition number


Format:

<expression 1>

The value of <expression 1> must be 0 to 19. 2


Explanation:
Specify the pallet definition number.

Pallet position number


Format:

<expression 2>

The value of <expression 2> must be from 1 to 32767.

Explanation:
Specify the pallet position number.

Example:
PMOVE(1,16)
----------- Main robot axes move from the current position to the position
specified by pallet position number 16 of pallet definition
number 1.

123
11. Command Statements

Option types
· Speed setting
Format 1:

SPEED = <expression>
2 S

The value of <expression> must be from 1 to 100. (Unit: %)

Explanation:
Specify the program speed in <expression>. Robot operating speed is determined by the
product of the automatic movement speed and the program speed. This option is enabled
only for the specified PMOVE statement.

n This
NOTE
option merely specifies the
Example:
PMOVE(1,3),S=10
maximum speed and does not ----------- Moves at 10% of normal program speed from the current
guarantee the specified speed.
position to the position specified by pallet position number 3
of pallet definition number 1.

· Arch motion setting


Format:

x = <expression> [, x = <expression> … ]

x : Axis Z, R, A or B

When the value of <expression> is an integer, the movement units are viewed as “pulses”.
When the value is a real number containing a decimal point, the units are viewed as “mm”
or “deg”.

Explanation:
The specified "x" axis first moves toward the position specified in <expression>. Then,
when the specified axis enters the arch position range, all axes other than the specified
axis move toward the target position. Finally, when all axes other than the specified axis
enter the arch position range and also when the specified axis enters within the tolerance
range of the position specified in <expression>, the specified axis moves toward the target
position. When it enters the OUT position range, the command terminates.

Example:
PMOVE(1,A),Z=0
----------- The Z-axis first moves from the current position to the “0
pulse” position. Then the other axes move to the position
specified by pallet position number A of pallet definition
number 1. Finally the Z-axis moves to the position specified
by pallet position number A.
Z=0

Current position Position specified


by pallet position number A

124
11. Command Statements

· STOPON condition setting


Format:

STOPON <conditional expression>

Explanation:
This command option stops the robot movement when the conditional expression is met.
2
The robot will move a slight distance while slowing down before coming to a stop after
the condition is met.
If the conditional expression is already satisfied before the robot begins to move, the
command will terminate without moving the robot. This option is enabled only during
program execution.

Example:
PMOVE(A,16),STOPON DI(20)=1
----------- Moves from the current position to the position specified by
pallet position number 16 of pallet definition number A, and
slows down and stops when the condition “DI (20) = 1” is
met.

125
11. Command Statements

PMOVE2 statement (Pallet movement command)

Format:

2 PMOVE2 (pallet definition number, pallet position number) [,option [,option] …]

n· NOTE
The pallet definition number must be
Explanation:
This statement executes a pallet movement command for all sub robot axes. This statement
designated to execute a PMOVE2 will not move the main robot axes and auxiliary axes.
statement.
Movement type : PTP
· The XYZ axes move to the positions
determined by the calculated values. Pallet definition number : Numerical expression
However, the R-axis moves to the Pallet position number : Numerical expression
position specified by pallet point data Options : Speed setting, arch motion setting, STOPON
P[1].
condition setting
· In each pallet definition, pallet
position numbers are designated as
follows:
Movement type
NX*NY*NZ
· PTP (point to point) movement
NY PTP movement begins after positioning on all movable axes is complete (within the
NX NY*(NZ-1)+1
NX*NY*(NZ-1)+1
NX*NY (NZ-1)+1 NX NY*(NZ-1)+NX
NX*NY*(NZ-1)+NX
NX*NY (NZ-1)+NX tolerance range), and the command terminates when all movable axes enter the OUT
P [3] P [4]
P [5]
NX*(NY-1)+1 NX*NY
position range. All movable axes will reach the target positions simultaneously, but their
NZ
NX+1 NX*2
paths are not guaranteed.
P [2] To execute the next command after waiting for the axes to enter the tolerance range of the
P [1] 1 2 ... NX
target position, use the WAIT ARM2 statement.
NX

Example:
PMOVE2(1,16)
----------- Sub robot axes move from the current position to the position
specified by pallet position number 16 of pallet definition
number 1.

126
11. Command Statements

Pallet definition number


Format:

<expression 1>

The value of <expression 1> must be 0 to 19. 2


Explanation:
Specify the pallet definition number.

Pallet position number


Format:

<expression 2>

The value of <expression 2> must be from 1 to 32767.

Explanation:
Specify the pallet position number.

Example:
PMOVE2(1,16)
----------- Sub robot axes move from the current position to the position
specified by pallet position number 16 of pallet definition
number 1.

127
11. Command Statements

Option types
· Speed setting
Format 1:

SPEED = <expression>
2 S

The value of <expression> must be from 1 to 100. (Unit: %)

Explanation:
Specify the program speed in <expression>. Robot operating speed is determined by the
product of the automatic movement speed and the program speed. This option is enabled
only for the specified PMOVE2 statement.

n This
NOTE
option merely specifies the
Example:
PMOVE2(1,3),S=10
maximum speed and does not ----------- Moves at 10% of normal program speed from the current
guarantee the specified speed.
position to the position specified by pallet position number 3
of pallet definition number 1.

· Arch motion setting


Format:

x = <expression> [, x = <expression> … ]

x: Axis Z or R

When the value of <expression> is an integer, the unit of movement is viewed as “pulses”.
When the value is a real number containing a decimal point, the unit is viewed as “mm”
or “deg”.

Explanation:
The specified "x" axis first moves toward the position specified in <expression>. Then,
when the specified axis enters the arch position range, all axes other than the specified
axis move toward the target position. Finally, when all axes other than the specified axis
enter the arch position range and also when the specified axis enters within the tolerance
range of the position specified in <expression>, the specified axis moves toward the target
position. When it enters the OUT position range, the command terminates.

Example:
PMOVE2(1,A),Z=0
----------- The Z-axis first moves from the current position to the “0
pulse” position. Then the other axes move to the position
specified by pallet position number A of pallet definition
number 1. Finally the Z-axis moves to the position specified
by pallet position number A.
Z=0

Current position Position specified


by pallet position number A

128
11. Command Statements

· STOPON condition setting


Format:

STOPON <conditional expression>

Explanation:
This command option stops the robot movement when the conditional expression is met.
2
The robot will move a slight distance while slowing down before coming to a stop after
the condition is met.
If the conditional expression is already satisfied before the robot begins to move, the
command will terminate without moving the robot. This option is enabled only during
program execution.

Example:
PMOVE2(A,16),STOPON DI(20)=1
-------- --- Moves from the current position to the position specified by
pallet position number 16 of pallet definition number A, and
slows down and stops when the condition “DI (20) = 1” is
met.

129
11. Command Statements

PRINT statement

Format:

2 PRINT [<expression>] [ , <expression>...] [ , ]


; ;

Explanation:
This statement displays a value for the variable specified on the MPB screen. Output
definitions are as follows:

1. If numbers or character strings are specified in <expression>, they will be displayed


as is. If variables or arrays are specified, the values assigned to the specified variables
or arrays will be displayed. If no <expression> is specified, only line-feed is
performed.
2. If the data length exceeds the width of the screen, line-feed is performed so that
the remainder of the data appears on the following lines of the screen.
3. If a comma ( , ) is used as a delimiter, a space (blank) is inserted between the
displayed items.
4. If a semicolon ( ; ) is used as a delimiter, the displayed items appear in succession
without being separated.
5. If the data is ended with a delimiter, no line-feed is inserted and the next PRINT
statement is executed on the same display line. If not ended with a delimiter, line-
feed is performed.

n Every
NOTE
time a PRINT statement is
Examples:
PRINT A
executed, data is sent to display the PRINT “A1 =”;A1
specified value on the MPB screen. PRINT “B(0),B(1) = “;B(0);”,”;B(1)
The program execution time may be PRINT P100
longer if two or more PRINT
statements are executed in succession.
Related command: INPUT

130
11. Command Statements

Pn (Point definition statement)

Format:

Pn = x y z r a b 2
c InCAUTION
controllers whose software version
n: 0 to 9999
Input range for x, y, z, r, a, b is determined by the point data format.
is earlier than V8.28, point numbers
from 0 to 4000 can be specified with
Pn (point definition statement). Explanation:
This statement defines the point (position) to move to within the robot operation range.
Make point definitions while referring to the following notes.
1. “n” is a point number.
2. Input data for “x” to “b” must be separated with a space (blank).
3. If all input data for “x” to “b” are integers (no decimal points), the movement units
are viewed as “pulses”. At this point, “x” through “b” correspond to axis 1 through
axis 6.
4. If one of input data for “x” through “b” is a real number (containing a decimal
point), the movement units are viewed as “mm”. At this point, “x” to “z” correspond
to the x, y and z coordinates of Cartesian coordinate system, while “r” to “b”
correspond to axis 4 through axis 6.
5. Input data in “pulses” units must be in the range from –6144000 to 6144000, and
input data in “mm” units must be in the range from –99999.99 to 99999.99.

n· NOTE
When specifying a hand system flag
Hand system flags can be specified when specifying point definition data in "mm" units
for a SCARA robot and its point data, for SCARA robots.
set either 1 (right-handed system) or 2 When setting an extended hand system flag for SCARA robots, set either 1 or 2 at the data
(left-handed system) at the data end of end of b. If a number other than 1 or 2 is set, or if no number is designated, then 0 will be
B-axis data. set to indicate that there is no hand system flag.
· Hand system flag setting is enabled
only when the software version is
V8.08 or later. 1 : Right-handed system is used to set point data.
2 : Left-handed system is used to set point data.

n· Input
NOTE
data is treated as a constant.
Example:
P1= 0 0 0 0 0 0
· If power is turned off during execution P2= 100.00 200.00 50.00 0.00 0.00 0.00
of a point definition statement, a P3= 10.00 0.00 0.00 0.00 0.00 0.00
memory-related error such as “Point P10= P2
data destroyed” may occur. FOR A=10 TO 15
P[A+1]=P[A]+P3
NEXT A
FOR A=10 TO 16
MOVE P,P1,P[A]
NEXT A
HALT

Related command: Point assignment statement

131
11. Command Statements

REM (Comment statement)

Format:

2 REM <character string>


Explanation:
All characters that follow REM or an apostrophe (’) are viewed as comments. This statement
can only be used to make comments in the program and does not execute any command.

Example:
REM *** MAIN PROGRAM ***
’*** SUBROUTINE ***
HALT ’HALT COMMAND

132
11. Command Statements

RESET statement

Format 1:

RESET DOm ( [b, · · ·, b] )


DO ( mb, · · ·, mb )
2
MOm ( [b, · · ·, b] )
MO ( mb, · · ·, mb )
TO0 ( [b, · · ·, b] )
TO ( 0b, · · ·, 0b )
LO0 ( [b, · · ·, b] )
LO ( 0b, · · ·, 0b )
SOm ( [b, · · ·, b] )
SO ( mb, · · ·, mb )

m : port number 2 to 7, 10 to 17, 20 to 27


b : bit definition 0 to 7

Format 2:

RESET _SYSFLG

Format 3:

RESET TCOUNTER

Explanation:
Format 1 of this statement turns OFF the bits of the specified ports.
Format 2 clears the system flag variables.
Format 3 clears 10ms counter variables.

n· NOTE
Output to ports 0 and 1 of DO, MO
Example:
RESET DO2()
and SO are not allowed. ----------- DO (27 to 20) are turned OFF.
· Bits must be specified in ascending RESET DO2(6,5,1)
order from the right.
· External output is unavailable to DO/
----------- DO (26, 25, 21) are turned OFF.
RESET (37,35,27,20)
SO ports not connected to hardware.
· System flag variables are used when ----------- DO(37, 35, 27, 20) are turned OFF.
making checks with the overload RESET _SYSFLG
monitor. ----------- System flag variables are cleared.
· 10ms counter variables are used to RESET TCOUNTER
measure the time in 10ms units. ----------- 10ms counter variables are cleared.

Related commands: SET, DO, MO, SO, TO, LO

133
11. Command Statements

RESTART statement

Format:

2 RESTART Tn

n : task number 2 to 8

Explanation:
This statement restarts another task that is in pause.

Example:
START *SUBTASK,T2
FLAG=1
*L0:
IF FLAG=1 AND DI2(0)=1 THEN
SUSPEND T2
FLAG=2
WAIT DI2(0)=0
ENDIF
IF FLAG=2 AND DI2(0)=1 THEN
RESTART T2
FLAG=1
WAIT DI2(1)=0
ENDIF
MOVE P,P0
MOVE P,P1
GOTO *L0
HALT
’SUBTASK ROUTINE
*SUBTASK:
DO2(0)=1
DELAY 1000
DO2(0)=0
DELAY 1000
GOTO *SUBTASK
EXIT TASK

Related commands: CUT, EXIT TASK, START, SUSPEND

134
11. Command Statements

RESUME statement

Format:

RESUME [ NEXT ]
<label>
2
Explanation:
This statement resumes the program execution after recovery from an error.
There are three ways to resume the program, depending on the location in the program.
1. RESUME The program resumes from the command that caused the
error.
2. RESUME NEXT The program resumes from the command following the
command that caused the error.
3. RESUME <label> The program resumes from the command specified by
<label>.
n· NOTE
The RESUME statement can also be
executed in an error processing Example:
routine. See the description of the ON ERROR GOTO statement.
· Error recovery processing does not
work if the error is serious.
Related command: ON ERROR GOTO

135
11. Command Statements

RIGHTY statement, LEFTY statement

Format:

2 RIGHTY
LEFTY

n These
NOTE
statements are valid only for
Explanation:
These statements select whether the main robot will be “right-handed” or “left-handed”
SCARA robots, and so cannot be used when moving to a point specified on a Cartesian coordinate system. This is a just selection
for Cartesian robots.
and does not move the robot. If the robot arm is moving, the command execution waits
until movement is complete (positioned within tolerance range).

Example:
RIGHTY
MOVE P,P1
LEFTY
MOVE P,P1
RIGHTY
HALT

P1

(2) (1)

Left-handed Right-handed

SCARA robot

136
11. Command Statements

RIGHTY2 statement, LEFTY2 statement

Format:

RIGHTY2
LEFTY2
2
n· NOTE
These statements are valid only when
Explanation:
These statements select whether the sub robot will be “right-handed” or “left-handed”
the sub group is set in the system when moving to a point specified on a Cartesian coordinate system. This is just a selection
generation.
and does not move the robot. If the robot arm is moving, the command execution waits
· These statements are valid only for
SCARA robots, and so cannot be used until movement is complete (positioned within tolerance range).
for Cartesian robots.
Example:
RIGHTY2
MOVE2 P,P1
LEFTY2
MOVE2 P,P1
RIGHTY2
HALT

P1

(2) (1)

Left-handed Right-handed

SCARA robot

137
11. Command Statements

Sn (Shift coordinate definition statement)

Format:

2 Sn = x y z r

n: 0 to 9
The values of “x”, “y”, “z” and “r” must be from –99999.99 to 99999.99.

Explanation:
This statement defines shift coordinate values in order to shift the coordinates for robot
movement. Define the shift coordinate values while referring to the following notes.
1. “n” is a shift number.
2. Input data for “x” to “r” must be separated with a space (blank).
3. Input data for “x” to “r” is viewed as “mm”.
4. “x” to “z” correspond to the x, y and z coordinate shift values on a Cartesian
coordinate system, and “r” to the rotating shift value on the xy coordinates.

n· NOTE
Input data is treated as a constant.
Example:
S0= 0.00 0.00 0.00 0.00
· If power is turned off during S1=100.00 200.00 50.00 90.00
execution of a shift coordinate P3=100.00 0.00 0.00 0.00 0.00 0.00
definition statement, a memory- SHIFT S0
related error such as “Shift data MOVE P,P3
destroyed” may occur. SHIFT S1
MOVE P,P3
HALT

Related commands: Shift assignment statement, SHIFT, SHIFT2

138
11. Command Statements

SELECT CASE statement, END SELECT statement

Format:

SELECT [CASE] <expression>


CASE <expression list 1>
2
[command block 1]
[CASE <expression list 2>
[command block 2]]
:
[CASE ELSE
[command block n]]
END SELECT

Explanation:
These statements execute multiple command blocks according to the value in <expression>.
Make the settings while referring to the following notes.

1. The <expression list> following CASE consists of multiple numerical expressions


and character expressions separated from each other by a comma ( , ).
2. If the value of <expression> matches one of expressions contained in <expression
list>, the specified command block is executed. After executing the command block,
the program jumps to the next command following the END SELECT statement.
3. If the value of <expression> does not match any of the expressions contained in
<expression list>, the command block written after the CASE ELSE statement is
executed. After executing the command block, the program jumps to the next
command following the END SELECT statement.
4. If the value of <expression> does not match any of the expressions contained in
<expression list> and the CASE ELSE statement is not written, the program jumps
to the next command following the END SELECT statement.

Example:
WHILE -1
SELECT CASE DI3()
CASE 1,2,3
CALL *EXEC(1,10)
CASE 4,5,6,7,8,9,10
CALL *EXEC(11,20)
CASE ELSE
CALL *EXEC(21,30)
END SELECT
WEND
HALT

139
11. Command Statements

c· CAUTION
When you restart the controller after
SEND statement
stopping the SEND statement, note
the following points.
1. SEND CMU TO XXX
Format:
· When the SEND statement stops

2 while data is still being read out from


the RS-232C receive buffer, the data
acquired up until that point is
SEND <read file> TO <write file>

discarded. Explanation:
2. SEND XXX TO CMU This statement sends the data in the <read file> to the <write file>.
· When the SEND statement stops
while data is still being written into Type File name Definition format Read Write
the RS-232C transmit buffer, the
data is rewritten from the beginning. All Separate file
User memory All files ALL –––– Yes Yes
Program PGM <bbbbbbbb> Yes Yes
Point data PNT Pn Yes Yes
Point comment PCM –––– Yes Yes
Parameter PRM /cccccc/ Yes Yes
Shift definition SFT Sn Yes Yes
Hand definition HND Hn Yes Yes
Pallet definition PLT PLn Yes Yes
Variable, Variable VAR ab...by Yes Yes
constant Array variable ARY ab...by (x) Yes Yes
Constant –––– “cc...c” Yes No
Status Program directory DIR <<bbbbbbbb>> Yes No
Parameter directory DPM –––– Yes No
Machine reference MRF –––– Yes No
Error log LOG –––– Yes No
Memory size MEM –––– Yes No
Device DI port DI () DIn () Yes No
DO port DO () DOn () Yes Yes
MO port MO () MOn () Yes Yes
TO port TO () TOn () Yes Yes
LO port LO () LOn () Yes Yes
SI port SI () SIn () Yes No
SO port SO () SOn () Yes Yes
RS-232C CMU –––– Yes Yes
Others File end code EOF Yes No

n For
NOTE
details on files, refer to “Data file
n: Number
a: Alphabetic character
description” described later.
b: Alphanumeric character or underscore ( _ )
c: Alphanumeric character or symbol
x: Expression
y: Format

140
11. Command Statements

n· NOTE
The SEND statement cannot be used
Example:
SEND PGM TO CMU
to write onto read-only files. ----------- All user programs are output through the RS-232C port.
Incorrect examples: SEND <<PRG1>> TO CMU
SEND CMU TO DIR ----------- The program named “PRG1” is output through the RS-232C
SEND PNT TO SI()
port.
· Even if the read and write files are
correct, writing cannot be executed
unless the data formats match.
SEND CMU TO PNT
----------- Point data files are input through the RS-232C port.
2
Incorrect Examples: SEND CMU TO P100
SEND PGM TO PNT ----------- Data of point number 100 is input through the RS-232C port.
SEND SI() TO SFT SEND “T1” TO CMU
----------- The character string “T1” is output through the RS-232C port.
SEND CMU TO A$
----------- The character string is input to variable A$ through the RS-
232C port.

141
11. Command Statements

SERVO statement

Format:

2 SERVO ON
OFF
[ (<expression>) ]

FREE
PWR

The value of <expression> must be from 1 to 6 (axis number).

Explanation:
This statement controls the servo ON/OFF of the specified axes in the main group or all
axes (in the main group and sub group).
If <expression> is not specified, all axes are controlled and the motor power supply
simultaneously turns ON and OFF.

ON ----------- Turns the servo ON. If no axis is specified the motor power supply
also turns ON.
OFF ----------- Turns the servo OFF and applies the dynamic brake. Those axes
having brakes are all locked by the brake. If no axis is specified
the motor power supply also turns OFF.
FREE ----------- Turns the servo OFF and releases the dynamic brake. The axes
n· NOTE
This statement is executed after
having brakes are all released. If no axis is specified the motor
power supply also turns OFF.
positioning on all axes (in the main
group and sub group) is complete PWR ----------- Turns ON only the motor power supply.
(within the tolerance range).
· The servo for an axis cannot be Example:
turned ON as long as its motor power SERVO ON
is OFF.
----------- Turns ON the servos for all axes after turning ON the motor
c DoCAUTION
not perform any work within the SERVO OFF
power supply.

robot movement range while the ----------- Turns OFF the motor power supply and the servos for all
motor power is turned OFF by using axes. Those axes having brakes are all locked by the brake.
the SERVO OFF statement. Always SERVO FREE(3)
check that the emergency stop is ON ----------- Turns OFF the servo for axis 3 (Z-axis) and releases the brake.
when working within the robot
movement area.

142
11. Command Statements

SERVO2 statement

Format:

SERVO2 ON
OFF
[ (<expression>) ]
2
FREE
PWR

The value of <expression> must be from 1 to 4 (axis number).

Explanation:
This statement controls the servo ON/OFF of the specified axes in the sub group or all
axes (in the main group and sub group).
If <expression> is not specified, all axes are controlled and the motor power supply
simultaneously turns ON and OFF.

ON ----------- Turns the servo ON. If no axis is specified the motor power supply
also turns ON.
OFF ----------- Turns the servo OFF and applies the dynamic brake. Those axes
n· NOTE
This statement can be used only when
having brakes are all locked by the brake. If no axis is specified
the sub group is set in the system
the motor power supply also turns OFF.
generation. FREE ----------- Turns the servo OFF and releases the dynamic brake. The axes
· This statement is executed after having brakes are all released. If no axis is specified the motor
positioning on all axes (in the main power supply also turns OFF.
group and sub group) is complete
(within the tolerance range).
PWR ----------- Turns ON only the motor power supply.
· The servo for an axis cannot be
turned ON as long as its motor power Example:
is OFF. SERVO2 ON
----------- Turns ON the servos for all axes after turning ON the motor
c DoCAUTION
not perform any work within the
power supply.
SERVO2 OFF
robot movement range while the
motor power is turned OFF by using ----------- Turns OFF the motor power supply and the servos for all
the SERVO OFF statement. Always axes. Those axes having brakes are all locked by the brake.
check that the emergency stop is ON SERVO2 FREE(2)
when working within the robot ----------- Turns OFF the servo for axis 2 (Y-axis of sub group) and
movement area. releases the brake.

143
11. Command Statements

SET statement

Format:

2 S E T DOm ( [ b, · · ·, b ] ) [, <expression> ]
DO (mb, · · ·, mb)
MOm ([b, · · ·, b])
MO (mb, · · ·, mb)
TO0 ([b, · · ·, b])
TO (0b, · · ·, 0b)
LO0 ([b, · · ·, b])
LO (0b, · · ·, 0b)
SOm ([b, · · ·, b])
SO (mb, · · ·, mb)

m : port number 2 to 7, 10 to 17, 20 to 27


b : bit definition 0 to 7
The value of <expression> must be from 1 to 3600000. (Unit: ms) Note that the minimum
run time is 10ms.

Explanation:
This statement turns ON the bits of the specified ports.
Specify the pulse output time (unit: ms) in <expression>. When the specified time has
elapsed, the output turns OFF to end the command execution.

n· NOTE
Output to the DO0 ( ) and DO1 ( )
Example:
SET DO2()
ports is not allowed. ----------- DO (27 to 20) are turned ON.
· Output to the MO0 ( ) and MO1 ( ) SET DO2(6,5,1),200
ports is not allowed.
----------- DO (26, 25, 21) are turned ON for 200ms.
· Output to the SO0 ( ) and SO1 ( )
SET DO(37,35,27,20)
ports is not allowed.
· Bits must be specified in ascending ----------- DO (37, 35, 27, 20) are turned ON.
order from the right.
· External output is unavailable to DO/ Related commands: RESET, DO, MO, SO, TO, LO
SO ports not connected to hardware.

144
11. Command Statements

SHARED statement

Format:

SHARED <variable> [ ( ) ] [, <variable> [ ( ) ]. . .]


2
n· NOTE
The SHARED statement allows
Explanation:
This statement does not permit variables declared with a program level code to be passed
variables to be shared only between
on as dummy arguments, but allows them to be referred to with a sub-procedure.
the program level code and sub-
procedure within the same program. As a <variable>, specify a simple variable or an array variable followed by parentheses.
· The program level code is a program This variable should be at the program level used with sub-procedures. If an array is
written outside of a sub-procedure. specified, that entire array is selected.

Example:
DIM Y!(10)
X!=2.5
Y!(10)=1.2
CALL *DISTANCE
CALL *AREA
HALT
SUB *DISTANCE
SHARED X!,Y!( )
PRINT X!^2+Y!(10)^2 --------- Variable is shared.
END SUB
SUB *AREA
DIM Y!(10)
PRINT X!*Y!(10) --------- Variable is not shared.
END SUB

Related commands: SUB, END SUB

145
11. Command Statements

SHIFT statement
(Shift coordinate setting statement for main robot)

Format:
2
SHIFT <shift variable>

n This
NOTE
statement is executed after
Explanation:
This statement sets the shift coordinates for the main robot by using the shift data specified
positioning on the main robot axes is in <shift variable>.
complete (within the tolerance range).
Example:
SHIFT S1
MOVE P,P10
SHIFT S[A]
MOVE P,P20
HALT

Related commands: Shift definition statement, shift assignment statement

146
11. Command Statements

SHIFT2 statement
(Shift coordinate setting statement for sub robot)

Format:
2
SHIFT2 <shift variable>

n· NOTE
This statement can be used only when
Explanation:
This statement sets the shift coordinates for the sub robot by using the shift data specified
the sub robot is set in the system
generation.
in <shift variable>.
· This statement is executed after
positioning on the sub robot axes is Example:
complete (within the tolerance range). SHIFT2 S1
MOVE2 P,P10
SHIFT2 S[A]
MOVE2 P,P20
HALT

Related commands: Shift definition statement, shift assignment statement

147
11. Command Statements

SO statement (Serial output)

Format:

2 [ LET ] SO m ( [ b, · · ·, b ] ) = <expression>
SO ( mb, · · ·, mb )

m : port number 2 to 7, 10 to 17, 20 to 27


b : bit definition 0 to 7
The value of <expression> should be an integer or it will be converted to an integer. The
lower bits corresponding to the bits specified on the left side will be valid.

Explanation:
This statement outputs the specified value to the SO port.

n· NOTE
Output to the SO0 ( ) and SO1 ( )
Example:
SO2()=&B10111000
ports is not allowed. ----------- SO (27, 25, 24, 23) are turned ON, and SO (26, 22, 21, 20)
· Bits must be specified in ascending
order from the right.
are turned OFF.
SO2(6,5,1)=&B010
· External output is unavailable to SO
ports not connected to hardware. ----------- SO (25) is turned ON, and SO (26, 21) are turned OFF.
SO3()=15
----------- SO (33, 32, 31, 30) are turned ON, and SO (37, 36, 35, 34)
are turned OFF.
SO(37,35,27,20)=A
----------- The contents of the 4 lower bits obtained when variable A is
converted to an integer are output to SO (37, 35, 27, 20),
respectively.

Related commands: RESET, SET

148
11. Command Statements

SPEED statement
(Speed setting statement for main group)

Format:

SPEED <expression>
2
The value of <expression> must be from 1 to 100. (Unit: %)

Explanation:
This statement changes the program speed for the main group to the value specified in
<expression>.

n· NOTE
This statement changes all the
Example:
ASPEED 100
movement speed parameters for the SPEED 70
main axes and auxiliary axes of the MOVE P,P0
robot. ----------- Moves at 70% (=100*70) of maximum speed from the current
· Robot operating speed is determined
by the product of the automatic
position to P0.
movement speed (specified by the SPEED 50
MPB or ASPEED command) and the MOVE P, P1
program speed (specified by the ----------- Moves at 50% (=100*50) of maximum speed from the current
SPEED command). position to P1.
Example: MOVE P,P2, S=10
When the automatic movement speed ----------- Moves at 10% (=100*10) of maximum speed from the current
is 80% and the program speed set by position to P2.
the SPEED command is 50%, then:
HALT
Robot operating speed = 80%*50% =
40%
Related commands: ASPEED, ASPEED2, SPEED2

149
11. Command Statements

SPEED2 statement
(Speed setting statement for sub group)

Format:
2
SPEED2 <expression>

The value of <expression> must be from 1 to 100. (Unit: %)

n· NOTE
This statement changes all the
Explanation:
This statement changes the program speed for the sub group to the value specified in
movement speed parameters for the <expression>.
standard axes and auxiliary axes of
the sub robot.
· Robot operating speed is determined Example:
by the product of the automatic ASPEED2 50
movement speed (specified by the SPEED2 70
MPB or ASPEED2 command) and the MOVE2 P,P0
program speed (specified by the ----------- Moves at 35% (=50*70) of maximum speed from the current
SPEED2 command). position to P0.
Example: SPEED2 50
When the automatic movement speed MOVE2 P,P1
is 80% and the program speed set by ----------- Moves at 25% (=50*50) of maximum speed from the current
the SPEED2 command is 50%, then:
Robot operating speed = 80%*50% = position to P1.
40% MOVE2 P,P2,S=10
----------- Moves at 5% (=50*10) of maximum speed from the current
c This
CAUTION
statement can be used only when HALT
position to P2.
the sub group is set in the system
generation.
Related commands: ASPEED, ASPEED2, SPEED

150
11. Command Statements

START statement

Format:

START <label>, Tn [, p ]
2
n : task number 2 to 8
p : task priority 17 to 47

Explanation:
This statement starts the task specified by <label> as task “n” with priority “p”.
If the task priority “p” is omitted, the priority will be 32.

Example:
START *SUBTASK,T2,33
*ST:
MOVE P,P0,P1
GOTO *ST
HALT
’SUBTASK ROUTINE
*SUBTASK:
n· NOTE
The priority of task 1 (main task) is
P100 = WHERE
IF LOCZ(P100) > 10000 THEN
32. DO(20) = 1
· The smaller the priority number, the ELSE
higher the priority level. DO(20) = 0
· When a task with a higher priority is ENDIF
set “READY”, all tasks with lower GOTO *SUBTASK
priority levels also stay “READY”. EXIT TASK

Related commands: CUT, EXIT TASK, RESTART, SUSPEND, CHGPRI

151
11. Command Statements

SUB statement, END SUB statement

Format:

2 SUB <label> [ ( <dummy argument> [, <dummy argument> . . . ] ) ]


<command block>
END SUB

n· NOTE
Sub-procedures cannot be defined
Explanation:
The SUB statement and END SUB statement define a sub-procedure that can be executed
within a sub-procedure. with the CALL statement. When the END SUB statement is executed, the program jumps
· The DECLARE statement cannot be
to the next command in the CALL statement that was called. Defines are shown below.
used within a sub-procedure.
· A label can be defined within a sub-
procedure, but it cannot jump with a 1. All variables declared within the sub-procedure are local variables so they are
GOTO or GOSUB statement to a label valid only within the sub-procedure. Local variables are initialized each time the
outside the sub-procedure.
sub-procedure is called up.
· Sub-procedures cannot be used within
an expression. 2. Use a SHARED statement when using global variables (program level).
· Local variables cannot be used with
PRINT and SEND statements.
3. Use <dummy argument> when variables are to be passed on. If two or more dummy
arguments are used, separate them by a comma ( , ).
4. A valid <dummy argument> consists of a name of variable and an entire array
(array name followed by parentheses).

152
11. Command Statements

Example 1:
I=1
CALL *TEST
PRINT I
HALT
’SUB ROUTINE: TEST
SUB *TEST
I=50
2
END SUB

In the above example, the program level variable I does not have any relation to
variable I within the sub-procedure. The value displayed with the PRINT statement
on the third line will be “1”.

Example 2:
X% = 4
Y% = 5
CALL *COMPARE( REF X%, REF Y% )
PRINT X%,Y%
Z% = 7
W% = 2
CALL *COMPARE( REF Z%, REF W% )
PRINT Z%,W%
HALT
’SUB ROUTINE: COMPARE
SUB *COMPARE( A%, B% )
IF A% < B% THEN
TEMP% = A%
A% = B%
B% = TEMP%
ENDIF
END SUB

In the above example, different variables are passed on as arguments to call up the
sub-procedure twice.

Related commands: CALL, DECLARE, EXIT SUB, SHARED

153
11. Command Statements

SUSPEND statement

Format:

2 SUSPEND Tn

n: task number 2 to 8

Explanation:
This statement temporarily stops another task being executed.

Examples:
START *SUBTASK,T2
SUSFLG=0
*L0:
MOVE P,P0
MOVE P,P1
WAIT SUSFLG=1
SUSPEND T2
SUSFLG=0
GOTO *L0
HALT
’SUBTASK ROUTINE
*SUBTASK:
WAIT SUSFLG=0
DO2(0)=1
DELAY 1000
DO2(0)=0
DELAY 1000
SUSFLG=1
GOTO *SUBTASK
EXIT TASK

Related commands: CUT, EXIT TASK, RESTART, SUSPEND

154
11. Command Statements

SWI statement

This statement switches the execution program.

Format:
2
SWI <program name>

n· NOTE
If there is no program to switch to,
Explanation:
This statement switches from the current program to the specified program, starting from
then the message “3.3: Program the first line after executing compiling. The output variable status does not change when
doesn't exist” appears and operation
stops.
the program was switched. However, dynamic variables and array variables are cleared.
· If an error occurs during compiling, If an error occurs during compiling, the operation stops. The program name you want to
an error message line is displayed switch to must be enclosed in < >.
and the program stops.
· The SWI statement can only be
executed within task 1 (main task).
Example:
If used within tasks 2 through 8, the SWI <ABC>
message “6.1:Illegal command” ----------- The execution program switches to <ABC>.
appears and operation stops.
· The Stop key does not function during
compiling.
· Execution of a SWI statement is
always accompanied by compiling,
and the time required for this
compiling depends on the size of
program to switch to.

155
11. Command Statements

TO statement

Format:

2 [ LET ] TO0 ( [b, · · ·, b ] ) = <expression>


TO ( 0 b, · · ·, 0 b )

b : bit definition 0 to 7
The value of <expression> should be an integer or it will be converted to an integer. The
lower bits corresponding to the bits specified on the left side will be valid.

Explanation:
This statement outputs the specified value to the TO port.

n Bits
NOTE
must be specified in ascending
Example:
TO0() = &B00000110
order from the right.
Related commands: RESET, SET

156
11. Command Statements

TOLE statement
(Tolerance setting statement for main group)

Format 1:
2
TOLE <expression>

Format 2:

TOLE ( <expression 1> ) = <expression 2>

The value of <expression 1> must be from 1 to 6 (axis number).


The values of <expression> and <expression 2> differ depending on the motor. (Unit:
pulses)

n· IfNOTE
an axis that is set to “no axis” in
Explanation:
This statement changes the tolerance parameter for the main group to the value specified
the system generation is specified, in <expression>. Format 1 changes all axes in the main group. Format 2 changes the
then an error message “Specification
mismatch” appears and execution of
tolerance parameter for the main group axis specified in <expression 1> to the value
the command will stop. specified in <expression 2>.
· This statement is executed after
positioning on the specified axes is Example:
complete (within the tolerance range). ’CYCLE WITH DECREASING TOLERANCE
FOR A=100 TO 20 STEP -20
GOSUB *CHANGE_TOLE
MOVE P,P0
MOVE P,P1
NEXT A
HALT
*CHANGE_TOLE:
FOR B=1 TO 4
TOLE(B)=A
NEXT B
RETURN

157
11. Command Statements

TOLE2 statement
(Tolerance setting statement for sub group)

Format 1:
2
TOLE2 <expression>

Format 2:

TOLE2 ( <expression 1> ) = <expression 2>

The value of <expression 1> must be from 1 to 4 (axis number).


The value of <expression> and <expression 2> differs depending on the motor setting.
(Unit: pulses)

n· NOTE
This statement can be used only when
Explanation:
This statement changes the tolerance parameter for the sub group to the value specified in
the sub group is set in the system <expression>. Format 1 changes all axes in the sub group. Format 2 changes the tolerance
generation.
parameter for the sub group axis specified in <expression 1> to the value specified in
· If an axis that is set to “no axis” in
the system generation is specified, <expression 2>.
then an error message “Specification
mismatch” appears and execution of Example:
the command will stop. ’CYCLE WITH DECREASING TOLERANCE
· This statement is executed after FOR A=100 TO 20 STEP -20
positioning on the specified axes is GOSUB *CHANGE_TOLE
complete (within the tolerance range). MOVE2 P,P0
MOVE2 P,P1
NEXT A
HALT
*CHANGE_TOLE:
FOR B=1 TO 4
TOLE2(B)=A
NEXT B
RETURN

158
11. Command Statements

TORQUE statement

Format

TORQUE ( <expression 1> ) = <expression 2>


2
The value of <expression 1> must be from 1 to 6 (axis number).
The value of <expression 2> must be from 1 to 100. (Unit: %)

n IfNOTE
an axis that is set to “no axis” in the
Explanation:
This statement changes the maximum torque instruction for the main group axis specified
system generation is specified, then an in <expression 1> to the value specified in <expression 2>. The torque parameter value
error message “Specification
does not change.
mismatch” appears and execution of
the command will stop. The maximum torque instruction by this statement remains valid until any of the following
operations are performed.
· When another TORQUE command for the same axis is executed.
c· CAUTION
If the specified value is too small, the · When a torque limit option is executed in the DRIVE statement for the same axis.
axis may not move. In this case,
· When power to the controller is turned off and then turned on.
press the emergency stop button and
then continue operation. · When parameters are changed or initialized.
· If the specified value is less than the
rated torque, then an error might not
· When return-to-origin or absolute reset is performed.
occur even when the robot bumps · When the servo turns off.
into an obstacle.

Example:
DRIVE(3,P0)
----------- Axis 3 moves from the current position to the point specified
by P0.
DRIVE(3,P1),T=50
----------- Axis 3 moves from the current position to the point specified
by P1 at 50% of rated torque.
WAIT ARM(3)
----------- Monitors movement and stopping of axis 3.
IF MO(12)=1 THEN
----------- Checks the current mode of axis 3. (If the check result is true,
the target position was reached.)
TORQUE(3) =100
----------- Sets the torque on axis 3 to a maximum (100%).
ELSE
DRIVE(3,P0),T=50
----------- Axis 3 moves from the current position to the point specified
by P0 at 50% of rated torque.
WAIT MO(12)=1
----------- Waits until axis 3 is held (at the target position).
TORQUE(3)=100
----------- Sets the torque on axis 3 to a maximum (100%).
ENDIF

Related command: DRIVE

159
11. Command Statements

TORQUE2 statement

Format

2 TORQUE2 ( <expression 1> ) = <expression 2>

The value of <expression 1> must be from 1 to 4 (axis number).


The value of <expression 2> must be from 1 to 100. (Unit: %)

n· NOTE
This statement can be used only when
Explanation:
This statement changes the maximum torque instruction for the sub group axis specified
the sub robot is set in the system
generation.
in <expression 1> to the value specified in <expression 2>. The torque parameter value
· If an axis that is set to “no axis” in does not change.
the system generation is specified, The maximum torque instruction by this statement remains valid until any of the following
then an error message “Specification operations are performed.
mismatch” appears and execution of
the command will stop.
· When another TORQUE2 command for the same axis is executed.
· When a torque limit option is executed in the DRIVE2 statement for the same axis.
· When power to the controller is turned off and then turned on.
c· CAUTION
If the specified value is too small, the
· When parameters are changed or initialized.
axis may not move. In this case, · When return-to-origin or absolute reset is performed.
press the emergency stop button and
· When the servo turns off.
then continue operation.
· If the specified value is less than the
rated torque, then an error might not Example:
occur even if the robot bumps into an DRIVE2(1,P0)
obstacle.
----------- Axis 1 moves from the current position to the point specified
by P0.
DRIVE2(1,P1),T=50
----------- Axis 1 moves from the current position to the point specified
by P1 at 50% of rated torque.
WAIT ARM2(1)
----------- Monitors movement and stopping of axis 1.
IF MO(12)=1 THEN
----------- Checks the current mode of axis 1. (If the check result is true,
the target position was reached.)
TORQUE2(1)=100
----------- Sets the torque on axis 1 to a maximum (100%).
ELSE
DRIVE2(1,P0),T=50
----------- Axis 1 moves from the current position to the point specified
by P0 at 50% of rated torque.
WAIT MO(12)=1
----------- Waits until axis 1 is held (at the target position).
TORQUE2(1)=100
----------- Sets the torque on axis 1 to a maximum (100%).
ENDIF

Related command: DRIVE2

160
11. Command Statements

WAIT statement

Format 1:

WAIT < DI / DO conditional expression> [, <expression>]


2
The value of <expression> must be from 1 to 3600000. (Unit: ms)

Explanation:
This statement allows waiting until the condition in <DI/DO conditional expression> is
met. Specify the time-out period (milliseconds) in the second <expression>.
If the wait condition is not met within the time-out period, the command terminates. Note
that the minimum wait time is 10 ms.

Format 2:
WAIT ARM
WAIT ARM2

WAIT ARM [ (<expression 1>) ]


ARM2 [ (<expression 2>) ]

The value of <expression 1> must be from 1 to 6 (axis number).


The value of <expression 2> must be from 1 to 4 (axis number).

Explanation:
This statement allows waiting until positioning on the robot axes is complete (within the
tolerance range).
If the <expression 1> and <expression 2> are not specified, then all axes (ARM) of the
main robot or all axes (ARM2) of the sub robot are subject to this command. When the
<expression 1> and <expression 2> are specified, only the specified axes are subject to
this command.

Examples:
WAIT A=10
----------- Waits until variable A is set to 10.

WAIT DI2( )=&B01010110


----------- Waits until DI(21), (22), (24), (26) are turned ON, and DI(20),
(23), (25), (27) are turned OFF.

WAIT DI2(4,3,2)=&B101
----------- Waits until DI(22) and DI(24) are turned ON, and DI(23) is
turned OFF.

WAIT DI(31)=1 OR DO(21)=1


----------- Waits until DI(31) or DO(21) is turned ON.

WAIT DI(20)=1,1000
----------- Waits until DI(20) is ON. If not turned ON after 1 second,
the command will end.

161
11. Command Statements

WAIT ARM
----------- Waits until the main robot movement is complete.
WAIT ARM2(2)
----------- Waits until movement on axis 2 of the sub robot is complete.

2 Related commands: DRIVE, DRIVE2, DRIVEI, DRIVEI2, MOVE, MOVE2, MOVEI,


MOVEI2

162
11. Command Statements

WEIGHT statement
(Tip weight parameter setting statement for main robot)

Format:
2
WEIGHT <expression>

The range of <expression> differs depending on the robot setting.

Explanation:
This statement changes the tip weight parameter of the main robot to the value of
<expression>.

n This
NOTE
statement changes the robot tip
Example:
A=5
weight parameter but does not have B=2
any effect on auxiliary axes. C=WEIGHT
WEIGHT A
MOVE P,P0
WEIGHT B
MOVE P,P1
WEIGHT C
HALT

163
11. Command Statements

WEIGHT2 statement
(Tip weight parameter setting statement for sub robot)

Format:
2
WEIGHT2 <expression>

The range of <expression> differs depending on the robot setting.

Explanation:
This statement changes the tip weight parameter of the sub robot to the value of
<expression>.

Example:
n· NOTE
A=5
B=2
This statement can be used only when C=WEIGHT2
the sub robot is set in the system WEIGHT2 A
generation. MOVE2 P,P0
· This statement changes the robot tip WEIGHT2 B
weight parameter but does not have MOVE2 P,P1
any effect on auxiliary axes. WEIGHT2 C
HALT

164
11. Command Statements

WHILE statement, WEND statement


The WHILE statement allows the same operation to repeat as long as the condition specified
by <expression> is met.

Format:
2
WHILE <expression>
<command block>
WEND

Explanation:
This statement executes the command block placed between the WHILE and WEND
statements when the condition specified by <expression> is met, and then returns to the
WHILE statement to repeat the same operation. When the condition specified by
n· NOTE
The WHILE and WEND statements
<expression> is not met, the program jumps to the next command following the WEND
must be used together as a set. statement. If the condition specified by <expression> is not satisfied from the beginning,
· If the value of <expression> is –1, the then no commands between the WHILE and WEND statements are executed and a jump
condition is judged to be satisfied. is made to the next command following the WEND statement.
To jump outside of the WHILE and WEND statement loop, use a GOTO statement, etc.

Examples 1:
A=0
WHILE DI3(0)=0
A=A+1
MOVE P,P0
MOVE P,P1
PRINT ”COUNTER=”;A
WEND
HALT

Examples 2:
A=0
WHILE -1 -------------- This will be an endless loop because the conditional expression is
always true (-1).
A=A+1
MOVE P,P0
IF DI3(0)=1 THEN *END
MOVE P,P1
PRINT ”COUNTER=”;A
IF DI3(0)=1 THEN *END
WEND
*END
HALT

165
11. Command Statements

Label statement

Format:

2 <label>:

Explanation:
This statement defines <Label> in the program lines. Labels must begin with an asterisk
( * ).

Examples:
*SUB2:
*PROG_END:

166
12. Functions

12.1 Arithmetic functions


These functions are used as elements in arithmetic expressions.

■ ABS

Format:

ABS (<expression>)

Explanation:
This function gives the absolute value of the value specified in <expression>.

Example:
A=ABS(-326.54)
----------- The absolute value of -326.54 (=326.54) is assigned to variable
A.

■ ACCEL

Format:

ACCEL (<expression>)

The value of <expression> must be from 1 to 6 (axis number).

n IfNOTE
an axis that is set to “no axis” in the
Explanation:
This function gives the acceleration coefficient parameter for the main group axis specified
system generation is specified in in <expression>.
<expression>, then an error message
“Specification mismatch” appears and
execution of the command will stop. Example:
A=ACCEL(3)
----------- The acceleration coefficient parameter for axis 3 in the main
group is assigned to variable A.

■ ACCEL2

Format:

ACCEL2 (<expression>)

The value of <expression> must be from 1 to 4 (axis number).

n• NOTE
This function can be used only when
Explanation:
This function gives the acceleration coefficient parameter for the sub group axis specified
the sub group has been set in the in the <expression>.
system generation.
• If an axis that is set to “no axis” in
the system generation is specified in Example:
<expression>, then an error message A=ACCEL2(2)
“Specification mismatch” appears ----------- The acceleration coefficient parameter for axis 2 in the sub
and execution of the command will group is assigned to variable A.
stop.

167
12. Functions

■ ARCH

Format:

ARCH (<expression>)
2
The value of <expression> must be from 1 to 6 (axis number).

n IfNOTE
an axis that is set to “no axis” in
Explanation:
This function gives the arch position parameter for the main group axis specified in
the system generation is specified in <expression>.
<expression>, then an error message
“Specification mismatch” appears and
execution of the command will stop. Example:
A=ARCH(1)
----------- The arch position parameter for axis 1 in the main group is
assigned to variable A.

■ ARCH2

Format:

ARCH2 (<expression>)

The value of <expression> must be from 1 to 4 (axis number).

n• NOTE
This function can be used only when
Explanation:
This function gives the arch position parameter for the sub group axis specified in the
the sub group has been set in the
<expression>.
system generation.
• If an axis that is set to “no axis” in
the system generation is specified in Example:
<expression>, then an error message A=ARCH2(1)
“Specification mismatch” appears ----------- The arch position parameter for axis 1 in the sub group is
and execution of the command will
assigned to variable A.
stop.

■ ARMCND

Format:

ARMCND

Explanation:
This function gives the current arm status used for the SCARA robot in the main group.
The arm status is “1” for left-handed condition and “0” for right-handed condition.
This function is enabled only when a SCARA robot is used.

Example:
A=ARMCND --------- The current arm status of the main robot is assigned to variable
A.
IF A=0 THEN --------- If right-handed system is used…
MOVE P,P100,Z=0
ELSE --------- If left-handeded system is used…
MOVE P,P200,Z=0
ENDIF

168
12. Functions

■ ARMCND2

Format:

ARMCND2
2
n This
NOTE
function can be used only when
Explanation:
This function gives the current arm status for the SCARA robot in the sub group.
the sub group has been set in the The arm status is “1” for left-handed condition and “0” for right-handed condition.
system generation.
This function is enabled only when a SCARA robot is used.

Example:
A=ARMCND2 --------- The current arm status of the sub robot is assigned to variable A.
IF A=0 THEN --------- If right-handed system is used…
MOVE2 P,P100,Z=0
ELSE --------- If left-handed system is used…
MOVE2 P,P200,Z=0
ENDIF

■ ARMTYPE

Format:

ARMTYPE

Explanation:
This function gives the hand system currently selected for the SCARA robot in the main
group.
The arm type is “1” for left-handed system and “0” for right-handed system.
This function is enabled only when a SCARA robot is used.

Example:
A=ARMTYPE --------- The arm type of the main robot is assigned to variable A.
IF A=0 THEN --------- If the arm type is a right-handed system …
MOVE P,P100,Z=0
ELSE --------- If the arm type is a left-handed system…
MOVE P,P200,Z=0
ENDIF

169
12. Functions

■ ARMTYPE2

Format:

ARMTYPE2
2
n• NOTE
This function can be used only when
Explanation:
This function gives the hand system currently selected for the SCARA robot in the sub
the sub group has been set in the group.
system generation. The arm type is “1” for left-handed system and “0” for right-handed system.
This function is enabled only when a SCARA robot is used.

Example:
A=ARMTYPE2 --------- The arm type of the sub robot is assigned to variable A.
IF A=0 THEN --------- If the arm type is a right-handed system …
MOVE2 P,P100,Z=0
ELSE --------- If the arm type is a left-handed system…
MOVE2 P,P200,Z=0
ENDIF

■ ATN

Format:

ATN (<expression>)

Explanation:
This function gives the arctangent of the value of <expression>. The resulting value
obtained will be from -π/2 rad to +π/2 rad.

Examples:
A(0)=A*ATN(Y/X)
----------- The product of the arctangent of the expression (Y/X) and
variable A is assigned to array A (0).
A(0)=ATN(0.5)
----------- The arctangent of 0.5 is assigned to array A (0).

Related functions: COS, DEGRAD, RADDEG, SIN, TAN

170
12. Functions

■ AXWGHT

Format:

AXWGHT (<expression>)
2
n• NOTE
This function can be used only for
The value of <expression> must be from 1 to 6 (axis number).

MULTI type robot axes or auxiliary Explanation:


axes.
Robot type and auxiliary axes are set
This function gives the axis tip weight parameter for the main group axis specified in
prior to shipment. <expression>.
• If an axis that is set to “no axis” in
the system generation is specified in Example:
<expression>, then an error message A=AXWGHT(1)
“Specification mismatch” appears
and execution of the command will
----------- The axis tip weight parameter for axis 1 in the main group is
stop. assigned to variable A.

■ AXWGHT2

Format:

AXWGHT2 (<expression>)

n• NOTE
This function can be used only when
The value of <expression> must be from 1 to 4 (axis number).

the sub group has been set in the Explanation:


system generation.
• This function can be used only for This function gives the axis tip weight parameter for the sub group axis specified in
MULTI type robot axes or auxiliary <expression>.
axes.
Robot type and auxiliary axes are set Example:
prior to shipment. A=AXWGHT2(1)
• If an axis that is set to “no axis” in
the system generation is specified in ----------- The axis tip weight parameter for axis 1 in the sub group is
<expression>, then an error message assigned to variable A.
“Specification mismatch” appears
and execution of the command will ■ COS
stop.

Format:

COS (<expression>)

Explanation:
This function gives the cosine of the value of <expression>. The <expression> units are in
radians.

Examples:
A(0)=B*COS(C)
----------- The product of the cosine of variable C and variable B is
assigned to array A (0).
A(1)=COS(DEGRAD(20))
----------- The cosine of 20.0° is assigned to array A (1).

Related functions: ATN, DEGRAD, RADDEG, SIN, TAN

171
12. Functions

■ DECEL
c The
CAUTION
DECEL statement is enabled
only when the software version is Format:
V8.15 or later.

DECEL (<expression>)
2 n• If an axis that is set to "no axis" in the
NOTE

system generation is specified, then an


The value of <expression> must be from 1 to 6 (axis number).
error message "Specification
mismatch" appears and execution of Explanation:
the command will stop. This function gives the deceleration rate parameter for the main group axis specified in
the <expression>.

Example:
A = DECEL (3)
----------- The deceleration rate parameter for axis 3 in the main group
is assigned to variable A.

■ DECEL2
c The
CAUTION
DECEL2 statement is enabled
only when the software version is Format:
V8.15 or later.

n• NOTE
This function can be used only when
DECEL2 (<expression>)

the sub group is set in the system The value of <expression> must be from 1 to 4 (axis number).
generation.
• If an axis that is set to "no axis" in the
system generation is specified, then an
Explanation:
error message "Specification This function gives the deceleration rate parameter for the sub group axis specified in the
mismatch" appears and execution of <expression>.
the command will stop.
Example:
A = DECEL2 (2)
----------- The deceleration rate parameter for axis 2 in the sub group is
assigned to variable A.

■ DEGRAD

Format:

DEGRAD (<expression>)

Explanation:
This function converts the value of <expression> into radians. The <expression> units are
in degrees.

Example:
A=COS(DEGRAD(30))
----------- The cosine of 30° is assigned to variable A.

Related functions: ATN, COS, RADDEG, SIN, TAN

172
12. Functions

■ DIST

Format:

DIST (<point expression 1>, <point expression 2>)

Explanation:
2
This function gives the distance between the 2 points (X, Y, Z) specified in <point expression
1> and <point expression 2>. An error is issued when the 2 points specified by each
<point expression> are not in the Cartesian coordinate system.

Example:
A=DIST(P0,P1)
----------- The distance between P0 and P1 is assigned to variable A.

■ ERR, ERL

Format:

ERR
ERL

Explanation:
These are used for in error processing routines specified by the ON ERROR GOTO
statement. ERR gives the error code of the error that has occurred, and ERL gives the line
number in which the error occurred.

Examples:
IF ERR<>&H604 THEN HALT
IF ERL=20 THEN RESUME NEXT

Related commands: ON ERROR GOTO, RESUME

■ INT

Format:

INT (<expression>)

Explanation:
This function gives an integer that does not exceed the value of <expression>, by truncating
all decimal fractions.

Examples:
A=INT(A(0))
B=INT(-1.233)
----------- “-2” is assigned to B.

173
12. Functions

■ LEN

Format:

LEN (<character string expression>)


2 Explanation:
This function gives the character string length (number of bytes) specified in <character
string expression>.

Example:
B=LEN(A$)

■ LSHIFT

Format:

LSHIFT (<expression 1>, <expression 2>)

Explanation:
This function shifts the value of <expression 1> to the left, by the number of bits in
<expression 2>. Here, a "0" is inserted in spaces open to the right due to shifting.

Example:
A=LSHIFT(&B10111011,2)
----------- “&B1011101100” is assigned to A.

Related functions: RSHIFT

■ MCHREF

Format:

MCHREF (<expression>)

The value of <expression> must be 1 to 6 (axis number).

Explanation:
This function gives the return-to-origin machine reference for the main group axis specified
in <expression>.

Example:
A=MCHREF(1)
----------- The return-to-origin machine reference of axis 1 in the main
group is assigned to variable A.

174
12. Functions

■ MCHREF2

Format:

MCHREF2 (<expression>)

The value of <expression> must be 1 to 4 (axis number).


2
Explanation:
This function gives the return-to-origin machine reference of the sub group axis specified
in <expression>.

Example:
A=MCHREF2(3)
----------- The return-to-origin machine reference of axis 3 in the sub
group is assigned to variable A.

■ ORD

Format:

ORD (<character string expression>)

Explanation:
This function gives the character code of the first character specified in <character string
expression>.

Example:
A=ORD(”B”)
----------- “66 (=&H42)” is assigned to A.

Related functions: CHR$

■ ORGORD

Format:

ORGORD

Explanation:
This function gives the axis sequence parameter for performing return-to-origin operation
for the main group.

Example:
A=ORGORD
----------- The return-to-origin sequence parameter for the main group
is assigned to variable A.

175
12. Functions

■ ORGORD2

Format:

ORGORD2
2
n This
NOTE
function can be used only when
Explanation:
This function gives the axis sequence parameter for performing return-to-origin operation
the sub group has been set in the for the sub group.
system generation.

Example:
A=ORGORD2
----------- The return-to-origin sequence parameter for the sub group is
assigned to variable A.

■ OUTPOS

Format:

OUTPOS (<expression>)

The value of <expression> must be 1 to 6 (axis number).

n IfNOTE
an axis that is set to “no axis” in the
Explanation:
This function gives the Out position parameter for the main group axis specified in the
system generation is specified in <expression>.
<expression>, then an error message
“Specification mismatch” appears and
execution of the command will stop. Example:
A=OUTPOS(3)
----------- The Out position parameter for axis 3 in the main group is
assigned to A.

■ OUTPOS2

Format:

OUTPOS2 (<expression>)

The value of <expression> must be 1 to 4 (axis number).

n• NOTE
This function can be used only when
Explanation:
This function gives the Out position parameter for the sub group axis specified in the
the sub group has been set in the <expression>.
system generation.
• If an axis that is set to “no axis” in
the system generation is specified in Example:
<expression>, then an error message A=OUTPOS2(3)
“Specification mismatch” appears ----------- The Out position parameter for axis 3 in the sub group is
and execution of the command will assigned to A.
stop.

176
12. Functions

■ RADDEG

Format:

RADDEG (<expression>)

Explanation:
2
This function converts the value of <expression> into degrees. The <expression> units
are in radians.

Example:
LOCR(P0)=RADDEG(ATN(B))
----------- The arctangent of variable B is converted into a value in
degrees and assigned to R data for the P0.

Related functions: ATN, COS, DEGRAD, SIN, TAN

■ RSHIFT

Format:

RSHIFT (<expression 1>, <expression 2>)

Explanation:
This function shifts the value of <expression 1> to the right, by the number of bits in
<expression 2>. Here a "0" is inserted in space open to the left due to shifting.

Example:
A=RSHIFT(&B10111011,2)
----------- “&B00101110” is assigned to A.

Related functions: LSHIFT

■ SIN

Format:

SIN (<expression>)

Explanation:
This function gives the sine of the value of <expression>. The <expression> units are in
radians.

Examples:
A(0)=SIN(B*2+C)
----------- The sine of the expression "B*2+C" is assigned to array A
(0).
A(1)=SIN(DEGRAD(30))
----------- The sine of 30.0° is assigned to array A (1).

Related functions: ATN, COS, DEGRAD, RADDEG, TAN

177
12. Functions

■ SQR

Format:

SQR (<expression>)
2 The value of <expression> must be a positive integer or “0”.

n AnNOTE
error occurs if a negative value is
Explanation:
This function gives the square root of the value in <expression>.
specified in <expression>.
Example:
A=SQR(X^2+Y^2)
----------- The square root of X^2+Y^2 will be assigned to A.

■ TAN

Format:

TAN (<expression>)

Explanation:
This function gives the tangent of the value of <expression>. The <expression> units are
in radians.

Examples:
A(0)=B-TAN(C)
----------- The tangent of variable C is subtracted from variable B and
the result is assigned to array A (0).
A(1)=TAN(DEGRAD(20))
----------- The tangent of 20.0° is assigned to array A (1).

Related functions: ATN, COS, DEGRAD, RADDEG, SIN

178
12. Functions

■ TIMER

Format:

TIMER
2
n The
NOTE
time can be set in
Explanation:
This function gives the current time in seconds, counting from 12:00 midnight as “0:00”.
“SYSTEM>INIT>CLOCK” mode. It is used to measure operation time during program execution, as well as for other uses.

Example:
c· CAUTION
The clock used in the controller
A%=TIMER
FOR B=1 TO 10
might differ from the correct time.
MOVE P,P0
MOVE P,P1
NEXT
A%=TIMER-A%
PRINT A%/60;”:”;A% MOD 60
HALT

Related functions: TIME$

■ TOLE

Format:

TOLE (<expression>)

The value of <expression> must be from 1 to 6 (axis number).

n• NOTE
If an axis that is set to “no axis” in
Explanation:
This function gives the tolerance parameter for the main group axis specified in
the system generation is specified in <expression>.
<expression>, then an error message
“Specification mismatch” appears
and execution of the command will
Example:
stop. A=TOLE(2)
----------- The tolerance parameter for axis 2 in the main group is
assigned to variable A.

179
12. Functions

■ TOLE2

Format:

TOLE2 (<expression>)
2 The value of <expression> must be from 1 to 4 (axis number).
n· NOTE
This function can be used only when
the sub group has been set in the Explanation:
system generation. This function gives the tolerance parameter for the sub group axis specified in <expression>.
· If an axis that is set to “no axis” in
the system generation is specified in
<expression>, then an error message Example:
“Specification mismatch” appears A=TOLE2(2)
and execution of the command will ----------- The tolerance parameter for axis 2 in the sub group is assigned
stop. to variable A.

■ TORQUE
Format:

TORQUE (<expression>)

The value of <expression> must be from 1 to 6 (axis number).

n IfNOTE
an axis that is set to “no axis” in the
Explanation:
This function gives the torque setting value for the main group axis specified in
system generation is specified in <expression>.
<expression>, then an error message
“Specification mismatch” appears and
execution of the command will stop.
Example:
A=TORQUE (2)
----------- The torque setting value for axis 2 in the main group is
assigned to variable A.

■ TORQUE2
Format:

TORQUE2 (<expression>)

The value of <expression> must be from 1 to 4 (axis number).

n· NOTE
This function can be used only when
Explanation:
This function gives the torque setting value for the sub group axis specified in <expression>.
the sub group has been set in the
system generation.
· If an axis that is set to “no axis” in
Example:
the system generation is specified in A=TORQUE2 (2)
<expression>, then an error message ----------- The torque setting value for axis 2 in the sub group is assigned
“Specification mismatch” appears to variable A.
and execution of the command will
stop.

180
12. Functions

■ VAL

Format:

VAL (<character string expression>)

Explanation:
2
This function converts the numeric value of the character string specified in <character
string expression> into an actual numeric value.
The value may be expressed in integer format (binary, decimal, hexadecimal), or real
number format (decimal point format, exponential format).
If the first character of the character string is “+”, “-”, “&” or anything other than a
numeric character, then the VAL function value becomes 0. If there are non-numeric
characters or spaces elsewhere in the character string, then all subsequent characters are
ignored by this function. However, in the case of hexadecimal numbers, A to F are
considered part of the numeric character.

Example:
A=VAL(”&B100001”)

Related functions: STR$

■ WEIGHT

Format:

WEIGHT

Explanation:
This function gives the tip weight parameter for the main robot.

Example:
A=WEIGHT
----------- The tip weight parameter of the main robot is assigned to
variable A.

■ WEIGHT2

Format:

WEIGHT2

Explanation:
This function gives the tip weight parameter for the sub robot.
n This
NOTE
function can be used only when Example:
the sub group has been set in system A=WEIGHT2
generation.
----------- The tip weight parameter of the sub robot is assigned to
variable A.

181
12. Functions

■ TCOUNTER

Format:

TCOUNTER
2 Explanation:
This function outputs count-up values at 10ms intervals starting from the point when the
TCOUNTER variable is reset.

n The
NOTE
10ms COUNTER variable counts
Example:
A=TCOUNETR
up from 0 to 65535, and then returns to
0 to continue count-up. Related functions: RESET

■ _SYSFLG

Format:

_SYSFLG

Explanation:
This is used as a flag that monitors the axis status according to the value specified by the
_SYSFLG variable. This should not be used during normal operation.

n When
NOTE
using this function as a flag for
Example:
_SYSFLG = 1
monitoring the axis status, please
consult us for proper support.
Related functions: RESET

182
12. Functions

12.2 Character string functions


Character string functions are only used as elements in character string expressions.

■ CHR$

Format: 2
CHR$ (<expression>)

Explanation:
This function gives the character having a character code specified in <expression>. The
value of <expression> must be between 0 and 255, otherwise an error will result.

Example:
A$=CHR$(65)
----------- A character “A” is assigned to A$.

Related functions: ORD

■ DATE$

Format:

DATE$

Explanation:
n The
NOTE
date can be set in This function gives the date in the format “yy/mm/dd” (last two digits of the year, month,
“SYSTEM>INIT>CLOCK” mode. day).

Examples:
A$=DATE$
PRINT DATE$

Related functions: TIME$

183
12. Functions

■ LEFT$

Format:

LEFT$ (<character string expression>, <expression>)


2 The value of <expression> must be 0 to 75.

Explanation:
This function extracts a character string with the digits specified by <expression> from
the left end of the character string specified by <character string expression>. The value
of <expression> must be between 0 and 75, otherwise an error will result. If the value of
<expression> is 0, then LEFT$ will be a null string. If the value of <expression> is greater
than the length of <character string expression>, then the LEFT$ string will be the same
as the <character string expression>.

Example:
B$=LEFT$(A$,4)

Related functions: MID$, RIGHT$

■ MID$

Format:

MID$ (<character string expression>, <expression 1>[, <expression 2>])

The value of <expression 1> must be 1 to 75.


The value of <expression 2> must be 0 to 75.

Explanation:
This function extracts a character string with the desired length (number of characters)
from the character string specified by <character string expression>. The value of
<expression 1> specifies the first character to be extracted, and the value of <expression
2> the number of characters. The value of <expression 1> must be between 1 and 75 and
<expression 2> must be between 0 and 75, otherwise an error will result. If <expression
2> is omitted, or if the number of characters to the right of the character of <expression
1> is less than the value of <expression 2>, then all characters to the right of the character
expressed by <expression 1> will be extracted. If <expression 1> is longer than the character
string, MID$ will be a null string.

Example:
B$=MID$(A$,2,4)

Related functions: LEFT$, RIGHT$

184
12. Functions

■ RIGHT$

Format:

RIGHT$ (<character string expression>, <expression>)

The value of <expression> must be 0 to 75.


2
Explanation:
This function extracts a character string with the digits specified by <expression> from
the right end of the character string specified by <character string expression>. The value
of <expression> must be between 0 and 75, otherwise an error will result. If the value of
<expression> is 0, then RIGHT$ will be a null string. If the value of <expression> is
greater than the length of <character string expression>, then the RIGHT$ string will be
the same as the <character string expression>.

Example:
B$=RIGHT$(A$,4)

Related functions: LEFT$, MID$

■ STR$

Format:

STR$ (<expression>)

Explanation:
This function changes the value of <expression> into a character string. The value of
<expression> may be either an integer or real number.

Example:
B$=STR$(10.01)

Related functions: VAL

■ TIME$

Format:

TIME$

n The
NOTE
clock can be set in
Explanation:
This function gives the time in the format “hh:mm:ss” (hours, minutes, seconds).
“SYSTEM>INIT>CLOCK” mode.
Examples:
A$=TIME$
PRINT TIME$

Related functions: DATE$, TIMER

185
12. Functions

12.3 Point functions


Point functions are only used as elements for point expressions.

■ JTOXY
2 Format:

JTOXY (<point expression>)

n When
NOTE
the command is executed, the
Explanation:
This function converts the joint coordinate data (unit: pulses) specified by <point
data is converted based on the expression> into Cartesian coordinate data (unit: mm, deg.) for the main group.
standard coordinate, shift coordinate
and hand definition that are set.
Example:
P10=JTOXY(WHERE)
----------- The current position data is converted into Cartesian
coordinate data.

Related functions: XYTOJ

■ JTOXY2

Format:

JTOXY2 (<point expression>)

Explanation:
n• NOTE
This function can be used only when This function converts the joint coordinate data (unit: pulses) specified by <point
the sub group has been set in the expression> into Cartesian coordinate data (unit: mm, deg.) for the sub group.
system generation.
• When the command is executed, the
data is converted based on the
Example:
P10=JTOXY2(WHERE2)
standard coordinate, shift coordinate
and hand definition that are set. ----------- The current position data is converted into Cartesian
coordinate data.

Related functions: XYTOJ2

■ PPNT

Format:

PPNT (pallet definition number, pallet position number)

Explanation:
This function creates point data specified by a pallet definition number and pallet position
number.

Example:
P10=PPNT(1, 24)
----------- Creates, at point P10, point data specified by pallet position
number 24 of pallet definition number 1.

Related functions: PDEF, PMOVE, PMOVE2

186
12. Functions

■ WHERE

Format:

WHERE

Explanation:
2
This function reads out the current position of the main group robot arm in joint coordinates.

Example:
P10=WHERE
----------- The current position is read and assigned to point 10. Point
10 is defined in joint coordinates (pulses).

■ WHERE2

Format:

WHERE2

Explanation:
This function reads out the current position of the sub group robot arm in joint coordinates.

n This
NOTE
function can be used only when
Example:
P10=WHERE2
the sub group has been set in the ----------- The current position is read and assigned to point 10. Point
system generation. 10 is defined in joint coordinates (pulses).

■ XYTOJ

Format:

XYTOJ (<point expression>)

n When
NOTE
the command is executed, the
Explanation:
This function converts the Cartesian coordinate data (unit: mm, deg.) in the main group
data is converted based on the specified by <point expression> into joint coordinate data (unit: pulses).
standard coordinate, shift coordinate
and hand definition that were set.
On SCARA robots, the converted result Example:
differs depending on whether right- P10=XYTOJ(P10)
handed or left-handed is specified. ----------- Point data at P10 is converted into joint coordinate data.

Related functions: JTOXY

187
12. Functions

■ XYTOJ2

Format:

XYTOJ2 (<point expression>)


2
n• NOTE
This function can be used only when
Explanation:
This function converts the Cartesian coordinate data (unit: mm, deg.) in the sub group
the sub group has been set in the specified by <point expression> into joint coordinate data (unit: pulses).
system generation.
• When the command is executed, the
data is converted based on the Example:
standard coordinate, shift coordinate P10=XYTOJ2(P10)
and hand definition that are set. —— Point data at P10 is converted into joint coordinate data.
On SCARA robots, the converted
result differs depending on whether
Related functions: JTOXY2
right-handed or left-handed is
specified.

188
13. Multi-tasking
Multi-tasking is used to create more sophisticated programs.
Before using the multi-tasking function, read this section thoroughly and make sure that you fully
understand its contents.

13.1 Outline
Multi-tasking allows executing two or more tasks in parallel. However, this does not mean
that multiple tasks are executed simultaneously because the controller has only one CPU
to execute the tasks. In multi-tasking, the CPU time is shared among multiple tasks by
assigning a priority to each task so that they can be executed efficiently.
A maximum of 8 tasks (task 1 to task 8) can be executed in one program. The priority
level of task 1 is fixed at 32, while the priority of task 2 to task 8 can be set to any level
between 17 and 47.

13.2 Task definition


A task is a set of instructions written in a program, which are executed in sequence. In a
program, tasks are defined by placing a label as shown below.

’MAIN TASK(TASK1)
START *IOTASK,T2
*ST1:
MOVE P,P1,P0
IF DI(20)= 1 THEN
HALT
ENDIF
GOTO *ST
HALT
’SUB TASK(TASK2)
*IOTASK:
IF DI(21)=1 THEN
DO(30)=1
ELSE
DO(30)=0
ENDIF
GOTO *IOTASK
EXIT TASK

Label *IOTASK: to EXIT TASK is a subtask.

189
13. Multi-tasking

13.3 Task status and transition


There are 6 types of task status.

(1) STOP status


2 A task is present but the task processing is stopped.
(2) RUN status
A task is present and the task processing is being executed by the CPU.
(3) READY status
A task is present and ready to be allocated to the CPU for task processing.
(4) WAIT status
A task is present and waiting for an event to begin the task processing.
(5) SUSPEND status
A task is present but suspended while waiting to begin the task processing.
(6) NON EXISTEN status
No tasks exist in the program.

Call
NON EXISTEN
Delete
Stop

STOP

Start

Resume
Cancel waiting

SUSPEND READY WAIT

Suspend Wait for CPU assignment


CPU assignment

RUN
Wait condition

Task state transition

190
13. Multi-tasking

13.4 Starting tasks


Task 1 is called up by a program if present, and placed in RUN status when the program
has started in AUTO mode. To call up the other tasks and place them in the READY
status, use the START command.
2
13.5 Task scheduling
Task scheduling determines the priority to be used in allocating tasks in the READY
status to the CPU and executing them. One task is selected from among tasks in the
READY status and placed in RUN status.
When there are two or more tasks which are put in the READY status, ready queues for
CPU allocation are used to determine the priority for executing the tasks. The number of
ready queues equal the number of task priority levels and are supervised by FCFS (First
Come First Service). The smaller the number, the higher the task priority level.
Priority level The head of the task with the
Task 1 highest priority is put in
RUN status.

32
Task 1 Task 3 Task 4

33
Task 5

34
Task 2

Order in which tasks are put in READY status.

The task in the RUN status moves to the end of the ready queue when the CPU occupation
time exceeds a specified time or a task with a higher priority level is put in READY
status.
Priority level
Task 1

32
Task 1 Task 3 Task 4 Task 1

191
13. Multi-tasking

13.6 Condition wait in task


A task is put in the WAIT state (waiting for an event) when a command causing a wait
state is executed for that task. At this time, the transition to READY status does not take
place until the wait condition is canceled.
2 1. When a command causing a wait state is executed, the following transition happens.
Task for which a command causing a wait state is executed - > WAIT
Task at the head of the ready queue with higher priority - > RUN
2. When an event waited by the task in the WAIT status occurs, the following status
transition takes place by task scheduling.
n IfNOTE
multiple tasks are in WAIT status
Task in the WAIT status for which the awaited event occurred- > READY
awaiting the the same condition event, However, if the task put in the READY status was at the head of the ready queue
or different condition events occur with the highest priority, the following transition takes place.
simultaneously, all tasks for which the
waited events occur are put in READY
Task that is currently in RUN status - > READY
status. Task at the head of the ready queue with higher priority - > RUN

Tasks are put in WAIT status by the following commands.

Event Command
Wait for axis Axis movement MOVE, MOVEI, MOVE2, MOVEI2
movement to command
DRIVE, DRIVEI, DRIVE2, DRIVEI2
complete
PMOVE, PMOVE2
SERVO, SERVO2
WAIT ARM, WAIT ARM2
Parameter ACCEL, ARCH, AXWGHT, DECEL, OUTPOS, TOLE
command
ACCEL2, ARCH2, AXWGHT2, DECEL2, OUTPOS2, TOLE2
ORGORD, WEIGHT, ORGORD2, WEIGHT2
Robot status CHANGE, SHIFT, CHANGE2, SHIFT2
change command
LEFTY, RIGHTY, LEFTY2, RIGHTY2
ASPEED, SPEED, ASPEED2, SPEED2
Wait for time to elapse DELAY, SET (Time should be specified.), WAIT (Time should be
specified.)
Wait for condition to be met WAIT
Wait for data to send or to be received SEND
Wait for print buffer to become empty PRINT
Wait for key input INPUT

The tasks are not put in WAIT status if the event has been established before the above
commands are executed.

192
13. Multi-tasking

13.7 Suspending and restarting tasks


The SUSPEND command temporarily stops tasks other than task 1 and places them in
SUSPEND status. The SUSPEND command cannot be used for task 1.
n When
NOTE When the SUSPEND command is executed, the status transition takes place as follows.
the SUSPEND command is
executed for a task that is in WAIT
status, the command being executed
Task that executed the SUSPEND command -> RUN 2
with the specified task is terminated. Specified task -> SUSPEND

Tasks in the SUSPEND status can be restarted with the RESTART command. However,
the RESTART command cannot be used for task 1.
When the RESTART command is executed, the status transition takes place as follows.

Task for which the RESTART command was executed - > RUN
Specified task -> READY

13.8 Deleting tasks


Tasks can delete themselves by using the EXIT TASK command and set to the NON
EXISTEN (no task registration) status. The EXIT TASK command cannot be used for
task 1.
When the EXIT TASK command is executed, the status transition takes place as follows.
Task that executed the EXIT TASK command - > NON EXISTEN
Task at the head of the ready queue with higher priority - > RUN

A task can also be deleted and put in the NON EXISTEN (no task registration) status by
the other tasks using the CUT command. The CUT command cannot be used for task 1.

When the CUT command is executed, the status transition takes place as follows.
Task that executed the CUT command - > RUN
Specified task - > NON EXISTEN

193
13. Multi-tasking

13.9 Stopping tasks


All tasks stop if any of the following cases occurs.
(1) HALT command is executed.
The program is reset and all tasks other than task 1 are put in the NON EXISTEN
2 status. Task 1 is put in the STOP status.
(2) HOLD command is executed.
All tasks are put in the STOP status. When the program is restarted, the tasks in the
STOP status set to the READY or SUSPEND status.
(3) STOP key on the programming unit (MPB) is pressed or the interlock signal is cut
off.
Just as in the case where the HOLD command is executed, all tasks are put in the
STOP status. When the program is restarted, the tasks in the STOP status set to the
READY or SUSPEND status.

n When
NOTE
the program is restarted without
(4) When the emergency stop switch on the programming unit (MPB) is pressed or
the emergency stop signal is cut off.
being reset after the tasks have been
stopped by a cause other than (1), then
All tasks are put in STOP status. At this point, the power to the robot is shut off and
each task is processed from the status the servo sets to the non-hold state. After the canceling emergency stop, when the
in which the task stopped. This holds program is restarted, the tasks in STOP status are set to the READY or SUSPEND
true when the power to the controller status. To turn back on the power to the robot, other processing is required.
is turned off and then turned on.

194
13. Multi-tasking

13.10 Multi-task program example


Each task in a multi-task program is processed according to the task scheduling.

’TASK1
START *ST2,T2
START *ST3,T3
*ST1:
2
DO(20) = 1
WAIT MO(20) = 1
MOVE P,P1,P2,Z=0
IF MO(21)=1 THEN *FIN
GOTO *ST1
*FIN:
CUT T2
HALT
’TASK2
*ST2:
IF DI(20) = 1
MO(20) = 1
DELAY 100
ELSE
MO(20) = 0
ENDIF
GOTO *ST2
EXIT TASK
’TASK3
*ST3:
IF DI(21) = 0 THEN *ST3
IF DI(30) = 0 THEN *ST3
IF DI(33) = 0 THEN *ST3
MO(21) = 1
EXIT TASK

195
13. Multi-tasking

c When
CAUTION
the same variables and data are
13.11 Sharing the data
used in two or more tasks, use Point data, shift coordinate definition data, hand definition data, pallet definition data, all
sufficient caution when rewriting the
variable and data. Improper changes
global variables and other variables are shared between all tasks.
may cause trouble in the task Execution of each task can be controlled while using the same variables and data shared
2 processing. with the other tasks. In this case, however, use sufficient caution when rewriting the variable
and data because improper changes may cause trouble in the task processing.

196
14. Data file description

This section explains data files used with a SEND statement and READ/WRITE online commands.

There are 26 different types of data files.

n• NOTE
All data is handled as character
1. Program file 14. DI file

strings conforming to ASCII character 2. Point file 15. DO file


codes.
3. Point comment file 16. MO file
• No lower case alphabetic characters
may be used in command statements. 4. Parameter file 17. LO file

5. Shift coordinate definition file 18. TO file

6. Hand definition file 19. SI file

7. Pallet definition file 20. SO file

8. All file 21. Error message history file

9. Program directory file 22. Machine reference file

10. Parameter directory file 23. EOF file

11. Variable file 24. Serial port communication file

12. Constant file 25. SIW file

13. Array variable file 26. SOW file

197
14. Data file description

14.1 Program file

14.1.1 All programs

2 Format:

PGM

• Expresses all programs.


• When used as a readout file, all programs currently stored are read out.
• When used as a write file, writing is performed with a program name.

Data format:

NAME=program name[cr/lf]
aaaaa…..aaaaaaaaaaaaaaaaaaaaaaaaaaaaa[cr/lf]
:
aaaaa…..aaaaaaaaaaaaaaaaaaaaaaaaaaaaa[cr/lf]
NAME=program name[cr/lf]
:
NAME=program name[cr/lf]
aaaaa…..aaaaaaaaaaaaaaaaaaaaaaaaaaaaa[cr/lf]
:
aaaaa…..aaaaaaaaaaaaaaaaaaaaaaaaaaaaa[cr/lf]
[cr/lf]

● Program names are shown with 8 characters or less consisting of alphanumeric


characters and underscore ( _ ).
● “a” indicates a character code.
● [cr/lf] indicates CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.
● A line may be up to 75 characters long.
● A TAB code is converted to a space.

Example:
SEND PGM TO CMU
----------- Outputs all programs from communication port as shown
below.
SEND CMU TO PGM
----------- Inputs all programs from communication as shown below.
Response:
NAME=TEST1[cr/lf]
A=1[cr/lf]
RESET DO2()[cr/lf]
:
NAME=TEST2[cr/lf]
:
NAME=PGM1[cr/lf]
:
HALT[cr/lf]
[cr/lf]

198
14. Data file description

14.1.2 One program

Format:

<program name>
2
• Expresses a specified program.
• Program name may be up to 8 characters consisting of alphanumeric characters
and underscore ( _ ) and must be enclosed by ”<” and ”>”.
• If no program name is specified, the currently selected program is specified.
• An error occurs if the specified program name differs from the program name on
the data.

Data format:

NAME=program name[cr/lf]
aaaaa…..aaaaaaaaaaaaaaaaaaaaaaaaaaaaa[cr/lf]
:
aaaaa…..aaaaaaaaaaaaaaaaaaaaaaaaaaaaa[cr/lf]
[cr/lf]

● The program name is shown with 8 characters or less consisting of alphanumeric


characters and underscore ( _ ).
● “a” indicates a character code.
● [cr/lf] shows CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.
● A line may be up to 75 characters long.
● A TAB code is converted to a space.

Example:
SEND <TEST1> TO CMU
----------- Outputs the program “TEST1” from communication port as
shown below.
n• NOTE
When the current mode is “AUTO” or
SEND CMU TO <TEST1>
----------- Inputs the program “TEST1” from communication port as
“PROGRAM” mode, and writing into
the currently selected program is not
shown below.
possible. Response:
• When a sequence program is being NAME=TEST1[cr/lf]
executed, writing into the program A=1[cr/lf]
name “SEQUENCE” is not possible. RESET DO2()[cr/lf]
• If there is no NAME statement used to :
specify a program, writing into the HALT[cr/lf]
program is not possible. [cr/lf]

199
14. Data file description

14.2 Point file

14.2.1 All points

2 Format:

PNT

• Expresses all point data.


• When used as a readout file, all points currently stored are read out.
• When used as a write file, writing is performed with a point number.

Data format:

Pmmmm= fxxxxxx fyyyyyy fzzzzzz frrrrrr faaaaaa fbbbbbb t [cr/lf]


Pmmmm= fxxxxxx fyyyyyy fzzzzzz frrrrrr faaaaaa fbbbbbb t [cr/lf]
:
Pmmmm= fxxxxxx fyyyyyy fzzzzzz frrrrrr faaaaaa fbbbbbb t [cr/lf]
Pmmmm= fxxxxxx fyyyyyy fzzzzzz frrrrrr faaaaaa fbbbbbb t [cr/lf]
[cr/lf]

● “mmmm” represents a number from 0 to 9999.


c InCAUTION
controllers whose software version ● “f” represents a +, - or space.
is earlier than V8.28, "mmmm"
represents a number from 0 to 4000. ● “xxxxxx”, “yyyyyy” … “bbbbbb” represent a numeric value of 8 digits or less.
When a dot (decimal point) is included, this is treated as point data in “mm” units.
Each piece of data is separated by one or more spaces.
● “t” is an extended hand system flag setting for SCARA robots. Hand system flags
c Hand
CAUTION
system flag setting is enabled are enabled only when specifying the coordinate data in “mm” units for SCARA
only when the software version is robots.
V8.08 or later.
If a number other than 1 or 2 is set, or if no number is designated, then 0 will be set
to indicate that there is no hand system flag.
1 : Right-handed system is used to set point data.
2 : Left-handed system is used to set point data.
● [cr/lf] indicates CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.
● A line may be up to 75 characters long.

Example:
SEND PNT TO CMU
----------- Outputs all points from communication port as shown below.
SEND CMU TO PNT
----------- Inputs all points from communication port as shown below.
Response:
P0 = 1 2 3 4 5 6[cr/lf]
P1 = 1.00 2.00 3.00 4.00 5.00 6.00[cr/lf]
P2 = 1.00 0.00 0.00 0.00 0.00 0.00[cr/lf]
:
P9999 = -1.00 0.00 0.00 0.00 0.00 0.00[cr/lf]
[cr/lf]

200
14. Data file description

14.2.2 One point

Format:

Pmmmm
2
c In controllers whose software version
CAUTION • Expresses a specified point.
• “mmmm” must be from 0 to 9999
is earlier than V8.28, "mmmm"
represents a number from 0 to 4000.
Data format:

Pmmmm= fxxxxxx fyyyyyy fzzzzzz frrrrrr faaaaaa fbbbbbb t [cr/lf]

● “mmmm” is from 0 to 9999.


● “f” represents a +, - or space.
● “xxxxxx”, “yyyyyy” … “bbbbbb” represent a numeric value of 8 digits or less.
When a dot (decimal point) is included, this is treated as point data in “mm” units.
Each piece of data is separated by one or more spaces.
● “t” is an extended hand system flag setting for SCARA robots. Hand system flags
c Hand
CAUTION
system flag setting is enabled are enabled only when specifying the coordinate data in “mm” units for SCARA
only when the software version is robots.
V8.08 or later.
If a number other than 1 or 2 is set, or if no number is designated, then 0 will be set
to indicate that there is no hand system flag.
1 : Right-handed system is used to set point data.
2 : Left-handed system is used to set point data.
● [cr/lf] indicates CR code (0Dh) + LF code (0Ah).
● A line may be up to 75 characters long.

n Integers
NOTE
indicate point data in “pulse”
Example:
SEND P100 TO CMU
units, and real numbers (containing a ----------- Outputs the specified point from communication port as
decimal point) in “mm” units.
shown below.
SEND CMU TO PNT
----------- Inputs the specified point from communication port as shown
below.

Response:
P100 = 1 2 3 4 5 6[cr/lf]

201
14. Data file description

14.3 Point comment file

14.3.1 All point comments

2 Format:

PCM

• Expresses all point comments.


• When used as a readout file, all point comments currently stored are read out.
• When used as a write file, writing is performed with a point comment number.

Data format:

PCmmmm= sssssssssssssss[cr/lf]
PCmmmm= sssssssssssssss[cr/lf]
:
PCmmmm= sssssssssssssss[cr/lf]
PCmmmm= sssssssssssssss[cr/lf]
[cr/lf]

● “mmmm” represents a number from 0 to 9999.


c InCAUTION
controllers whose software version ● “ss…ss” represents comment data. Comment data exceeding 15 characters is
is earlier than V8.28, "mmmm" ignored.
represents a number from 0 to 4000.
● [cr/lf] indicates CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.
● A line may be up to 75 characters long.

Example:
SEND PCM TO CMU
----------- Outputs all point comments from communication port as
shown below.
SEND CMU TO PCM
----------- Inputs all point comments from communication port as shown
below.

Response:
PC1 =ORIGIN POS[cr/lf]
PC3 =WAIT POS[cr/lf]
:
PC3999= WORK100[cr/lf]
[cr/lf]

202
14. Data file description

14.4 Parameter file

14.4.1 All parameters

n· NOTE
Parameters can be written only when
Format:
2
the axis servo is off.
· Parameters are already compatible
PRM
with upper versions. However,
parameters might not always be • Expresses all parameters (including settings in “UTILITY” mode).
compatible with lower versions.
· When you attempt to load a
• When used as a readout file, all parameters currently stored are read out.
parameter file of new version into a • When used as a write file, only the parameters specified by parameter labels are
controller of an earlier version, an written.
error "10.14 : Undefined parameter
found" may appear. If this happens,
you may load the parameter by setting Data format:
the "Skip undefined parameters"
parameter to "VALID". For more
details, refer to the "SYSTEM mode" – /parameter label/ ’ <comment> [cr/lf]
"Other parameters" section in the RC= xxxxxx [cr/lf]
robot controller owner's manual. /parameter label/ ’ <comment> [cr/lf]
R1= xxxxxx R2= yyyyyy [cr/lf]
/parameter label/ ’ <comment> [cr/lf]
A1= xxxxxx A2= yyyyyy A3= zzzzzz A4= rrrrrr[cr/lf]
/parameter label/ ’ <comment> [cr/lf]
:
[cr/lf]

● Parameter labels are shown with 6 alphabetic characters.


● The description of each parameter is shown in <comment>.
● “RC=” indicates the entire controller.
● “R1=” indicates the main robot, and “R2=” the sub robot.
● “A1=” to “An=” indicate axis numbers from axis 1 to axis n.
● [cr/lf] indicates CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.
● A line may be up to 75 characters long.

203
14. Data file description

Example:
SEND PRM TO CMU
----------- Outputs all parameters from communication port as shown
below.
SEND CMU TO PRM
----------- Inputs all parameters from communication port as shown
2 Response:
below.

/RBTNUM/ ’Robot number(V8.01/R1001)[cr/lf]


R1= 3000 R2= 3010[cr/lf]
/AXES / ’Number of axes[cr/lf]
R1= 2 R2= 2[cr/lf]
/AXSNUM/ ’Axis number(V1.01/V1.01/V1.01/V1.01/-----/-----/-----/-----/)[cr/lf]
A1= 5000 A2= 5001 A3= 5010 A4= 5011[cr/lf]
A5= 0 A6= 0 A7= 0 A8= 0[cr/lf]
/ATTRIB/ ’Axis attribute[cr/lf]
A1= 33792 A2= 33792 A3= 33792 A4= 33792[cr/lf]
A5= 256 A6= 256 A7= 256 A8= 256[cr/lf]
/WEIGHT/ ’Tip weight[kg][cr/lf]
R1= 2 R2= 12[cr/lf]
:
/CURPNO/ ’Port number of output[cr/lf]
RC= 20[cr/lf]
/CURPT1/ ’Compare point number1[cr/lf]
RC= 0[cr/lf]
/CURPT2/ ’Compare point number2[cr/lf]
RC= 0[cr/lf]
[cr/lf]

204
14. Data file description

14.4.2 One parameter

Format:

/parameter label/
2
• Expresses a parameter label with 6 alphabetic characters.
• When used as a readout file, only the parameter specified by a parameter label is
read out.
• When used as a write file, only the parameter specified by a parameter label is
written.

Data format:

/parameter label/ ’ <comment> [cr/lf]


RC= xxxxxx [cr/lf]
[cr/lf]
or
/parameter label/ ’ <comment> [cr/lf]
R?= xxxxxx [cr/lf]
[cr/lf]
or
/parameter label/ ’ <comment> [cr/lf]
A?= xxxxxx[cr/lf]
[cr/lf]

● The parameter label is shown with 6 alphabetic characters.


● The description of each parameter is shown in <comment>.
● “RC=” indicates the entire controller.
● “R1=” indicates the main robot, and “R2=” the sub robot.
● “A1=” to “An=” indicate axis numbers from axis 1 to axis n.
● [cr/lf] indicates CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.
● A line may be up to 75 characters long.

n· NOTE
Parameters can be written only when
Example:
SEND /ACCEL / TO CMU
the axis servo is off. ----------- Outputs the acceleration parameter from communication port
· Parameters are already compatible as shown below.
with upper versions. However, SEND CMU TO /ACCEL /
parameters might not always be
compatible with lower versions.
----- ------ Inputs the acceleration parameter from communication port
· When you attempt to load a as shown below.
parameter file of new version into a Response:
controller of an earlier version, an /ACCEL / ’Accel coefficient[%]
error "10.14 : Undefined parameter A1= 100 A2= 100 A3= 100 A4= 100[cr/lf]
found" may appear. If this happens, [cr/lf]
you may load the parameter by setting
the "Skip undefined parameters"
parameter to "VALID". For more
details, refer to the "SYSTEM mode" –
"Other parameters" section in the
robot controller owner's manual.

205
14. Data file description

14.5 Shift coordinate definition file

14.5.1 All shift data

2 Format:

SFT

• Expresses all shift data.


• When used as a readout file, all shift data currently stored are read out.
• When used as a write file, writing is performed with a shift number.

Data format:

Sm = fxxxxxx fyyyyyy fzzzzzz frrrrrr [cr/lf]


{SPm = fxxxxxx fyyyyyy fzzzzzz frrrrrr [cr/lf]}
{SMm = fxxxxxx fyyyyyy fzzzzzz frrrrrr [cr/lf]}
:
Sm = fxxxxxx fyyyyyy fzzzzzz frrrrrr [cr/lf]
{SPm = fxxxxxx fyyyyyy fzzzzzz frrrrrr [cr/lf]}
{SMm = fxxxxxx fyyyyyy fzzzzzz frrrrrr [cr/lf]}
[cr/lf]

● “m” represents a number from 0 to 9.


● “f” represents a +, - or space.
● “xxxxxx”, “yyyyyy” … “rrrrrr” represent a numeric value of 8 digits or less, having
2 or less places below the decimal point.
● Data enclosed by { } is shown depending on the data input.
● [cr/lf] indicates CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.
● A line may be up to 75 characters long.

Example:
SEND SFT TO CMU
----------- Outputs all shift data from communication port as shown
below.
SEND CMU TO SFT
----------- Inputs all shift data from communication port as shown below.
Response:
S0 = 0.00 0.00 0.00 0.00[cr/lf]
SP0 = 0.00 0.00 0.00 0.00[cr/lf]
SM0 = 0.00 0.00 0.00 0.00[cr/lf]
S1 = 1.00 1.00 1.00 1.00[cr/lf]
:
SM9 = 9.00 9.00 9.00 9.00[cr/lf]
[cr/lf]

206
14. Data file description

14.5.2 One shift definition

Format:

Sm
2
• Expresses a specified shift definition.
• “m” must be from 0 to 9.

Data format:

Sm = fxxxxxx fyyyyyy fzzzzzz frrrrrr [cr/lf]

● “m” is from 0 to 9.
● “f” represents a +, - or space.
● “xxxxxx”, “yyyyyy” … “rrrrrr” represent a numeric value of 8 digits or less, having
2 or less places below the decimal point.
● [cr/lf] indicates CR code (0Dh) + LF code (0Ah).
● A line may be up to 75 characters long.

Example:
SEND S0 TO CMU
----------- Outputs the specified shift coordinate definition data from
communication port as shown below.
SEND CMU TO S0
----------- Inputs the specified shift coordinate definition data from
communication port as shown below.
Response:
S0 = 0.00 0.00 0.00 0.00[cr/lf]
SP0 = 0.00 0.00 0.00 0.00[cr/lf]
SM0 = 0.00 0.00 0.00 0.00[cr/lf]
[cr/lf]

207
14. Data file description

14.6 Hand definition file

14.6.1 All hand data

2 Format:

HND

• Expresses all hand data.


• When used as a readout file, all hand data currently stored are read out.
• When used as a write file, writing is performed with a hand number.

Data format:

Hm = fxxxxxx fyyyyyy fzzzzzz {R} [cr/lf]


:
Hm = fxxxxxx fyyyyyy fzzzzzz {R} [cr/lf]
[cr/lf]

● “m” represents a number from 0 to 7. 0 to 3 are used for the main robot, and 4 to 7
for the sub robot.
● “f” represents a +, - or space.
● “xxxxxx”, “yyyyyy”, “zzzzzz” represent a numeric value of 8 digits or less, having
2 or less places below the decimal point, or an integer of 7 digits or less. (This
numeric format depends on the robot type setting and hand definition type.)
● {R} indicates whether a hand is attached to the R-axis.
● [cr/lf] indicates CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.
● A line may be up to 75 characters long.

Example:
SEND HND TO CMU
----------- Outputs all hand data from communication port as shown
below.
SEND CMU TO HND
----------- Inputs all hand data from communication port as shown below.
Response:
H0 = 0.00 0.00 0.00[cr/lf]
H1 = 1.00 1.00 1.00[cr/lf]
H2 = 2.00 2.00 2.00[cr/lf]
H3 = 3.00 3.00 3.00[cr/lf]
H4 = 4.00 4.00 4.00[cr/lf]
H5 = 5.00 5.00 5.00[cr/lf]
H6 = 6.00 6.00 6.00[cr/lf]
H7 = 7.00 7.00 7.00[cr/lf]
[cr/lf]

208
14. Data file description

14.6.2 One hand definition

Format:

Hm
2
• Expresses a specified hand definition.
• “m” must be from 0 to 7.

Data format:

Hm = fxxxxxx fyyyyyy fzzzzzz {R} [cr/lf]

● “m” is from 0 to 7. 0 to 3 are used for the main robot, and 4 to 7 for the sub robot.
● “f” represents a +, - or space.
● “xxxxxx”, “yyyyyy”, “zzzzzz” represent a numeric value of 8 digits or less, having
2 or less places below the decimal point, or an integer of 7 digits or less. (This
numeric format depends on the robot type setting and hand definition type.)
● {R} indicates whether a hand is attached to the R-axis.
● [cr/lf] indicates CR code (0Dh) + LF code (0Ah).
● A line may be up to 75 characters long.

Example:
SEND H3 TO CMU
----------- Outputs the specified hand definition data from
communication port as shown below.
SEND CMU TO H3
----------- Inputs the specified hand definition data from communication
port as shown below.
Response:
H3 = 3.00 3.00 3.00[cr/lf]

209
14. Data file description

14.7 Pallet definition file

14.7.1 All pallet definitions

2 Format:

PLT

• Expresses all pallet definitions.


• When used as a readout file, all pallet definitions currently stored are read out.
• When used as a write file, writing is performed with a pallet number.

Data format:

PLm [cr/lf]
PLN = XY [cr/lf]
NX = nnn [cr/lf]
NY = nnn [cr/lf]
NZ = nnn [cr/lf]
P[1] = fxxxxxx fyyyyyy fzzzzzz frrrrrr faaaaaa fbbbbbb t [cr/lf]
:
P[5] = fxxxxxx fyyyyyy fzzzzzz frrrrrr faaaaaa fbbbbbb t [cr/lf]
PLm [cr/lf]
:
[cr/lf]

● “m” represents a number from 0 to 19.


● “nnn” represents a positive integer.
● “f” represents a +, - or space.
● “xxxxxx”, “yyyyyy” … “bbbbbb” represent a numeric value of 8 digits or less.
When a dot (decimal point) is included, this is treated as point data in “mm” units.
Each piece of data is separated by one or more spaces.

c· CAUTION
Hand system flag setting is enabled
“t” is an extended hand system flag setting for SCARA robots. Hand system flags
are enabled only when specifying the coordinate data in “mm” units for SCARA
only when the software version is robots. However, hand system flags are ignored during operation using pallet
V8.08 or later. definitions.
· Hand system flags are ignored
during operation using pallet If a number other than 1 or 2 is set, or if no number is designated, then 0 will be set
definitions. to indicate that there is no hand system flag.
1 : Right-handed system is used to set point data.
2 : Left-handed system is used to set point data.
● [cr/lf] indicates CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.
● A line may be up to 75 characters long.

210
14. Data file description

Example:
SEND PLT TO CMU
----------- Outputs all pallet definitions from communication port as
shown below.
SEND CMU TO PLT
----------- Inputs all pallet definitions from communication port as shown

Response:
below. 2
PL0[cr/lf]
PLN=XY[cr/lf]
NX= 3[cr/lf]
NY= 4[cr/lf]
NZ= 2[cr/lf]
P[1]= 0.00 0.00 0.00 0.00 0.00 0.00[cr/lf]
P[2]= 100.00 0.00 0.00 0.00 0.00 0.00[cr/lf]
P[3]= 0.00 100.00 0.00 0.00 0.00 0.00[cr/lf]
P[4]= 100.00 100.00 0.00 0.00 0.00 0.00[cr/lf]
P[5]= 0.00 0.00 50.00 0.00 0.00 0.00[cr/lf]
PL1[cr/lf]
PLN=XY[cr/lf]
NX= 3[cr/lf]
NY= 4[cr/lf]
NZ= 2[cr/lf]
P[1]= 0.00 0.00 0.00 0.00 0.00 0.00[cr/lf]
P[2]= 100.00 100.00 0.00 0.00 0.00 0.00[cr/lf]
P[3]= 0.00 200.00 0.00 0.00 0.00 0.00[cr/lf]
P[4]= 100.00 200.00 0.00 0.00 0.00 0.00[cr/lf]
P[5]= 0.00 0.00 100.00 0.00 0.00 0.00[cr/lf]
[cr/lf]

211
14. Data file description

14.7.2 One pallet definition

Format:

PLm
2 • Expresses a specified pallet definition.
• “m” must be from 0 to 19.

Data format:

PLm [cr/lf]
PLN = XY [cr/lf]
NX = nnn [cr/lf]
NY = nnn [cr/lf]
NZ = nnn [cr/lf]
P[1] = fxxxxxx fyyyyyy fzzzzzz frrrrrr faaaaaa fbbbbbb t [cr/lf]
:
P[5] = fxxxxxx fyyyyyy fzzzzzz frrrrrr faaaaaa fbbbbbb t [cr/lf]
[cr/lf]

● “m” is from 0 to 19.


● “nnn” represents a positive integer.
● “f” represents a +, - or space.
● “xxxxxx”, “yyyyyy” … “bbbbbb” represent a numeric value of 8 digits or less.
When a dot (decimal point) is included, this is treated as point data in “mm” units.
Each piece of data is separated by one or more spaces.
● “t” is an extended hand system flag setting for SCARA robots. Hand system flags
c· CAUTION
Hand system flag setting is enabled
are enabled only when specifying the coordinate data in “mm” units for SCARA
robots. However, hand system flags are ignored during operation using pallet
only when the software version is
V8.08 or later. definitions.
· Hand system flags are ignored If a number other than 1 or 2 is set, or if no number is designated, then 0 will be set
during operation using pallet
to indicate that there is no hand system flag.
definitions.
1 : Right-handed system is used to set point data.
2 : Left-handed system is used to set point data.
● [cr/lf] indicates CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.
● A line may be up to 75 characters long.

Example:
SEND PL2 TO CMU
----------- Outputs the specified pallet definition from communication
port as shown below.
SEND CMU TO PL2
----------- Inputs the specified pallet definition from communication port
as shown below.
Response:
PL2[cr/lf]
PLN=XY[cr/lf]
NX= 3[cr/lf]
NY= 3[cr/lf]
NZ= 2[cr/lf]
P[1]= 100.00 100.00 50.00 90.00 0.00 0.00[cr/lf]

n Integers
P[2]= 200.00 100.00 50.00 90.00 0.00 0.00[cr/lf]
NOTE
P[3]= 100.00 200.00 50.00 90.00 0.00 0.00[cr/lf]
indicate point data in “pulse”
P[4]= 200.00 200.00 50.00 90.00 0.00 0.00[cr/lf]
units, and real numbers (containing a
P[5]= 100.00 10.00 100.00 90.00 0.00 0.00[cr/lf]
decimal point) in “mm” units.
[cr/lf]

212
14. Data file description

14.8 All file

14.8.1 All files

Format: 2
ALL

• Expresses all files essential for the entire system.


• When used as a readout file, all files of the entire system are read out.
• When used as a write file, a specified file is written.

Data format:

[PGM]
All program format
[PNT]
All point format
[PCM]
All point comment format
[PRM]
All parameter format
[SFT]
All shift data format
[HND]
All hand data format
[PLT]
All pallet data format
[END]

n• NOTE
For more details on each file, see the
Example:
SEND ALL TO CMU
description of each file. ----------- Outputs all files of the entire system from communication
• The [xxx] identifiers are used to
port.
determine the file format from the next
SEND CMU TO ALL
line.
• [END] indicates the end of all files. ----------- Inputs all files of the entire system from communication port.

213
14. Data file description

14.9 Program directory file

14.9.1 Entire program directory

2 Format:

DIR

• Expresses entire program directory.


• When used as a readout file, information on entire program directory is read out.
• Cannot be used as a write file.

Data format:

No. Name Line Byte RW/RO Date Time[cr/lf]


nnnfgssssssss llll bbbbbb xx yy/mm/dd hh:mm[cr/lf]
:
nnnfgssssssss llll bbbbbb xx yy/mm/dd hh:mm[cr/lf]
END[cr/lf]

● “nnn” (3 digits) represents a program directory number.


● “f” (1 digit) shows “o” when a program object is present and “s” when a sequence
object is present.
● “g” (1 digit) shows an asterisk ( * ) for the currently selected program.
● “ssssssss” (8 digits) represents a program name.
● “llll” (4 digits) represents the number of program lines.
● “bbbbbb” (6 digits) represents the byte size of the program.
● “xx” (2 digits) shows “RW” when the program is readable/writable and “RO”
when not rewritable.
● ”yy/mm/dd” (8 digits) is the date when the program was updated.
● ”hh:mm” (5 digits) is the time when the program was updated.
● [cr/lf] indicates CR code (0Dh) + LF code (0Ah).

Example:
SEND DIR TO CMU
----------- Outputs information on all program directory from
communication port as shown below.
Response:
No. Name Line Byte RW/RO Date Time[cr/lf]
1o* 12345678 5 21 RW 01/06/20 10:35[cr/lf]
2 PGM1 5 66 RW 01/06/20 10:35[cr/lf]
3 PGM2 5 66 RW 01/06/20 10:35[cr/lf]
4 PGM3 5 66 RW 01/06/20 10:35[cr/lf]
5 PGM4 5 66 RW 01/06/20 10:35[cr/lf]
6 PGM5 5 66 RW 01/06/20 10:35[cr/lf]
7 PGM6 5 66 RW 01/06/20 10:35[cr/lf]
8s SEQUENCE 1 15 RW 01/06/20 10:35[cr/lf]
END[cr/lf]

214
14. Data file description

14.9.2 One program

Format:

<<program name>>
2
• Expresses information on one program.

Data format:

No. Name Line Byte RW/RO Date Time[cr/lf]


nnnfgssssssss llll bbbbbb xx yy/mm/dd hh:mm[cr/lf]

● “nnn” (3 digits) represents a program directory number.


● “f” (1 digit) shows “o” when a program object is present and “s” when a sequence
object is present.
● “g” (1 digit) shows an asterisk ( * ) for the currently selected program.
● “ssssssss” (8 digits) represents a program name.
● “llll” (4 digits) represents the number of program lines.
● “bbbbbb” (6 digits) represents the byte size of the program.
● “xx” (2 digits) shows “RW” when the program is readable/writable and “RO”
when not rewritable.
● ”yy/mm/dd” (8 digits) is the date when the program was updated.
● ”hh:mm” (5 digits) is the time when the program was updated.
● [cr/lf] indicates CR code (0Dh) + LF code (0Ah).

Example:
SEND <<TEST>> TO CMU
----------- Outputs information on the specified program from
communication port as shown below.
Response:
No. Name Line Byte RW/RO Date Time[cr/lf]
3o* PGM2 5 66 RW 01/06/20 10:35[cr/lf]

215
14. Data file description

14.10 Parameter directory file

14.10.1 Entire parameter directory

2 Format:

DPM

• Expresses entire parameter directory.


• When used as a readout file, information on entire parameter directory is read out.
• Cannot be used as a write file.

Data format:

/parameter label/ ’<comment>[cr/lf]


/parameter label/ ’<comment>[cr/lf]
:
/parameter label/ ’<comment>[cr/lf]
[cr/lf]

● Parameter labels are shown with 6 alphabetic characters.


● The description of each parameter is shown in <comment>.
● [cr/lf] indicates CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.
● A line may be up to 75 characters long.

Example:
SEND DPM TO CMU
----------- Outputs information on all parameter directory from
communication port as shown below.
Response:
/RBTNUM/ ’Robot number(V8.01/R1001)[cr/lf]
/AXES / ’Number of axes[cr/lf]
/AXSNUM/ ’Axis number (V1.01/V1.01/V1.01/V1.01/-----/-----/-----/-----/)[cr/lf]
/ATTRIB/ ’Axis attribute[cr/lf]
/WEIGHT/ ’Tip weight[kg][cr/lf]
/ORIGIN/ ’Origin sequence[cr/lf]
/RORIEN/ ’R axis orientation[cr/lf]
:
/CURPNO/ ’Port number of output[cr/lf]
/CURPT1/ ’Compare point number1[cr/lf]
/CURPT2/ ’Compare point number2[cr/lf]
[cr/lf]

216
14. Data file description

14.11 Variable file

14.11.1 All variables


Format:
2
VAR

• Expresses all global variables.


• When used as a readout file, all global variables currently stored are read out.
• When used as a write file, a specified global variable is written.

Data format:

<variable name>t = xxxxxx [cr/lf]


<variable name>t = xxxxxx [cr/lf]
:
<variable name>t = xxxxxx [cr/lf]
[cr/lf]

● <Variable name> is a global variable defined in the program.


● <Variable name> is shown with 16 characters or less consisting of alphanumeric
characters and underscore ( _ ).
● “t” indicates a type of variable. (!: real type, %: integer type, $: character type)
● “xxxxx” differs depending on the type of variable.
Integer type: integer of 7 digits or less
Real type: real number of 7 digits or less including decimal fractions
Character type: character string of 70 characters or less
● [cr/lf] shows CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.
● A line may be up to 75 characters long.

217
14. Data file description

Example:
SEND VAR TO CMU
----------- Outputs all global variables from communication port as
shown below.
Response:
SGI0=0[cr/lf]
2 SGI1=1111[cr/lf]
SGI2=2222[cr/lf]
SGI3=3333[cr/lf]
SGI4=4444[cr/lf]
SGI5=5555[cr/lf]
SGI6=6666[cr/lf]
SGI7=7777[cr/lf]
SGR0=0[cr/lf]
SGR1=1.1111E3[cr/lf]
SGR2=2.2222E3[cr/lf]
SGR3=3.3333E3[cr/lf]
SGR4=4.4444E3[cr/lf]
SGR5=5.5555E3[cr/lf]
SGR6=6.6666E3[cr/lf]
SGR7=7.7777E3[cr/lf]
B1%=111[cr/lf]
B2%=222[cr/lf]
C1$=”CNS_1”[cr/lf]
C2$=”CNS_2”[cr/lf]
[cr/lf]

218
14. Data file description

14.11.2 One variable

Format:

<variable name>t
2
• Expressed one variable.

Data format:

xxxxxx [cr/lf]

● <Variable name> is a global variable defined in the program.


● <Variable name> is shown with 16 characters or less consisting of alphanumeric
characters and underscore ( _ ).
● “t” indicates a type of variable. (!: real type, %: integer type, $: character type)
● “xxxxx” differs depending on the type of variable.
Integer type: integer of 8 digits or less
Real type: real number of 7 digits or less including decimal fractions
Character type: character string of 70 characters or less
● [cr/lf] shows CR code (0Dh) + LF code (0Ah).
● A line may be up to 75 characters long.

Example:
n• NOTE
SGIx indicates an integer type static
SEND SGI6 TO CMU[cr/lf]
----------- Outputs the specified variable SGI6 from communication port
variable.
• SGRx indicates a real type static as shown below.
variable. Response:
• Dynamic global variables are 6666[cr/lf]
registered during compiling. Variables
cannot be referred to unless they are
registered.

219
14. Data file description

14.12 Constant file

14.12.1 One character string

2 Format:

”<character string>”

• Expresses a specified character string.


• When used as a readout file, the specified character string is read out.
• Cannot be used as a write file.

Data format:

sssss…ssssss[cr/lf]

● “sssss…ssssss” shown with 61 characters or less.


● Output of a double quotation ( ” ) is shown with two successive double quotations.
● [cr/lf] shows CR code (0Dh) + LF code (0Ah).

Example:
SEND”””YAMAHA ROBOT””” TO CMU
----------- Outputs the specified character string from communication
port as shown below.
Response:
”YAMAHA ROBOT”[cr/lf]

220
14. Data file description

14.13 Array variable file

14.13.1 All array variables

Format: 2
ARY

● Expresses all array variables.


● When used as a readout file, all array variables are read out.
● When used as a write file, writing is performed with a specified array variable.

Data format:

<variable name>t(l{,m{,n}}) = xxxxxx [cr/lf]


<variable name>t(l{,m{,n}}) = xxxxxx [cr/lf]
:
<variable name>t(l{,m{,n}}) = xxxxxx [cr/lf]
[cr/lf]

● <Variable name> is a global array variable defined by the DIM statement in the
program.
● <Variable name> is shown with 16 characters or less consisting of alphanumeric
characters and underscore ( _ ).
● “t” indicates a type of variable. (!: real type, %: integer type, $: character type)
● “l”, “m” and “n” indicate array arguments.
● “xxxxx” differs depending on the type of variable.
Integer type: integer of 8 digits or less
Real type: real number of 7 digits or less including decimal fractions
Character type: character string of 70 characters or less
● [cr/lf] shows CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.
● A line may be up to 75 characters long.

221
14. Data file description

Example:
SEND ARY TO CMU
----------- Outputs all global array variables from communication port
as shown below.
Response:
A!(0)=0[cr/lf]
2 A!(1)=1.E2[cr/lf]
A!(2)=2.E2[cr/lf]
B%(0,0)=0[cr/lf]
B%(0,1)=1111[cr/lf]
B%(1,0)=2222[cr/lf]
B%(1,1)=3333[cr/lf]
C$(0,0,0)=”ARY1”[cr/lf]
C$(0,0,1)=”ARY2”[cr/lf]
C$(0,1,0)=”ARY3”[cr/lf]
C$(0,1,1)=”ARY4”[cr/lf]
C$(1,0,0)=”ARY5”[cr/lf]
C$(1,0,1)=”ARY6”[cr/lf]
C$(1,1,0)=”ARY7”[cr/lf]
C$(1,1,1)=”ARY8”[cr/lf]
[cr/lf]

222
14. Data file description

14.13.2 One array variable

Format:

<variable name>t(l{,m{,n}})
2
• Expresses one array variable.

Data format:

xxxxxx [cr/lf]

● <Variable name> is a global array variable defined by the DIM statement in the
program.
● <Variable name> is shown with 16 characters or less consisting of alphanumeric
characters and underscore ( _ ).
● “t” indicates a type of variable. (!: real type, %: integer type, $: character type)
● “l”, “m” and “n” indicate array arguments.
● “xxxxx” differs depending on the type of variable.
Integer type: integer of 8 digits or less
Real type: real number of 7 digits or less including decimal fractions
Character type: character string of 70 characters or less
● [cr/lf] shows CR code (0Dh) + LF code (0Ah).

Example:
SEND CMU TO C1$(2)[cr/lf]
----------- Inputs the specified array variable C1$(2) from
n Array
NOTE
variables defined by the DIM communication port as shown below.
statement are registered during
compiling. Array variables cannot be Response:
referred to unless they are registered. YAMAHA ROBOT[cr/lf]

223
14. Data file description

14.14 DI file

14.14.1 All DI information

2 Format:

DI()

• Expresses all DI information.


• When used as a readout file, all DI information is read out.
• Cannot be used as a write file.

Data format:

DI0()=&Bnnnnnnnn [cr/lf]
DI1()=&Bnnnnnnnn [cr/lf]
:
DI27()=&Bnnnnnnnn [cr/lf]
[cr/lf]

● “n” is a binary number of 0 or 1, comprising an 8-digit number corresponding to


m0, m1 … m7 starting from the right. (“m” is a port number.)
● [cr/lf] shows CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.

Example:
SEND DI() TO CMU
----------- Outputs all DI information from communication port as shown
below.
Response:
DI0()=&B10001001[cr/lf]
DI1()=&B00000010[cr/lf]
DI2()=&B00000000[cr/lf]
:
DI7()=&B00000000[cr/lf]
DI10()=&B00000000[cr/lf]
DI11()=&B00000000[cr/lf]
DI12()=&B00000000[cr/lf]
:
DI17()=&B00000000[cr/lf]
DI20()=&B00000000[cr/lf]
:
DI26()=&B00000000[cr/lf]
DI27()=&B00000000[cr/lf]
[cr/lf]

224
14. Data file description

14.14.2 One DI port


Format:

DIm()

• Expresses the status of one DI port. 2


• When used as a readout file, the specified DI port status is read out.
• Cannot be used as a write file.

Data format:

DIm()=&Bnnnnnnnn[cr/lf]

● “m” is from 0 to 7, 10 to 17 or 20 to 27.


● “n” is a binary number of 0 or 1, comprising an 8-digit number corresponding to
m0, m1 … m7 starting from the right.
● [cr/lf] shows CR code (0Dh) + LF code (0Ah).

Example:
SEND DI5() TO CMU
----------- Outputs the DI5 port status from communication port as
shown below.
Response:
DI5()=&B00000000[cr/lf]

225
14. Data file description

14.15 DO file

14.15.1 All DO information

2 Format:

DO()

• Expresses all DO information.


• When used as a readout file, all DO information is read out.
• Cannot be used as a write file.

Data format:

DO0()=&Bnnnnnnnn [cr/lf]
DO1()=&Bnnnnnnnn [cr/lf]
:
DO27()=&Bnnnnnnnn [cr/lf]
[cr/lf]

● “n” is a binary number of 0 or 1, comprising an 8-digit number corresponding to


m0, m1 … m7 starting from the right. (“m” is a port number.)
● [cr/lf] shows CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.

Example:
SEND DO() TO CMU
----------- Outputs all DO information from communication port as
shown below.
Response:
DO0()=&B10001001[cr/lf]
DO1()=&B00000010[cr/lf]
DO2()=&B00000000[cr/lf]
:
DO7()=&B00000000[cr/lf]
DO10()=&B00000000[cr/lf]
DO11()=&B00000000[cr/lf]
DO12()=&B00000000[cr/lf]
:
DO17()=&B00000000[cr/lf]
DO20()=&B00000000[cr/lf]
:
DO26()=&B00000000[cr/lf]
DO27()=&B00000000[cr/lf]
[cr/lf]

226
14. Data file description

14.15.2 One DO port

Format:

DOm()
2
• Expresses the status of one DO port.
• When used as a readout file, the specified DO port status is read out.
• When used as a write file, the value is written to the specified DO port. However,
writing to DO0() and DO1() is prohibited.

Data format:
Readout file

DOm()=&Bnnnnnnnn[cr/lf]

Write file

&Bnnnnnnnn[cr/lf] or k[cr/lf]

● “m” is from 0 to 7, 10 to 17 or 20 to 27.


● “n” is a binary number of 0 or 1, comprising an 8-digit number corresponding to
m0, m1 … m7 starting from the right.
● “k” is an integer from 0 to 255.
● [cr/lf] shows CR code (0Dh) + LF code (0Ah).

n Writing
NOTE
to DO0() and DO1() is
Example 1:
SEND DO5() TO CMU
prohibited. ----------- Outputs the DO5 port status from communication port as
shown below.
Response:
DO5()=&B00000000[cr/lf]

Example 2:
SEND CMU TO DO5()
----------- Inputs the DO5 port status from communication port as shown
below.
&B00000111

Response:
OK[cr/lf]

227
14. Data file description

14.16 MO file

14.16.1 All MO information

2 Format:

MO()

• Expresses all MO information.


• When used as a readout file, all MO information is read out.
• Cannot be used as a write file.

Data format:

MO0()=&Bnnnnnnnn [cr/lf]
MO1()=&Bnnnnnnnn [cr/lf]
:
MO27()=&Bnnnnnnnn [cr/lf]
[cr/lf]

● “n” is a binary number of 0 or 1, comprising an 8-digit number corresponding to


m0, m1 … m7 starting from the right. (“m” is a port number.)
● [cr/lf] shows CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.

Example:
SEND MO() TO CMU
----------- Outputs all MO information from communication port as
shown below.
Response:
MO0()=&B10001001[cr/lf]
MO1()=&B00000010[cr/lf]
MO2()=&B00000000[cr/lf]
:
MO7()=&B00000000[cr/lf]
MO10()=&B00000000[cr/lf]
MO11()=&B00000000[cr/lf]
MO12()=&B00000000[cr/lf]
:
MO17()=&B00000000[cr/lf]
MO20()=&B00000000[cr/lf]
:
MO26()=&B00000000[cr/lf]
MO27()=&B00000000[cr/lf]
[cr/lf]

228
14. Data file description

14.16.2 One MO port

Format:

MOm()
2
• Expresses the status of one MO port.
• When used as a readout file, the specified MO port status is read out.
• When used as a write file, the value is written to the specified MO port. However,
writing to MO0() and MO1() is prohibited.

Data format:
Readout file

MOm()=&Bnnnnnnnn[cr/lf]

Write file

&Bnnnnnnnn[cr/lf] or k[cr/lf]

● “m” is from 0 to 7, 10 to 17 or 20 to 27.


● “n” is a binary number of 0 or 1, comprising an 8-digit number corresponding to
m0, m1 … m7 starting from the right.
● “k” is an integer from 0 to 255.
● [cr/lf] shows CR code (0Dh) + LF code (0Ah).

n Writing
NOTE
to MO0() and MO1() is
Example 1:
SEND MO5() TO CMU
prohibited. ----------- Outputs the MO5 port status from communication port as
shown below.
Response:
MO5()=&B00000000[cr/lf]

Example 2:
SEND CMU TO MO5()
----------- Inputs the MO5 port status from communication port as shown
below.
&B00000111

Response:
OK[cr/lf]

229
14. Data file description

14.17 LO file

14.17.1 All LO information

2 Format:

LO()

• Expresses all LO information.


• When used as a readout file, all LO information is read out.
• Cannot be used as a write file.

Data format:

LO0()=&Bnnnnnnnn [cr/lf]
[cr/lf]

● “n” is a binary number of 0 or 1, comprising an 8-digit number corresponding to


00, 01 … 07 starting from the right.
● [cr/lf] shows CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.

Example:
SEND LO() TO CMU
----------- Outputs all LO information from communication port as
shown below.
Response:
LO0()=&B10001001[cr/lf]
[cr/lf]

230
14. Data file description

14.17.2 One LO port

Format:

LO0 ()
2
• Expresses the status of one LO port.
• When used as a readout file, the specified LO port status is read out.
• When used as a write file, the value is written to the specified LO port.

Data format:
Readout file

LO0()=&Bnnnnnnnn[cr/lf]

Write file

&Bnnnnnnnn[cr/lf] or k[cr/lf]

● “n” is a binary number of 0 or 1, comprising an 8-digit number corresponding to


00, 01 … 07 starting from the right.
● “k” is an integer from 0 to 255.
● [cr/lf] shows CR code (0Dh) + LF code (0Ah).

Example 1:
SEND LO0() TO CMU
----------- Outputs the LO0 port status from communication port as
shown below.
Response:
LO0()=&B00000000[cr/lf]

Example 2:
SEND CMU TO LO0()
----------- Inputs the LO0 port status from communication port as shown
below.
&B00000111

Response:
OK[cr/lf]

231
14. Data file description

14.18 TO file

14.18.1 All TO information

2 Format:

TO()

• Expresses all TO information.


• When used as a readout file, all TO information is read out.
• Cannot be used as a write file.

Data format:

TO0()=&Bnnnnnnnn [cr/lf]
[cr/lf]

● “n” is a binary number of 0 or 1, comprising an 8-digit number corresponding to


00, 01 … 07 starting from the right.
● [cr/lf] shows CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.

Example:
SEND TO() TO CMU
----------- Outputs all TO information from communication port as
shown below.
Response:
TO0()=&B10001001[cr/lf]
[cr/lf]

232
14. Data file description

14.18.2 One TO port

Format:

TO0()
2
• Expresses the status of one TO port.
• When used as a readout file, the specified TO port status is read out.
• When used as a write file, the value is written to the specified TO port.

Data format:
Readout file

TO0()=&Bnnnnnnnn[cr/lf]

Write file

&Bnnnnnnnn[cr/lf] or k[cr/lf]

● “n” is a binary number of 0 or 1, comprising an 8-digit number corresponding to


00, 01 … 07 starting from the right.
● “k” is an integer from 0 to 255.
● [cr/lf] shows CR code (0Dh) + LF code (0Ah).

Example 1:
SEND TO0() TO CMU
----------- Outputs the TO0 port status from communication port as
shown below.
Response:
TO0()=&B00000000[cr/lf]

Example 2:
SEND CMU TO TO0()
----------- Inputs the TO0 port status from communication port as shown
below.
&B00000111

Response:
OK[cr/lf]

233
14. Data file description

14.19 SI file

14.19.1 All SI information

2 Format:

SI()

• Expresses all SI information.


• When used as a readout file, all SI information is read out.
• Cannot be used as a write file.

Data format:

SI0()=&Bnnnnnnnn [cr/lf]
SI1()=&Bnnnnnnnn [cr/lf]
:
SI27()=&Bnnnnnnnn [cr/lf]
[cr/lf]

● “n” is a binary number of 0 or 1, comprising an 8-digit number corresponding to


m0, m1 … m7 starting from the right. (“m” is a port number.)
● [cr/lf] shows CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.

Example:
SEND SI() TO CMU
----------- Outputs all SI information from communication port as shown
below.
Response:
SI0()=&B10001001[cr/lf]
SI1()=&B00000010[cr/lf]
SI2()=&B00000000[cr/lf]
:
SI7()=&B00000000[cr/lf]
SI10()=&B00000000[cr/lf]
SI11()=&B00000000[cr/lf]
SI12()=&B00000000[cr/lf]
:
SI17()=&B00000000[cr/lf]
SI20()=&B00000000[cr/lf]
:
SI26()=&B00000000[cr/lf]
SI27()=&B00000000[cr/lf]
[cr/lf]

234
14. Data file description

14.19.2 One SI port

Format:

SIm()
2
• Expresses the status of one SI port.
• When used as a readout file, the specified SI port status is read out.
• Cannot be used as a write file.

Data format:

SIm()=&Bnnnnnnnn[cr/lf]

● “m” is from 0 to 7, 10 to 17 or 20 to 27.


● “n” is a binary number of 0 or 1, comprising an 8-digit number corresponding to
m0, m1 … m7 starting from the right.
● [cr/lf] shows CR code (0Dh) + LF code (0Ah).

Example:
SEND SI5() TO CMU
----------- Outputs the SI5 port status from communication port as shown
below.
Response:
SI5()=&B00000000[cr/lf]

235
14. Data file description

14.20 SO file

14.20.1 All SO information

2 Format:

SO()

• Expresses all SO information.


• When used as a readout file, all SO information is read out.
• Cannot be used as a write file.

Data format:

SO0()=&Bnnnnnnnn [cr/lf]
SO1()=&Bnnnnnnnn [cr/lf]
:
SO27()=&Bnnnnnnnn [cr/lf]
[cr/lf]

● “n” is a binary number of 0 or 1, comprising an 8-digit number corresponding to


m0, m1 … m7 starting from the right. (“m” is a port number.)
● [cr/lf] shows CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.

Example:
SEND SO() TO CMU
----------- Outputs all SO information from communication port as
shown below.
Response:
SO0()=&B10001001[cr/lf]
SO1()=&B00000010[cr/lf]
SO2()=&B00000000[cr/lf]
:
SO7()=&B00000000[cr/lf]
SO10()=&B00000000[cr/lf]
SO11()=&B00000000[cr/lf]
SO12()=&B00000000[cr/lf]
:
SO17()=&B00000000[cr/lf]
SO20()=&B00000000[cr/lf]
:
SO26()=&B00000000[cr/lf]
SO27()=&B00000000[cr/lf]
[cr/lf]

236
14. Data file description

14.20.2 One SO port

Format:

SOm()
2
• Expresses the output status of one SO port.
• When used as a readout file, the specified SO port status is read out.
• When used as a write file, the value is written to the specified SO port. However,
writing to SO0() and SO1() is prohibited.

Data format:
Readout file

SOm()=&Bnnnnnnnn[cr/lf]

Write file

&Bnnnnnnnn[cr/lf] or k[cr/lf]

● “m” is from 0 to 7, 10 to 17 or 20 to 27.


● “n” is a binary number of 0 or 1, comprising an 8-digit number corresponding to
m0, m1 … m7 starting from the right.
● “k” is an integer from 0 to 255.
● [cr/lf] shows CR code (0Dh) + LF code (0Ah).

Example 1:
SEND SO5() TO CMU
----------- Outputs the SO5 port status from communication port as
shown below.
Response:
SO5()=&B00000000[cr/lf]

Example 2:
SEND CMU TO SO5()
----------- Inputs the SO5 port status from communication port as shown
below.
n Writing
NOTE
to SO0() and SO1() is
&B00000111
prohibited.
Response:
OK[cr/lf]

237
14. Data file description

14.21 Error message history file

14.21.1 All error message history

2 Format:

LOG

• Expresses all error message history.


• When used as a readout file, all error message history is read out.
• Cannot be used as a write file.

Data format:

nnn:yy/mm/dd,hh:mm:ss gg.bb:msg[cr/lf]
nnn:yy/mm/dd,hh:mm:ss gg.bb:msg[cr/lf]
:
nnn:yy/mm/dd,hh:mm:ss gg.bb:msg[cr/lf]
[cr/lf]

● “nnn” represents an error history serial number and may be up to 500.


● “yy/mm/dd” is the year/month/day when the error occurred.
● “hh”, “mm” and “ss” represent hour, minute and second.
● “gg” represents an error message group.
● “bb” represents an error message category.
● “msg” represents an error message.
● [cr/lf] indicates CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.

Example:
SEND LOG TO CMU
----------- Outputs all error message history from communication port
as shown below.

1 :01/06/14,13:19:20 14.22:No start code (@)[cr/lf]


2 :01/06/14,13:18:34 22.3:DC24V power low[cr/lf]
:
498 :01/06/12,21:49:54 5.39:Illegal identifier[cr/lf]
499 :01/06/12,21:49:14 14.22:No start code (@)[cr/lf]
500 :01/06/12,21:49:00 22.3:DC24V power low[cr/lf]
[cr/lf]

238
14. Data file description

14.22 Machine reference file

14.22.1 All machine reference data


Format:
2
MRF

• Expresses the machine reference data obtained after return-to-origin has been
performed.
• Reads out all machine reference data when used as a readout file.
• Cannot be used as a write file.

Data format:

M1=nnn% M2=nnn% . . . nnn%[cr/lf]


S1=nnn% S2=nnn% . . . nnn%[cr/lf]
[cr/lf]

● “nnn” is an integer from 0 to 100.


● “M1”, “M2” … indicate the main robot group axes.
● “S1”, “Sn” … indicate the sub robot group axes.
● [cr/lf] indicates CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.

Example:
SEND MRF TO CMU
----------- Outputs all machine reference data from communication port
as shown below.
Response:
M1= 55% M2= 23% M3= 33% M4= 26%[cr/lf]
[cr/lf]

239
14. Data file description

14.23 EOF file

14.23.1 EOF data

2 Format:

EOF

• This file is a special file consisting only of a ^Z (=1Ah) code.


• When used as a readout file, ^Z (=1Ah) is read out.
• Cannot be used as a write file.

Data format:

^ Z (=1Ah)

Example:
SEND PGM TO CMU
SEND EOF TO CMU
----------- Outputs EOF data from communication port as shown below.

n When
NOTE
transmitting data to an external
device through the communication NAME=TEST1[cr/lf]
port, the EOF data can be used to add A=1[cr/lf]
a ^Z code at the end of file. :
HALT[cr/lf]
[cr/lf]
^Z

240
14. Data file description

14.24 Serial port communication file

14.24.1 Serial port communication file

Format: 2
CMU

• Expresses the serial communication port.


• Depends on the various data formats.

Example:
SEND PNT TO CMU
----------- Outputs all point data from communication port.
SEND CMU TO PNT
----------- Inputs all point data from communication port.

241
14. Data file description

14.25 SIW file


14.25.1 All SIW

2 c SIW
CAUTION
is enabled only when the
Format:

software version is V8.08 or later. SIW()

• Expresses all SIW data.


• Reads out all SIW information in hexadecimal digit when used as a readout file.
• Cannot be used as a write file.

Data format:

SIW( 0)=&Hnnnn [cr/lf]


SIW( 1)=&Hnnnn [cr/lf]
:
SIW(15)=&Hnnnn [cr/lf]
[ cr/lf]

● “n” represents a 4-digit number from 0 to 9 and A to F.


● [cr/lf] indicates CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.

Example:
SEND SIW() TO CMU
----------- Outputs all SIW data from communication port as shown
below.
Response:
SIW( 0)=&H1001[cr/lf]
SIW( 1)=&H0010[cr/lf]
SIW( 2)=&H0000[cr/lf]
:
SIW(15)=&H0000[cr/lf]
[cr/lf]

242
14. Data file description

14.25.2 One SIW data

Format:

c SIW
CAUTION
is enabled only when the
software version is V8.08 or later.
SIW(m)
2
• Expresses one SIW state.
• Reads out the designated SIW information in hexadecimal when used as a readout
file.
• Cannot be used as a write file.

Data format:

SIW(m)=&Hnnnn [cr/lf]

● “m” represents a number from 0 to 15.


● “n” represents a 4-digit number from 0 to 9 and A to F.
● [cr/lf] indicates CR code (0Dh) + LF code (0Ah).

Example:
SEND SIW(5) TO CMU
----------- Outputs SIW (5) from communication port as shown below.
Response:
SIW( 5)=&H1001[cr/lf]

243
14. Data file description

14.26 SOW file


14.26.1 All SOW

2 Format:

c SOW
CAUTION
is enabled only when the
SOW()
software version is V8.08 or later.
• Expresses all SOW data.
• Reads out all SOW information in hexadecimal when used as a readout file.
• Cannot be used as a write file.

Data format:

SOW( 0)=&Hnnnn [cr/lf]


SOW( 1)=&Hnnnn [cr/lf]
:
SOW(15)=&Hnnnn [cr/lf]
[ cr/lf]

● “n” represents a 4-digit number from 0 to 9 and A to F.


● [cr/lf] indicates CR code (0Dh) + LF code (0Ah).
● A line containing only [cr/lf] is added at the end of the file, indicating the end of
the file.

Example:
SEND SOW() TO CMU
----------- Outputs all SOW data from communication port as shown
below.
Response:
SOW( 0)=&H1001[cr/lf]
SOW( 1)=&H0010[cr/lf]
SOW( 2)=&H0000[cr/lf]
:
SOW(15)=&H0000[cr/lf]
[cr/lf]

244
14. Data file description

14.26.2 One SOW data

Format:

c SOW
CAUTION
is enabled only when the
software version is V8.08 or later.
SOW(m)
2
• Expresses one SOW state.
• Reads out the designated SOW information in hexadecimal when used as a readout
file.
• When used as a write file, the value is written to the designated SOW. However,
writing to SOW (0) and SOW (1) is prohibited.

Data format:

SOW(m)=&Hnnnn [cr/lf]

● “m” represents a number from 2 to 15.


● “n” represents a 4-digit number from 0 to 9 and A to F.
● [cr/lf] indicates CR code (0Dh) + LF code (0Ah).

nWriting
NOTE
to SOW (0) and SOW (1) is
Example1:
SEND SOW(5) TO CMU
prohibited. ----------- Outputs SOW (5) from communication port as shown below.
Response:
SOW( 5)=&H1001[cr/lf]

Example2:
SEND CMU TO SOW(5)
----------- Outputs SOW (5) from communication port as shown below.
&H1001

Response:
OK[cr/lf]

245
15. User program examples

15.1 Basic operation

15.1.1 Directly writing point data in program


Overview
The robot arm can be moved by PTP (point-to-point) motion by directly specifying point
data in the program.

Processing flow

START

300.00 300.00 50.00 90.00 0.00 0.00 PTP movement


300.00 100.00 0.00 0.00 0.00 0.00 PTP movement
200.00 200.00 10.00 -90.00 0.00 0.00 PTP movement

STOP

Program example
MOVE P, 300.00 300.00 50.00 90.00 0.00 0.00
MOVE P, 300.00 100.00 0.00 0.00 0.00 0.00
MOVE P, 200.00 200.00 10.00 -90.00 0.00 0.00
HALT

246
15. User program examples

15.1.2 Using point numbers


Overview
Coordinate data can be specified by using point numbers in a program. Coordinate data
should be entered beforehand in “MANUAL>POINT” mode, for example as shown below.
P0= 0.00
P1= 100.00
0.00
0.00
0.00
150.00
0.00
30.00
0.00
0.00
0.00
0.00
2
P2= 0.00 100.00 50.00 0.00 0.00 0.00
P3= 300.00 300.00 0.00 0.00 0.00 0.00
P4= 300.00 100.00 100.00 90.00 0.00 0.00
P5= 200.00 200.00 0.00 0.00 0.00 0.00

Processing flow

START

PTP movement to P0
PTP movement to P1
PTP movement to P2
PTP movement to P3
PTP movement to P4
PTP movement to P5

STOP

Program example
MOVE P, P0 FOR J=0 TO 5
MOVE P, P1 MOVE P,P[J]
MOVE P, P2 NEXT J
MOVE P, P3 or HALT
MOVE P, P4
MOVE P, P5
HALT

247
15. User program examples

15.1.3 Using shift coordinates


Overview
In the example shown below, after PTP movement from P3 to P5, the coordinate system is
shifted +140 along the X-axis and -100 along the Y-axis, and the robot then moves from
2 P3 to P5 again. The shift coordinate data is set in S1 and P3, P4, P5 are set as described in
the previous section (“15.1.2 Using point numbers”).
S0= 0.00 0.00 0.00 0.00
S1= 140.00 -100.00 0.00 0.00
Y+
↑ P3

P5

Shift Coordinate P4
S0
→ X+
0 Shift
100 Coordinate
S1

140

Processing flow
START

PTP movement from P3 to P5.


Shift according to S1, PTP movement from P3 to P5.

STOP

Program example
SHIFT S0
FOR J=3 TO 5
MOVE P, P[J]
NEXT J
SHIFT S1
FOR K=3 TO 5
MOVE P,P[K]
NEXT K
HALT

248
15. User program examples

15.1.4 Palletizing

15.1.4.1 Utilizing the shift coordinates

Overview
Repetitive movement between a fixed work supply position P0 and each of the equally 2
spaced points on a pallet can be performed with the following program. In the drawing
below, points N1 to N20 are on Cartesian coordinates, consisting of 5 points positioned at
a 50mm pitch in the X-axis direction and 4 points at a 25mm pitch in the Y-axis direction.
The robot arm moves from point to point in the order of P0-N1-P0-N2...N5-P0-N6-P0...
while repeatedly moving back and forth between point P0 and each pallet.

Work supply position : P0= 0.0 0.0 0.0 0.0 0.0 0.0
X-axis pitch : P10= 50.0 0.0 0.0 0.0 0.0 0.0
Y-axis pitch : P20= 0.0 25.0 0.0 0.0 0.0 0.0
N1 position : P1= 100.0 50.0 0.0 0.0 0.0 0.0

The above data should be entered beforehand in “MANUAL>POINT” mode.


↑ Y+
Shift Coordinate S1

N16 N17 N18 N19 N20

N11 N12 N13 N14 N15

N6 N7 N8 N9 N10
25 X+
N1 N2 N3 N4 N5

50 P0

Processing flow

START

P200=P1
P100=P1

Movement to P0
Repeat 5 times Movement to P100
P100=P100+P10

P200=P200+P20
Repeat 4 times P100=P200

STOP

249
15. User program examples

Program Example
SHIFT S1
P100=P1
P200=P1
FOR J=1 TO 4
FOR K=1 TO 5

2 SHIFT S0
MOVE P,P0
SHIFT S1
MOVE P,P100
P100=P100+P10
NEXT K
P200=P200+P20
P100=P200
NEXT J

15.1.4.2 Utilizing pallet movement

Overview
Repetitive movement between a fixed work supply position P0 and each of the equally
spaced points on a pallet can be performed with the following program. In the drawing
below, points N1 to N24 are on Cartesian coordinates, consisting of 3 points positioned at
a 50mm pitch in the X-axis direction, 4 points at a 50mm pitch in the Y-axis direction, and
2 points at 100mm pitch in the Z-axis direction. The robot arm moves from point to point
in the order of P0-N1-P0-N2...-N5-P0-N6... while repeatedly moving back and forth
between point P0 and each pallet.

Work supply position : P0 = 0.00 0.00 100.00 0.00 0.00 0.00


Pallet definition : PL0 (P3996 to P4000 are used)
NX= 3
NY= 4
NZ= 2
P3996= 100.00 50.00 100.00 0.00 0.00 0.00
P3997= 200.00 50.00 100.00 0.00 0.00 0.00
P3998= 100.00 200.00 100.00 0.00 0.00 0.00
P3999= 200.00 200.00 100.00 0.00 0.00 0.00
P4000= 100.00 50.00 100.00 0.00 0.00 0.00
P4000

P3998 P3999
NZ
NY

P0 P3996 P3997
NX

250
15. User program examples

Processing flow

START

Pallet definition
Point assignment
2
Movement to P0
Repeat 24 times
Pallet movement

STOP

Program example
FOR I=1 TO 24
MOVE P,P0,Z=0.00
PMOVE (0,I),Z=0.00
NEXT I
MOVE P,P0,Z=0.00
HALT

251
15. User program examples

15.1.5 DI/DO (digital input and output) operation


Overview
The following example shows general-purpose signal input and output operations through
the STD. I/O connector.
2 Processing flow

START

Wait until DI2( ) is all at “0”.


Set all of DO2 ( ) to “1”.
Wait 1 second.
Wait until DI2 (0) is at “1”.

N=1

Y
DI2 (1)=“1”?

Set DO2 (7, 6, 1, 0) to “1”.


N Wait 2 seconds
Set all of DO2 ( ) to “0”.
Y
N>20

END
N
Set all of DO2 ( ) to “0”.
Wait 0.5 seconds
N=N+1

Program example
WAIT DI2( )=0
DO2( )=&B11111111
DELAY 1000
WAIT DI2(0)=1
N=1
*LOOP1:
IF DI2(1)=1 THEN *PROGEND
IF N>20 THEN *ALLEND
DO2( )=0
DELAY 500
N=N+1
GOTO *LOOP1
’END ROUTINE
*PROGEND:
DO2(7,6,1,0)=&B1111
DELAY 2000
DO2( )=0
*ALLEND:
HALT

252
15. User program examples

15.2 Application

15.2.1 Pick and place between 2 points


Overview
The following is an example for picking up a part at point A and placing it at point B.
2
Z

P3 30mm P4

50mm

P1 P2

Point A Point B

Precondition
1. Set the robot movement path.
P3→P1→P3→P4→P2→P4
Locate P3 and P4 respectively at a position 50mm above P1 and P2 and set the P1
and P2 positions by teaching.

2. I/O signal
DO2 (0) Chuck (gripper) open/close = 0: open, 1: close
A 0.1 second wait time is set during chuck open and close.

253
15. User program examples

Program examples
(1) When calculating to find P3 and P4
P3=P1
P4=P2
LOCZ(P3)=LOCZ(P3)-50.0

2 LOCZ(P4)=LOCZ(P4)-50.0
MOVE P,P3
GOSUB *OPEN
MOVE P,P1
GOSUB *CLOSE
MOVE P,P3
MOVE P,P4
MOVE P,P2
GOSUB *OPEN
MOVE P,P4
HALT
*OPEN:
DO2(0)=0
DELAY 100
RETURN
*CLOSE:
DO2(0)=1
DELAY 100
RETURN

(2) When using arch motion


P4=P2
LOCZ(P4)=LOCZ(P4)-50.0
GOSUB *OPEN
MOVE P,P1,Z=30.0
GOSUB *CLOSE
MOVE P,P2,Z=30.0
GOSUB *OPEN
MOVE P,P4
HALT
*OPEN:
DO2(0)=0
DELAY 100
RETURN
*CLOSE:
DO2(0)=1
DELAY 100
RETURN

254
15. User program examples

15.2.2 Palletizing
Overview
The following is an example for picking up parts supplied from the parts feeder and
placing them on a pallet on the conveyor. The pallet is ejected when full.

Z
2
0

50mm

P1
P1 P0

Robot

P0

Parts feeder

Precondition
1. I/O signal

DI(30) = 1: Parts are supplied


DI(31) = 1: Pallet is loaded

DO(30) Robot hand open/close = 0: open, =1: close


DO(31) = 1: Pallet eject

Robot hand open/close time is 0.1 second and pallet eject time is 0.5 seconds.

2. The points below should be input beforehand as point data.

P0 Part supply position


P1 Pallet reference position
P10 X direction pitch
P11 Y direction pitch

3. Vertical movement is performed to a position Z=50mm above the pallet and parts
feeder.

255
15. User program examples

Program example 1
WHILE -1
FOR A=0 TO 2
FOR B=0 TO 2
WAIT DI(31)=1
WAIT DI(30)=1

2 DO(30)=0
DELAY 100
MOVE P,P0,Z=50.0
DO(30)=1
DELAY 100
P100=P1+P10*B+P11*A
MOVE P,P100,Z=50.0
DO(30)=0
DELAY 100
NEXT
NEXT
DRIVE (3,0)
DO(31)=1
DELAY 500
DO(31)=0
WEND
HALT

Program example 2
* When defined in pallet 0
WHILE -1
FOR A=1 TO 9
WAIT DI(31)=1
WAIT DI(30)=1
DO(30)=0
DELAY 100
MOVE P,P0,Z=50.0
DO(30)=1
DELAY 100
PMOVE(0,A),Z=50.0
DO(30)=0
DELAY 100
NEXT
DRIVE(3,0)
DO(31)=1
DELAY 500
DO(31)=0
WEND
HALT

256
15. User program examples

15.2.3 Pick and place of stacked parts


Overview
The following is an example for picking up parts stacked in a maximum of 6 layers and 3
blocks and placing them on the conveyor.
The number of parts per block may differ from others. Parts are detected with a sensor
installed on the robot hand.
2
Z=0.0

P5 P1 P2 P3
Conveyor Block 1 Block 2 Block 3

Precondition
1. I/O signal

DI(30) Part detection sensor = 1: Parts are supplied


DO(30) Robot hand open/close = 0: open, =1: close

Robot hand open/close time is 0.1 seconds.

2. The points below should be input beforehand as point data.

P1 Bottom of block 1
P2 Bottom of block 2
P3 Bottom of block 3
P5 Position on conveyor

3. Movement proceeds at maximum speeds but slows down when in proximity to the
part.

High speed
P4=WHERE
Set the current position
P4=WHERE
into point data (P4).

Set the speed at maximum


P5 P1
Load the part onto
conveyor position (P5)
High speed
P4=WHERE Move to position (P4)
Slow during parts detection

Slow down

Move to P1
P5 P1

4. Use a STOPON condition in the MOVE statement for sensor detection during
movement.

257
15. User program examples

Program example
FOR A=1 TO 3
SPEED 100
GOSUB *OPEN
P6=P[A]
LOCZ(P6)=0.00

2 MOVE P,P6,Z=0.0
WHILE -1
SPEED 20
MOVE P,P[A],STOPON DI3(0)=1
IF DI3(0)=0 THEN *L1
’SENSOR ON
P4=JTOXY(WHERE)
GOSUB *CLOSE
SPEED 100
MOVE P,P5,Z=0.0
GOSUB *OPEN
MOVE P,P4,Z=0.0
WEND
*L1: ’SENSOR OFF
NEXT A
SPEED 100
DRIVE (3,0)
HALT
*OPEN:
DO3(0)=0
DELAY 100
RETURN
*CLOSE:
DO3(0)=1
DELAY 100
RETURN

258
15. User program examples

15.2.4 Parts inspection (Multi-tasking example)


Overview
One robot is used to inspect two different parts and sort them according to the OK/NG
results.
The robot picks up the part at point A and moves it to the testing device at point B. The
testing device checks the part and sends it to point C if OK or to point D if NG.
2
The part at point A’ is picked up and moved to the testing device at point B' in the same
way. The testing device checks the part and sends it to point C’ if OK or to point D’ if NG.
It is assumed that 10 to 15 seconds are required for the testing device to issue the OK/NG
results.
Parts supply Testing device OK NG

P1 P2 P3 P4
A B C D

A’ B’ C’ D’
P11 P12 P13 P14

Precondition
n*1:NOTE
As the start signal, supply a 0.1
1. I/O signal

second pulse signal to the testing 7 6 5 4 3 2 1 0


device. DO2
Testing device 1 start (0.1 second) 1: Start *1
0.1 seconds Testing device 2 start (0.1 second) 1: Start *1
Chuck (gripper) open/close 0: open, 1: close *2
ON 7 6 5 4 3 2 1 0
OFF DI3 *3
Testing device 1 test completed
*2: Chuck open and close time is 0.1
Testing device 1 OK/NG signal
seconds.
Testing device 2 test completed
*3: Each time a test is finished, the test
Testing device 2 OK/NG signal
completion signal and OK/NG
signal are sent from the testing 7 6 5 4 3 2 1 0
device. DI4
Part supply 1
After testing, the test completion
Part supply 2
signal turns ON (=1), and the OK/
NG signal turns ON (=1) when the Part 1 OK
result is OK and turns OFF (=0) Part 1 NG
when NG. Part 2 OK
Part 2 NG

2. The main task (task 1) is used to test part 1 and the subtask (task 2) is used to test
part 2.

3. An exclusive control flag is used to allow other tasks to run while waiting for the
test completion signal from the testing device.
FLAG1 = 1 : Task 1 busy (Task 2 is kept waiting)
= 0 : Task 1 ready (Task 2 operable)
FLAG2 = 1 : Task 2 busy (Task 1 is kept waiting)
= 0 : Task 2 ready (Task 1 operable)

259
15. User program examples

4. Flow chart

START

Exclusive control flag reset FLAG1=FLAG2=0


2 Subtask start

N
Part 1 supplied?

Y
Task 2 busy?

N
Exclusive control flag set FLAG1=1

Chuck open

Move to parts supply position P1

Chuck close

Move to testing device 1

Chuck open

Move upward 10000 pulses

Exclusive control flag reset FLAG1=0


Testing device 1 start

N
Test completed?

Y Task 2 busy?

N
Exclusive control flag set
FLAG1=1
Move to testing device 1

Chuck close

N
Part OK?

Y Y

Y Y
OK parts? NG parts?

N N
Move to OK parts position Move to NG parts position

Chuck open

Move upward 10000 pulses

Exclusive control flag reset FLAG1=0

Task 2 (subtask) runs in the same flow.

260
15. User program examples

Program example

FLAG1=0
FLAG2=0
UPPOS=0.0
START *S1,T2 Subtask Start
2
*L1: *S1:
WAIT DI4(0)=1 Part supply standby WAIT DI4(1)=1
WAIT FLAG2=0 Task completion standby WAIT FLAG1=0
FLAG1=1 Exclusive control flag set FLAG2=1
GOSUB *OPEN Chuck open GOSUB *OPEN
MOVE P,P1,Z=UPPOS Move to part supply position MOVE P,P11,Z=UPPOS
GOSUB *CLOSE Chuck close GOSUB *CLOSE
MOVE P,P2,Z=UPPOS Move to testing device MOVE P,P12,Z=UPPOS
GOSUB *OPEN Chuck open GOSUB *OPEN
DRIVEI (3,-10000) Move Z-axis upward Z 10,000 pulses DRIVEI (3,-10000)
FLAG1=0 Exclusive control flag reset FLAG2=0
DO2(0)=1 Testing device start DO2(3)=1
DELAY 100 DELAY 100
DO2(0)=0 DO2(3)=0
WAIT DI3(0)=1 Test completion standby WAIT DI3(4)=1
WAIT FLAG2=0 Task completion standby WAIT FLAG1=0
FLAG1=1 Exclusive control flag set FLAG2=1
MOVE P,P2,Z=UPPOS Move to testing device MOVE P,P12,Z=UPPOS
GOSUB *CLOSE Chuck close GOSUB *CLOSE
IF DI3(1)=1 THEN Test IF DI3(5)=1 THEN
’GOOD ’GOOD
WAIT DI4(2)=0 Part movement standby WAIT DI4(4)=0
MOVE P,P3,Z=UPPOS Move to OK parts position MOVE P,P13,Z=UPPOS
ELSE ELSE
’NG ’NG
WAIT DI4(3)=0 Part movement standby WAIT DI4(5)=0
MOVE P,P4,Z=UPPOS Move to NG parts position MOVE P,P14,Z=UPPOS
ENDIF ENDIF
GOSUB *OPEN Chuck open GOSUB *OPEN
DRIVEI (3,-10000) Move Z-axis upward 10,000 pulses DRIVEI (3,-10000)
FLAG1=0 Exclusive control flag reset FLAG2=0
GOTO *L1 GOTO *S1
*OPEN:
DO2(7)=0
DELAY 100
RETURN
*CLOSE:
DO2(7)=1
DELAY 100
RETURN

261
15. User program examples

15.2.5 Sealing
Overview
This section shows an example of the parts sealing operation.
P5 P4
2 P3

P2

20mm

P6 P7
P0 P1

10mm

Precondition
1. I/O signal

DO(20) Valve open/close = 1: open, =0: close

2. Set P0 - P7 by teaching.

Program example
MOVE P,P0,Z=0
SPEED 40
PATH SET Start of path setting
PATH L,P1,DO(20)[email protected] Start of coating at 10 mm position
PATH L,P2
PATH C,P3,P4
Path setting
PATH L,P5
(Robot does not operate.)
PATH L,P6,S=30
PATH L,P7,DO(20)[email protected] End of coating at 20 mm position
PATH END End of path setting
PATH START Execute PATH motion (Robot starts from P0 and stops at P7.)
HALT

262
15. User program examples

15.2.6 Connection to an external device through RS-232C (example 1)


Overview
Point data can be written in a program by using an external device connected to the RCX
series controller via the RS-232C port.
Precondition
1. Input to the external device from the controller
2
SDATA/X/Y [cr]

2. Output to the controller from the external device


P10=156.42 243.91 0.00 0.00 0.00 0.00 [cr]
* The [cr] is cr (=0Dh).
Program example
n• NOTE
"SEND xxx TO CMU" outputs the 'INIT
contents specified by "xxx" through VCMD$="SDATA/X/Y"
the RS-232C. P0 = 0.00 0.00 0.00 0.00 0.00 0.00
• "SEND CMU TO xxx" sends data into 'MAIN ROUTINE
the files specified by "xxx" through the MOVE P, P0
RS-232C. *ST:
SEND VCMD$ TO CMU
SEND CMU TO P10
MOVE P, P10
GOTO *ST

263
15. User program examples

15.2.7 Connection to an external device through RS-232C (example 2)


Overview
Point data can be created from the desired character strings and written in a program by
using an external device connected to the RCX series controller via the RS-232C port.

2 Precondition
1. Input to the external device from the controller
SDATA/X/Y [cr]

2. Output to the controller from the external device


X=156.42, Y=243.91 [cr]
* The [cr] is cr (=0Dh).

n• NOTE
"SEND xxx TO CMU" outputs the
Program example
'INT
contents specified by "xxx" through VCMD$="SDATA/X/Y"
the RS-232C. VIN$=""
• "SEND CMU TO xxx" sends data into VX$=""
the files specified by "xxx" through the VY$=""
RS-232C. P0 = 0.00 0.00 0.00 0.00 0.00 0.00
• The LEN ( ) function obtains the P11 = 100.00 100.00 0.00 0.00 0.00 0.00
length of the character string. 'MAIN ROUTINE
• The MID$ ( ) function obtains the MOVE P, P0
specified character string from among *ST:
the character strings. SEND VCMD$ TO CMU
• The VAL ( ) function obtains the value SEND CMU TO VIN$
I=1
from the character string.
VMAX=LEN(VIN$)
*LOOP:
IF I>VMAX THEN GOTO *E_LOOP
C$=MID$(VIN$,I ,1)
IF C$="X"THEN
I=I+2
J=I
*X_LOOP:
C$=MID$(VIN$, J, 1)
IF C$="," THEN
*X1_LP:
L=J-I
VX$=MID$(VIN$, I, L)
I=J+1
GOTO *LOOP
ENDIF
J=J+1
IF J>VMAX THEN GOTO *X1_LP
GOTO *X_LOOP
ENDIF
IF C$="Y" THEN
I=I+2
J=I
*Y_LOOP:
C$=MID$(VIN$, J, 1)
IF C$=","THEN
*Y1_LP:
L=J-I
VY$=MID$(VIN$, I, L)
I=J+1
GOTO *LOOP
ENDIF
J=J+1
IF J>VMAX THEN GOTO *Y1_LP
GOTO *Y_LOOP
END IF
I=I+1
GOTO *LOOP
*E_LOOP:
WX=VAL(VX$)
WY=VAL(VY$)
LOCX(P11)=WX
LOCY(P11)=WY
MOVE P, P11
GOTO *ST

264
16. Sequence function

Besides normal robot programs, this controller can execute high-speed processing programs (sequence
programs) in response to the robot input/output (DI, DO, MO, LO TO, SI, SO) signals. This means
that two different programs (robot program and sequence program) can be executed at the same
time.
The sequence program runs according to its own cycle in “AUTO” or “MANUAL” mode, regardless
of the execution or stopping of a robot program. The sequence program starts running as soon as
the controller is turned on (that is, in “MANUAL” mode), so it can be used to monitor the status of
sensors, push button switches, solenoid valves, etc.
The sequence program can be written in the same robot language used for robot programs. This
eliminates the need to learn a new language and making it easier to program.

16.1 Creating a sequence program

16.1.1 Programming method


The following explains how to create a sequence program in order to make use of the
sequence function.
First, enter "PROGRAM" mode and create a file with the file name "SEQUENCE". The
controller automatically recognizes that a file with this name is a sequence program.
Fig. 16-1-1-1 Naming a sequence program file

PROGRAM>DIR <TEST10 >

No. Name Line Byte RW/RO


1 TEST10 12 145 RW
2 LOCATE20 25 320 RW

Enter program name >SEQUENCE

Next, create a sequence program the same way as you create a robot program. The
commands that may be used are explained later.
Fig. 16-1-1-2 Creating a sequence program

PROGRAM>EDIT <SEQUENCE>
1 2 3
1 DO(20)=DI(21) AND DI(22)
2 MO(30)=DO(23) OR DI(22)
3 MO(31)= ˜ MO(30)
4 DO(21)=(DI(36) OR DI(25))AND DI(2
5 DO(30)=MO(30) OR DI_
SELECT COPY CUT PASTE BS

265
16. Sequence function

16.1.2 Compiling
After editing the program, it must be compiled as a sequence program. Compiling is
performed in the same way as for robot programs. Press the F 5 (COMPILE) key on
the highest-level screen in “PROGRAM” mode (Fig. 16-1-2-1).
2 Fig. 16-1-2-1 Sequence program

PROGRAM <SEQUENCE>
1 2 3
1 DO(20)=DI(21) AND DI(22)
2 MO(30)=DO(23) OR DI(22)
3 MO(31)= ˜ MO(30)
4 DO(21)=(DI(36) OR DI(25))AND DI(2
5 DO(30)=MO(30) OR DI(27)
EDIT DIR COMPILE

A check message appears asking if you want to compile the sequence program. (Fig. 16-
1-2-2) Press the F 4 (YES) key to compile the program. To cancel this compiling,
press the F 5 (NO) key. The display changes to the compiling screen for normal robot
programs.
Fig. 16-1-2-2 Compiling the sequence program

PROGRAM>COMPILE <SEQUENCE>
1 2 3
1 DO(20)=DI(21) AND DI(22)
2 MO(30)=DO(23) OR DI(22)
3 MO(31)= ˜ MO(30)
4 DO(21)=(DI(36) OR DI(25))AND DI(2
5 DO(30)=MO(30) OR DI(27)
Compile for SEQUENCE OK? YES NO

If there is a syntax error in the program, an error message appears and the program will be
listed from the line with the error (Fig. 16-1-2-3)
When the compiling ends without any error, the program will be listed from its first line.
Fig. 16-1-2-3 Compiling error

PROGRAM <SEQUENCE>
5.1:Syntax error 2 3
3 MO(31)= ˜ MO(30)’ AB
4 DO(21)=MO(36) OR DI(27)
5 DO(30)=MO(30) OR DI(27)
6 DO(25)=DI(26) AND DO(32)
7 DO(30)=MO(30) OR DI(27)
EDIT DIR COMPILE

266
16. Sequence function

c The
CAUTION
sequence execution program is
When you display the directory after the compiling the sequence program, a letter “s”
appears to the left of the program name “SEQUENCE”. This means that the sequence
erased and the letter “s” disappears in program has been compiled successfully and is ready for use (Fig. 16-1-2-4).
the following cases. In these cases the
sequence function cannot be used in Fig. 16-1-2-4 Sequence execution program after compiling
“UTILITY” mode.
1. When the sequence program was
erased
2. When the sequence program was
PROGRAM>DIR <TEST10 > 2
edited No. Name Line Byte RW/RO
3. When normal robot program
compiling was performed for the 1 TEST10 12 145 RW
sequence program 2 LOCATE20 25 320 RW
4. Program data was initialized.
3 s SEQUENCE 8 141 RW
5. A “Sequence object check sum” error
occurred.
NEW I INFO

16.2 Executing a sequence program


The following conditions must be satisfied to execute a sequence program. If any of these
conditions is not met, the sequence program cannot be executed.
1. The sequence execution program has been created by compiling.
2. The sequence function is enabled in “UTILITY” mode.
3. The external sequence control input (DI10) contact is closed.
4. The current operation mode is “MANUAL” or “AUTO”.

When all of the above conditions are met, the sequence program can now be executed.
While the program is running, the letter “s” will appear at the left end of the second line
of the screen. (Fig. 16-2-1)
Fig. 16-2-1 Sequence program execution in progress

MANUAL 50% [MG] [S0H0J]


S
Current position
M1= 0 M2= 0 *M3= 0
*M4 0

POINT PALLET VEL+ VEL-

267
16. Sequence function

16.2.1 Sequence program STEP execution


The sequence program may be executed line by line while checking one command line at
a time.
To do this, press the F 5 (NO) key on the compile screen (Fig. 16-1-2-2). Sequence

2 program compiling is canceled and the normal robot compile screen (Fig. 16-2-2) then
appears.
Press the F 4 (YES) key to compile and create a normal execution program. Then,
execute this program with the STEP statement in “AUTO” mode to check the operation.

Fig. 16-2-2 Sequence program STEP execution

PROGRAM>COMPILE <SEQUENCE>
1 2 3
1 DO(20)=DI(21) AND DI(22)
2 MO(30)=DO(23) OR DI(22)
3 MO(31)= ˜ MO(30)
4 DO(21)=(DI(36) OR DI(25))AND DI(2
5 DO(30)=MO(30) OR DI(27)
Compile program OK? YES NO

16.3 Creating a sequence program


When creating a sequence program, you may use only assignment statements comprised
of input/output variables and logical operators. An error will occur during compiling if
any statement other than assignment statements is used in the program, and the compiling
cannot be completed.

16.3.1 Assignment statements used with sequence program

<output variable> =<expression>


<internal auxiliary output variable>
<arm lock output variable>
<timer output variable>

<expression> may only be a logic operation using parallel input/output variables, internal
auxiliary output variables, arm lock output variables, timer output variables or serial input/
output variables.

268
16. Sequence function

16.3.2 Input/output variables used in sequence program

a. Parallel input variables


These variables show the status of the parallel input signal.

DI(mb) m: Port number 0 to 7, 10 to 17, 20 to 27


2
b:bit definition 0 to 7

b. Parallel output variables


These variables specify or refer to the status of parallel output signal.

DO(mb) m: port number 0 to 7, 10 to 17, 20 to 27


b: bit definition 0 to 7

Output to ports 0 and 1 is not possible.

c. Internal auxiliary output variables


These variables are used within the controller and are not output externally.

MO(mb) m: port number 0 to 7, 10 to 17, 20 to 27


b: bit definition 0 to 7

Output to ports 0 and 1 is not possible.

d. Arm lock output variables


These variables are used to prohibit the arm movement. An axis movement is prohibited
by ON status.

LO(mb) m: port number 0


b: bit definition 0 to 7

LO(00) to LO(07) corresponds to arm 1 to arm 8.

e. Timer output variables

TO(mb) m: port number 0


b: bit definition 0 to 7

There are a total of 8 timer output variables: TO(00) to TO(07). The timer of each variable
is defined by the timer definition statement TIM00 to 07.

269
16. Sequence function

f. Serial input variables


These variables show the status of serial input signal.

SI(mb) m: Port number 0 to 7, 10 to 17, 20 to 27


b: bit definition 0 to 7
2
g. Serial output variables
These variables show the status of serial output signal.

SO(mb) m: port number 0 to 7, 10 to 17, 20 to 27


b: bit definition 0 to 7

Output to ports 0 and 1 is not possible.

Timer example:
TIM02=2500
TO(02)=DI(23)

When DI(23) is ON, after 2.5 seconds, TO(02) is set ON.


When DI(23) is OFF, TO(02) is also OFF.
When DI(23) isn’t ON after 2.5 second or more, TO(02) does not change to ON.

DI (23)

1.6sec
2.5sec

TO (02)

Variables may only be defined in the 1 bit format.

Examples:
DO(35)
MO(24)
DI(16)

Incorrect examples:
DO(37,24)
DI3(4)
MO3()

270
16. Sequence function

16.3.3 Timer definition statement

TIMmb=<expression> m: port number 0


b: bit definition 0 to 7

The value of <expression> must be from 100 to 999900msec (=0.1 to 999.9 second). 2
However, since the units are set every 100msec, values less than 99msec are truncated

Examples:
TIM00 = 650 ............ 0.6 seconds
TIM03 = 2480 ............ 2.4 seconds

The timer definition statement sets the timer value of the timer output variable. This
definition statement may be anywhere in the program. When the timer definition statement
is omitted, the timer setting value of the variable is 0.
TIM00 to 07 correspond to the timer output variables TO(00) to (07).

16.3.4 Logical operators used with sequence program


OR, | Logical OR
AND, & Logical AND
NOT, ~ Logical NOT

271
16. Sequence function

c1. NOT
CAUTION
cannot be used prior to the first
16.3.5 Priority of logic operations
parenthesis “ ( “ or on the left of an 1. Expressions in parentheses
expression. For example, the 2. NOT, ~
following commands cannot be used.
DO(21)=~(DI(30) | DI(32)) 3. AND, &
2 ~DO(30)=DI(22) & DI(27)

2. Numeric values cannot be assigned


4. OR, |

on the right of an expression. The Assignment statement example:


following examples cannot be used:
MO(35)=1
A ladder diagram is also shown merely for your reference.
DO(26)=0
DO(23)=DI(16)&DO(35)
3. There is no need to define a ”HALT” MO(34)=DO(25)| DI(24)
or ”HOLD” statement at the end of DO(31)=(DI(20)|DO(31))& DI(21)
the program.
Ladder diagram
4. The I/O and internal auxiliary output
variables used in sequence programs DI (16) DO (35) DO (23)
are shared with robot programs, so be
careful not to make improper changes
when using the same variables DO (25) MO (34)
between them.
~DI (24)

DI (20) ~DI (21) DO (31)

DO (31) (Self-hold circuit)

Sequence program specifications

Commands Logical OR, AND, NOT


I/O Same as robot language
Program capacity 4096 bytes (A maximum of 512 variables can be specified.)
Scan time 10 to 30ms depending on the number of steps (This changes automatically.)

272
17. Online commands

This chapter explains online commands that can be input to the robot controller through the RS-
232C port to execute specific instructions. See the robot controller owner's manual for information
on methods for connecting to the RS-232C port.

Online command list

Operation type Command Option Meaning Conditions


1. Key operation AUTO Change mode AUTO mode 3
PROGRAM PROGRAM mode
MANUAL MANUAL mode
SYSTEM SYSTEM mode
RESET Program Reset program 4
RUN Execute program
STEP Execute one line
SKIP Skip one line
NEXT Execute to next line
STOP Stop program 2
BREAK m, n (m: break point No., n: line) Set break point 4
CHGTSK Switch execution task 3
MSPEED k (k : 1-100) Change manual speed Main robot 3
MSPEED2 k (k : 1-100) Sub robot
ABSADJ k, 0 or k, 1 (k : 1-6) Move to absolute reset position Main robot
ABSADJ2 k, 0 or k, 1 (k : 1-6) Sub robot
ABSRESET k (k : 1-6) Absolute reset on each axis Main robot
ABSRESET2 k (k : 1-6) Sub robot
2. Utility PADDR Acquire program execution status 4
COPY <program 1> TO <program 2> Copy program 1 to program 2 3
Pm-Pn TO Pk Copy points “m - n” to point “k”
PCm-PCn TO PCk Copy point comments “m - n” to point comment “k”
ERA <program> Delete program 3
Pm-Pn Delete points “m - n”
PCm-PCn Delete point comments “m - n”
PLm Delete pallet “m”
REN <program 1> TO <program 2> Rename “program 1” to “program 2” 3
ATTR <program 1> TO s (s: RW/RO) Change program attribute 3
INIT PGM Initialize data Program 3
PNT Point
SFT Shift
HND Hand
PLT Pallet
PCM Point comment
MEM Above data
PRM Parameter
ALL MEM+PRM
CMU Communication parameter
LANGUAGE k Setting Display language 3
ACCESS k Setting Access level 3
EXELVL k Execution level
SEQUENCE k Sequence execution flag
UNIT k Point units
ARMTYP m, k Main hand system
ARMTYP2 m, k Sub hand system
EMGRST Reset internal emergency stop flag 1
MSGCLR Clear line message

273
17. Online commands

Operation type Command Option Meaning Conditions


3. Data ? LANGUAGE Acquiring status Display language 1
handling ACCESS Access level
ARM Arm status
BREAK Break point status
2 CONFIG
EXELVL
Controller configuration
Execution level
MEM Remaining memory capacity
MOD Mode status
MSG [m, n] Error message
ORIGIN Return-to-origin status
ABSRST Absolute reset status
SERVO Servo status
SEQUENCE Sequence execution flag status
SPEED AUTO/MANUAL speed status
UNIT Point unit status
VER Version information
WHERE Current main robot position (pulse coordinate)
WHERE2 Current sub robot position (pulse coordinate)
WHRXY Current main robot position (XY coordinate)
WHRXY2 Current sub robot position (XY coordinate)
TASKS Task number
TSKMON Task operation status
SHIFT Selected shift status
HAND Selected hand status
EMG Emergency stop status
SELFCHK Error status by self-diagnosis
OPSLOT Option slot status
READ Data file (PGM, PNT, …) Data readout 2
WRITE Data file (PGM, PNT, …) Data write 2
4. Robot language SWI <program> 4
independent
Robot language executable independently. 4
execution
5.Control code ^C(=03H) Execution language interruption 1
Conditions:
1. Always executable.
2. Executable except when MPB is used for input/output operation.
3. Executable except when in condition 2 or program is being executed.
4. Executable except for condition 3 or specific limitation.

274
17. Online commands

Online command description

17.1 Key operation

n Basically,
NOTE 17.1.1 Changing the mode 2
a response “OK” appears
when an instruction from key operation Command format:
online command is received.
An error message responds if online @AUTO[c/r]
commands cannot be executed due to
error. @PROGRAM[c/r]
@MANUAL[c/r]
@SYSTEM[c/r]

Response format:

OK[c/r]

Meaning:
• Changes the mode.
AUTO : Changes to AUTO mode.
PROGRAM : Changes to PROGRAM mode.
MANUAL : Changes to MANUAL mode.
SYSTEM : Changes to SYSTEM mode.

Example:
Command @AUTO[c/r]
Response OK[c/r]

17.1.2 AUTO mode operation

17.1.2.1 Program execution


Command format:

@RESET[c/r]
@RUN[c/r]
@STEP[c/r]
@SKIP[c/r]
@NEXT[c/r]
@STOP[c/r]

Response format:

OK[c/r]

275
17. Online commands

Meaning:
• Executes or stops the current program.
RESET : Resets the program.
RUN : Executes the program.
STEP : Executes one line of the program. (Enters the subroutine.)
2 SKIP : Skips one line of program. (Skips one line of the subroutine.)
n Programs
NOTE
can be executed only in
NEXT
STOP
: Executes to the next line. (Executes the subroutine as one line.)
: Stops the program.
AUTO mode.
Example:
Command @RUN[c/r]
Response OK[c/r]

17.1.2.2 Setting a break point


Command format:

@BREAK m,n[c/r]

m : Break point number (m = 1 to 4)


n : Line number to set a break point. (n = 1 to 9999)
When setting a break point in the COMMON program, the line number should be
+10000.
Break point is cleared when 0 is specified as the line number.

Response format:

OK[c/r]

n Break
NOTE
points can be set only in AUTO
Meaning:
• Sets a break point used to temporarily stop execution of the program.
mode.

Example:
Command @BREAK 1, 28[c/r]
Response OK[c/r]

276
17. Online commands

17.1.2.3 Switching the execution task


Command format:

@CHGTSK[c/r]

Response format: 2
OK[c/r]

n Tasks
NOTE
can be switched only in AUTO
Meaning:
• Switches the selected task while program execution is stopped.
mode.
• The ongoing task is switched to another task not being executed in order from task 1
–> 2 -> …-> 8 -> 1.

Example:
Command @CHGTSK[c/r]
Response OK[c/r]

17.1.3 MANUAL mode operation

17.1.3.1 Changing the MANUAL mode speed


Command format:

@MSPEED k[c/r]
@MSPEED2 k[c/r]

k : Manual movement speed (k = 1 to 100)

Response format:

OK[c/r]

n The
NOTE
MANUAL mode speed can be
Meaning:
• Changes the MANUAL mode movement speed.
changed only in MANUAL mode.
MSPEED : Changes manual movement speed for main robot.
MSPEED2 : Changes manual movement speed for sub robot.

Example:
Command @MSPEED 50[c/r]
Response OK[c/r]

277
17. Online commands

17.1.3.2 Absolute reset


Command format:

@ABSADJ k,f[c/r]
@ABSADJ2 k,f[c/r]
2 @ABSRESET k[c/r]
@ABSRESET2 k[c/r]

k : Designated axis (k = 1 to 6)
f : Movement direction (f = 0: + direction, 1: - direction)

Response format:

OK[c/r]

n Absolute
NOTE
reset can be performed only
Meaning:
• Performs absolute reset.
in MANUAL mode.
ABSADJ : Moves the main robot axes to the absolute reset positions.
ABSADJ2 : Moves the sub robot axes to the absolute reset positions.
ABSRESET : Performs absolute reset on the main robot axes.
ABSRESET2 : Performs absolute reset on the sub robot axes.

Example:
Command @ABSADJ 1,0[c/r]
Response OK[c/r]

278
17. Online commands

17.2 Utility operation

17.2.1 Acquiring the program execution status


Command format:
2
@PADDR[c/r]

Response format:

<program name>, Tn,m,k[c/r]

Program name : Currently selected program name


Tn: Current task number (n = 1 to 8)
m : Current program line number (m = 1 to 9999)
k : Current task priority level (k = 17 to 47)
If the COMMON program is used, the response format might become as follows.

<COMMON>/<program name>, Tn,m,k[c/r]

Meaning:
• Acquires the current program execution status.
n The
NOTE
current program execution status
can be acquired only when the Example:
program is stopped during AUTO
mode.
Command @PADDR[c/r]
Response <TEST>,T3,134,32[c/r]

17.2.2 Copy

17.2.2.1 Copying a program


Command format:

@COPY <program name 1> TO <program name 2>[c/r]

Program name 1 : Program name in copy source (8 characters or less consisting of


alphanumeric characters and underscore)
Program name 2 : Program name in copy destination (8 characters or less consisting of
alphanumeric characters and underscore)

Response format:

OK[c/r]

Meaning:
• Copies the contents of program name 1 under program name 2.

Example:
Command @COPY <TEST1> TO <TEST2>[c/r]
Response OK[c/r]

279
17. Online commands

17.2.2.2 Copying point data


Command format:

c InCAUTION
controllers whose software version
@COPY Pmmmm-Pnnnn TO Pkkkk[c/r]

2 is earlier than V8.28, point numbers


from 0 to 4000 can be specified as the mmmm : Top point number in copy source (mmmm = 0 to 9999)
point copy source and destination. nnnn : Last point number in copy source (nnnn = 0 to 9999)
kkkk : Top point number in copy destination (kkkk = 0 to 9999)

Response format:

OK[c/r]

Meaning:
• Copies the point data between Pmmmm and Pnnnn to Pkkkk and subsequent point
numbers.

Example:
Command @COPY P101-P200 TO P1101[c/r]
Response OK[c/r]

17.2.2.3 Copying point comments


Command format:

c InCAUTION
controllers whose software version
@COPY PCmmmm-PCnnnn TO PCkkkk[c/r]
is earlier than V8.28, point numbers
from 0 to 4000 can be specified as the mmmm : Top point comment number in copy source (mmmm = 0 to 9999)
point comment copy source and nnnn : Last point comment number in copy source (nnnn = 0 to 9999)
destination. kkkk : Top point comment number in copy destination (kkkk = 0 to 9999)

Response format:

OK[c/r]

Meaning:
• Copies the point comments between PCmmmm and PCnnnn to PCkkkk and subsequent
point comment numbers.

Example:
Command @COPY PC101-PC200 TO PC1101[c/r]
Response OK[c/r]

280
17. Online commands

17.2.3 Erase

17.2.3.1 Erasing a program


Command format:

@ERA <program name>[c/r]


2
Program name : Program name to be erased (8 characters or less consisting of
alphanumeric characters and underscore)

Response format:

OK[c/r]

Meaning:
• Erases the designated program.

Example:
Command @ERA <TEST1>[c/r]
Response OK[c/r]

17.2.3.2 Erasing point data


Command format:

c InCAUTION
controllers whose software version
@ERA Pmmmm-Pnnnn[c/r]
is earlier than V8.28, point numbers
from 0 to 4000 can be used to specify mmmm : Top point number to be erased (mmmm = 0 to 9999)
the top and last point numbers of the nnnn : Last point number to be erased (nnnn = 0 to 9999)
point range to be erased.

Response format:

OK[c/r]

Meaning:
• Erases the point data between Pmmmm and Pnnnn.

Example:
Command @ERA P101-P200[c/r]
Response OK[c/r]

281
17. Online commands

17.2.3.3 Erasing point comments


Command format:

c InCAUTION
controllers whose software version
@ERA PCmmmm-PCnnnn[c/r]

2 is earlier than V8.28, point numbers


from 0 to 4000 can be used to specify
the top and last point numbers of the
mmmm : Top point comment number to be erased (mmmm = 0 to 9999)
nnnn : Last point comment number to be erased (nnnn = 0 to 9999)
point comment range to be erased.

Response format:

OK[c/r]

Meaning:
• Erases the point comments between PCmmmm and PCnnnn.

Example:
Command @ERA PC101-PC200[c/r]
Response OK[c/r]

17.2.3.4 Erasing pallet data


Command format:

@ERA PLm[c/r]

m : Pallet number to be erased (m = 0 to 19)

Response format:

OK[c/r]

Meaning:
• Erases the designated pallet data.

Example:
Command @ERA PL1[c/r]
Response OK[c/r]

282
17. Online commands

17.2.4 Rename
Command format:

@REN <program name 1> TO <program name 2>[c/r]

Program name 1 : Program name before renaming (8 characters or less consisting of 2


alphanumeric characters and underscore)
Program name 2 : Program name after renaming (8 characters or less consisting of
alphanumeric characters and underscore)

Response format:

OK[c/r]

Meaning:
• Changes program name 1 to program name 2.

Example:
Command @REN <TEST1> TO <TEST2>[c/r]
Response OK[c/r]

17.2.5 Changing the attribute


Command format:

@ATTR <program name> TO s[c/r]

Program name : Program name to change the attribute (8 characters or less consisting
of alphanumeric characters and underscore)
s: Attribute (s = RW: read & write, RO: read only)

Response format:

OK[c/r]

Meaning:
• Changes the attribute of the designated program.

Example:
Command @ATTR <TEST1> TO RO[c/r]
Response OK[c/r]

283
17. Online commands

17.2.6 Initialize

17.2.6.1 Initializing the memory


Command format:
2 @INIT PGM[c/r]
@INIT PNT[c/r]
@INIT SFT[c/r]
@INIT HND[c/r]
@INIT PLT[c/r]
@INIT PCM[c/r]
@INIT MEM[c/r]
@INIT PRM[c/r]
@INIT ALL[c/r]

Response format:

OK[c/r]

Meaning:
• Initializes the memory.
PGM : Initializes the program area.
PNT : Initializes the point data area.
SFT : Initializes the shift data area.
HND : Initializes the hand data area.
PLT : Initializes the pallet data area.
PCM : Initializes the point comment area.
MEM : Initializes the above areas (PGM+PNT+SFT+HND+PLT+PCM).
PRM : Initializes the parameter area.
ALL : Initializes all areas (MEM+PRM).

Example:
Command @INIT PGM[c/r]
Response OK[c/r]

284
17. Online commands

17.2.6.2 Initializing the communication port


Command format:

@INIT CMU[c/r]

Response format: 2
OK[c/r]

Meaning:
• Initializes the communication port parameters.
• For information about the communication port initial settings, refer to the
communication port manual.

Example:
Command @INIT CMU[c/r]
Response OK[c/r]

17.2.7 Setting the display language


Command format:

@LANGUAGE k[c/r]

k : Display language (k = 0: Japanese, 1: English)

Response format:

OK[c/r]

Meaning:
• Sets the controller display language.

Example:
Command @ LANGUAGE 1[c/r]
Response OK[c/r]

285
17. Online commands

17.2.8 Setting the coordinates and units in MANUAL mode


Command format:

@UNIT k[c/r]

2 c k=2
CAUTION
(mm or degree units in tool k :Unit definition (k=0 : pulses, 1 : mm, 2 : mm or degrees in tool coordinate mode)
coordinate mode) can be selected only
when the software version is V8.19 or
later. Response format:

OK[c/r]

Meaning:
• Select the display unit to indicate current position.
• k=2 (tool coordinate mode) can be selected only when the hand attached to the R-axis
of a Cartesian or SCARA robot is selected.

Example:
Command @UNIT 1[c/r]
Response OK[c/r]

17.2.9 Clearing the MPB error message


Command format:

@MSGCLR[c/r]

Response format:

OK[c/r]

Meaning:
• Clears the error messages displayed on the MPB.

Example:
Command @MSGCLR[c/r]
Response OK[c/r]

286
17. Online commands

17.2.10 Setting the UTILITY mode

17.2.10.1 Setting the access level


Command format:

@ ACCESS k[c/r]
2
k : Access level (k = 0 to 3)

Response format:

OK[c/r]

n For
NOTE
a detailed description of the access
Meaning:
• Sets the access level.
level, refer to the robot controller
owner’s manual.
Example:
Command @ACCESS 1[c/r]
Response OK[c/r]

17.2.10.2 Setting the execution level


Command format:

@EXELVL k[c/r]

k : Execution level (k = 0 to 8)

Response format:

OK[c/r]

n For
NOTE
a detailed description of the
Meaning:
• Sets the execution level.
execution level, refer to the robot
controller owner’s manual.
Example:
Command @ EXELVL 1[c/r]
Response OK[c/r]

287
17. Online commands

17.2.10.3 Setting the sequence program execution flag


Command format:

@SEQUENCE k[c/r]

2 k : Execution flag (k = 0: disable, 1: enable, 3: enable (DO reset))

Response format:

OK[c/r]

Meaning:
• Sets the sequence program execution flag.

Example:
Command @ SEQUENCE 1[c/r]
Response OK[c/r]

17.2.10.4 Setting the SCARA robot hand system


Command format:

@ARMTYP m,k[c/r]
@ARMTYP2 m,k[c/r]

m : Current hand system (m = 0: right-handed system, 1: left-handed system)


k : Hand system at program reset (k = 0: right-handed system, 1: left-handed system)

Response format:

OK[c/r]

Meaning:
• Sets the SCARA robot hand system.
ARMTYP : Changes the main robot hand system.
ARMTYP2 : Changes the sub robot hand system.

Example:
Command @ ARMTYP 0, 0 [c/r]
Response OK[c/r]

288
17. Online commands

17.2.10.5 Resetting the internal emergency stop flag


Command format:

@EMGRST[c/r]

Response format: 2
OK[c/r]

Meaning:
• Resets the internal emergency stop flag.

Example:
Command @ EMGRST[c/r]
Response OK[c/r]

289
17. Online commands

17.3 Data handling

17.3.1 Acquiring the display language

2 Command format:

@?LANGUAGE[c/r]

Response format:

m[c/r]

m : Display language (m = JAPANESE or ENGLISH)

Meaning:
• Acquires the language for displaying messages on the MPB.

Example:
Command @?LANGUAGE[c/r]
Response JAPANESE[c/r]

17.3.2 Acquiring the access level


Command format:

@?ACCESS[c/r]

Response format:

LEVELk[c/r]

k : Access level (k = 0 to 3)

n For
NOTE
a detailed description of the access
Meaning:
• Acquires the access level.
level, refer to the robot controller
owner’s manual.
Example:
Command @?ACCESS[c/r]
Response LEVEL2[c/r]

290
17. Online commands

17.3.3 Acquiring the arm status


Command format:

@?ARM[c/r]

Response format: 2
m1/s1,m2/s2[c/r]

Main robot
m1 : Current arm setting status (m1 = RIGHTY: right-handed system, LEFTY: left-handed
system)
m2 : Arm setting status at program reset (m2 = RIGHTY: right-handed system, LEFTY:
left-handed system)

Sub robot
s1 : Current arm setting status (s1 = RIGHTY: right-handed system, LEFTY: left-handed
system)
s2 : Arm setting status at program reset (s2 = RIGHTY: right-handed system, LEFTY:
left-handed system)

n• NOTE
This command is valid only for
Meaning:
• Acquires the arm setting status.
SCARA robot setting.
• “s1” and “s2” are not displayed
when sub robot is not set. Example:
Command @?ARM[c/r]
Response RIGHTY,RIGHTY[c/r]

17.3.4 Acquiring the break point status


Command format:

@?BREAK[c/r]

Response format:

k1,k2,k3,k4[c/r]

kn : Line number on which break point “n” is set (kn = 1 to 9999)


• When kn is 0, this means no break point is set.
• When a break point is set in the COMMON program, the line number shows +10000.

Meaning:
• Acquires the break point status.

Example:
Command @?BREAK[c/r]
Response 12,35,0,0[c/r]

291
17. Online commands

17.3.5 Acquiring the controller configuration status


Command format:

@?CONFIG[c/r]

2 Response format:

mr/sr-ma/sa-r-o1-o2[c/r]

mr : Main robot name


sr : Sub robot name
ma : Main group axis setting (Auxiliary axes are shown separated by “+”.)
sa : Sub group axis setting (Auxiliary axes are shown separated by “+”.)
r : Standard interface unit
o1 : Option unit
o2 : Other setting

n “sr”
NOTE
and “sa” are not displayed when
Meaning:
• Acquires the controller configuration status.
sub robot is not set.

Example:
Command @?CONFIG[c/r]
Response YK250X-XYZR-SRAM/196kB,DIO_N-DIO_N(1/2)[c/r]

17.3.6 Acquiring the execution level


Command format:

@?EXELVL[c/r]

Response format:

LEVELk[c/r]

k : Execution level (k = 0 to 8)

n For
NOTE
a detailed description of the
Meaning:
• Acquires the execution level.
execution level, refer to the robot
controller owner’s manual.
Example:
Command @?EXELVL[c/r]
Response LEVEL2[c/r]

292
17. Online commands

17.3.7 Acquiring the mode status


Command format:

@?MOD[c/r]

Response format: 2
s[c/r]

s : Mode status
s
Meaning
English Japanese
AUTO ジドウ AUTO mode
PROGRAM プログラム PROGRAM mode
MANUAL シュドウ MANUAL mode
SYSTEM システム SYSTEM mode

Meaning:
• Acquires the controller mode status.

Example:
Command @?MOD[c/r]
Response AUTO[c/r]

17.3.8 Acquiring the message


Command format 1:

@?MSG[c/r]

Response format 1:

gg,bb:msg[c/r]
or
OK[c/r]

gg : Error group
bb : Error category
msg : Error message

Command format 2:

@?MSG m,n[c/r]

m : Top number to be acquired (m = 1 to 500)


m : Last number to be acquired (n = 1 to 500)

293
17. Online commands

Response format 2:

yy/mm/dd,hh:mm:ss gg.bb:msg[c/r]

yy/mm/dd,hh:mm:ss gg.bb:msg[c/r]
2 :
OK[c/r]

yy/mm/dd : Date (year/month/day) when error occurred


hh:mm:ss : Time (hour:minute:second) when error occurred
gg : Error group
bb : Error category
msg : Error message

Meaning:
• Command format 1 acquires information on the message line displayed on the MPB.
• Command format 2 acquires error history message.

Example:
Command @?MSG[c/r]
Response 5.30: Undefined identifier[c/r] or OK[c/r]

Example:
Command @?MSG 1,5[c/r]
Response 01/10/28,14:20:20 5.30: Undefined identifier[c/r]
01/10/28,14:18:34 5.1: Syntax error[c/r]
01/10/28,14:10:54 5.30: Undefined identifier[c/r]
01/10/28,14:05:40 14.22: No start code(@)[c/r]
01/10/28,14:05:00 5.52: Command doesn’t exist[c/r]
OK[c/r]

17.3.9 Acquiring return-to-origin status


Command format:

@?ORIGIN[c/f]

Response format:

COMPLETE[c/f] or INCOMPLETE[c/f]

COMPLETE : Return-to-origin is complete.


INCOMPLETE : Return-to-origin is incomplete.

Meaning:
• Acquires return-to-origin status.

Example:
Command @?ORIGIN[c/f]
Response COMPLETE[c/f]

294
17. Online commands

17.3.10 Acquiring the absolute reset status


Command format:

@?ABSRST[c/r]

Response format: 2
COMPLETE[c/r] or INCOMPLETE,xxxxxxxx[c/r]

COMPLETE : Absolute reset is complete.


INCOMPLETE : Absolute reset is incomplete.
xxxxxxxx : Absolute reset status of each axis (axis 1 to axis 8 from the right)
“0”: Incomplete
“1”: Complete
“9”: Not applicable

Meaning:
• Acquires the absolute reset status.

Example:
Command @?ABSRST[c/r]
Response INCOMPLETE,99991011[c/r]

17.3.11 Acquiring the servo status


Command format:

@?SERVO[c/r]

Response format:

OFF,xxxxxxxx [c/r] or ON,xxxxxxxx[c/r]

• Response outputs are defined as follows:


ON : Motor power is ON.
OFF : Motor power is OFF.
xxxxxxxx : Status of each axis (axis 1 to axis 8 from the right)
“0”: Mechanical break ON + dynamic break ON
“1”: Servo ON
“2”: Mechanical break OFF + dynamic break OFF
“9”: Not applicable

Meaning:
• Acquires the servo status.

Example:
Command @?SERVO[c/r]
Response OFF,99991011[c/r]

295
17. Online commands

17.3.12 Acquiring the sequence program execution status


Command format:

@?SEQUENCE[c/r]

2 Response format:

ENABLE,s[c/r] or ENABLE(RST.DO),s[c/r] or DISABLE[c/r]

• Response output means as follows:


ENABLE : Enabled
ENABLE(RST.DO) : Enabled and output is cleared at emergency stop
DISABLE : Disabled
s : Program execution is in progress or stopped. (s = RUNNING
or STOP)

Meaning:
• Acquires the sequence program execution status.

Example:
Command @? SEQUENCE[c/r]
Response DISABLE[c/r]

17.3.13 Acquiring the speed setting status


Command format:

@?SPEED[c/r]

Response format:

ma/sa,mm/sm[c/r]

Main group
ma : Automatic movement speed setting status (ma = 1 to 100)
mm : Manual movement speed setting status (mm = 1 to 100)

Sub group
sa : Automatic movement speed setting status (sa = 1 to 100)
sm : Manual movement speed setting status (sm = 1 to 100)

n "sa"
NOTE
and "sm" are not displayed unless
Meaning:
• Acquires the speed setting status.
the sub robot is set.

Example:
Command @?SPEED[c/r]
Response 100,50[c/r]

296
17. Online commands

17.3.14 Acquiring the point coordinates and units


Command format:

@?UNIT[c/r]

Response format: 2
s [c/r]

s : Coordinates and units (s = PULSE: joint coordinate in “pulse” units, MM: Cartesian
coordinate in “mm” or “deg.” units)

Meaning:
• Acquires the coordinates and units for point data.

Example:
Command @?UNIT[c/r]
Response PULSE[c/r]

17.3.15 Acquiring the version information


Command format:

@?VER[c/r]

Response format:

cv,cr-mv-d1/d2/d3/d4/d5/d6/d7/d8{-ov}[c/r]

• Response outputs are defined as follows:


cv : Host version number (V8.xx)
cr : Host revision number (Rxxxx)
mv : MPB version number (V5.xx)
d?(?:1-8) : Driver version number (Vx.xx)
ov : Option unit version number (Vx.xx)

Meaning:
• Acquires the version information.

Example:
Command @?VER[c/r]
Response V8.02,R1021-V5.10-V1.01/V1.01/V1.01/V1.01/-----/-----/-----/-----/[c/r]

297
17. Online commands

17.3.16 Acquiring the current positions


17.3.16.1 Acquiring the current positions on pulse unit coordinates
Command format:

2 @?WHERE[c/r]
@?WHERE2[c/r]

Response format:

[POS]xxxxxx yyyyyy zzzzzz rrrrrr aaaaaa bbbbbb[c/r]

xxxxxx : Current position of axis 1 in “pulse” units


yyyyyy : Current position of axis 2 in “pulse” units
:
bbbbbb : Current position of axis 6 in “pulse” units

Meaning:
• Acquires the current positions.
n WHERE2
NOTE
cannot be used unless the WHERE : Acquires the current positions of main group axes.
sub robot is set. WHERE2 : Acquires the current positions of sub group axes.

Example:
Command @?WHERE[c/r]
Response [POS] 1000 2000 3000 -40000 0 0[c/r]

17.3.16.2 Acquiring the current positions on XY coordinates


Command format:

@?WHRXY[c/r]
@?WHRXY2[c/r]

Response format:

[POS] xxxxxx yyyyyy zzzzzz rrrrrr aaaaaa bbbbbb[c/r]

xxxxxx : Current position of axis 1 in “mm” units


yyyyyy : Current position of axis 2 in “mm” units
:
bbbbbb : Current position of axis 6 in “mm” units

Meaning:
• Acquires the current positions.
n WHRXY2
NOTE
cannot be used unless the
WHRXY : Acquires the current positions of main group axes.
sub robot is set. WHRXY2 : Acquires the current positions of sub group axes.

Example:
Command @?WHRXY[c/r]
Response [POS] 100.00 200.00 300.00 -40.00 0.00 0.00[c/r]

298
17. Online commands

17.3.17 Acquiring the tasks in RUN or SUSPEND status


Command format:

@?TASKS[c/r]

Response format: 2
n{,n{,{…}}}[c/r]

n : Task number currently run or suspended (n = 1 to 8)

Meaning:
• Acquires the tasks in RUN or SUSPEND status.

Example:
Command @?TASKS[c/r]
Response 1,3,4,6[c/r]

17.3.18 Acquiring the tasks operation status


Command format:

@?TSKMON[c/r]

Response format:

nfp,{nfp},{nfp},{nfp},{nfp},{nfp},{nfp},{nfp}[c/r]

n : Line number being executed in each tack (n = 1 to 9999)


f : Status of each tack (f = R: RUN, U: SUSPEND, S: STOP)
p : Priority level of each task (p = 17 to 47)

Meaning:
• Acquires the status of each task in order from Task 1 to Task 8.

Example:
Command @?TSKMON[c/r]
Response 11R32,,43U32,,,,129R31,[c/r]

299
17. Online commands

17.3.19 Acquiring the shift status


Command format:

@?SHIFT[c/r]

2 Response format:

m/s[c/r]

m : Shift number selected for main robot (m = 0 to 9)


s : Shift number selected for sub robot (s = 0 to 9)

n "s"NOTE
is not displayed unless the sub
Meaning:
• Acquires the shift status.
robot is set.
Example:
Command @?SHIFT[c/r]
Response 1[c/r]

17.3.20 Acquiring the hand status


Command format:

@?HAND[c/r]

Response format:

m/s[c/r]

m : Hand number selected for main robot (m = 0 to 3)


s : Hand number selected for sub robot (s = 4 to 7)

n "s"NOTE
is not displayed unless the sub
Meaning:
• Acquires the hand status.
robot is set.

Example:
Command @?HAND[c/r]
Response 1[c/r]

300
17. Online commands

17.3.21 Acquiring the remaining memory capacity


Command format:

@?MEM[c/r]

Response format: 2
k/m[c/r]

k : Remaining source area (unit: bytes)


m : Remaining object area (unit: bytes)

Meaning:
• Acquires the remaining memory capacity.

Example:
Command @?MEM[c/r]
Response 102543/1342[c/r]

17.3.22 Acquiring the emergency stop status


Command format:

@?EMG[c/r]

Response format:

k[c/r]

k : Emergency stop status (k = 0: normal operation, 1: emergency stop)

Meaning:
• Acquires the emergency stop status by checking the internal emergency stop flag.

Example:
Command @?EMG[c/r]
Response 1[c/r]

301
17. Online commands

17.3.23 Acquiring the error status by self-diagnosis


Command format:

@?SELFCHK[c/r]

2 Response format:
• If an error occurred

m.n: ”message” [c/r]


:
END [c/r]

m : Shows error group


n : Shows error category
”message” : Show error message

• When no error was found

OK [c/r]

Meaning:
• Acquires the error status by self-diagnosis that checks for errors inside the controller.

Example:
Command @?SELFCHK[c/r]
Response 12.1: Emg.stop on[c/r]
END[c/r]

302
17. Online commands

17.3.24 Acquiring the option slot status


Command format:

@?OPSLOT[c/r]

Response format: 2
OP.1 : ”option board name” [c/r]
OP.2 : ”option board name” [c/r]
OP.3 : ”option board name” [c/r]
OP.4 : ”option board name” [c/r]

“option boar name” : Name of option board installed in the controller.


DIO_Nm : DIO board with NPN specifications (m: board ID)
DIO_Pm : DIO board with PNP specifications (m: board ID)
CCLnk : CC_LINK compatible board
D_Net : DeviceNet compatible board
Profi : Profibus compatible board
E_Net : Ethernet compatible board
no board : No option board is installed.
illegal board : Incompatible board is installed.

Meaning:
• Acquires the option slot status by checking the option boards.

Example:
Command @?OPSLOT[c/r]
Response OP.1 : DIO_N2[c/r]
OP.2 : DIO_N1[c/r]
OP.3 : no board[c/r]
OP.4 : CCLnk [c/r]

303
17. Online commands

17.3.25 Data readout processing


Command format:

@READ “readout file” [c/r]

2 “readout file”: Designate a readout file name.

Response format:
• Response output depends on the designated readout file.

n For
NOTE
more information about files, refer
Meaning:
• Reads out the data from the designated file.
to the earlier section "Data file • Online commands that are input through the RS-232C port have the same meaning as
description".
the following command.
SEND <readout file> TO CMU

Definition format
Type Readout file name
All Separate file
User memory All files ALL ––––
Program PGM <bbbbbbbb>
Point data PNT Pn
Point comment PCM ––––
Parameter PRM /cccccc/
Shift definition SFT Sn
Hand definition HND Hn
Pallet definition PLT PLn
Variable, Variable VAR ab...by
constant Array variable ARY ab...by (x)
Constant –––– “cc...c”
Status Program directory DIR <<bbbbbbbb>>
Parameter directory DPM ––––
Machine reference MRF ––––
Error history (log) LOG ––––
Memory size MEM ––––
Device DI port DI () DIn ()
DO port DO () DOn ()
MO port MO () MOn ()
TO port TO () TOn ()
LO port LO () LOn ()
SI port SI () SIn ()
SO port SO () SOn ()
Others File end code EOF ––––

n: Number
a: Alphabetic character
b: Alphanumeric character or underscore ( _ )
c: Alphanumeric character or symbol
x: Expression
y: Format
Example:
Command @READ PGM[c/r]
Example:
Command @READ P100[c/r]

304
17. Online commands

17.3.26 Data write processing


Command format:

@WRITE “write file” [c/r]

“write file” : Designate a write file name. 2


Response format:
• The following response appears asking you to enter the data to write.

*** Please enter ![c/r]

• The following response appears when writing to the designated file has been finished.

OK[c/r]

Meaning:
• Writes the data in the designated file.
n For
NOTE
more information about files, refer • Online commands that are input through the RS-232C port have the same meaning as
to the earlier section "Data file the following commands.
description".
SEND CMU TO <write file>

Definition format
Type Write file name
All Separate file
User memory All files ALL ––––
Program PGM <bbbbbbbb>
Point data PNT Pn
Point comment PCM ––––
Parameter PRM /cccccc/
Shift definition SFT Sn
Hand definition HND Hn
Pallet definition PLT PLn
Variable, Variable VAR ab...by
constant Array variable ARY ab...by (x)
Device DO port DO () DOn ()
MO port MO () MOn ()
TO port TO () TOn ()
LO port LO () LOn ()
SO port SO () SOn ()

n: Number
a: Alphabetic character
b: Alphanumeric character or underscore ( _ )
c: Alphanumeric character or symbol
x: Expression
y: Format
Example:
Command @WRITE PRM[c/r]
Example:
Command @WRITE P100[c/r]

305
17. Online commands

17.4 Executing the robot language independently

17.4.1 Switching the program

2 Command format:

@SWI <program name>[c/r]

Response format:

OK[c/r] or LINEx,m,n:”message”

OK : Program was switched correctly.


LINEx,m,n : ”message” Error occurred during compiling.
x : Shows the line number on which error occurred.
m : Shows error group
n : Shows error category
”message” : Show error message

Meaning:
• Switches the program.
• In AUTO mode, the program that is switched to will be compiled.
• In other modes, the program is only switched.
However, when “SEQUENCE” program is designated, a sequence object is created.

Example: AUTO mode


Command @SWI <TEST1>[c/r]
Response Line2,5.39:Illegal identifier[c/r]

Example: Other modes


Command @SWI <TEST1>[c/r]
Response OK[c/r]

306
17. Online commands

17.4.2 Other robot language command processing


Command format:

@”robot language”[c/r]

Response format: 2
OK[c/r] or *** Aborted
• Response output means as follows:
OK : Command was executed correctly.
*** Aborted : An error occurred during execution.

Meaning:
• Robot language commands can be executed.
• Independently executable commands can only be executed.
• Command format depends on each command to be executed.

Example:
Command @SET DO(20) [c/r]
Response OK[c/r]

Example:
Command @MOVE P,P100,S=20[c/r]
Response OK[c/r]

17.5 Control codes

17.5.1 Interrupting the command execution


Command format:

^C (=03H)

Response format:

*** Aborted[c/r]

Meaning:
• Interrupts execution of the current command.

Example:
Command @MOVE P,P100,S=20[c/r]
^C
Response *** Aborted[c/r]

307
18. IO commands

Using bit information (DI/DO port) for general-purpose input/output allows issuing commands directly
from the PLC. It is now possible to execute commands such as the MOVE command that were
impossible to execute up until now without using the robot program or RS-232C port.

18.1 IO command format

c •CAUTION
IO commands are valid only when
The following features are assigned to each IO.
Output (Controller → PLC) Input (Controller ← PLC)
the software version is V8.18 or
later. Output port Contents Input port Contents
• To use IO commands, the "IO cmd RCX DO26 Execution check output DI05 IO command execution trigger input
(DI05) on STD.DIO" parameter 141/142/40 DO27 Execution in-progress output DI2() Command code
(explained in the "SYSTEM mode" RCX DO16 Execution check output DI3() Command data
- "Other parameters" section in the 221/222 DO17 Execution in-progress output DI4()
robot controller owner's manual)
must be set to "VALID" ■ IO commands can be executed by using part of the general-purpose input and output.
beforehand. For more details, refer When no connection is made to the option DIO, then DI4() is always recognized as
to the robot controller owner's
manual. being OFF.

n General-purpose
NOTE
outputs DO26 and
■ IO commands cannot be executed while program execution is in progress (DO13 is
ON).
DO27 are used when executing an IO
command. General-purpose outputs ■ IO commands cannot be executed simultaneously with online commands.
DO26 and DO27 (DO16 and DO17 for
RCX221/222) are used when executing ■ IO commands assign command codes to be executed to DI2(), and command data to
an IO command. Pay attention to this DI3() and DI4(). These are executed when the DI05 is changed from OFF to ON. The
point when you are using them for controller processes the IO commands when they are received and sends execution
other purposes.
check results and execution in-progress information to the PLC via DO26 and DO27
(DO16 and DO17 for RCX221/222).
■ Command data added to the IO commands will differ according to the IO command.
See detailed information available on the IO commands. Command data settings must
always be made before attempting to set the IO commands.
■ Data is set in binary code. If the data size is greater than 8 bits, set the upper bit data
into the higher address. (little endian)
For example, to set 0x0F9F [hexadecimal] (=3999) in the DI3 () and DI4 () ports, set
0x0F [hexadecimal] in DI4 () and set 0x9F [hexadecimal] in DI3 ().
■ The IO command execution trigger input is not accepted when the execution in-progress
output is ON.
■ The execution in-progress output is ON in the following cases.
• When an IO command is running after receiving an IO command execution trigger
input.
• When an IO command is terminated after receiving an IO command execution trigger
input yet a maximum of 100ms state is maintained when IO command trigger input
is ON.
■ The IO command trigger input pulse must always be maintained for 100ms or more
during input. Commands cannot be accepted unless this statement is maintained.
■ Sometimes 20ms or more is needed for the execution in-progress output to turn ON
after startup (rising edge) of the IO command trigger input pulse. The IO command
trigger input might not be accepted during this period.
■ After inputting the IO command trigger input pulse and the in-progress output turns
OFF, at least a 100ms time period must always elapse before executing the next com-
mand. If this elapsed time period is too small, the IO command execution trigger input
might not be accepted.
■ The execution check output turns OFF when an IO command is received.

■ The execution check output turns ON when an IO command ends normally, but it
remains OFF if the IO command ends abnormally.

308
18. IO commands

18.2 Sending and receiving IO commands


Sending and receiving is performed in the IO register as shown below.
DI05 w r
100ms or more

Input port DI2( ) q r 2


DI3( ) to q r
DI4( ) 30ms or more

e t
DO27
Output port
DO17*
DO26 t
DO16*
Execution end
* When using RCX221/222
c To use IO commands, the "IO cmd
CAUTION
q Set command code and command data (Time interval between q and w: 30ms or
(DI05) on STD.DIO" parameter more)
(explained in the "SYSTEM mode" -
"Other parameters" section in the w Set IO command execution trigger input (Pulse width: 100ms or more)
robot controller owner's manual)
must be set to "VALID" beforehand.
e Transition to execute
For more details, refer to the robot r Clear the IO command execution trigger input and command code and command data
controller owner's manual.
t Set termination of IO command and execution check output

c Output
CAUTION
port for the execution check
Example : Follow these steps when sending and receiving IO commands to execute the
PTP movement command to point 19.
output is as follows:
RCX141/142/40 : DO26
RCX221/222 : DO16
Output port for the execution in-
q Set the following values in the register to execute the PTP movement command by
progress output is as follows: designating a point.
RCX141/142/40 : DO27 DI2 ( ) : Command code (0x01)
RCX221/22 : DO17
DI3 ( ) : Lower point setting (0x13= point 19)
DI4 ( ) : Upper point setting (0x00=point 19)
w Set DI05 from ON to OFF.
e The controller receives the IO command and executes it if the command and command
data are acceptable. The execution in-progress output turns ON and the execution
check output turns OFF at this time. The robot moves to the position specified by
point 19.
r Clear DI2 ( ) through DI4 ( ) after checking that execution in-progress output is ON.
t The command has ended so the execution in-progress output turns OFF and execution
check output turns ON if command ended correctly, and turns OFF if the command
failed.

* If DI05 was not set to OFF in r, the execution in-progress output remains ON for
a maximum of 100ms from the timing in t.
DI05 w r

q r
Input port DI2( )

DI3( ) to q r
DI4( )

e t
DO27
Output port 100ms
DO17*
DO26 t
DO16*
Execution end
* When using RCX221/222

309
18. IO commands

18.3 IO command list


IO commands are expressed with hexadecimal codes.
Command code (DI2( ))
No. Command contents
Main robot Sub robot

2 1 MOVE command PTP designation


Linear interpolation
0x01
0x03
0x81

2 MOVEI command PTP designation 0x09 0x89


3 Pallet movement command PTP designation at pallet 0 0x18 0x98
4 Jog movement command 0x20 0xA0
5 Inching movement command 0x24 0xA4
6 Point teaching command 0x28 0xA8
7 Absolute reset movement command 0x30 0xB0
8 Absolute reset command 0x31 0xB1
9 Return-to-origin command 0x32
10 Servo command On 0x34 0xB4
Off 0x35 0xB5
Free 0x36 0xB6
Power-on 0x37
11 Manual movement speed change command 0x38 0xB8
12 Auto movement speed change command 0x39 0xB9
13 Program speed change command 0x3A 0xBA
14 Shift designation change command 0x3B 0xBB
15 Hand designation change command 0x3C 0xBC
16 Arm designation change command 0x3D 0xBD
17 Point display unit designation command 0x3E
* 1. Linear interpolation with the MOVE command is only possible on the main robot.
* 3. The pallet movement command is only valid for pallet 0.
* 4, 5. The movement methods on the jog movement command and inching movement command differ
according to the point units that were specified.
* 6. The point teaching command uses different point units according to the point units that were specified.
* 9. When two robots are specified, the return-to-origin command is first executed for the main robots and
then the sub robots.
* 17. The point display unit designation command is for use on the controller.

310
18. IO commands

18.4 IO command description


18.4.1 MOVE command
Execute this command group to move the robot to an absolute position.

2
c •CAUTION
In controllers whose software
18.4.1.1 PTP designation

version is earlier than V8.28, point


This command moves the robot to a target position in PTP motion by specifying the point
numbers from 0 to 4000 can be number.
specified.
• The point number setting range is 0 Command
to 255 when there is no DI4(). DI port Contents Value
DI2() Command code For main robot 0x01
n When
NOTE
a SCARA robot is used and a
For sub robot 0x81
DI3() Point number 0xpppp
hand system flag is set for the point
DI4()
data you specify, that hand system has
priority over the current arm type. pppp: Specify the point number in 16 bits.
Specified range: 0 (=0x0000) to 9999(=0x270F)

c •CAUTION
In controllers whose software
18.4.1.2 Linear interpolation
version is earlier than V8.28, point This command moves the robot to a target position by linear interpolation by specifying
numbers from 0 to 4000 can be the point number. The sub robot is not subject to this command.
specified.
• The point number setting range is 0 Command
to 255 when there is no DI4().
DI port Contents Value
• When moving the robot by linear
interpolation to a point where a DI2() Command code For main robot 0x03
hand system flag is specified, make DI3() Point number 0xpppp
sure that the same hand system is DI4()
used at the current position and
target position. If the same hand pppp: Specify the point number in 16 bits.
system is not used, then an error Specified range: 0 (=0x0000) to 9999(=0x270F)
will occur and robot movement will
not be allowed.

n When
NOTE
a SCARA robot is used and a
hand system flag is set for the point
data you specify, that hand system has
priority over the current arm type.

c •CAUTION
In controllers whose software
18.4.2 MOVEI command
version is earlier than V8.28, point Execute this command group to move the robot to a relative position.
numbers from 0 to 4000 can be
specified.
• The point number setting range is 0
18.4.2.1 PTP designation
to 255 when there is no DI4().
This command moves the robot a specified distance in PTP motion by specifying the
point number.
n When
NOTE
a SCARA robot is used and a
Command
hand system flag is set for the point DI port Contents Value
data you specify, that hand system has DI2() Command code For main robot 0x09
priority over the current arm type.
For sub robot 0x89
DI3() Point number 0xpppp
DI4()
pppp: Specify the point number in 16 bits.
Specified range: 0 (=0x0000) to 9999(=0x270F)

311
18. IO commands

18.4.3 Pallet movement command


Execute this command group to move the robot to a position with respect to pallet 0.

18.4.3.1 PTP designation


2 c The
CAUTION
This command moves the robot to a target position in PTP motion by specifying the work
position number.
work position number setting
range is 0 to 255 when there is no
Command
DI4().
DI port Contents Value
DI2() Command code For main robot 0x18
For sub robot 0x98
DI3() Work position number 0xwwww
DI4()
wwww : Specify the work position number in 16 bits.
Specified range: 1 (=0x0001) to 32767 (=0x7FFF)

18.4.4 Jog movement command


This command moves the robot in jog mode while in MANUAL mode. This command is
only valid in MANUAL mode.
This command is linked with the controller point display units. The robot axis moves in
PTP motion when display units are in pulses, and moves by linear interpolation on Carte-
sian coordinates when units are in millimeters.
Jog speed is determined by the manual movement speed.

To stop the jog movement command, set the dedicated input interlock signal to OFF.
After checking that jog movement has stopped, set the interlock signal back to ON.
Command
DI port Contents Value
DI2() Command code For main robot 0x20
For sub robot 0xA0
DI3() Axis to move and bit 0 Axis 1 tt
direction bit 1 Axis 2
bit 2 Axis 3
bit 3 Axis 4
bit 6-bit 4 (0:Fixed) 0
bit 7 Direction d
DI4() Not used 0x00
tt : Specify the axis to move in 0 to 3 bits. Only one axis can be specified.
d : Specify the movement direction in 1 bit.
Value Meaning
0 + direction
1 - direction

312
18. IO commands

18.4.5 Inching movement command


Execute this command to move the robot by inching in MANUAL mode. Inching move-
ment distance is linked to the manual movement speed. The inching command can only
be executed in MANUAL mode.
This command is linked with the controller’s point display unit system. So when display
units are in pulses, the axis moves a certain number of pulses at the manual speed setting.
When display units are in millimeters, the axis moves on Cartesian coordinates by linear
2
interpolation at the manual speed setting divided by 100.
Command
DI port Contents Value
DI2() Command code For main robot 0x24
For sub robot 0xA4
DI3() Axis to move and bit 0 Axis 1 tt
direction bit 1 Axis 2
bit 2 Axis 3
bit 3 Axis 4
bit 6-bit 4 (0:Fixed) 0
bit 7 Direction d
DI4() Not used 0x00
tt : Specify the axis to move in 0 to 3 bits. Only one axis can be specified.
d : Specify the movement direction in 1 bit.
Value Meaning
0 + direction
1 - direction

18.4.6 Point teaching command


c • In controllers whose software
CAUTION
Execute this command to teach the current robot position to the specified point number.
version is earlier than V8.28, point Point data units of this command are linked to the controller's point display unit system.
numbers from 0 to 4000 can be
specified. Command
• The point number setting range is 0 Contents
DI port Value
to 255 when there is no DI4().
DI2() Command code For main robot 0x28
For sub robot 0xA8
DI3() Point number 0xpppp
DI4()
pppp: Specify the point number in 16 bits.
Specified range: 0 (=0x0000) to 9999(=0x270F)

313
18. IO commands

18.4.7 Absolute reset movement command


When absolute reset of the specified axis uses the mark method, this command moves the
axis to the nearest position where absolute reset can be executed.
Positions capable of absolute reset are located at every 1/4 rotation of the motor.

2 Command
DI port Contents Value
DI2() Command code For main robot 0x30
For sub robot 0xB0
DI3() Axis to move and bit 0 Axis 1 tt
direction bit 1 Axis 2
bit 2 Axis 3
bit 3 Axis 4
bit 6-bit 4 (0:Fixed) 0
bit 7 Direction d
DI4() Not used 0x00
tt : Specify the axis to move in 0 to 3 bits. Only one axis can be specified.
d : Specify the movement direction in 1 bit.
Value Meaning
0 + direction
1 - direction

18.4.8 Absolute reset command


This command executes absolute reset of the specified axis.
When absolute reset of the specified axis uses the mark method, the axis must be at a
position where absolute reset can be executed.
When no axis is specified, absolute reset is performed on all axes. However, this com-
mand cannot be executed if return-to-origin is not yet complete on the axis using the mark
method. In this case, perform absolute reset individually on each axis.
Command

DI port Contents Value


DI2() Command code For main robot 0x31
For sub robot 0xB1
DI3() Specify the axis bit 0 Axis 1 tt
bit 1 Axis 2
bit 2 Axis 3
bit 3 Axis 4
bit 7-bit 4 (0:Fixed) 0
DI4() Not used 0x00
tt : Specify the axis to move in 0 to 3 bits. Only one axis can be specified.
If no particular axis is specified then absolute reset is performed on all axes.

314
18. IO commands

18.4.9 Return-to-origin command


n This
NOTE
command cannot be executed if This command executes return-to-origin on incremental axes.
the return-to-origin method of an When two robots are used, the return-to-origin command is first executed for the main
incremental motor axis is set to
robot group and then the sub robot group.
"Mark".
Command
DI port Contents Value
2
For main robot
DI2() Command code 0x32
For sub robot
DI3() Not used 0x00
DI4() Not used 0x00

18.4.10 Servo command


Execute this command group to operate the robot servos.
Operation Contents
Servo ON Execute this command to turn on the servo of a specified axis.
The motor power must be turned on when specifying the axis.
All controller servos are turned on if no axis is specified.
Servo OFF Execute this command to turn off the servo of a specified axis.
All controller servos are turned off if no axis is specified.
Servo Free Execute this command to turn off the mechanical brake and dynamic brake
after turning off the servo of a specified axis. Servo OFF and Free are
repeated when this command is consecutively executed.
All controller servos will be free if no axis is specified.

Power ON Execute this command to turn on the motor power.


No axis can be specified.

Command
DI port Contents Value
DI2() Command code Servo ON For main robot 0x34
For sub robot 0xB4
Servo OFF For main robot 0x35
For sub robot 0xB5
Servo Free For main robot 0x36
For sub robot 0xB6
Power ON All controller servos 0x37
DI3() Specify the axis bit 0 Axis 1 tt
bit 1 Axis 2
bit 2 Axis 3
bit 3 Axis 4
bit 7-bit 4 (0:Fixed) 0
DI4() Not used 0x00
tt : Specify the axis to move in 0 to 3 bits. All controller servos are processed if no axis
is specified. No axis can be specified when executing Power ON.

315
18. IO commands

18.4.11 Manual movement speed change command


Execute this command to change the manual movement speed in MANUAL mode.
This command can only be executed in MANUAL mode.
Command

2 DI port
DI2() Command code
Contents
For main robot
Value
0x38
For sub robot 0xB8
DI3() Specified speed 0xss
DI4() Not used 0x00
ss : Specify the manual movement speed in 8 bits.
Specified range: 1 (=0x01) to 100 (=0x64)

18.4.12 Auto movement speed change command


Execute this command to change the auto movement speed in AUTO mode.
This command can only be executed in AUTO mode.
Command
DI port Contents Value
DI2() Command code For main robot 0x39
For sub robot 0xB9
DI3() Specified speed 0xss
DI4() Not used 0x00
ss : Specify the auto movement speed in 8 bits.
Specified range: 1 (=0x01) to 100 (=0x64)

18.4.13 Program speed change command


Execute this command to change the program speed in AUTO mode.
The program speed changed with this command is reset to 100% when the program is
reset or changed.
Command
DI port Contents Value
DI2() Command code For main robot 0x3A
For sub robot 0xBA
DI3() Specified speed 0xss
DI4() Not used 0x00
ss : Specify the program speed in 8 bits.
Specified range: 1 (=0x01) to 100 (=0x64)

316
18. IO commands

18.4.14 Shift designation change command


Execute this command to change the selected shift to a specified shift number.
Command
DI port Contents Value
DI2() Command code For main robot
For sub robot
0x3B
0xBB
2
DI3() Specified shift number 0xss
DI4() Not used 0x00
ss : Specify the shift number in 8 bits.
Specified range: 0 (=0x00) to 9 (0x09)

18.4.15 Hand designation change command


Execute this command to change the selected hand to a specified hand number.
Command
DI port Contents Value
DI2() Command code For main robot 0x3C
For sub robot 0xBC
DI3() Specified hand number 0xss
DI4() Not used 0x00
ss : Specify the hand number in 8 bits.
Specified range for main robot : 0 (=0x00) to 3 (0x03)
Specified range for sub robot : 4 (=0x04) to 7 (0x07)

18.4.16 Arm designation change command


Execute this command to change the arm designation status.
Command
DI port Contents Value
DI2() Command code For main robot 0x3D
For sub robot 0xBD
DI3() Status of specified arm 0xss
DI4() Not used 0x00
ss : Specify the arm designation status in 8 bits.
Value Meaning
0x00 Right-handed system
0x01 Left-handed system

18.4.17 Point display unit designation command


Execute this command to change the point display unit.
This command is for the controller.
Command
DI port Contents Value
DI2() Command code For controller 0x3E
DI3() Display units for specified point 0xss
DI4() Not used 0x00
ss : Specify the point display unit in 8 bits.
Value Meaning
0x00 Pulse units
0x01 Millimeter units

317
Appendix

A. Reserved word list


ABSADJ DEFIO IRET PATH SOW
ABSADJ2 DEFPOS JTOXY PC SPEED
ABSRESET DEGRAD JTOXY2 PCM SPEED2
ABSRESET2 DELAY JOG PDEF SQR
ABSRPOS DI JOG2 PLN START
ABSRPOS2 DIM LANGUAGE PLT STEP
ABSRST DIR LEFT PMOVE STOP
ABOVE DIST LEFTY PMOVE2 STOPON
ABS DO LEFTY2 PRINT STR
ACC DPM LEN PROGRAM SUB
ACCEL DRIVE LET PGM SUSPEND
ACCEL2 DRIVE2 LOCA PNT SWI
ACCESS DRIVEI LOCB POS SYS
ALL DRIVEI2 LOCF PPNT SYSTEM
AND ELSE LOCR PRM TAN
ARCH ELSEIF LOCX PTP TASK
ARCH2 EMGRST LOCY PWR TASKS
ARM EMG LOCZ RADDEG TCOUNTER
ARM2 END LOG READ TEACH
ARMTYPE ENDIF LOOP REF THEN
ARMTYPE2 EOF LSHIFT REN TIME
ARY ERA MANUAL RELESE TIMER
ASPEED ERL MCHREF REM TO
ASPEED2 ERR MCHREF2 REMOTE TOLE
ATN ERROR MEM RESET TOLE2
ATN2 ETH MID RESTART TORQUE
ATTR EXELVL MIRROR RESUME TORQUE2
AUTO EXIT MOD RETURN TSKMON
AXWGHT EXITTASK MOVE RIGHT UNIT
AXWGHT2 FDD MOVE2 RIGHTY UNTIL
BELOW FLIP MOVEI RIGHTY2 VAL
BIN FN MOVEI2 RO VAR
BIT FOR MRF ROTATE VER
BREAK FREE MSG RSHIFT VEL
BYTE FUNCTION MSGCLR RUN WAIT
CALL GASP MSPEED RW WEIGHT
CASE GEN MSPEED2 S WEIGHT2
CHANGE GO NAME SELECT WEND
CHANGE2 GOHOME NEXT SEND WHERE
CHGPRI GOSUB NONFLIP SEQUENCE WHERE2
CHGTSK GOTO NOT SERVO WHILE
CHR HALT OFF SERVO2 WHRXY
CMU HAND OFFLINE SET WHRXY2
CMU1 HAND2 ON SFT WORD
CONFIG HND ONLINE SGI WRITE
CONT HEX OR SGR XOR
COO HOME ORD SHARED XY
COPY HOLD ORGORD SHIFT XYTOJ
COS IF ORGORD2 SHIFT2 XYTOJ2
CUT IN ORIGIN SI YZ
DATE INCH OUT SID ZX
DEC INCH2 OUTPOS SIN _SYSFLG
DECEL INIT OUTPOS2 SIW
DECEL2 INPUT P SKIP
DECLARE INT PASS SO
DEF INTEGER PADDR SOD

n The
NOTE
above words are reserved for robot language and cannot be used as identifiers (variables, etc.).

318
B. Robot language lists

How to see table


• The "Cond." column in each table indicates the conditions that allow the robot language commands to be executed. The
numbers shown in the "Cond." column correspond to the following 6 conditions.
2
Condition 1: Commands that can be executed with both direct commands and on-line commands.
Condition 2: In addition to condition 1, commands that execute task 1 (main task) only.
Condition 3: In addition to condition 1, commands containing operands that cannot be executed with direct commands
and on-line commands.
Condition 4: In addition to condition 5, MOVE L and MOVE C execute task 1 (main task) only. STOPON option
cannot be executed with direct commands and on-line commands.
Condition 5: In addition to condition 1, commands that are executed after positioning is complete.
Condition 6: Commands that cannot be executed with direct commands and on-line commands.
• The numbers shown in the "Ref. page" column indicate the page numbers in this manual.

■ General commands

Function
Ref.
Language Type Cond. page
Format

Declares that a label or sub-procedure is in an external program.


DECLARE Command DECLARE <label>[,<label>...] 6 44
DECLARE SUB <label>[(<dummy argument>[,<dummy argument>]...)]
Defines a function that is available to the user.
DEF FN<name>[ % ] [(<dummy argument>[,<dummy argument>...])] =<function definition expression>
DEF FN Command 6 46
!
$
Declares the name of an array variable and the number of elements.
DIM Command 6 48
DIM <array definition>[,<array definition>,...]
Terminates a FOR statement to NEXT statement loop.
EXIT FOR Command 6 62
EXIT FOR
Controls repetitive operations. Repeatedly executes the FOR statement to
NEXT statement until the specified value is reached.
FOR to NEXT Command FOR <control variable>=<expression 1> TO <expression 2> [STEP <expression 3>] 6 65
:
NEXT [<control variable>]
Jumps to a subroutine with the label specified by a GOSUB statement and
executes the subroutine. Then, with RETURN in the subroutine being
executed, jumps to the next line of the GOSUB statement.
GOSUB <label>
GOSUB to
Command GO SUB 6 66
RETURN
:
<label>:
:
RETURN
Unconditionally jumps to the line specified by a label.
GOTO Command GOTO <label> 6 67
GO TO
Stops a program and resets it.
HALT Command HALT [ <expression> ] 6 68
<character string>
Pauses a program.
HOLD Command HOLD [ <expression> ] 6 77
<character string>

319
Robot language lists

Function
Ref.
Language Type Cond. page
Format

Allows control flow to branch according to conditions.


IF <conditional expression> THEN <label 1> [ELSE <label 2> ]
<statement 1> <statement 2>

IF <conditional expression 1> THEN


IF Command : 6 78
[ELSEIF <conditional expression 2> THEN
: ]
[ELSE
: ]
ENDIF
Executes a specified assignment statement.
[LET]
<arithmetic variable> =<expression>
<point element variable>
<shift element variable>
<parallel output variable>
LET Command 1 81
<internal output variable>
<arm lock output variable>
<timer output variable>
<serial output variable>
[LET] <character string variable>=<character string expression>
Jumps to a subroutine with each label specified by a GOSUB statement
according to conditions and executes the subroutine. Then, with RETURN
in the subroutine being executed, jumps to the next line of the GOSUB
ON to GOSUB Command statement. 6 103
ON <expression> GOSUB <label 1>[,<label 2>...]
GO SUB
Jumps to each line specified by a label according to conditions.
ON to GOTO Command ON <expression> GOTO <label 1>[,<label 2>...] 6 102
GO TO
All characters that follow REM or an apostrophe (’) are viewed as comments.
REM Command REM <character string> 6 132

Allows control flow to branch according to conditions. Executes a block
(bunch of commands) that meets conditions.
SELECT [CASE] <expression>
CASE <expression list 1>
[command block 1]
SELECT CASE
Command [CASE <expression list 2> 6 139
to END SELECT
[command block 2]]
:
[CASE ELSE
[command block n]]
END SELECT
Switches the currently executed program to a specified program, and
SWI Command executes from the first line after compiling. 2 155
SWI <program name>
Controls repetitive operations. Repeats the same operation as long as the
conditions are met.
WHILE to WEND Command WHILE <expression> 6 165
:
WEND
Defines “labels” in program lines. Labels must begin with an asterisk ( * ).
Label statement Command 6 166
*<label>:

320
Robot language lists

■ Robot operation

Function
Ref.
Language Type Cond. page
Format

Performs return-to-origin along robot absolute motor axes.


ABSRST Command 5 30
ABSRST
Performs an absolute movement of each axis in the main group. Only PTP
movement on specified axes is possible. Command options allow conditional
DRIVE Command stop by I/O or variables during arm movement and maximum torque limit. 5 50
DRIVE (<expression 1>, <expression 2> ) [, (<expression 1>, <expression 2> )...] [,option]
<point expression> <point expression>
Performs an absolute movement of each axis in the sub group. Only PTP
movement on specified axes is possible. Command options allow conditional
DRIVE2 Command stop by I/O or variables during arm movement and maximum torque limit. 5 54
DRIVE2 (<expression 1>, <expression 2> ) [, (<expression 1>, <expression 2> )...] [,option]
<point expression> <point expression>
Performs a relative movement of each axis in the main group. Only PTP
movement on specified axes is possible. Command options allow conditional
DRIVEI Command stop by I/O or variables during arm movement. 5 58
DRIVEI (<expression 1>, <expression 2> ) [, (<expression 1>, <expression 2> )...] [,option]
<point expression> <point expression>
Performs a relative movement of each axis in the sub group. Only PTP
movement on specified axes is possible. Command options allow conditional
DRIVEI2 Command stop by I/O or variables during arm movement. 5 60
DRIVEI2 (<expression 1>, <expression 2> ) [, (<expression 1>, <expression 2> )...] [,option]
<point expression> <point expression>
Performs an absolute movement of the main robot axes. Three movements of PTP,
linear interpolation and circular interpolation are possible. Command options allow arch
motion, conditional stop by I/O or variables during arm movement and circular
interpolation so that a movement projected on a specified coordinate plane is circular.
MOVE Command 4 85
MOVE PTP , <point definition>[, option[, option]...]
P
L
C
Performs an absolute movement of the sub robot axes. Only PTP
movement is possible. Command options allow arch motion and
MOVE2 Command conditional stop by I/O or variables during arm movement. 5 93
MOVE2 PTP , <point definition>[, option[, option]...]
P
Performs a relative movement of the main robot axes. Only PTP movement is possible.
MOVEI Command MOVEI PTP , <point definition>[, option[, option]...] 5 97
P
Performs a relative movement of the sub robot axes. Only PTP movement is possible.
MOVEI2 Command MOVEI2 PTP , <point definition>[, option[, option]...] 5 99
P
Performs return-to-origin along the incremental motor axes of the robot.
ORIGIN Command 5 107
ORIGIN
Performs a pallet movement of the main robot axes. Only PTP movement
is possible. Command options allow arch motion and conditional stop by
PMOVE Command 5 122
I/O or variables during arm movement.
PMOVE(pallet definition number, pallet position number)[,option[,option]...]
Performs a pallet movement of the sub robot axes. Only PTP movement is
possible. Command options allow arch motion and conditional stop by I/O
PMOVE2 Command 5 126
or variables during arm movement.
PMOVE2(pallet definition number, pallet position number)[,option[,option]...]

321
Robot language lists

Function
Ref.
Language Type Cond. page
Format

Controls the servo ON/OFF of the specified axes in the main group
or all axes (in main group and sub group).
SERVO ON [(<expression>)]
SERVO Command 5 142
OFF
FREE
PWR
Controls the servo ON/OFF of the specified axes in the sub group
or all axes (in main group and sub group).
SERVO2 ON [(<expression>)]
SERVO2 Command 5 143
OFF
FREE
PWR

322
Robot language lists

■ I/O control

Function
Ref.
Language Type Cond. page
Format

Waits for the specified length of time (ms) .


DELAY Command 6 47
DELAY <expression>
Outputs the specified value to the DO ports.
DO Command [LET] DOm([b, ..., b]) =<expression> 1 49
DO(mb, ..., mb)
Outputs the specified value to the LO port to prohibit axis movement or
permit axis movement.
LO Command 1 83
[LET] LO0([b, ..., b]) =<expression>
LO(0b, ..., 0b)
Outputs the specified value to the MO ports.
The origin sensor status and axis hold status can also be checked with an
MO Command MO statement. 1 84
[LET] MOm([b, ..., b]) =<expression>
MO(mb, ..., mb)
Turns ON the bits of the specified output ports and the command
statement ends. Then, turns OFF the bits of the specified ports after
automatic operation has continued for the specified time.
OUT DOm([b, ..., b]) [, <expression>]
DO(mb, ..., mb)
MOm([b, ..., b])
6 108
OUT Command MO(mb, ..., mb)
SOm([b, ..., b])
SO(mb, ..., mb)
LO0([b, ..., b])
LO(0b, ..., 0b)
TO0([b, ..., b])
TO(0b, ..., 0b)
Turns OFF the bits of the specified output ports. Also clears the system
flag variables and/or 10ms counter variables.
RESET DOm([b, ..., b])
DO(mb, ..., mb)
MOm([b, ..., b])
1 133
MO(mb, ..., mb)
RESET Command
TO0([b, ..., b])
TO(0b, ..., 0b)
LO0([b, ..., b])
LO(0b, ..., 0b)
SOm([b, ..., b])
SO(mb, ..., mb)
Turns ON the bits of the specified output ports.
SET DOm([b, ..., b]) [, <expression>]
DO(mb, ..., mb)
MOm([b, ..., b])
MO(mb, ..., mb) 3 144
SET Command TO0([b, ..., b])
TO(0b, ..., 0b)
LO0([b, ..., b])
LO(0b, ..., 0b)
SOm([b, ..., b])
SO(mb, ..., mb)

323
Robot language lists

Function
Ref.
Language Type Cond. page
Format

Outputs the specified value to the SO port.


SO [LET] SOm([b, ..., b]) =<expression> 1 148
SO(mb, ..., mb)
Outputs the specified value to the TO port.
TO [LET] TO0([b, ..., b]) =<expression> 1 156
TO(0b, ..., 0b)
q Waits until the condition in DI/DO conditional expression are met. The
time-out period can also be specified.
w Waits until positioning on the robot axes is complete (within the
WAIT tolerance range). 6 161
q WAIT <DI/DO conditional expression> [,<expression>]
w WAIT ARM [(<expression 1>)]
ARM2 [(<expression 2>)]

■ Coordinate control

Function
Ref.
Language Type Cond. page
Format

Switches the hand of the main robot.


CHANGE Command 5 69
CHANGE Hn
Switches the hand of the sub robot.
CHANGE2 Command 5 73
CHANGE2 Hn
Defines the hand of the main robot.
HAND Command 5 69
HAND Hn=<1st parameter> <2nd parameter> <3rd parameter> [R]
Defines the hand of the sub robot.
HAND2 Command 5 73
HAND2 Hn=<1st parameter> <2nd parameter> <3rd parameter> [R]
Selects whether the main robot will be “right-handed” or “left-handed”
RIGHTY / when moving to a point specified on a Cartesian coordinate system.
Command 5 136
LEFTY RIGHTY
LEFTY
Selects whether the sub robot will be “right-handed” or “left-handed” when
RIGHTY2 / moving to a point specified on a Cartesian coordinate system.
Command 5 137
LEFTY2 RIGHTY2
LEFTY2
Sets the shift coordinates for the main robot by using the shift data
SHIFT Command specified by a shift variable. 5 146
SHIFT <shift variable>
Sets the shift coordinates for the sub robot by using the shift data
SHIFT2 Command specified by a shift variable. 5 147
SHIFT2 <shift variable>

324
Robot language lists

■ Condition change

Function
Ref.
Language Type Cond. page
Format

Changes the acceleration coefficient parameter of the main group.


ACCEL Command ACCEL <expression> 5 31
ACCEL(<expression 1>)=<expression 2>
Changes the acceleration coefficient parameter of the sub group.
ACCEL2 Command ACCEL2 <expression> 5 32
ACCEL2(<expression 1>)=<expression 2>
Changes the arch position parameter of the main group.
ARCH Command ARCH <expression> 5 33
ARCH(<expression 1>)=<expression 2>
Changes the arch position parameter of the sub group.
ARCH2 Command ARCH2 <expression> 5 34
ARCH2(<expression 1>)=<expression 2>
Changes the automatic movement speed of the main group.
ASPEED Command 5 35
ASPEED <expression>
Changes the automatic movement speed of the sub group.
ASPEED2 Command 5 36
ASPEED2 <expression>
Changes the axis tip weight parameter of the main group.
AXWGHT Command 5 37
AXWGHT(<expression 1>)=<expression 2>
Changes the axis tip weight parameter of the sub group.
AXWGHT2 Command 5 38
AXWGHT2(<expression 1>)=<expression 2>
Changes the deceleration rate parameter of the main group.
DECEL Command DECEL <expression> 5 42
DECEL(<expression 1>)=<expression 2>
Changes the deceleration rate parameter of the sub group.
DECEL2 Command DECEL2 <expression> 5 43
DECEL2(<expression 1>)=<expression 2>
Sets the axis sequence parameter to perform return-to-origin movement in the main group.
ORGORD Command 5 105
ORGORD <expression>
Sets the axis sequence parameter to perform return-to-origin movement in the sub group.
ORGORD2 Command 5 106
ORGORD2 <expression>
Changes the OUT position parameter of the main group.
OUTPOS Command OUTPOS <expression> 5 109
OUTPOS(<expression 1>)=<expression 2>
Changes the OUT position parameter of the sub group.
OUTPOS2 Command OUTPOS2 <expression> 5 110
OUTPOS2(<expression 1>)=<expression 2>
Defines the pallet used to execute a pallet movement command.
PDEF Command 1 121
PDEF(pallet definition number)=nx,ny[,nz]
Changes the program speed for the main group.
SPEED Command 5 149
SPEED <expression>
Changes the program speed for the sub group.
SPEED2 Command 5 150
SPEED2 <expression>
Changes the tolerance parameter of the main group.
TOLE Command TOLE <expression> 5 157
TOLE(<expression 1>)=<expression 2>
Changes the tolerance parameter of the sub group.
TOLE2 Command TOLE2 <expression> 5 158
TOLE2(<expression 1>)=<expression 2>

325
Robot language lists

Function
Ref.
Language Type Cond. page
Format

Changes the maximum torque instruction for the specified axis in the main group.
TORQUE Command 5 159
TORQUE(<expression 1>)=<expression 2>
Changes the maximum torque instruction for the specified axis in the sub group.
TORQUE2 Command 5 160
TORQUE2(<expression 1>)=<expression 2>
Changes the tip weight parameter of the main robot.
WEIGHT Command 5 163
WEIGHT <expression>
Changes the tip weight parameter of the sub robot.
WEIGHT2 Command 5 164
WEIGHT2 <expression>

326
Robot language lists

■ Parameter reference

Function
Ref.
Language Type Cond. page
Format

Arithmetic Gives the acceleration coefficient parameter of the specified main group axis.
ACCEL – 167
function ACCEL(<expression>)

Arithmetic Gives the acceleration coefficient parameter of the specified sub group axis.
ACCEL2 – 167
function ACCEL2(<expression>)

Arithmetic Gives the arch position parameter of the specified main group axis.
ARCH – 168
function ARCH(<expression>)

Arithmetic Gives the arch position parameter of the specified sub group axis.
ARCH2 – 168
function ARCH2(<expression>)

Arithmetic Gives the axis tip weight parameter of the specified main group axis.
AXWGHT – 171
function AXWGHT(<expression>)

Arithmetic Gives the axis tip weight parameter of the specified sub group axis.
AXWGHT2 – 171
function AXWGHT2(<expression>)

Arithmetic Gives the deceleration rate parameter of the specified main group axis.
DECEL – 172
function DECEL(<expression>)

Arithmetic Gives the deceleration rate parameter of the specified sub group axis.
DECEL2 – 172
function DECEL2(<expression>)

Arithmetic Gives the axis sequence parameter to perform return-to-origin movement in the main group.
ORGORD – 175
function ORGORD

Arithmetic Gives the axis sequence parameter to perform return-to-origin movement in the sub group.
ORGORD2 – 176
function ORGORD2

OUTPOS Arithmetic Gives the OUT position parameter of the specified main group axis.
– 176
function OUTPOS(<expression>)

OUTPOS2 Arithmetic Gives the OUT position parameter of the specified sub group axis. – 176
function OUTPOS2(<expression>)

Arithmetic Gives the tolerance parameter of the specified main group axis.
TOLE – 179
function TOLE(<expression>)

Arithmetic Gives the tolerance parameter of the specified sub group axis.
TOLE2 – 180
function TOLE2(<expression>)

Arithmetic Gives the torque setting for the specified axis in the main group.
TORQUE – 180
function TORQUE(<expression>)

Arithmetic Gives the torque setting for the specified axis in the sub group.
TORQUE2 – 180
function TORQUE2(<expression>)

Arithmetic Gives the tip weight parameter of the main robot.


WEIGHT – 181
function WEIGHT

Arithmetic Gives the tip weight parameter of the sub robot.


WEIGHT2 – 181
function WEIGHT2

327
Robot language lists

■ Condition reference

Function
Ref.
Language Type Cond. page
Format

Arithmetic Gives the current arm status of the SCARA robot in the main group.
ARMCND – 168
function ARMCND

Arithmetic Gives the current arm status of the SCARA robot in the sub group. 169
ARMCND2 –
function ARMCND2
Gives the hand system currently selected for the SCARA robot in the main
Arithmetic group.
ARMTYPE – 169
function
ARMTYPE
Gives the hand system currently selected for the SCARA robot in the sub
Arithmetic group.
ARMTYPE2 – 170
function
ARMTYPE2
Gives the return-to-origin machine reference of the specified main group
Arithmetic axis.
MCHREF – 174
function
MCHREF(<expression>)
Gives the return-to-origin machine reference of the specified sub group
Arithmetic axis.
MCHREF2 – 175
function
MCHREF2(<expression>)

■ Communication control

Function
Ref.
Language Type Cond. page
Format

Changes communication mode and initialize the communication port.


ONLINE /
Command ONLINE 1 104
OFFLINE
OFFLINE
Sends the read file data into a write file.
SEND <read file> TO <write file>
SEND Command 1 140
SEND CMU TO ~ (Inputs data from RS-232C port)
SEND ~ TO CMU (Outputs data from RS-232C port)

■ Screen control

Function
Ref.
Language Type Cond. page
Format

Displays the value of specified variable on the MPB screen.


PRINT Command PRINT [<expression>][ , <expression>...][ , ] 1 130
; ;

328
Robot language lists

■ Key control

Function
Ref.
Language Type Cond. page
Format

Assigns a value to the variable specified from the MPB.


INPUT [<prompt statement> ; ] <variable> [, <variable> , ...]
INPUT Command 1 80
, <point variable> <point variable>
<shift variable> <shift variable>

■ Procedure

Function
Ref.
Language Type Cond. page
Format

Calls up sub-procedures defined by the SUB and END SUB statements.


CALL Command 6 39
CALL <label>[(<actual argument>[,<actual argument>...])]
Terminates the sub-procedure defined by the SUB and END SUB
EXIT SUB Command statements. 6 63
EXIT SUB
Does not permit variables declared with a program written outside a sub-
procedure (SUB to END SUB) to be passed on as dummy arguments, but
SHARED Command 6 145
allows them to be referred to with a sub-procedure.
SHARED <variable>[()][,<variable>[()]...]
Defines a sub-procedure.
SUB to END SUB <label>[(<dummy argument> [,<dummy argument>...])]
Command 6 152
SUB :
END SUB

■ Task control

Function
Ref.
Language Type Cond. page
Format

Changes the priority of the specified task.


CHGPRI Command 6 40
CHGPRI Tn,p
Terminates a task currently being executed or temporarily stopped.
CUT Command 6 41
CUT Tn
Terminates its own task currently being executed.
EXIT TASK Command 6 64
EXIT TASK
Restarts a task that is temporarily stopped.
RESTART Command 6 134
RESTART Tn
Sets the task number and priority of the specified task and starts that task.
START Command 6 151
START <label>,Tn,[,p]
Temporarily stops another task being executed.
SUSPEND Command 6 154
SUSPEND Tn

329
Robot language lists

■ Error control

Function
Ref.
Language Type Cond. page
Format

If an error occurs during program execution, this command allows the


program to jump to the error processing routine specified by the label without
ON ERROR
Command stopping the program, or stops the program and displays the error message. 6 101
GOTO
ON ERROR GOTO <label>
0
Resumes the program execution after recovery from an error. This
command is used in the error processing routine.
RESUME Command 6 135
RESUME [ NEXT ]
<label>

ERL Arithmetic Gives the line number where an error occurred.


– 173
function ERL

ERR Arithmetic Gives the error code number when an error occurred.
– 173
function ERR

■ PATH control

Function
Ref.
Language Type Cond. page
Format

Sets the PATH motion on the main robot axis. Command options allow
circular interpolation so that a movement projected on a specified
coordinate plane is circular and also specifying port output at a specified
PATH Command 6 113
position during robot movement.
PATH L , <point definition> [, option [, option...] ]
C
Terminates the path setting for PATH motion.
PATH END Command 6 117
PATH END
Starts the path setting for PATH motion.
PATH SET Command 6 118
PATH SET [<point definition>]
Starts the PATH motion.
PATH START Command 6 120
PATH START

330
Robot language lists

■ Point arithmetic operation

Function
Ref.
Language Type Cond. page
Format

Executes the specified assignment statement.


LET Command 1 81
[LET] <point variable>=<point expression>
Defines a point in a program.
Pn Command 1 131
Pn=x y z r a b
Converts the joint coordinate data (unit: pulses) at the specified point into
Point Cartesian coordinate data (unit: mm, deg) in the main group.
JTOXY – 186
function
JTOXY(<point expression>)
Converts the joint coordinate data (unit: pulses) at the specified point into
Point Cartesian coordinate data (unit: mm, deg) in the sub group.
JTOXY2 – 186
function
JTOXY2(<point expression>)

LOCx Point element Handles point data for each axis and hand system flag. – 14
variable LOCx(<point expression>)
Creates point data specified by a pallet definition number and pallet
Point position number.
PPNT – 186
function
PPNT(pallet definition number, pallet position number)
Point Reads out the current position of the main group robot arm in joint coordinates.
WHERE – 187
function WHERE
Point Reads out the current position of the sub group robot arm in joint coordinates.
WHERE2 – 187
function WHERE2
Converts the Cartesian coordinate data (unit: mm, deg.) in the main group
Point at the specified point into joint coordinate data (unit: pulses).
XYTOJ – 187
function
XYTOJ(<point expression>)
Converts the Cartesian coordinate data (unit: mm, deg.) in the sub group
Point at the specified point into joint coordinate data (unit: pulses).
XYTOJ2 – 188
function
XYTOJ2(<point expression>)

■ Shift arithmetic operation

Function
Ref.
Language Type Cond. page
Format

Executes the specified assignment statement.


LET Command 5 81
[LET] <shift variable>=<shift expression>
Defines shift coordinates in a program.
Sn Command 5 138
Sn=x y z r

LOCx Shift element Handles shift data for each element. 15



variable LOCx(<shift expression>)

331
Robot language lists

■ Arithmetic functions

Function
Ref.
Language Type Cond. page
Format

ABS Arithmetic Gives the absolute value of the specified value. – 167
function ABS(<expression>)

ATN Arithmetic Gives the arctangent of the specified value. – 170


function ATN(<expression>)

COS Arithmetic Gives the cosine of the specified value. – 171


function COS(<expression>)

DEGRAD Arithmetic Converts the specified value into radians. – 172


function DEGRAD(<expression>)

DIST Arithmetic Gives the distance between the specified 2 points. – 173
function DIST(<point expression 1>,<point expression 2>)

INT Arithmetic Gives an integer of the specified value by truncating all decimal fractions. – 173
function INT(<expression>)

LSHIFT Arithmetic Shifts the specified value to the left by the specified number of bits. – 174
function LSHIFT(<expression 1>,<expression 2>)

RADDEG Arithmetic Converts the specified value into degrees. – 177


function RADDEG(<expression>)

RSHIFT Arithmetic Shifts the specified value to the right by the specified number of bits. – 177
function RSHIFT(<expression 1>,<expression 2>)

SIN Arithmetic Gives the sine of the specified value. – 177


function SIN(<expression>)

SQR Arithmetic Gives the square root of the specified value. – 178
function SQR(<expression>)

TAN Arithmetic Gives the tangent of the specified value. – 178


function TAN(<expression>)
Outputs count-up values at 10ms intervals starting from the point when
Arithmetic the TCOUNTER variable is reset.
TCOUNTER – 182
function
TCOUNTER
This is used as a flag that monitors the axis status according to the value
Arithmetic
_SYSFLG specified by the _SYSFLG variable. This should not be used in normal operation. – 182
function
_SYSFLG

332
Robot language lists

■ Character string operation

Function
Ref.
Language Type Cond. page
Format

CHR$ Character Gives the character having a specified character code. – 183
string function CHR$(<expression>)
Extracts a character string with the specified digits from the left end of the
Character specified character string.
LEFT$ – 184
string function
LEFT$(<character string expression>, <expression>)
Arithmetic Acquires the length (number of bytes) of the specified character string.
LEN – 174
function LEN(<character string expression>)
Extracts a character string with the desired length (number of characters)
Character
MID$ from the specified character string. – 184
string function
MID$(<character string expression>,<expression 1>[,<expression 2>])
Acquires the character code of the first character of the specified
Arithmetic
ORD character string. – 175
function
ORD(<character string expression>)
Extracts a character string with the specified digits from the right end of
Character
RIGHT$ the specified character string. – 185
string function
RIGHT$(<character string expression>,<expression>)
Character Converts the specified value into a character string.
STR$ string function STR$(<expression>) – 185

Converts the numeric value of the specified character string into an actual
Arithmetic
VAL function numeric value. – 181
VAL(<character string expression>)

■ Date and time control

Function
Ref.
Language Type Cond. page
Format

DATE$ Character Gives the date in the "yy/mm/dd" format character string. – 183
string function DATE$

TIME$ Character Gives the time in the format "hh:mm:ss" format character string. – 185
string function TIME$

TIMER Arithmetic Gives the current time in seconds, counting from 12:00 midnight as "0:00". – 179
function TIMER

333
Robot language lists

■ Variables

Function
Ref.
Language Type Cond. page
Format


Array <Variable name>[ % ] (<expression>,[<expression>, <expression>])
Array variable – 12
variable !
$
Specifies a point number.
Point
Pn Pnnnn – 14
variable
P"["<expression>"]"
Specifies a shift number.
Shift
Sn Sn – 14
variable
S"["<expression>"]"
Parallel Indicates the parallel input signal status.
DI input DIm([b,...,b]) – 15
variable DI(mb,...,mb)
Parallel Specifies the parallel output signal and indicates the output status.
DO output DOm([b,...,b]) – 16
variable DO(mb,...,mb)

Internal This variable is used for signal exchange with a sequence program.
MO output MOm([b,...,b]) – 17
variable MO(mb,...,mb)
This variable is used for the timer function of a sequence program.
Timer output TOm([b,...,b])
TO – 19
variable
TO(mb,...mb)
Arm lock This variable is used to prohibit axis movement.
LO output LOm([b,...,b]) – 18
variable LO(mb,...,mb)
Indicates the serial input signal status.
Serial input
SI SIm([b,...,b]) – 20
variable
SI(mb,...,mb)
Serial Specifies the serial output signal and indicates the output status.
SO output SOm([b,...,b]) – 21
variable SO(mb,...,mb)
Serial word Indicates the status of serial input word information.
SIW – 22
input variable SIW(m)

Serial double-word Indicates the status of serial input word information in a double word.
SID – 22
input variable SID(m)
Serial word Outputs to the serial output word information and indicate the output status.
SOW – 23
output variable SOW(m)
Outputs the status of serial output word information in a double word and
Serial double-word
SOD output variable indicate the output status. – 23
SOD(m)

* For point element variable (LOCx), see "Point arithmetic operation".


* For shift element variable (LOCx), see "Shift arithmetic operation".

334
MEMO
Revision record

Manual version Issue date Description

Ver. 1.00 Mar. 2005 English manual Ver. 1.00 is based on Japanese manual 2nd edition.
Ver. 2.00 Jun. 2005 English manual Ver. 2.00 is based on Japanese manual Ver. 3.00.
Ver. 2.01 Nov. 2006 English manual Ver. 2.01 is based on Japanese manual Ver. 3.02.

PROGRAMMING MANUAL

Robot Controller

Nov. 2006
Ver. 2.01
This manual is based on Ver. 3.02 of the Japanese manual.

© YAMAHA MOTOR CO., LTD. IM Company


All rights reserved. No part of this publication may be reproduced in
any form without the permission of YAMAHA MOTOR CO., LTD.
Information furnished by YAMAHA in this manual is believed to be
reliable. However, no responsibility is assumed for possible
inaccuracies or omissions. If you find any part unclear in this manual,
please contact YAMAHA or YAMAHA sales representatives.

You might also like