0% found this document useful (0 votes)
7 views200 pages

RCX Series: EGR7137502 E76

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 200

RCX Series

EGR7137502

Ver. 5.02 E76


Introduction
Our sincere thanks for your purchase of this YAMAHA RCX series robot controller.

This manual describes robot program commands and related information for using YAMAHA RCX
series robot controllers. Be sure to read this manual 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 controller user's
manual that comes with the YAMAHA robot controller.

Applicable controllers: RCX240, RCX141, RCX142, RCX40, RCX221 and RCX222

Model names as used in this manual include the following controllers.


RCX240 ... Includes RCX240, RCX141, RCX142 and RCX40 (4-axis controllers)
RCX14x ... Includes RCX141, RCX142 and RCX40 (4-axis controllers excluding RCX240)*
RCX22x ... Includes RCX221 and RCX222 (2-axis controllers)

* Here, "RCX14x" does not include RCX240 and is used when there is a difference between the
RCX240 and other 4-axis controllers due to differences in software versions.
Safety precautions
Be sure to read before using

Before using the YAMAHA robot controller, be sure to read this manual and related manuals, 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.
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 “CAUTION” and “NOTE”.

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 NOTE
Primarily explains function differences, etc., between software versions.

MEMO
Explains robot operation procedures 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 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.
CONTENTS RCX Series
Programming Manual

Chapter 1 Writing Programs


1 The YAMAHA Robot Language 1-1

2 Characters 1-1

3 Program Basics 1-1

4 Program Names 1-2

5 Identifiers 1-7

6 Comment 1-7

7 Command Statement Format 1-8

Chapter 2 Constants
1 Outline 2-1

2 Numeric constants 2-1


2.1 Integer constants 2-1
2.2 Real constants 2-1

3 Character constants 2-2

Chapter 3 Variables
1 Outline 3-1

2 User Variables & System Variables 3-2


2.1 User Variables 3-2
2.2 System Variables 3-2

3 Variable Names 3-3


3.1 Dynamic Variable Names 3-3
3.2 Static Variable Names 3-3

4 Variable Types 3-4


4.1 Numeric variables 3-4
4.2 Character variables 3-4

5 Array variables 3-5

6 Value Assignments 3-5

T-1
CONTENTS RCX Series
Programming Manual

7 Type Conversions 3-6

8 Value Pass-Along & Reference Pass-Along 3-6

9 System Variables 3-7


9.1 Point data variable 3-7
9.2 Shift coordinate variable 3-8
9.3 Point element variable 3-9
9.4 Shift element variable 3-10
9.5 Parallel input variable 3-10
9.6 Parallel output variable 3-11
9.7 Internal output variable 3-12
9.8 Arm lock output variable 3-13
9.9 Timer output variable 3-14
9.10 Serial input variable 3-15
9.11 Serial output variable 3-16
9.12 Serial word input 3-17
9.13 Serial double word input 3-17
9.14 Serial word output 3-18
9.15 Serial double word output 3-18

10 Bit Settings 3-19

11 Valid range of variables 3-20


11.1 Valid range of dynamic variables 3-20
11.2 Valid range of static variables 3-20
11.3 Valid range of dynamic array variables 3-20

12 Clearing variables 3-21


12.1 Clearing dynamic variables 3-21
12.2 Clearing static variables 3-21

Chapter 4 Expressions and Operations


1 Arithmetic operations 4-1
1.1 Arithmetic operators 4-1
1.2 Relational operators 4-1
1.3 Logic operations 4-2
1.4 Priority of arithmetic operation 4-3
1.5 Data format conversion 4-3

2 Character string operations 4-4


2.1 Character string connection 4-4
2.2 Character string comparison 4-4

T-2
CONTENTS RCX Series
Programming Manual

3 Point data format 4-5

4 DI/DO conditional expressions 4-6

Chapter 5 Multiple Robot Control


1 Overview 5-1

2 Command list for each group 5-2

Chapter 6 Multi-tasking
1 Outline 6-1

2 Task definition 6-1

3 Task status and transition 6-2


3.1 Starting tasks 6-2
3.2 Task scheduling 6-3
3.3 Condition wait in task 6-4
3.4 Suspending tasks (SUSPEND) 6-5
3.5 Restarting tasks (RESTART) 6-5
3.6 Deleting tasks 6-6
3.7 Stopping tasks 6-7

4 Multi-task program example 6-8

5 Sharing the data 6-8

6 Cautionary Items 6-9

Chapter 7 Sequence function


1 Sequence function 7-1

2 Creating a sequence program 7-1


2.1 Programming method 7-1
2.2 Compiling 7-2

3 Executing a sequence program 7-4


3.1 Sequence program STEP execution 7-4

4 Creating a sequence program 7-5


4.1 Assignment statements 7-5
4.2 Input/output variables 7-5

T-3
CONTENTS RCX Series
Programming Manual

4.3 Timer definition statement 7-7


4.4 Logical operators 7-7
4.5 Priority of logic operations 7-8
4.6 Sequence program specifications 7-8

Chapter 8 Robot Language Lists


How to read the robot language table 8-1

Command list in alphabetic order 8-3

Function Specific 8-8

Functions: in alphabetic order 8-15

Functions: operation-specific 8-18

1 ABS Acquires absolute values 8-20

2 ABSINIT / ABSINIT2 Resets the current position of a specified axis 8-21

3 ABSRPOS / ABSRPOS2 Acquires a machine reference 8-23

4 ABSRST Absolute motor axis return-to-origin operation 8-24

5 ACCEL / ACCEL2 Specifies/acquires the acceleration coefficient parameter 8-25

6 ARCH / ARCH2 Specifies/acquires the acceleration coefficient parameter 8-26

7 ARMCND / ARMCND2 Arm status acquisition 8-28

8 ARMTYPE / ARMTYPE2 SCARA robot hand system 8-29

9 ATN / ATN2 Acquires the arctangent of the specified value 8-30

10 ASPEED / ASPEED2 Sets the automatic movement speed 8-31

11 AXWGHT / AXWGHT2 Sets/acquires the axis tip weight 8-32

12 CALL Calls a sub-procedure 8-33

13 CHANGE / CHANGE2 Switches the hand 8-34

14 CHGPRI Changes the priority ranking of a specified task 8-35

15 CHR$ Acquires a character with the specified character code 8-36

16 COS Acquires the cosine value of a specified value 8-37

17 CURTRQ / CURTRQ2 Acquires the current torque of the specified axis 8-37

18 CUT Terminates another sub task which is currently being executed 8-38

19 DATE$ Acquires the date 8-39

20 DECEL / DECEL2 Specifies/acquires the deceleration rate parameter 8-40

21 DECLARE Declares that a sub-routine or sub-procedure is to be used within 8-41


the COMMON program

22 DEF FN Defines functions which can be used by the user 8-43

T-4
CONTENTS RCX Series
Programming Manual

23 DEGRAD Angle conversion (angle → radian) 8-44

24 DELAY Program execution waits for a specified period of time 8-45

25 DI Acquires the input status from the parallel port 8-46

26 DIST Acquires the distance between 2 specified points 8-47

27 DIM Declares array variable 8-48

28 DO Outputs to parallel port 8-49

29 DRIVE / DRIVE2 Executes absolute movement of specified axes 8-50

30 DRIVEI / DRIVEI2 Moves the specified robot axes in a relative manner 8-58

31 END SELECT Ends the SELECT CASE statement 8-63

32 END SUB Ends the sub-procedure definition 8-64

33 ERR / ERL Acquires the error code / error line No 8-65

34 EXIT FOR Terminates the FOR to NEXT statement loop 8-66

35 EXIT SUB Terminates the sub-procedure defined by SUB to END 8-67

36 EXIT TASK Terminates its own task which is in progress 8-68

37 FOR to NEXT Performs loop processing until the variable-specified value is exceeded 8-69

38 GOSUB to RETURN Jumps to a sub-routine 8-70

39 GOTO Executes an unconditional jump to the specified line 8-71

40 HALT Stops the program and performs a reset 8-72

41 HAND / HAND2 Defines the hand 8-73


41.1 For SCARA Robots 8-73
41.2 For Cartesian Robots 8-76
42 HOLD Temporarily stops the program 8-78

43 IF Evaluates a conditional expression value, and executes the 8-79


command in accordance with the conditions
43.1 Simple IF statement 8-79
43.2 Block IF statement 8-80
44 INPUT Assigns a value to a variable specified from the programming box 8-81

45 INT Truncates decimal fractions 8-82

46 JTOXY / JTOXY2 Performs axis unit system conversions (pulse → mm) 8-83

47 LABEL Statement Defines labels at program lines 8-84

48 LEFT$ Extracts character strings from the left end 8-85

49 LEFTY / LEFTY2 Sets the SCARA robot hand system as a left-hand system 8-86

50 LEN Acquires a character string length 8-87

51 LET Assigns values to variables 8-88

52 LO Arm lock output 8-91

53 LOCx Specifies/acquires point data or shift data for a specified axis 8-92

T-5
CONTENTS RCX Series
Programming Manual

54 LSHIFT Left-shifts a bit 8-94

55 MCHREF / MCHREF2 Acquires a machine reference 8-95

56 MID$ Acquires a character string from a specified position 8-96

57 MO Outputs a specified value to the MO port (internal output) 8-97

58 MOVE / MOVE2 Performs absolute movement of all robot axes 8-98

59 MOVEI / MOVEI2 Performs absolute movement of all robot axes 8-114

60 OFFLINE Sets a specified communication port to the "offline" mode 8-119

61 ORD Acquires a character code 8-120

62 ON ERROR GOTO Jumps to a specified label when an error occurs 8-121

63 ON to GOSUB Executes the subroutine specified by the <expression> value 8-122

64 ON to GOTO Jumps to the label specified by the <expression> value 8-123

65 ONLINE Sets the specified communication port to the "online" mode 8-124

66 ORGORD / ORGORD2 Specifies/acquires the robot's return-to-origin sequence 8-125

67 ORIGIN Performs an incremental mode axis return-to-origin 8-126

68 OUT Turns ON the specified port output 8-127

69 OUTPOS / OUTPOS2 Specifies/acquires the OUT enable position parameter of the robot 8-128

70 PATH Specifies the main robot axis PATH motion path 8-130

71 PATH END Ends the movement path setting 8-136

72 PATH SET Starts the movement path setting 8-137

73 PATH START Starts the PATH motion 8-139

74 PDEF Defines the pallet used to execute pallet movement commands 8-140

75 PMOVE / PMOVE2 Executes a pallet movement command for the robot 8-141

76 Pn Defines points within a program 8-145

77 PPNT Creates pallet point data 8-147

78 PRINT Displays the specified expression value at the programming box 8-148

79 RADDEG Performs a unit conversion (radians → degrees) 8-149

80 REM Inserts a comment 8-150

81 RESET Turns OFF the bits of specified ports, or clears variables 8-151

82 RESTART Restarts another task during a temporary stop 8-152

83 RESUME Resumes program execution after error recovery processing 8-153

84 RETURN Processing which was branched by GOSUB, is returned to the 8-154


next line after GOSUB

85 RIGHT$ Extracts a character string from the right end of another character string 8-155

86 RIGHTY / RIGHTY2 Sets the SCARA robot hand system to "Right" 8-156

87 RSHIFT Shifts a bit value to the right 8-157

88 Sn Defines the shift coordinates in the program 8-158

T-6
CONTENTS RCX Series
Programming Manual

89 SELECT CASE Executes the specified command block in accordance with the 8-159
<expression> value

90 SEND Sends <read file> data to the <write file> 8-160

91 SERVO / SERVO2 Controls the servo status 8-162

92 SET Turns the bit at the specified output port ON 8-163

93 SHARED Enables sub-procedure referencing without passing on the variable 8-164

94 SHIFT / SHIFT2 Sets the shift coordinates 8-165

95 SIN Acquires the sine value for a specified value 8-166

96 SO Outputs a specified value to the serial port 8-167

97 SPEED / SPEED2 Changes the program movement speed 8-168

98 START Starts a new task 8-169

99 STR$ Converts a numeric value to a character string 8-170

100 SQR Acquires the square root of a specified value 8-171

101 SUB to END SUB Defines a sub-procedure 8-172

102 SUSPEND Temporarily stops another task which is being executed 8-174

103 SWI Switches the program being executed 8-175

104 TAN Acquires the tangent value for a specified value 8-176

105 TCOUNTER Timer & counter 8-177

106 TIME$ Acquires the current time 8-178

107 TIMER Acquires the current time 8-179

108 TO Outputs a specified value to the TO port 8-180

109 TOLE / TOLE2 Specifies/acquires the tolerance parameter 8-181

110 TORQUE / TORQUE2 Specifies/acquires the maximum torque command value which 8-182
can be set for a specified axis

111 TRQSTS / TRQSTS2 Acquires the status when DRIVE statement ends 8-184

112 TRQTIME / TRQTIME2 Sets/acquires the time-out period for the torque limit setting option 8-185

113 VAL Converts character strings to numeric values 8-187

114 WAIT Waits until the conditions of the DI/DO conditional expression are met 8-188

115 WAIT ARM / WAIT ARM2 Waits until the robot axis operation is completed 8-189

116 WEIGHT/WEIGHT2 Specifies/acquires the tip weight parameter 8-190

117 WEND Ends the WHILE statement's command block 8-191

118 WHERE / WHERE2 Acquires the arm's current position (pulse coordinates) 8-192

119 WHILE to WEND Repeats an operation for as long as a condition is met 8-193

120 WHRXY / WHRXY2 Acquires the arm's current position in Cartesian coordinates 8-194

121 XYTOJ / XYTOJ2 Converts the main group axes Cartesian coordinate data ("mm") 8-195
to joint coordinate data ("pulse")

122 _SYSFLG Axis status monitoring flag 8-195

T-7
CONTENTS RCX Series
Programming Manual

Chapter 9 PATH Statements


1 Overview 9-1

2 Features 9-1

3 How to use 9-1

4 Cautions when using this function 9-2

Chapter 10 Limitless motion


1 Overview 10-1

2 Operation Procedure 10-1


2.1 Parameters 10-1
2.2 Robot language 10-1
2.3 Sample program 10-2

3 Restrictions 10-3

Chapter 11 Data file description


1 Overview 11-1
1.1 Data file types 11-1
1.2 Cautions 11-1

2 Program file 11-2


2.1 All programs 11-2
2.2 One program 11-3

3 Point file 11-4


3.1 All points 11-4
3.2 One point 11-6

4 Point comment file 11-8


4.1 All point comments 11-8
4.2 One point comment 11-8

5 Parameter file 11-10


5.1 All parameters 11-10
5.2 One parameter 11-12

6 Shift coordinate definition file 11-13


6.1 All shift data 11-13
6.2 One shift definition 11-14

T-8
CONTENTS RCX Series
Programming Manual

7 Hand definition file 11-15


7.1 All hand data 11-15
7.2 One hand definition 11-16

8 Pallet definition file 11-17


8.1 All pallet definitions 11-17
8.2 One pallet definition 11-20

9 All file 11-23


9.1 All files 11-23

10 Program directory file 11-24


10.1 Entire program directory 11-24
10.2 One program 11-25

11 Parameter directory file 11-26


11.1 Entire parameter directory 11-26

12 Variable file 11-27


12.1 All variables 11-27
12.2 One variable 11-29

13 Constant file 11-30


13.1 One character string 11-30

14 Array variable file 11-31


14.1 All array variables 11-31
14.2 One array variable 11-32

15 DI file 11-33
15.1 All DI information 11-33
15.2 One DI port 11-34

16 DO file 11-35
16.1 All DO information 11-35
16.2 One DO port 11-36

17 MO file 11-37
17.1 All MO information 11-37
17.2 One MO port 11-38

18 LO file 11-39
18.1 All LO information 11-39
18.2 One LO port 11-40

T-9
CONTENTS RCX Series
Programming Manual

19 TO file 11-41
19.1 All TO information 11-41
19.2 One TO port 11-42

20 SI file 11-43
20.1 All SI information 11-43
20.2 One SI port 11-44

21 SO file 11-45
21.1 All SO information 11-45
21.2 One SI port 11-46

22 Error message history file 11-47


22.1 All error message history 11-47

23 Error Message History Details File 11-48


23.1 General error message history details 11-48

24 Machine reference file 11-49


24.1 All machine reference file 11-49

25 EOF file 11-50


25.1 EOF data 11-50

26 Serial port communication file 11-51


26.1 Serial port communication file 11-51

27 SIW file 11-52


27.1 All SIW 11-52
27.2 One SIW data 11-53

28 SOW file 11-54


28.1 All SIW 11-54
28.2 One SOW data 11-55

29 Ethernet port communication file 11-56


29.1 Ethernet port communication file 11-56

Chapter 12 User program examples


1 Basic operation 12-1
1.1 Directly writing point data in program 12-1

T-10
CONTENTS RCX Series
Programming Manual

1.2 Using point numbers 12-2


1.3 Using shift coordinates 12-3
1.4 Palletizing 12-4
1.4.1 Calculating point coordinates 12-4
1.4.2 Utilizing pallet movement 12-6
1.5 DI/DO (digital input and output) operation 12-7

2 Application 12-8
2.1 Pick and place between 2 points 12-8
2.2 Palletizing 12-10
2.3 Pick and place of stacked parts 12-12
2.4 Parts inspection (Multi-tasking example) 12-14
2.5 Sealing 12-17
2.6 Connection to an external device through RS-232C (example 1) 12-18
2.7 Connection to an external device through RS-232C (example 2) 12-19

Chapter 13 Online commands


1 Online Command List 13-1
1.1 Online command list: Function specific 13-1
1.2 Online command list: In alphabetic order 13-4

2 Key operation 13-6


2.1 Changing the mode 13-6
2.2 AUTO mode operation 13-7
2.3 MANUAL mode operation 13-9

3 Utility operation 13-12


3.1 Acquiring the program execution status 13-12
3.2 Copy 13-12
3.3 Erase 13-14
3.4 Rename program name 13-16
3.5 Changing the program attribute 13-16
3.6 Initialize 13-17
3.7 Setting the display language 13-18
3.8 Setting the coordinates and units in MANUAL mode 13-19
3.9 Clearing the programming box error message 13-19
3.10 Setting the UTILITY mode 13-20
3.11 Checking and setting the date 13-22
3.12 Checking and setting the time 13-23

4 Data handling 13-24


4.1 Acquiring the display language 13-24
4.2 Acquiring the access level 13-24

T-11
CONTENTS RCX Series
Programming Manual

4.3 Acquiring the arm status 13-25


4.4 Acquiring the break point status 13-25
4.5 Acquiring the controller configuration status 13-26
4.6 Acquiring the execution level 13-26
4.7 Acquiring the mode status 13-27
4.8 Acquiring the message 13-28
4.9 Acquiring return-to-origin status 13-29
4.10 Acquiring the absolute reset status 13-29
4.11 Acquiring the servo status 13-30
4.12 Acquiring the sequence program execution status 13-30
4.13 Acquiring the speed setting status 13-31
4.14 Acquiring the point coordinates and units 13-31
4.15 Acquiring the version information 13-32
4.16 Acquiring the current positions 13-32
4.17 Acquiring the tasks in RUN or SUSPEND status 13-34
4.18 Acquiring the tasks operation status 13-35
4.19 Acquiring the shift status 13-35
4.20 Acquiring the hand status 13-36
4.21 Acquiring the remaining memory capacity 13-36
4.22 Acquiring the emergency stop status 13-37
4.23 Acquiring the error status by self-diagnosis 13-37
4.24 Acquiring the option slot status 13-38
4.25 Acquiring various values 13-39
4.26 Data readout processing 13-41
4.27 Data write processing 13-42
4.28 Current torque value acquisition 13-43

5 Executing the robot language independently 13-44


5.1 Switching the program 13-44
5.2 Other robot language command processing 13-45

6 Control codes 13-46


6.1 Interrupting the command execution 13-46

Chapter 14 IO commands
1 Overview 14-1

2 IO command format 14-1

3 Sending and receiving IO commands 14-3

4 IO command list 14-5

T-12
CONTENTS RCX Series
Programming Manual

5 IO command description 14-6


5.1 MOVE command 14-6
5.2 MOVEI command 14-7
5.3 Pallet movement command 14-7
5.4 Jog movement command 14-8
5.5 Inching movement command 14-8
5.6 Point teaching command 14-9
5.7 Absolute reset movement command 14-9
5.8 Absolute reset command 14-10
5.9 Return-to-origin command 14-10
5.10 Servo command 14-11
5.11 Manual movement speed change command 14-12
5.12 Auto movement speed change command 14-12
5.13 Program speed change command 14-12
5.14 Shift designation change command 14-13
5.15 Hand designation change command 14-13
5.16 Arm designation change command 14-13
5.17 Point display unit designation command 14-13

Chapter 15 Appendix
1 Reserved word list 15-1

2 Robot Language Lists: Command list in alphabetic order 15-3

3 Robot Language Lists: Function Specific 15-8

4 Functions: in alphabetic order 15-15

5 Functions: operation-specific 15-18

6 Execution Level 15-20

Index

T-13
Chapter 1
Writing Programs

1 1 The YAMAHA Robot Language................. 1-1


2 2 Characters................................................. 1-1
3 3 Program Basics.......................................... 1-1
4 4 Program Names......................................... 1-2
5 5 Identifiers.................................................... 1-7
6 6 Comment................................................... 1-7
7 7 Command Statement Format.................. 1-8
1 The YAMAHA Robot Language
1
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 2
YAMAHA robot language, including actual examples on how its commands are used.

2 Characters 3
The characters and symbols used in the YAMAHA robot language are shown below.
Only 1-byte characters can be used.
•• Alphabetic characters 4
A to Z, a to z
•• Numbers
0 to 9
•• Symbols 5
()[]+-*/^=<>&|~_%!#$:;,."'@?
•• katakana (Japanese phonetic characters)

MEMO • Katakana (Japanese phonetic characters) cannot be entered from a programming box. Katakana 6
can be used when communicating with a host computer (if it handles katakana).
• Spaces are also counted as characters (1 space = 1 character).

7
3 Program Basics

Programs are written in a "1 line = 1 command" format, and every line must contain a command.
n NOTE Blank lines (lines with no command) will cause an error when the program is compiled (creation of
••For sub-procedure details, execution objects). The program's final line, in particular, must not be blank.
refer to the "CALL" and
"SUB ~ END SUB" items.
To increase the program's efficiency, processes which are repeated within the program should be
written as subroutines or sub-procedures which can be called from the main routine. Moreover,
same processing items which occurs in multiple programs should be written as common routines

n
within a program named [COMMON], allowing those processing items to be called from multiple
NOTE programs.
••For details regarding user
defined functions, refer to
the "DEF FN" item. User functions can be defined for specific calculations. Defined user functions are easily called,
allowing even complex calculations to be easily performed.

Multi-task programs can also be used to execute multiple command statements simultaneously in a
parallel processing manner.

Using the above functions allows easy creation of programs which perform complex processing.

The YAMAHA Robot Language 1-1


4 Program Names
1
Each program to be created in the robot controller must have its own name.
Programs can be named as desired provided that the following conditions are satisfied:

2 ■■ Program names may contain no more than 8 characters, comprising a combination of


alphanumeric characters and underscores (_).
■■ Each program must have a unique name (no duplications).

3 The 4 program names shown below are reserved for system operations, and programs with these
names have a special meaning.

AAA FUNCTION
4 BBB SEQUENCE
CCC _SELECT
DDD COMMON

5 The functions of these programs are explained below.

A) FUNCTION

6 Functions Pressing the USER key in “PROGRAM” mode or “MANUAL” mode allows the
user function to be used. When user functions are used in the "PROGRAM" mode,
commands (MOVE, GOTO, etc.) which are frequently used during program editing can
be entered by function keys. When used in “MANUAL” mode, DO output is available
7 with the function keys without running the program. The FUNCTION program defines
function keys which are used to execute user functions. The desired functions can be
freely assigned to the function keys.

SAMPLE
FOR MANUAL MODE
*M_F1: DO(20)ALTERNATE
DO(20)=~DO(20) DO ( 20 ) ON/OFF highlighting
occurs when the key is pressed.
*M_F2: DO(21)ALTERNATE
DO(21)=~DO(21) DO (21) is highlighted.
:
*M_F6: DO(25)MOMENTARY
DO(25)=1 DO (25) is set to "1" when the key is pressed.
DO(25)=0 DO (25) is set to "0" when the key is released.
*M_F7: MOTION
MOVE P,P1 Movement to Point 1 occurs.
MOVE P,P2 Movement to Point 2 occurs.
:
FOR PROGRAM MODE
*P_F1: MOVE P, [MOVE P,] is written to the
program when the key is pressed.
*P_F6: MOVE L, [MOVE L,] is written to the
program when the key is pressed.
*P_F2: GOTO * [GOTO *] is written to the
program when the key is pressed.
:

1-2 Chapter 1 Writing Programs


●● Registering editing function keys used in the PROGRAM mode

Format 1
*P_F <n>: ' <character string>

Values <n> ........................................Denotes the No. of the function key being registered
(n = 1 to 15). 2
<character string>...................The character string which is registered and displayed
for the function key.

MEMO • Although up to 65 characters can be entered for a <character string>, no more than 7 characters 3
are displayed on the Menu.

SAMPLE
*P_F2 MOVE P, Registers "MOVE P," at the
4
[F2] key.
*P_F8 DELAY Registers "DELAY" at the [F8]
key.
5
●● Registering output command function keys used in the MANUAL mode

Format
6
*M_F <n>:' <character string>
<Output statement 1>
<Output statement 2>
7
Values <n>.........................................Denotes the No. of the function key being registered
(n = 1 to 15).
<character string>...................The character string which is displayed for the function
key.
<Input/output statement 1>.....Command statement which is executed when the key
is pressed.
<Input/output statement 2>.....Command statement which is executed when the key
is released

MEMO • Although up to 65 characters can be entered for a <character string>, no more than 7 characters
are displayed on the Menu.

SAMPLE
*M_F2:'MOMENT Displays "MOMENT" at the [F2]
key.
DO(20)=1 DO (20) is turned ON when the
[F2] key is pressed.
DO(20)=0 DO (20) is turned OFF when the
[F2] key is released.
*M_F14 'ALTER Displays "ALTER" at the [F14]
key.
DO(20)=~DO(20) The DO( 20 ) output status is highlighted
when the [F 14 ] key is pressed.

REFERENCE For details, refer to the relevant controller manual.

Program Names 1-3


B) SEQUENCE
1 Functions Unlike standard robot programs, the RCX Controller allows the execution of high-speed-
processing programs (sequence programs) in response to robot inputs and outputs (DI,
DO, MO, LO, TO, SI, SO). Specify a program name of "SEQUENCE" to use this function,
thus creating a pseudo PLC within the controller.
2
When the controller is in the AUTO or MANUAL mode, a SEQUENCE program can
be executed in fixed cycles (regardless of the program execution status) in response
to dedicated DI10 (sequence control input) input signals, with the cycle being
3 determined by the program capacity. For details, see Chapter 7 "4.6 Sequence program
specifications".
This allows sensors, push-button switches, and solenoid valves, etc., to be monitored
and operated by input/output signals.
4 Moreover, because the sequence programs are written in robot language, they can
easily be created without having to use a new and unfamiliar language.

SAMPLE
5 DO(20)=~DI(20)
DO(25)=DI(21) AND DI(22)
MO(26)=DO(26) OR DO(25)
:
6
REFERENCE For details, see Chapter 7 "Sequence function".

1-4 Chapter 1 Writing Programs


C)_SELECT

Functions This function allows the user to create a program which is always selected and executed 1
when the robot program is reset. Specify a program name of "_SELECT" to use this
function. For example, if multiple programs exist, and there is a need to switch between
the programs by using DI inputs, simply create a program-switching program named "_
SELECT". Even if another program is running, the system always returns to this program 2
when a reset input occurs after that program stops. The various reset types and their
corresponding processing are as follows (also refer to the program example shown
below):
3
1. When a reset is executed from the Programming Box, a query displays, asking if
n NOTE a change to "_SELECT" is desired. If "No" is pressed, a selection screen displays,
••For details regarding the allowing the user to select whether or not a reset is to be executed.
"execution level", refer to
the controller manual.
2. When reset by the HALT command in a program, dedicated DI (reset signal) or 4
online command, the system switches to the "_SELECT" program.
3. The operation which occurs at power ON varies according to the "execution level".
If the execution level has been selected as "execute program reset at power ON", a
reset is executed at power ON, and "_SELECT" is then selected. 5
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. 6
When DI3( ) is other than the above cases, the system quits the program that is
currently running.

SAMPLE
ON ERROR GOTO *ER1
7
n NOTE *ST:
••U s i n g a n O N E R R O R SELECT CASE DI3( ) Branching occurs based on the DI3 "( )" value.
statement allows running CASE 0
the program in a loop not
ending in an error even
GOTO *ST If "0", a return to "*ST" occurs,
without the program and the processing is repeated.
name specified by a SWI CASE 1
statement.
SWI <PART1> If "1"
••A n e r r o r c o d e i s s u e d
CASE 2
during execution of the
program is input into a SWI <PART2> If "2"
variable ERR. "ERR=&0303" CASE 3
means "Program doesn’t SWI <PART3> If "3"
exist".
CASE ELSE
GOTO *FIN For any other value, a jump to
"*FIN" occurs, and processing ends.
END SELECT
GOTO *ST
*FIN:
HALT
*ER1:
IF ERR=&H0303 THEN *NEXT_L A return is executed if a "no
program exists" error occurs.
ON ERROR GOTO 0 For any other error, processing ends.
*NEXT_L:
RESUME NEXT

REFERENCE For details, refer to the command explanations given in this manual.

Program Names 1-5


D) COMMON
1 Functions A separate "COMMON" program can be created to perform the same processing in
multiple robot programs. The common processing routine which has been written in the
COMMON program can be called and executed as required from multiple programs.
This enables efficient use of the programming space.
2
The sample COMMON program shown below contains two processing items (obtaining
the distance between 2 points (SUB *DISTANCE), and obtaining the area (*AREA))
which are written as common routines, and these are called from separate programs
3 (SAMPLE 1 and SAMPLE 2).
When SAMPLE1 or SAMPLE2 is executed, the SUB *DISTANCE (A!,B!,C!) and the
*AREA routine specified by the DECLARE statement are executed.

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

Program name: SAMPLE2


7 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 Common routine


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

REFERENCE For details, refer to the command explanations given in this manual.

1-6 Chapter 1 Writing Programs


5 Identifiers
1
"Identifiers" are a combination of characters and numerals used for label names, variable names,
and procedure names. Identifiers can be named as desired provided that the following conditions
are satisfied:
2
■■ Identifiers must consist only of alphanumeric characters and underscores (_). Special symbols
cannot be used, and the identifier must not begin with an underscore (_).
The identifier length must not exceed 16 characters (all characters beyond the 16th character are
3
■■

ignored).
■■ Up to 500 identifiers may be used.
■■ Variable names must not be the same as a reserved word, or the same as a name defined as
a system variable. Moreover, variable name character strings must begin with an alphabetic
character. For label names, however, the "*" mark may be immediately followed by a numeric 4
character.

SAMPLE
LOOP, SUBROUTINE, GET_DATA 5
REFERENCE For details regarding reserved words, see Chapter 15 "1. Reserved word list".

6
6 Comment

Characters which follow REM or an apostrophe mark (" ' ") are processed as a comment. Comment 7
statements are not executed. Moreover, comments may begin at any point in the line.

SAMPLE
REM *** MAIN PROGRAM ***
(Main program)
*** SUBROUTINE ***
(Subroutine)
HALT HALT COMMAND This comment may begin at any
point in the line.

Identifiers 1-7
7 Command Statement Format
1
Format

[<label>:] <statement> [<operand>]


2
One robot language command must be written on a single line and arranged in the format shown
below:

3 •• Items enclosed in [ ] can be omitted.


•• 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.
4 •• The label can be omitted. When using a label, it must always be preceded by an asterisk (*),
and it must end with a colon (:) (the colon is unnecessary when a label is used as a branching
destination).
For details regarding labels, refer to Chapter 8 "45. LABEL Statement".
5 •• Operands may be unnecessary for some commands.
•• Programs are executed in order from top to bottom unless a branching instruction is given.

1 line may contain no more than 75 characters.

1-8 Chapter 1 Writing Programs


Chapter 2
Constants

1 1 Outline........................................................ 2-1
2 2 Numeric constants.................................... 2-1
3 3 Character constants................................. 2-2
1 Outline
1
Constants can be divided into two main categories: "numeric types" and "character types". These
categories are further divided as shown below.

Category Type Details/Range 2


Numeric Integer Decimal constants
type type -1,073,741,824 to 1,073,741,823

3
Binary constants
&B0 to &B11111111
Hexadecimal constants
&H80000000 to &H7FFFFFFF
Real type Single-precision real numbers
-999,999.9 to +999,999.9 4
Exponential format single-precision real numbers
-1.0*1038 to +1.0*1038
Character
type
Character
string
Alphabetic, numeric, special character, or katakana (Japanese)
character string of 75 bytes or less. 5

2 Numeric constants
6
2.1 Integer constants
111 Decimal constants 7
Integers from –1,073,741,824 to 1,073,741,823 may be used.
222 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.
Range: &B0 (decimal: 0) to &B11111111 (decimal: 255)
333 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.
Range: &H80000000 (decimal: -2,147,483,648) to &H7FFFFFFF (decimal: 2,147,483,647)

2.2 Real constants


111 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.)
222 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

MEMO • An integer constant range of –1,073,741,824 to 1,073,741,823 is expressed in signed


hexadecimal number as &HC0000000 to &H3FFFFFFF.

Outline 2-1
3 Character constants
1
Character type constants are character string data enclosed in quotation marks ("). The character
string must not exceed 75 bytes in length, and it may contain upper-case alphabetic characters,
numerals, special characters, or katakana (Japanese) characters.
2 To include a double quotation mark (") in a string, enter two double quotation marks in succession.

SAMPLE
3 "YAMAHA ROBOT"
"EXAMPLE OF""A""" EXAMPLE OF "A"
PRINT "COMPLETED"
"YAMAHA ROBOT"
4

2-2 Chapter 2 Constants


Chapter 3
Variables

1 1 Outline........................................................ 3-1
2 2 User Variables & System Variables.......... 3-2
3 3 Variable Names......................................... 3-3
4 4 Variable Types........................................... 3-4
5 5 Array variables.......................................... 3-5
6 6 Value Assignments.................................... 3-5
7 7 Type Conversions...................................... 3-6
8 8 Value Pass-Along & Reference Pass-Along.... 3-6
9 9 System Variables....................................... 3-7
1110Bit Settings................................................ 3-19
11 11 Valid range of variables......................... 3-20
11 12Clearing variables................................... 3-21
1 Outline
1
There are "user variables" which can be freely defined, and "system variables" which have pre-
defined names and functions.

User variables consist of "dynamic variables" and "static variables". "Dynamic variables" are cleared 2
at program editing, compiling, program resets, and program switching. "Static variables" are not
cleared unless the memory is cleared. The names of dynamic variables can be freely defined, and
array variables can also be used.
3
Variables can be used simply by specifying the variable name and type in the program. A
declaration is not necessarily required. However, array variables must be pre-defined by a DIM
statement.

User variables & system variables


4

Dynamic variables Numeric type Integer variables

5
User variables

Real variables (single-precision)

Character type Character string variables

6
Static variables Numeric type Integer variables

Real variables (single-precision)

Input-output variables Input variables 7


System variables

Output variables
Point data variables

Shift coordinate variables

Element variables Point element variables

Shift element variables

33301-R7-00

REFERENCE For details regarding the above array, see Chapter 3 "5 Array variables".

Outline 3-1
2 User Variables & System Variables
1
2.1 User Variables
Numeric type variables consist of an "integer type" and a "real type", and these two types have
2 different usable numeric value ranges. Moreover, each of these types has different usable variables
(character string variables, array variables, etc.), and different data ranges, as shown below.

Category Variable Type Details/Range


3 Dynamic Numeric type Integer type variables
variables -1,073,741,824 to 1,073,741,823
(Signed hexadecimal constants: &HC0000000 to
&H3FFFFFFF)
4 Real variables (single-precision)
-1.0*1038 to +1.0*1038
Character type Character string variables
Alphabetic, numeric, special character, or katakana
5 (Japanese) character string of 75 bytes or less.
Static Numeric type Integer type variables
variables -1,073,741,824 to 1,073,741,823
Real variables (single-precision)
6 -1.0*1038 to +1.0*1038
Array Numeric type Integer array variables
n NOTE variables -1,073,741,824 to 1,073,741,823
••A r r a y v a r i a b l e s a r e Real number array variables (single-precision)
7
dynamic variables. -1.0*1038 to +1.0*1038
Character type Character string array variables
Alphabetic, numeric, special character, or katakana
(Japanese) character string of 75 bytes or less.

2.2 System Variables


As shown below, system variables have pre-defined names which cannot be changed.

Category Type Details Specific Examples


Input/output Input variable External signal / status inputs DI, SI, SIW, SID
variables
Output variable External signal / status outputs DO, SO, SOW, SOD
Point variable Handles point data Pnnnn
Shift variable Specifies the shift coordinate No. as Sn
a numeric constant or expression.
Element Point element Handles point data for each axis, LOCx
variables variable hand system flag, or for the X-arm (point expression)
or Y-arm rotation information.

Shift element Handles shift data in element units. LOCx


variable (shift expression)

REFERENCE For details, see Section "9 System Variables".

3-2 Chapter 3 Variables


3 Variable Names
1
3.1 Dynamic Variable Names
Dynamic variables can be named as desired, provided that the following conditions are satisfied:
2
■■ The name must consist only of alphanumeric characters and underscores (_). Special symbols
cannot be used.
The name must not exceed 16 characters (all characters beyond the 16th character are ignored).
3
■■

■■ The name must begin with an alphabetic character.

SAMPLE
COUNT Use is permitted
COUNT123 Use is permitted 4
2COUNT Use is not permitted

■■ Variable names must not be the same as a reserved word.


Variable names must not begin with characters used for system variable names (pre-defined 5
variables). These characters include the following: FN, DIn, DOn, MOn, LOn, TOn, SIn, SOn, Pn,
Sn, Hn ("n" denotes a numeric value).

SAMPLE
COUNT Use is permitted
6
ABS (Reserved word)
FNAME (FN: pre-defined variable)
S91 (Sn: pre-defined variable)
7
REFERENCE For details regarding reserved words, see Chapter 15 "1 Reserved word list".

3.2 Static Variable Names


Static variable names are determined as shown below, and these names cannot be changed.

Variable Type Variable Name


Integer variable SGIn (n: 0 to 7)
Real variable SGRn (n: 0 to 7)

Static variables are cleared only when initializing is executed by a SYSTEM mode or online
command.

REFERENCE For details regarding the clearing of static variables, see Section "12 Clearing
variables".

Variable Names 3-3


4 Variable Types
1
The type of variable is specified by the type declaration character attached at the end of the variable
name.
However, because the names of static variables are determined based on their type, no type
2 declaration statement is required.

Type Declaration Character Variable Type Specific Examples


$ Character type variables STR1$
3 % Integer type variables CONT0%, ACT%(1)
! Real type variables CNT1!, CNT1

4 MEMO • If no type declaration character is attached, the variable is viewed as a real type.
• Variables using the same identifier are recognized to be different from each other by the type of
each variable.

5
• ASP_DEF%............. Integer variable
• ASP_DEF................ Real variable )
→ ASP_DEF% and ASP_DEF are different variables.

• ASP_DEF!............... Real variable


• ASP_DEF................ Real variable) → ASP_DEF! and ASP_DEF are the same variables.

6 4.1 Numeric variables


Integer variables
n NOTE
7 ••When a real number is
assigned to an integer
Integer variables and integer array elements can handle an integer from –1,073,741,824 to
1,073,741,823 (in signed hexadecimal, this range is expressed as &HC0000000 to &H3FFFFFFF).
type variable, the
decimal value is rounded
off to the nearest whole Examples: R1% = 10
number. For details, refer
to Chapter 4 "1.5 Data R2%(2) = R1% + 10000
format conversion".
Real variables
n NOTE
••The "!" used in real variables Real variables and real array elements can handle a real number from –1.0*1038 to 1.0*1038.
may be omitted .

Examples: R1! = 10.31


R2!(2)= R1% + 1.98E3

4.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" "YAMAHA MOTOR"

3-4 Chapter 3 Variables


5 Array variables
1
Both numeric and character type arrays can be used at dynamic variables.
Using an array allows multiple same-type continuous data to be handled together.
Each of the array elements is referenced in accordance with the parenthesized subscript which
appears after each variable name. Subscripts may include integers or <expressions> in up to 3 2
dimensions.
In order to use an array, a DIM statement must be declared in advance, and the maximum number
of elements which can be used is the declared subscripts + 1 (0 ~ number of declared subscripts).
3
MEMO • Array variables are all dynamic variables (for details regarding dynamic variables, see Chapter 3
"11 Valid range of variables".)
• The length of an array variable that can be declared with the DIM statement depends on the
program size. 4
Format

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


! 5
$

SAMPLE 6
A%(1) Integer array variable
DATA!(1,10,3) Single-precision real number array

STRING$(10)
variable (3-dimension array)
Character array variable
7

6 Value Assignments

An assignment statement (LET) can also be used to assign a value to a variable.

MEMO • "LET" directly specifies an assignment statement, and it can always be omitted.

Format

[LET] <variable> = <expression>

Write the value assignment target variable on the left side, and write the assignment value or the
<expression> on the right side. The <expression> may be a constant, a variable, or an arithmetic
expression, etc.

REFERENCE For details, refer to Chapter 8 "49 LET (Assignment Statement)"

Array variables 3-5


7 Type Conversions
1
When different-type values are assigned to variables, the data type is converted as described below.

•• When a real number is assigned to an integer type:


2 The decimal value is rounded off to the nearest whole number.
•• When an integer is assigned to a real type:
The integer is assigned as it is, and is handled as a real number.
•• When a numeric value is assigned to a character string type:
3 The numeric value is automatically converted to a character string which is then assigned.
•• When a character string is assigned to numeric type:
This assignment is not possible, and an error will occur at the compiling operation. Use the "VAL"
command to convert the character string to a numeric value, and that value is then assigned.
4

8 Value Pass-Along & Reference Pass-Along


5
A variable can be passed along when a sub-procedure is called by a CALL statement. This pass-
along can occur in either of two ways: as a value pass-along, or as a reference pass-along.

6 Value pass-along

With this method, the variable's value is passed along to the sub-procedure. Even if this value is
changed within the sub-procedure, the content of the call source variable is not changed.
7 A value pass-along occurs when the CALL statement's actual argument specifies a constant, an
expression, a variable, or an array element (array name followed by (<subscript>)).

Reference pass-along

With this method, the variable's reference (address in memory) is passed along to the sub-
procedure. If this value is changed within the sub-procedure, the content of the call source variable
is also changed.
A reference pass-along occurs when the CALL statement's actual argument specifies an entire array
(an array named followed by parenthetical content), or when the actual argument is preceded by
"REF".

Value pass-along & reference pass-along

Value pass-along Reference pass-along

X%=5 X%=5
CALL *TEST( X% ) CALL *TEST( REF X% )
PRINT X% PRINT X%
HALT HALT
SUB ROUTINE SUB ROUTINE
SUB *TEST( A% ) SUB *TEST( A% )
A%=A%*10 A%=A%*10
END SUB END SUB

Execution result: the X% value remains as "5". Execution result: the X% value becomes "50".
33302-R7-00

3-6 Chapter 3 Variables


9 System Variables
1
The following system variables are pre-defined, and other variable names must not begin with the
characters used for these system variable names.

Variable Type Format Meaning 2


Point variable Pnnn / P " ["<expression>"] " Specifies a point number.
Shift variable Sn / S " ["<expression>"] " Specifies the shift number as a constant
or as an expression.
Point element variable LOCx (<point expression>) Handles point data for each axis, hand
3
system flag, or for the X-arm or Y-arm
rotation information.

Shift element variable


Parallel input variable
LOCx (<shift expression>)
DI(mb), DIm(b)
Handles shift data with the element range.
Parallel input signal status.
4
Parallel output variable DO(mb), DOm(b) Parallel output signal setting and status.
Internal output variable MO(mb), MOm(b) Controller's internal output signal setting
and status
5
Arm lock output variable LO(mb), LOm(b) Axis-specific movement prohibit.
Timer output variable TO(mb), TOm(b) For sequence program's timer function.
Serial input variable SI(mb), SIm(b) Serial input signal status.
Serial output variable SO(mb), SOm(b) Serial output signal setting and status. 6
Serial word input SIW(m) Serial input's word information status
Serial double-word input SID(m) Serial input's double-word information
status.
Serial word output SOW(m) Serial output's word information status 7
Serial double-word output SOD(m) Serial output's double-word information
status.

9.1 Point data variable


This variable specifies a point data number with a numeric constant or expression.

Format

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

Values n: Point number ..................... 0 to 9


n NOTE Each bracket in quotation marks ("[" "]") must be written. Brackets are not used to
••I n c o n t r o l l e r s w h o s e indicate an item that may be omitted.
software version is earlier
than 8.28, point numbers
from 0 to 4000 can be Functions A point data number is expressed with a 'P' followed by a number of 4 digits or less, or
specified with point an expression surrounded by brackets ("[" <expression> "]").
variables.
Point numbers from 0 to 9999 can be specified with point variables.

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

System Variables 3-7


9.2 Shift coordinate variable
1 This variable specifies a shift coordinate number with a numeric constant or expression.

Format

Sn or S "["<expression>"]"
2
Values n: Shift number ...................... 0 to 9
Each bracket in quotation marks ("[" "]") must be written. Brackets are not used to
indicate an item that may be omitted.
3
Functions A shift number is expressed with an 'S' followed by a 1-digit number or an expression
surrounded by brackets ("[" <expression> "]").

4 Examples: S1
S[A]
S[BASE]
S[A(10)]
5
MEMO • The "shift coordinate range" for each shift number can be changed from the programming box.

3-8 Chapter 3 Variables


9.3 Point element variable
Specifies point data for each axis, hand system flag, or for the X-arm or Y-arm rotation information. 1
n NOTE
Format
••Hand system flags are
only available from LOCx (<point expression>)
software version 8.08
onwards.
2
Values x.............................................X,Y,Z,R,A,B (axis setting), F (hand system flag setting),
n NOTE F1 (X-arm rotation information), F2 (Y-arm rotation
information).
••Hand system flags are
only valid on SCARA 3
robots, and the point
data must be specified in Functions Extracts the point-data-specified axis coordinates, hand system flag, X-arm rotation
"mm" units. information, and Y-arm rotation information, or changes the value.
••T h e h a n d s y s t e m f l a g
value may be 0 (no
designation), 1 (right-
Examples: A(1)=LOCX(P10) 4
handed system) or 2 (left- The X-axis data of P10 is assigned to array variable A(1).
handed system). LOCZ(P[A])=100.0
••X-arm and Y-arm rotation The Z-axis data of P[A] is set to 100.0.
information is only
available in software LOCF(P100)=1 5
Ver.10.66 onwards. Changing the P100 hand system flag to a right-handed system
••X-arm and Y-arm rotation (The P100 point data must be in "mm" units)
information is only
LOCF1(P100)=1
6
available on a YK500TW
model robot with Changes the P100 X-arm rotation information to 1.
"mm" units point data. (The P100 point data must be in "mm" units)
Attempting to use this
information on any other
LOCF2(P100)=1
robot model will result in Changes the P100 Y-arm rotation information to 1.
the "5.37: Specification
m i s m a t c h " e r r o r, a n d
(The P100 point data must be in "mm" units) 7
execution is stopped. B=LOCX(WHERE)
••For details regarding the Assigns the current X-axis motor pulse value to array variable "B".
X-arm and Y-arm rotation C(3)=LOCX(WHRXY)
information, see Chapter
4 "3. Point data format".
Assigns the current arm position's X-axis to array variable C(3).
D=LOCX(JTOXY(WHERE))
E=LOCX(XYTOJ(WHRXY))

MEMO • Because JTOXY is a command for handling a <point expression>, a "JTOXY(LOCx(WHERE))" or


"XYTOJ(LOCx(WHRXY))" command will result in an error.

n NOTE
••W H R X Y / W H R X Y 2 a r e
available from following
software version.
RCX14x version 8.64 onwards
RCX22x version 9.11 onwards

System Variables 3-9


9.4 Shift element variable
1 This variable is used with shift data for each element.

Format

LOCx (<shift expression>)


2
Values x: Axis setting . ....................... X,Y,Z,R

Functions Extracts the shift-data-specified axis coordinates, or changes the value.


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

9.5 Parallel input variable


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

Format 1

6 DIm([b, ,b])

Format 2

7 DI(mb, ,mb)

Values 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.

Examples: A%=DI1()
Input status of ports DI(17) to DI(10)
is assigned to variable A%.
A 0 to 255 integer can be assigned to 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.)
WAIT DI(21)=1
Waits for DI(21) to change to 1(ON).

MEMO • When specifying multiple bits, specify them from left to right in descending order (large to
small).
• A '0' is entered if there is no actual input board.

3-10 Chapter 3 Variables


9.6 Parallel output variable
Specifies the parallel output signal or indicates the output status. 1
Format 1

DOm([b, ,b])
2
Format 2

DO(mb, ,mb)
3
Values 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.
4
Examples: A%=DO2()
Output status of DO(27) to DO(20) is
assigned to variable A%.
A%=DO5(7,4,0) 5
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) 6
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.) 7
DO3 =B%
Changes to a status in which the DO(37)
to DO(30) output can be indicated by B%.
For example, if B% is "123": If a binary
number is used, "123" will become
"01111011", DO(37) and DO(32) will become
"0", and the other bits will become "1".
DO4(5,4,0)=&B101
DO(45) and DO(40) become "1", and DO(44) becomes "0".

MEMO • When specifying multiple bits, specify them from left to right in descending order (large to
small).
• A '0' is entered if there is no actual input board.

System Variables 3-11


9.7 Internal output variable
1 Specifies the controller's internal output signals and indicates the signal status.

Format 1

MOm([b, ,b])
2
Format 2

MO(mb, ,mb)
3
Values 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.
4
Functions Internal output variables which are used only in the controller, can be changed and referenced.
These variables are used for signal communications, etc., with the sequence program.
Ports 0 and 1 are for dedicated internal output variables which can only be referenced
5 (they cannot be changed).

111 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.
6 222 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.

Bit 7 6 5 4 3 2 1 0
7 Port 0 Axis 8 Axis 7 Axis 6 Axis 5 Axis 4 Axis 3 Axis 2 Axis 1
Origin sensor statuses 0: OFF / 1: ON
Port 1 Axis 8 Axis 7 Axis 6 Axis 5 Axis 4 Axis 3 Axis 2 Axis 1
Hold status 0: RELEASE / 1: HOLD (Axis 1 is not used)

MEMO • Axes where no origin sensor is connected are always ON.


• 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'.

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.)

MEMO • When specifying multiple bits, specify them from left to right in descending order (large to small).

3-12 Chapter 3 Variables


9.8 Arm lock output variable
Specifies axis-specific movement prohibit settings. 1
Format 1

LOm([b, ,b])
2
Format 2

LO(mb, ,mb)
3
Values m : port number ..................... 0
b : bit definition ..................... 0 to 7
• If the bit definition is omitted, bits 0 to 7 are all selected.
4
Functions 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 bit is ON, movement on the corresponding axis is prohibited.
5
Examples: A%=LO0()
Arm lock status of LO(07) to LO(00) is
assigned to variable A%.
A%=LO0(7,4,0) 6
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) 7
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.)

MEMO • When specifying multiple bits, specify them from left to right in descending order (large to
small).
• Servo OFF to ON switching is disabled if an arm lock is in effect at even 1 axis.
• When performing JOG movement in the MANUAL mode, axis movement is possible at axes
where an arm lock status is not in effect, even if an arm lock status is in effect at another axis.
• When executing movement commands from the program, etc., the "12.3 XX.Arm lock" error
will occur if an arm lock status is in effect at the axis in question. (XX: arm lock enabled axis.
Example: M1 S1)

System Variables 3-13


9.9 Timer output variable
1 This variable is used in the timer function of a sequence program.

Format 1

TOm([b, ,b])
2
Format 2

TO(mb, ,mb)
3
Values m : port number ..................... 0
b : bit definition ..................... 0 to 7
• If the bit definition is omitted, bits 0 to 7 are all selected.
4
Functions 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.
5
For details regarding sequence program usage examples, refer to the timer usage examples given in
Chapter 7 "4.2 Input/output variables".

6 Examples: A%=TO0()
Status of TO(07) to TO(00) is assigned
to variable A%.
A%=TO0(7,4,0)
7 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.)

MEMO • When specifying multiple bits, specify them from left to right in descending order (large to
small).

3-14 Chapter 3 Variables


9.10 Serial input variable
This variable is used to indicate the status of serial input signals. 1
Format 1

SIm([b, ,b])
2
Format 2

SI(mb, ,mb
3
Values 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.
4
Examples: A%=SI1()
Input status of ports SI(17) to SI(10)
is assigned to variable A%.
A%=SI5(7,4,0) 5
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) 6
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.) 7
WAIT SI(21)=1
Waits until SI(21) sets to 1 (ON).

MEMO • When specifying multiple bits, specify them from left to right in descending order (large to
small).
• A '0' is entered if there is no actual serial board.

System Variables 3-15


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

Format 1

SOm([b, ,b])
2
Format 2

SO(mb, ,mb)
3
Values 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.
4
Examples: A%=SO2()
Output status of SO(27) to SO(20) is
assigned to variable A%.
5 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.)
6 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
7 (ON), then A%=5.)
SO3()=B%
Changes to a status in which the DO(37)
to DO(30) output can be indicated by B%.
For example, if B% is "123": If a binary
number is used, "123" will become
"01111011", DO(37) and DO(32) will become
"0", and the other bits will become "1".
SO4(5,4,0)=&B101
DO(45) and DO(40) become "1", and DO(44) becomes "0".

MEMO • When specifying multiple bits, specify them from left to right in descending order (large to
small).
• External output is unavailable if the serial port does not actually exist.

3-16 Chapter 3 Variables


9.12 Serial word input
This variable indicates the status of the serial input word information. 1
Format

SIW(m)
2
n NOTE Values m : Port No. 2 to 15
••T h e s e r i a l w o r d i n p u t The acquisition range is 0 (&H0000) to 65535 (&HFFFF).
function is available from
software version 8.08
onwards. Examples: A%=SIW(2) 3
The input state from SIW (2) is
assigned to variable A%.
A%=SIW(15)
The input state from SIW (15) is 4
assigned to variable A%.

• The information is handled as unsigned word data.


MEMO
• '0' is input if the serial port does not actually exist. 5

9.13 Serial double word input 6


This variable indicates the state of the serial input word information as a double word.

Format

SID(m)
7

n NOTE Values m : Port No. 2, 4, 6, 8, 10, 12, 14


••The serial double word The acquisition range is -1073741824 (&HC0000000) to 1073741823 (&H3FFFFFFF).
input function is available
from software version 8.08
onwards. Examples: 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%.

MEMO • The information is handled as signed double word data.


• '0' is input if the serial port does not actually exist.
• An error will occur if the value is not within the acquisition range (&H80000000 to
&HBFFFFFFF, &H40000000 to &H7FFFFFFF.)
• The lower port number data is placed at the lower address.
For example, if SIW(2) =&H2345,SIW(3) =&H0001, then SID(2) =&H000123245.

System Variables 3-17


9.14 Serial word output
1 Outputs to the serial output word information or indicates the output status.

Format

SOW(m)
2
n NOTE Values m : Port No. 2 to 15
••The serial word output The output range is 0 (&H0000) to 65535 (&HFFFF).
function is available from
Note that if a negative value is output, the low-order word information will be output
3 software version 8.08
onwards. after being converted to hexadecimal.

Examples: A%=SOW(2)
The output status from SOW (2) is
4 assigned to variable A%.
SOW(15)=A%
The contents of variable A% are
assigned in SOW (15).
5 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
6 assigned to SOW (15).
-255 is a negative value, so the low-order
word information (&HFF01) will be assigned.

7 MEMO • The information is handled as unsigned word data.


• If a serial board does not actually exist, the information is not output externally.
• If a value exceeding the output range is assigned, the low-order 2-byte information is output.

9.15 Serial double word output


Output the status of serial output word information in a double word, or indicates the output status.

Format

SOD(m)

n NOTE Values m : Port No. 2, 4, 6, 8, 10, 12, 14


••The serial double word The output range is -1073741824 (&HC0000000) to 1073741823 (&H3FFFFFFF).
output function is
available from software
version 8.08 onwards. Examples: A%=SOD(2)
The input status from SOW (2) is assigned to variable A%.
SOD(14)=A%
The contents of variable A% are assigned in SOD (14).

• The information is handled as signed double word data.


• If a serial board does not actually exist, the information is not output externally.
• An error will occur if the value is not within the output range (&H80000000 to &HBFFFFFFF,
&H40000000 to &H7FFFFFFF.)
• The lower port number data is placed at the lower address.
For example, if SOW(2) =&H2345,SOW(3) =&H0001, then SOD(2) =&H000123245.

3-18 Chapter 3 Variables


10 Bit Settings
1
Bits can be specified for input/output variables by any of the following methods.

1. Single bit
2
To specify only 1 of the bits, the target port number and bit number are specified in parentheses.
The port number may also be specified outside the parentheses.

Programming example: DOm(b)DOm(b) 3


Example: DO(25) Specifies bit 5 of port 2.
DO2(5)

2. Same-port multiple bits 4


To specify multiple bits at the same port, those bit numbers are specified in parentheses (separated
by commas) following the port number.
The port number may also be specified in parentheses. 5
Programming example: DOm(b,b,…,b) DO(mb,mb,…,mb)
Example: DO2(7,5,3) Specifies DO(27), DO(25), DO(23)
DO(27,25,23) 6
3. Different-port multiple bits

To specify multiple bits at different ports, the port number and the 2-digit bit number must be 7
specified in parentheses and must be separated by commas.

Programming example: DO(mb,mb,…,mb)


Example: DO(37,25,20) Specifies DO(37), DO(25), DO(20).

4. All bits of 1 port

To specify all bits of a single port, use parentheses after the port number. Methods 2 and 3 shown
above can also be used.

Programming example: DOm()


Example: DO2() Specifies all the DO(27) to DO(20) bits
The same result can be obtained by the following:
DO(27,26,25,24,23,22,21,20)
or,
DO2(7,6,5,4,3,2,1,0)

Bit Settings 3-19


11 Valid range of variables
1
Variable branching occurs as shown below.

11.1 Valid range of dynamic variables


2
Dynamic variables are divided into global variables and local variables, according to their
declaration position in the program. Global and local variables have different valid ranges.

3 Variable Type Explanation


Global variables Variables are declared outside of sub-procedures (outside of
program areas enclosed by a SUB statement and END SUB
statement). These variables are valid throughout the entire program.
4 Local variables Variables are declared within sub-procedures and are valid only in
these sub-procedures.

5 11.2 Valid range of static variables


Static variable data is not cleared when a program reset occurs. Moreover, variable data can be
changed and referenced from any program.
6 The variable names are determined as shown below (they cannot be named as desired).

Variable type Variable name


Integer variable SGIn (n: 0 to 7)
7 Real variable SGRn (n: 0 to 7)

11.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.

Variable Type Explanation


Global variables Variables are declared outside of sub-procedures (outside of
program areas enclosed by a SUB statement and END SUB
statement). These variables are valid throughout the entire program.
Local variables Variables are declared within sub-procedures and are valid only in
these sub-procedures.

MEMO • For details regarding arrays, refer to Chapter 3 "5 Array variables".
• A variable declared at the program level can be referenced from a sub-procedure without
being passed along as a dummy argument, by using the SHARED statement (for details, refer to
Chapter 8 "91 SHARED").

3-20 Chapter 3 Variables


12 Clearing variables
1
12.1 Clearing dynamic variables
In the cases below, numeric variables are cleared to zero, and character variables are cleared to a
null string. The variable array is cleared in the same manner. 2
■■ When a program is edited.
When program switching occurs (including SWI command execution).
3
■■

■■ When program compiling occurs.


■■ When a program reset occurs.
■■ 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. 4
1. Program memory (SYSTEM>INIT>MEMORY>PROGRAM)
2. Entire memory (SYSTEM>INIT>MEMORY>ALL)
■■ When any of the following online commands was executed.
@RESET, @INIT PGM, @INIT MEM, @INIT ALL, @SWI 5
■■ When the HALT statement was executed in the program.

12.2 Clearing static variables


6
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) 7
■■ When any of the following online commands was executed.
@INIT MEM, @INIT ALL

MEMO • Static variable values are not cleared even if the program is edited.

Clearing variables 3-21


Chapter 4
Expressions and Operations

1 1 Arithmetic operations............................... 4-1


2 2 Character string operations..................... 4-4
3 3 Point data format....................................... 4-5
4 4 DI/DO conditional expressions................ 4-6
1 Arithmetic operations
1
1.1 Arithmetic operators
Operators Usage Example Meaning
+ A+B Adds A to B
2
- A-B Subtracts B from A
* A*B Multiplies A by B
/ A/B Divides A by B
3
^ A^B Obtains the B exponent of A (exponent operation)
- -A Reverses the sign of A
MOD A MOD B Obtains the remainder A divided by B

When a "remainder" (MOD) operation involves real numbers, the decimal value is rounded off to 4
the nearest whole number which is then converted to an integer before the calculation is executed.
The result represents the remainder of an integer division operation.

Examples: A=15 MOD 2 A=1(15/2=7....1) 5


A=17.34 MOD 5.98 A=2(17/5=3....2)

1.2 Relational operators


6
Relational operators are used to compare 2 values. If the result is "true", a "-1" is obtained. If it is
"false", a "0" is obtained.

Operators Usage Example Meaning 7


= A=B "-1" if A and B are equal, "0" if not.
<>, >< A<>B "-1" if A and B are unequal, "0" if not.
< A<B "-1" if A is smaller than B, "0" if not.
> A>B "-1" if A is larger than B, "0" if not.
<=, =< A<=B "-1" if A is equal to or smaller than B, "0" if not.
>=, => A>=B "-1" if A is equal to or larger than B, "0" if not.

Examples: A=10>5 → Since 10 > 5 is "true", A = -1.

MEMO • When using equivalence relational operators with real variables and real arrays, the desired
result may not be obtained due to the round-off error.
Examples:..............................A=2
B=SQR(A!)
IF A!=B!*B! THEN...
→ In this case, A! will be unequal to B!*B!.

Arithmetic operations 4-1


1.3 Logic operations
1 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.
2
■■

■■ Logic operations with real numbers convert the values into integers before they are executed.

Operators Functions Meaning


NOT, ~ Logical NOT Reverses the bits.
3 AND, & Logical AND Becomes "1" when both bits are "1".
OR, | Logical OR Becomes "1" when either of the bits is "1".
XOR Exclusive OR Becomes "1" when both bits are different.

4
Examples: A%=NOT 13.05 → "-14" is assigned to A% (reversed after being rounded off to 13).

Bit 7 6 5 4 3 2 1 0
5 13 0 0 0 0 1 1 0 1
NOT 13=-14 1 1 1 1 0 0 1 0

Examples: A%=3 AND 10 → "2" is assigned to A%


6
Bit 7 6 5 4 3 2 1 0
3 0 0 0 0 0 0 1 1
10 0 0 0 0 1 0 1 0
7 3 AND 10 = 4 0 0 0 0 0 0 1 0

Examples: A%=3 OR 10 → "11" is assigned to A%

Bit 7 6 5 4 3 2 1 0
3 0 0 0 0 0 0 1 1
10 0 0 0 0 1 0 1 0
3 OR 10 = 11 0 0 0 0 1 0 1 1

Examples: A%=3 XOR 10 → "9" is assigned to A%

Bit 7 6 5 4 3 2 1 0
3 0 0 0 0 0 0 1 1
10 0 0 0 0 1 0 1 0
3 OR 10 = 11 0 0 0 0 1 0 0 1

4-2 Chapter 4 Expressions and Operations


1.4 Priority of arithmetic operation
Operations are performed in the following order of priority. When two operations of equal priority 1
appear in the same statement, the operations are executed in order from left to right.

Priority Rank Arithmetic Operation


1 Expressions included in parentheses
2
2 Functions, variables
3 ^ (exponents)
4 Independent "+" and "-" signs (monominal operators)
3
5 * (multiplication), / (division)
6 MOD
7 + (addition), - (subtraction)
8 Relational operators 4
9 NOT, ~ (Logical NOT)
10 AND, & (logical AND)
11 OR, |, XOR (Logical OR, exclusive OR)
5
1.5 Data format conversion
Data format is converted in cases where two values of different formats are involved in the same 6
operation.

111 When a real number is assigned to an integer, decimal places are rounded off.
7
Examples: A%=125.67 → A%=126

222 When integers and real numbers are involved in the same operation, the result
becomes a real number.

Examples: A(0)=125 * 0.25 → A(0)=31.25

333 When an integer is divided by an integer, the result is an integer with the remainder
discarded.

Examples: A(0)=100/3 → A(0)=33

Arithmetic operations 4-3


2 Character string operations
1
2.1 Character string connection
Character strings may be combined by using the "+" sign.
2
SAMPLE
A$="YAMAHA"
B$="ROBOT"
3 C$="LANGUAGE"
D$="MOUNTER"
E$=A$+" "+B$+" "+C$
F$=A$+" "+D$
4 PRINT E$
PRINT F$

Results: YAMAHA ROBOT LANGUAGE


5 YAMAHA MOUNTER

2.2 Character string comparison


6
Characters can be compared with the same relational operators as used for numeric values.
Character string comparison can be used to find out the contents of character strings, or to sort
character strings into alphabetical order.
7
■■ 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.
■■ When the character string lengths differ, the longer of the character strings is judged to be the
greater value string.

All examples below are "true".

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

4-4 Chapter 4 Expressions and Operations


3 Point data format
1
There are two types of point data formats: joint coordinate format and Cartesian coordinate format.
n NOTE Point numbers are in the range of 0 to 9999.
••F o r c o n t r o l l e r s w i t h
software versions of 8.28
a n d e a r l i e r, t h e p o i n t Coordinate Format Data Format Explanation 2
numbers which can Joint coordinate ± nnnnnnn This is a decimal integer constant of 7 digits
be specified by point format or less with a plus or minus sign, and can be
variables are 0 to 4000. specified from –6144000 to 6144000.
••The XYZRAB data format
is used for both the joint
Unit: [pulses] 3
coordinate format and Cartesian ± nnn.nn to ± nnnnnnn This is a decimal fraction of a total of 7 digits
the Cartesian coordinate coordinate including 2 or less decimal places.
format. format Unit: [mm] or [degrees]
••P l u s ( + ) s i g n s c a n b e
omitted. 4
••Hand system flags are When setting an extended hand system flag for SCARA robots, set either 1 or 2 at the end of the
only available from 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
software version 8.08
onwards. hand system flag is set.
••X-arm and Y-arm rotation 5
information is only Hand System Data Value
available in software
Ver.10.66 onwards. RIGHTY (right-handed system) 1
LEFTY (left-handed system) 2
6
••X-arm and Y-arm rotation
information is not available
on any robot model
except the YK500TW.
On the YK500TW model robot, the X-arm and Y-arm movement range is extended beyond 360
degrees (The movable range for both the X-arm and Y-arm is -225° to +225°).
Therefore, attempts to convert Cartesian coordinate data ("mm" units) to joint coordinate data (pulse 7
units) will result in multiple solutions, making the position impossible to determine.
In order to obtain the correct robot position and arm posture when converting to joint coordinates,
X-arm and Y-arm rotation information is added after the "mm" units point data's extended hand
system flag.
The Cartesian coordinate data ("mm" units) is then converted to joint coordinate data (pulse units)
according to the specified X-arm and Y-arm rotation information.

To set extended X-arm and Y-arm rotation information at the YK500TW model robot, a "-1", "0",
or "1" value must be specified after the hand system flag. Any other value, or no value, will be
processed as "0".

Arm rotation information Data Value


"mm" → pulse converted angle data x (*1) range: -180° < x <= 180° 0
"mm" → pulse converted angle data x (*1) range: 180° < x <= 540° 1
"mm" → pulse converted angle data x (*1) range: -540° < x <= -180° -1

*1: The joint-coordinates-converted pulse data represents each arm's distance (converted to angular
data) from its mechanical origin point.

Point data format 4-5


4 DI/DO conditional expressions
1
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
2 expressions are shown below.

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

Examples: WAIT DI(31)=1 OR DI(34)=1


→ The program waits until either DI31 or
6 DI34 turns ON.

4-6 Chapter 4 Expressions and Operations


Chapter 5
Multiple Robot Control

1 1 Overview.................................................... 5-1
2 2 Command list for each group.................. 5-2
1 Overview
1
The YAMAHA robot RCX 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. 2
A robot axis is classified into one of the groups below.

Main group (6 axes)


3
■■

■■ Main group (6 axes) + sub-group (2 axes) (when using the YC-LINK option)
■■ Main group (4 axes) + sub-group (4 axes) (when using the YC-LINK option)
■■ Main group (2 axes) + sub-group (2 axes)
■■ Main group (3 axes) + sub-group (3 axes)
(This setting is possible only when using the YC-LINK option and a compatible software version: 4
Ver.8.69 or newer for RCX14x, and Ver.9.16 or newer for RCX22x.)

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. 5
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.

Axes configuration
6
1. For main group only

Main group
Main robot Main auxiliary axis 7
(Number of axes: 1 to 4) (Number of axes: 1 to 4)

2. For main group & sub-group

Main group
Main robot Main auxiliary axis
(Number of axes: 1 or 2) (Number of axes: 1 or 2)

sub-group
Sub robot Sub auxiliary axis
(Number of axes: 1 or 2) (Number of axes: 1 or 2)

3. For 1 robot with no additional axes used

Main group
Main robot Main auxiliary axis
(Number of axes: 1 to 4) (None)

4. When no main additional axes & sub additional axes are set

Main group
Main robot Main auxiliary axis
(Number of axes: 1 or 2) (None)

sub-group
Sub robot Sub auxiliary axis
(Number of axes: 1 or 2) (None)

33501-R7-00

Overview 5-1
2 Command list for each group
1
The special commands and functions for robot movement and coordinate control are shown below.

Operator Main group Sub group


2 Robot movement DRIVE DRIVEI DRIVE2 DRIVEI2
MOVE MOVEI MOVE2 MOVEI2
PMOVE SERVO PMOVE2 SERVO2
WAIT ARM WAIT ARM2
3 Coordinate control CHANGE HAND CHANGE2 HAND2
LEFTY RIGHTY LEFTY2 RIGHTY2
SHIFT SHIFT2
Status change ACCEL ARCH ACCEL2 ARCH2

4
ASPEED AXWEIGHT ASPEED2 AXWEIGHT2
DECEL ORGORD DECEL2 ORGORD2
OUTPOS SPEED OUTPOS2 SPEED2
TOLE WEIGHT TOLE2 WEIGHT2
Point operation JTOXY WHERE JTOXY2 WHERE2
5 XYTOJ WXTOJ2
Parameter reference ACCEL ARCH ACCEL2 ARCH2
AXWEIGHT DECEL AXWEIGHT2 DECEL2
ORGORD OUTPOS ORGORD2 OUTPOS2
TOLE WEIGHT TOLE2 WEIGHT2
6 Status reference ABSRPOS ARMCND ABSRPOS2 ARMCND2
ARMTYPE MCHREF ARMTYPE2 MCHREF2
PATH control PATH PATH END
PATH SET PATH START
7 Torque control DRIVE (with torque limit setting DRIVE2 (with torque limit setting
option) option)
TORQUE TRQSTS TORQUE2 TRQSTS2
TRQTIME CURTRQ TRQTIME2 CURTRQ2

■■ MOVE, MOVEI commands are used at main robot operations, and MOVE2, MOVEI2 commands
are used at sub-robot operations.
■■ An axis specified as an auxiliary axis cannot be moved with the MOVE (MOVE2), MOVEI
(MOVEI2) and PMOVE (PMOVE2) commands. Use the DRIVE (DRIVE2) or DRIVEI (DRIVEI2)
command to move it.
■■ When specifying all axes with the SERVO or SERVO2 command, the servos of all axes in the
main group and sub group can be switched ON or OFF.

MEMO • The restrictions shown below apply to the following software versions: RCX14x…version prior
to Ver.8.64; RCX22x…versions prior to Ver.9.11.
• The MOVE statement's linear and circular interpolations are only possible at Task 1 (main task)
and by direct command.
• The MOVE2 statement can be used only for PTP control. It cannot be used for linear and
circular interpolations.

5-2 Chapter 5 Multiple Robot Control


Chapter 6
Multi-tasking

1 1 Outline........................................................ 6-1
2 2 Task definition............................................ 6-1
3 3 Task status and transition.......................... 6-2
4 4 Multi-task program example................... 6-8
5 5 Sharing the data........................................ 6-8
6 6 Cautionary Items....................................... 6-9
1 Outline
1
The multi-task function performs multiple processing simultaneously in a parallel manner, and can
be used to create programs of higher complexity. Before using the multi-tasking function, read this
section thoroughly and make sure that you fully understand its contents.
Multi-tasking allows executing two or more tasks in parallel. However, this does not mean that 2
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.
3
■■ A maximum of 8 tasks (task 1 to task 8) can be executed in one program.
■■ Tasks can be prioritized and executed in their priority order (higher priority tasks are executed first).
■■ 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. 4
■■ Smaller values have higher priority, and larger values have lower priority
(High priority: 17 ⇔ 47: low priority).

MEMO • In RCX14x software version prior to Ver.8.64, and in RCX22x software versions prior to Ver.9.11, 5
the MOVE statement's linear and circular interpolations are possible only at Task 1 (main task).

2 Task definition 6
A task is a set of instructions within a program which are executed as a single sequence. As
explained below, a task is defined by assigning a label to it.
7
1. Assign a label to the first line of the command block which is to be defined as a task.
2. At the Task 1 (main task) START statement, specify the label which was assigned at step 1
above. Task Nos. are then assigned, and the program starts.

The task definition may call for 2 to 8 subtasks. Task 1 (main task) is automatically defined.

MEMO • Although all tasks are written within a single program, parallel processing occurs at each of the tasks.

SAMPLE
MAIN TASK(TASK1)
START *IOTASK,T2 *IOTASK is started as Task 2
*ST1:
MOVE P,P1,P0
IF DI(20)= 1 THEN
HALT
ENDIF
GOTO *ST
HALT
SUB TASK(TASK2)
*IOTASK: Task 2 begins from here
IF DI(21)=1 THEN
DO(30)=1
ELSE
DO(30)=0
ENDIF
GOTO *IOTASK Task 2 processing ends here
EXIT TASK

Outline 6-1
3 Task status and transition
1
There are 6 types of task status.

111 STOP status


2 A task is present but the task processing is stopped.
222 RUN status
A task is present and the task processing is being executed by the CPU.
333 READY status
3 A task is present and ready to be allocated to the CPU for task processing.
444 WAIT status
A task is present and waiting for an event to begin the task processing.
555 SUSPEND status
4 A task is present but suspended while waiting to begin the task processing.
666 NON EXISTEN status
No tasks exist in the program. (The START command is used to perform a call).

5 Task state transition

CPU assignment

Wait for CPU assignment

6
Resume Cancel waiting Wait condition

SUSPEND READY WAIT RUN

7 Suspend

Stop Stop Start Stop Stop

STOP

Delete Call

NON EXISTEN

33601-R7-00

3.1 Starting tasks


When the program is being executed in the AUTO mode, Task 1 (main task) is automatically
selected and placed in a RUN status when the program begins. Therefore, the delete, forced wait,
forced end commands, etc., cannot be executed for Task 1.
Other tasks (2 to 8 subtasks) will not be called simply by executing the program. The START
command must be used at Task 1 in order to call, start, and place these tasks in a READY status.

MEMO • The RESTART, SUSPEND, EXIT TASK, and CUT commands cannot be executed at Task 1.

6-2 Chapter 6 Multi-tasking


3.2 Task scheduling
Task scheduling determines the priority to be used in allocating tasks in the READY(execution 1
enabled) status to the CPU and executing them.
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. One of these READY status
tasks is then selected and executed (RUN status). 2
Only tasks with the same priority ranking are assigned to a given ready queue. Therefore, where
several tasks with differing priority rankings exist, a corresponding number of ready queues are
created. Tasks within a given ready queue are handled on a first come first serve (FCFS) basis. The 3
task where a READY status is first established has priority. The smaller the number, the higher the
task priority level.

Task scheduling
4
Priority level
The head of the task with the highest priority
Task 1 is put in RUN status.
5
High

32
Task 1 Task 3 Task 4 Ready queue 1

33
Task 5 Ready queue 2 6
34
Task 2 Ready queue 3

Low
Order in which tasks are put in READY status.
7
33602-R7-00

A RUN status task will be moved to the end of the ready queue if placed in a READY status by any
of the following causes:
1) A WAIT status command was executed.
n NOTE 2) The CPU occupation time exceeds a specified time.
••When the prescribed CPU 3) A task with a higher priority level is put in READY status.
occupation time elapses,
the active command is Ready queue
ended, and processing
moves to the next task.
1 RUN status READY status
However, if there are no
other tasks of the same
or higher priority (same
or higher ready queue), Task 1 Task 3 Task 4
the same task will be
executed again.
2 Moves to the end of the ready queue, and Task 3 is executed.

Task 1 Task 3 Task 4 Task 1

3 Moves to the end of the ready queue, and Task 4 is executed.

Task 3 Task 4 Task 1 Task 3

Execution sequence
33603-R7-00

Task status and transition 6-3


3.3 Condition wait in task
1 A task is put in the WAIT status (waiting for an event) when a command causing a wait status is
executed for that task. At this time, the transition to READY status does not take place until the wait
condition is canceled.

2 111 When a command causing a wait status is executed, the following transition happens.
■■ Task for which a command causing a wait status is executed → WAIT status
■■ Task at the head of the ready queue with higher priority → RUN status

3 MEMO • For example, when a MOVE statement (a command that establishes a WAIT status)
is executed, the CPU sends a "MOVE" instruction to the driver, and then waits for a
"MOVE COMPLETED" reply from the driver. This is a "waiting for an event" status.
In this case, a WAIT status is established at the task which executed the MOVE command, and that
4 task is moved to the end of the ready queue. A RUN status is then established at the next task.

5
n NOTE 222 When an event waited by the task in the WAIT status occurs, the following status
transition takes place by task scheduling.
••If multiple tasks are in
WAIT status awaiting the ■■ Task in the WAIT status for which the awaited event occurred → READY status
same condition event, or However, if the task put in the READY status was at the head of the ready queue with the
different condition events
occur simultaneously, all highest priority, the following transition takes place.
6 tasks for which the waited
events occur are put in
1) Task that is currently in RUN status → READY status
2) Task at the head of the ready queue with higher priority → RUN status
READY status.

MEMO • In the above MOVE statement example, the task is moved to the end of the ready queue. Then,
7 when a "MOVE COMPLETED" reply is received, this task is placed in READY status.

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 ACCEL2 ARCH ARCH2
command AXWEIGHT AXWEIGHT2 DECEL DECEL2
OUTPOS OUTPOS2 TOLE TOLE2
ORGORD ORGORD2 WEIGHT WEIGHT2
Robot status CHANGE CHANGE2 SHIFT SHIFT2
change command LEFTY LEFTY2 RIGHTY RIGHTY2
ASPEED ASPEED2 SPEED 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

MEMO • The tasks are not put in WAIT status if the event has been established before the above
commands are executed.

6-4 Chapter 6 Multi-tasking


3.4 Suspending tasks (SUSPEND)
The SUSPEND command temporarily stops tasks other than task 1 and places them in SUSPEND 1
status. The SUSPEND command cannot be used for task 1.
When the SUSPEND command is executed, the status transition takes place as follows.

■■ Task that executed the SUSPEND command → RUN status 2


■■ Specified task → SUSPEND status

Suspending tasks (SUSPEND)

3
SUSPEND

Task 1 Task 2 Task 3 Task 1 Task 3

RUN READY READY RUN


Task 2
READY
4
The task is placed in a SUSPEND status, SUSPEND
and is removed from the ready queue.
33604-R7-00

5
3.5 Restarting tasks (RESTART)
Tasks in the SUSPEND status can be restarted with the RESTART command. However, the RESTART 6
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 status 7
■■ Specified task → READY status

Restarting tasks (RESTART)

RESTART

Task 1 Task 3 Task 1 Task 3 Task 2

RUN READY RUN READY READY


Task 2

SUSPEND The task is placed in a READY status,


and is assigned to a ready queue.
33605-R7-00

Task status and transition 6-5


3.6 Deleting tasks
1 Task self-delete (EXIT TASK)

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.
2 When the EXIT TASK command is executed, the status transition takes place as follows.

■■ Task that executed the EXIT TASK command → NON EXISTEN status
Task at the head of the ready queue with higher priority → RUN status
3
■■

Task self-delete (EXIT TASK)

EXIT TASK

4 Task 2 Task 3 Task 4 Task 3 Task 4

RUN READY READY RUN READY


Task 2

5 The task is placed in a NOT EXISTEN status,


and is removed from a ready queue.
NOT EXISTEN

33606-R7-00

6 Other-task delete (CUT)

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.
7 When the CUT command is executed, the status transition takes place as follows.

■■ Task that executed the CUT command → RUN


■■ Specified task → NON EXISTEN

Other-task delete (CUT)

CUT

Task 2 Task 3 Task 4 Task 2 Task 4

RUN READY READY RUN READY


Task 3

The task is placed in a NOT EXISTEN status, NOT EXISTEN


and is removed from the ready queue.
33607-R7-00

MEMO • If a SUSPEND command is executed for a WAIT-status task, the commands being executed by
that task are ended.
• None of these commands can be executed for Task 1.

6-6 Chapter 6 Multi-tasking


3.7 Stopping tasks
All tasks stop if any of the following cases occurs. 1
111 HALT command is executed. (stop & reset)
The program is reset and all tasks other than task 1 are put in the NON EXISTEN status. Task 1
is put in the STOP status. 2
222 HOLD command is executed. (temporary stop)
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.
333 STOP key on the programming box is pressed or the interlock signal is cut off. 3
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 status (or, the task
is placed in a SUSPEND status after being placed in a READY status).
444 When the emergency stop switch on the programming box is pressed or the 4
emergency stop signal is cut off.
All tasks are put in STOP status. At this point, the power to the robot is shut off and the servo
sets to the non-hold state.
After the canceling emergency stop, when the program is restarted, the tasks in STOP status are 5
set to the READY or SUSPEND status. However, a servo ON is required in order to restart the
robot power supply.

MEMO • When the program is restarted without being reset after the tasks have been stopped by a cause 6
other than 1., then each task is processed from the status in which the task stopped. This holds
true when the power to the controller is turned off and then turned on.

Task status and transition 6-7


4 Multi-task program example
1
Tasks are executed in their scheduled order. An example of a multi-task program is shown below.

SAMPLE
2 TASK1
START *ST2,T2
START *ST3,T3
*ST1:
3 DO(20) = 1
WAIT MO(20) = 1
MOVE P,P1,P2,Z=0
IF MO(21)=1 THEN *FIN
4 GOTO *ST1
*FIN:
CUT T2
HALT
5 TASK2
*ST2: Task 2 begins here.
IF DI(20) = 1
MO(20) = 1
6 DELAY 100
ELSE
MO(20) = 0
ENDIF
7 GOTO *ST2
EXIT TASK Ends here.
TASK3 Task 3 begins here.
*ST3:
IF DI(21) = 0 THEN *ST3
IF DI(30) = 0 THEN *ST3
IF DI(33) = 0 THEN *ST3
MO(21) = 1
EXIT TASK Ends here.

5 Sharing the data

Point data, shift coordinate definition data, hand definition data, pallet definition data, all global
variables and other variables are shared between all tasks.
Execution of each task can be controlled while using the same variables and data shared with the
other tasks.

MEMO • In this case, however, use sufficient caution when rewriting the variable and data because
improper changes may cause trouble in the task processing.

6-8 Chapter 6 Multi-tasking


6 Cautionary Items
1
A silence stop may occur if subtasks are continuously started (START command) and ended (EXIT
TASK command) by a main task in an alternating manner.
This occurs for the following reason: if the main task and subtask priority levels are the same, a task
transition to the main task occurs during subtask END processing, and an illegal task status then 2
occurs when the main task attempts to start a subtask.
Therefore, in order to properly execute the program, the subtask priority level must be set higher
than that of the main task. This prevents a task transition condition from occurring during execution
of the EXIT TASK command. 3
In the sample program shown below, the priority level of task 1 (main task) is set as 32, and the
priority level of task 2 is set as 31 (the lower the value, the higher the priority).

SAMPLE
4
FLAG1 = 0
*MAIN_TASK:
IF FLAG1=0 THEN 5
FLAG1 = 1
START *TASK2,T2,31 Task 2 (*TASK2) is started at the
priority level of 31.
ENDIF 6
GOTO *MAIN_TASK
'==============
' TASK2
'============== 7
*TASK2:
DRIVE(1,P1)
WAIT ARM(1)
DRIVE(1,P2)
WAIT ARM(1)
FLAG1 = 0
EXIT TASK
HALT

Cautionary Items 6-9


Chapter 7
Sequence function

1 1 Sequence function.................................... 7-1


2 2 Creating a sequence program................ 7-1
3 3 Executing a sequence program.............. 7-4
4 4 Creating a sequence program................ 7-5
1 Sequence function
1
Besides normal robot programs, this RCX 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 when a sequence program is running, it is running simultaneously with the robot
program (2 programs are running). 2
When the dedicated "DI10: sequence control input" is ON, the sequence program runs according to
n NOTE its own cycle in the AUTO or MANUAL mode, regardless of robot program starts and stops.
3
••T h e " D O 1 2 : S e q u e n c e The sequence program starts running as soon as the controller is turned on (normally, the MANUAL
program running"
mode), so it can be used to monitor the status of sensors, push button switches, solenoid valves, etc.
dedicated signal output
occurs while a sequence The sequence program can be written in the same robot language used for robot programs. This
program is being eliminates the need to learn a new language and making it easier to program.
executed.
General-purpose outputs are not reset while the sequence function is running, even if a program 4
reset is executed. However, a setting can be specified which allows these outputs to be reset at
the sequence program compiling operation. For details regarding settings required to execute a
sequence program, see section "3 Executing Sequence Programs".
5

2 Creating a sequence program


6
2.1 Programming method
The following explains how to create a sequence program in order to make use of the sequence
function. 7
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.

Naming a sequence program file

34701-R7-00

Sequence function 7-1


Next, input a program. This is no different from the standard robot program creation method.
Commands which can be input are explained later in this manual.
1
Creating a sequence program

34702-R7-00

4
2.2 Compiling
After editing the program, it must be compiled as a sequence program. Compiling is performed in
5 the same way as for robot programs. Press the F5 key on the highest-level screen in "PROGRAM"
mode.

Sequence program

34703-R7-00

A check message appears asking if you want to compile the sequence program. Press the F4 key
to compile the program. To cancel this compiling, press the F5 key. The display changes to the
compiling screen for normal robot programs.
Press the F4 key to compile the sequence program.
Compile the sequence program before compiling the main program.

Compiling the sequence program

34704-R7-00

7-2 Chapter 7 Sequence function


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 When the compiling ends without any error, the program will be listed
from its first line. 1
Compiling error

34705-R7-00 4

MEMO • The sequence execution program is erased and the letter "s" disappears in the following cases.
In these cases the sequence function cannot be used in "UTILITY" mode. 5
1. When the sequence program was erased
2. When the sequence program was edited
3. When normal robot program compiling was performed for the sequence program 6
(The same processing occurs even if the mode is changed to AUTO while in the SEQUENCE
program is selected.)
4. Program data was initialized.
5. A "9.39: Sequence object destroyed.
7
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 program has been
compiled successfully and is ready for use.

Sequence execution program after compiling

34706-R7-00

Creating a sequence program 7-3


3 Executing a sequence program
1
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.

2 1. The sequence execution program has been created by compiling.


2. The sequence function is enabled in "UTILITY" mode.
(For details regarding the UTILITY mode, refer to the controller manual.)
3. The external sequence control input (DI10) contact is closed.
3 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.
4 Sequence program execution in progress

6
34707-R7-00

7 For details regarding the UTILITY mode setting procedure, refer to the controller manual.

3.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 F5 key on the compile screen. Sequence program compiling is canceled and
the normal robot compile screen then appears.
Press the F4 key to compile and create a normal execution program. Then, execute this program
with the STEP statement in "AUTO" mode to check the operation.

Sequence program STEP execution

Press the F5 key.

Press the F4 key.

32708-R7-00

7-4 Chapter 7 Sequence function


4 Creating a sequence program
1
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.
2
4.1 Assignment statements

Format
3
<output variable> =<expression>
<internal auxiliary output variable>
<arm lock output variable>
<timer output variable>
4
Values <expression> ......................... Any one of the following can be used.
• Parallel input/output variables
• Internal auxiliary output variables 5
• Arm lock output variables
• Timer output variables
• Serial input/output variable
• The logic operation expression shown above 6
4.2 Input/output variables
Each variable must be specified in a 1-bit format 7
Correct examples DO(35)
MO(24)
DI(16)
Incorrect examples DO(37, 24)
DI3(4)
MO3()

●● Parallel input variables

Format

DI(mb) m: Port number 0 to 7, 10 to 17, 20 to 27


b: bit definition 0 to 7

These variables show the status of the parallel input signal.

●● Parallel output variables

Format

DO(mb) m: Port number 0 to 7, 10 to 17, 20 to 27


b: bit definition 0 to 7

A parallel output is specified, or the output status is referenced. Ports 0 and 1 are for referencing
only, and no outputs can occur there.

Creating a sequence program 7-5


●● Internal output variables

1 Format

MO(mb) m: Port number 0 to 7, 10 to 17, 20 to 27


b: bit definition 0 to 7

2 These variables are used within the controller and are not output externally. Ports 0 and 1 are for
referencing only, and no outputs can occur there.

●● Arm lock output variables


3
Format

LO(mb) m: port number 0


b: bit definition 0 to 7
4
These variables are used to prohibit the arm movement. Movement is prohibited when ON.
LO(00) to LO(07) corresponds to arm 1 to arm 8.

5 ●● Timer output variables

Format

TO(mb) m: port number 0


6 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.
7
●● Serial input variables

Format

SI(mb) m: Port number 0 to 7, 10 to 17, 20 to 27


b: bit definition 0 to 7

Indicates a serial input signal status. Only referencing can occur. No settings are possible.

●● Serial output variables

Format

SO(mb) m: Port number 0 to 7, 10 to 17, 20 to 27


b: bit definition 0 to 7

Sets or references a serial output signal status. Ports 0 and 1 are for referencing only, and no
outputs can occur there.

7-6 Chapter 7 Sequence function


Timer example
1
SAMPLE
TIM02 2500 Timer 02 is set to 2.5 seconds.
TO(02) DI(23) Timer starts when DI(23)
switches ON. 2
• 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. 3
Timer usage example: Timing chart

DI(23)
4
1.6sec
2.5sec

TO(02) 5
33701-R7-00

4.3 Timer definition statement


6
Format

TIMmb=<time> m: Port number 0


b: bit definition 0 to 7
7
Values <time> ................................... 100 to 999,900msec (0.1 to 999.9 second)

Meaning 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).
However, since the units are set every 100msec, values less than 99msec are truncated.

4.4 Logical operators


Operators Functions Meaning
NOT, ~ Logical NOT Reverses the bits.
AND, & Logical AND Becomes "1" when both bits are "1".
OR, | Logical OR Becomes "1" when either of the bits is "1".

Creating a sequence program 7-7


4.5 Priority of logic operations
1 Priority Ranking Operation Content
1 Expressions in parentheses
2 NOT, ~ (Logical NOT)

2 3 AND, & (Logical AND)


4 OR, | (Logical OR)

●● Example with a ladder statement substitution


3
SAMPLE
DO(23)=DI(16)&DO(35)
MO(34)=DO(25) | ~DI(24)
4 DO(31)=(DI(20) | DO(31))&~DI(21)

Ladder diagram

5
DI(16) DO(35) DO(23)

DO(25) MO(34)

6 ~DI(24)

DI(20) ~DI(21) DO(32)

7 DO(31) (Self-hold circuit)

33702-R7-00

MEMO • NOT cannot be used prior to the first parenthesis " ( " or on the left of an expression. For
example, the following commands cannot be used.
•DO(21)=~(DI(30) | DI(32))
•~DO(30)=DI(22)&DI(27)
• Numeric values cannot be assigned on the right of an expression.
•MO(35)=1
•DO(26)=0
• There is no need to define a "HALT" or "HOLD" statement at the end of the program.
• The I/O and internal auxiliary output variables used in sequence programs are shared with
robot programs, so be careful not to make improper changes when using the same variables
between them.

4.6 Sequence program specifications


Item Specification
Commands Logical NOT, AND, OR
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.)

7-8 Chapter 7 Sequence function


Chapter 8
Robot Language Lists

How to read the robot language table........... 8-1


Command list in alphabetic order................... 8-3
Function Specific............................................... 8-8
Functions: in alphabetic order....................... 8-15
Functions: operation-specific......................... 8-18
1 1 ABS....................................................... 8-20
2 2 ABSINIT / ABSINIT2............................... 8-21
3 3 ABSRPOS / ABSRPOS2......................... 8-23
4 4 ABSRST.................................................. 8-24
5 5 ACCEL / ACCEL2................................. 8-25
6 6 ARCH / ARCH2.................................... 8-26
7 7 ARMCND / ARMCND2......................... 8-28
8 8 ARMTYPE / ARMTYPE2......................... 8-29
9 9 ATN / ATN2........................................... 8-30
11 10 ASPEED / ASPEED2............................... 8-31
11 11 AXWGHT / AXWGHT2.......................... 8-32
11 12 CALL..................................................... 8-33
11 13 CHANGE / CHANGE2.......................... 8-34
11 14 CHGPRI................................................. 8-35
11 15 CHR$..................................................... 8-36
11 16 COS...................................................... 8-37
11 17 CURTRQ / CURTRQ2............................. 8-37
11 18 CUT....................................................... 8-38
11 19 DATE$.................................................... 8-39
22 20 DECEL / DECEL2................................... 8-40
22 21 DECLARE............................................... 8-41
22 22 DEF FN................................................... 8-43
22 23 DEGRAD............................................... 8-44
22 24 DELAY.................................................... 8-45
22 25 DI.......................................................... 8-46
22 26 DIST....................................................... 8-47
22 27 DIM....................................................... 8-48
22 28 DO........................................................ 8-49
22 29 DRIVE / DRIVE2.................................... 8-50
33 30 DRIVEI / DRIVEI2.................................. 8-58
33 31 END SELECT........................................... 8-63
33 32 END SUB................................................ 8-64
33 33 ERR / ERL............................................... 8-65
33 34 EXIT FOR............................................... 8-66
33 35 EXIT SUB................................................ 8-67
33 36 EXIT TASK.............................................. 8-68
33 37 FOR to NEXT......................................... 8-69
33 38 GOSUB to RETURN................................ 8-70
33 39 GOTO................................................... 8-71
44 40 HALT...................................................... 8-72
44 41 HAND / HAND2.................................... 8-73
44 42 HOLD.................................................... 8-78
44 43 IF........................................................... 8-79
44 44 INPUT..................................................... 8-81
44 45 INT......................................................... 8-82
44 46 JTOXY / JTOXY2................................... 8-83
44 47 LABEL Statement.................................. 8-84
44 48 LEFT$..................................................... 8-85
44 49 LEFTY / LEFTY2....................................... 8-86
55 50 LEN........................................................ 8-87
55 51 LET......................................................... 8-88
55 52 LO......................................................... 8-91
55 53 LOCx..................................................... 8-92
55 54 LSHIFT.................................................... 8-94
55 55 MCHREF / MCHREF2............................ 8-95
55 56 MID$..................................................... 8-96
55 57 MO........................................................ 8-97
55 58 MOVE / MOVE2................................... 8-98
55 59 MOVEI / MOVEI2............................... 8-114
66 60 OFFLINE.............................................. 8-119
66 61 ORD.................................................... 8-120
66 62 ON ERROR GOTO............................... 8-121
66 63 ON to GOSUB..................................... 8-122
66 64 ON to GOTO...................................... 8-123
66 65 ONLINE............................................... 8-124
66 66 ORGORD / ORGORD2....................... 8-125
66 67 ORIGIN............................................... 8-126
66 68 OUT..................................................... 8-127
66 69 OUTPOS / OUTPOS2........................... 8-128
77 70 PATH.................................................... 8-130
77 71 PATH END............................................ 8-136
77 72 PATH SET.............................................. 8-137
77 73 PATH START.......................................... 8-139
77 74 PDEF.................................................... 8-140
77 75 PMOVE / PMOVE2............................. 8-141
77 76 Pn........................................................ 8-145
77 77 PPNT.................................................... 8-147
77 78 PRINT................................................... 8-148
77 79 RADDEG............................................. 8-149
88 80 REM..................................................... 8-150
88 81 RESET................................................... 8-151
88 82 RESTART............................................... 8-152
88 83 RESUME............................................... 8-153
88 84 RETURN................................................ 8-154
88 85 RIGHT$................................................ 8-155
88 86 RIGHTY / RIGHTY2.............................. 8-156
88 87 RSHIFT................................................. 8-157
88 88 Sn........................................................ 8-158
88 89 SELECT CASE...................................... 8-159
99 90 SEND................................................... 8-160
99 91 SERVO / SERVO2................................ 8-162
99 92 SET....................................................... 8-163
99 93 SHARED............................................... 8-164
99 94 SHIFT / SHIFT2..................................... 8-165
99 95 SIN...................................................... 8-166
99 96 SO....................................................... 8-167
99 97 SPEED / SPEED2.................................. 8-168
99 98 START................................................... 8-169
99 99 STR$..................................................... 8-170
111 100SQR..................................................... 8-171
111 101SUB to END SUB.................................. 8-172
111 102SUSPEND............................................. 8-174
111 103SWI...................................................... 8-175
111 104TAN..................................................... 8-176
111 105TCOUNTER.......................................... 8-177
111 106TIME$.................................................. 8-178
111 107TIMER.................................................. 8-179
111 108TO....................................................... 8-180
111 109TOLE / TOLE2...................................... 8-181
111 110 TORQUE / TORQUE2........................... 8-182
111 111 TRQSTS / TRQSTS2............................... 8-184
111 112 TRQTIME / TRQTIME2.......................... 8-185
111 113 VAL...................................................... 8-187
111 114 WAIT.................................................... 8-188
111 115 WAIT ARM / WAIT ARM2.................... 8-189
111 116 WEIGHT/WEIGHT2.............................. 8-190
111 117 WEND.................................................. 8-191
111 118 WHERE / WHERE2............................... 8-192
111 119 WHILE to WEND.................................. 8-193
111 120WHRXY / WHRXY2.............................. 8-194
111 121XYTOJ / XYTOJ2................................. 8-195
111 122_SYSFLG.............................................. 8-195
How to read the robot language table
8
The key to reading the following robot language table is explained below.
(1) (2) (3) (4) (5)
| | | | |
No. Function Conditions Direct Type
9
Declares the array variable name and the
DIM 27 number of elements.
6 × Command

(1) No. 10
Indicates the Item No. where this robot language is explained in detail.

Example of "No." column


11
No.

27 DIM
Declares array variable

Format

DIM <array definition> [, <array definition>, ]


12
Format

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


!
$

Values <constant> ............................Array subscript: 0 to 32,767 (positive integer) 13


Explanation Directly 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 a single line by using comma ( , ) breakpoints to separate the arrays.

MEMO • Array subscripts can be "0 to a specified value", with their total number being the <constant> + 1.

14
• A "9.31: Memory full" error may occur depending on the size of each dimension in an
array.

SAMPLE
DIM A%(10) Defines a integer array
variable A% ( 0 ) to A% ( 10 ).
(Number of elements: 11).
DIM B(2,3,4) Defines a real array variable

15
B (0, 0, 0) to B (2, 3, 4).
(Number of elements: 60).
DIM C%(2,2),D!(10) Defines an integer array C%
(0,0) to C% (2,2) and a real
array D! (0) to D! (10).

(2) Function
Explains the function of the robot language.
(3) Condition
Lists the conditions under which command execution is enabled.

Condition 1: Commands that can be executed by both direct commands and online commands.
Condition 2: In addition to Condition 1, commands that execute task 1 (main task) only.
Condition 3: I n addition to condition 1, commands containing operands that cannot be
executed by direct commands or online commands.
Condition 4: In addition to condition 1, commands which are executed after positioning is completed.
Condition 5: MOVE L and MOVE C can be executed by both direct commands and online
commands, although they are executed after positioning is completed.
The STOPON option cannot be executed by direct commands and online commands.
Condition 6: Commands that cannot be executed by direct commands and online commands.

Regarding robot languages which can be used as both commands and functions, the "execution
enabled" conditions for a "command execution" may differ from those for a "function execution".
In such cases, the respective conditions for the command and function are divided by a slash mark (/).
For example, if condition 4 is applies for a "Command", but there are no conditions for the
"Function", this would be expressed as follows: 4/-

How to read the robot language table 8-1


(4) Direct
If " " is indicated at this item, both direct commands and online commands can be used.
8
MEMO • Direct commands are input directly from the programming box while in the AUTO mode, and
are used to perform temporary operations. For details, refer to the controller manual.

9 (5) Type
Indicates the robot language type as "Command" or "Function".
When a command is used as both a "Command" and "Function", this is expressed as follows:
Command/Function
10

11

12

13

14

15

8-2 Chapter 8 Robot Language Lists


Command list in alphabetic order
8
No. Command Function Condition Direct Type

A
1 ABS Acquires the absolute value of a specified value. - - Functions
9
2 ABSINIT Resets the current position of a specified main group axis. 4 Command Statements
2 ABSINIT2 Resets the current position of a specified sub group axis. 4 Command Statements
3 ABSRPOS Acquires the machine reference of the specified
main group axis. (Valid only for axes where the
- - Functions
10
return-to-origin method is set as "mark method".)
3 ABSRPOS2 Acquires the machine reference of the specified sub - - Functions
group axis. (Valid only for axes where the return-to-

4 ABSRST
origin method is set as "mark method".)
Executes a return-to-origin at the robot absolute 4 Command Statements
11
motor axes.
5 ACCEL Specifies/acquires the acceleration coefficient 4/- Command Statements/
parameter of the main group. Functions
5 ACCEL2 Specifies/acquires the acceleration coefficient 4/- Command Statements/ 12
parameter of the sub group. Functions
6 ARCH Specifies/acquires the arch position parameter of the 4/- Command Statements/
main group. Functions
6 ARCH2 Specifies/acquires the arch position parameter of the
sub group.
4/- Command Statements/
Functions
13
7 ARMCND Acquires the current arm status of the main robot. - - Functions
7 ARMCND2 Acquires the current arm status of the sub robot. - - Functions
8
8
ARMTYPE
ARMTYPE2
Acquires the current "hand system" setting of the main robot.
Acquires the current "hand system" setting of the sub robot.
-
-
-
-
Functions
Functions
14
10 ASPEED Changes the AUTO movement speed of the main group. 4 Command Statements
10 ASPEED2 Changes the AUTO movement speed of the sub group. 4 Command Statements
9 ATN Acquires the arctangent of the specified value. - - Functions 15
9 ATN2 Acquires the arctangent of the specified X-Y - - Functions
coordinates.
11 AXWGHT Specifies/acquires the axis tip weight parameter of 4/- Command Statements/
the main group. Functions
11 AXWGHT2 Specifies/acquires the axis tip weight parameter of 4/- Command Statements/
the sub group. Functions

C
12 CALL Executes (calls) another program. 6 Command Statements
13 CHANGE Switches the main robot hand. 4 Command Statements
13 CHANGE2 Switches the sub robot hand. 4 Command Statements
14 CHGPRI Changes the priority ranking of a specified task. 6 Command Statements
15 CHR$ Acquires a character with the specified character code. - - Functions
16 COS Acquires the cosine value of a specified value. - - Functions
17 CURTRQ Acquires the current torque value of the specified - Functions
main group axis.
17 CURTRQ2 Acquires the current torque value of the specified - Functions
sub group axis.
18 CUT Terminates a task currently being executed or 6 Command Statements
temporarily stopped.

D
19 DATE$ Acquires the date as a "yy/mm/dd" format character string. - - Functions

Command list in alphabetic order 8-3


No. Command Function Condition Direct Type

8 20 DECEL Specifies/acquires the deceleration rate parameter


of the main group.
4/- Command Statements/
Functions
20 DECEL2 Specifies/acquires the deceleration rate parameter 4/- Command Statements/
of the sub group. Functions

9
23 DEGRAD Converts a specified value to radians (↔RADDEG). - - Functions
24 DELAY Waits for the specified period (units: ms). 6 Command Statements
27 DIM Declares the array variable name and the number of 6 Command Statements
elements.
26 DIST Acquires the distance between 2 specified points. - - Functions
10 28 DO Outputs a specified value to the DO port. 1 Command Statements
29 DRIVE Moves a specified main group axis to an absolute position. 4 Command Statements
29 DRIVE (With T-option) Executes an absolute movement 4 Command Statements
command for a specified axis.
11 29 DRIVE2 Moves a specified sub group axis to an absolute position. 4 Command Statements
30 DRIVEI Moves a specified main group axis to a relative position. 4 Command Statements
30 DRIVEI2 Moves a specified sub group axis to a relative position. 4 Command Statements

E
12
33 ERL Gives the line No. where an error occurred. - - Functions
33 ERR Gives the error code number of an error which has occurred. - - Functions
34 EXIT FOR Terminates the FOR to NEXT statement loop. 6 Command Statements

13 36 EXIT TASK Terminates its own task which is in progress. 6 Command Statements

F
37 FOR to NEXT Controls repetitive operations. Executes the FOR to NEXT 6 Command Statements
statement repeatedly until a specified value is reached.
14 G
38 GOSUB to Jumps to a subroutine with the label specified by a 6 Command Statements
RETURN GOSUB statement, and executes that subroutine.
39 GOTO Unconditionally jumps to the line specified by a label. 6 Command Statements
15 H
40 HALT Stops the program and performs a reset. 6 Command Statements
41 HAND Defines the main robot hand. 4 Command Statements
41 HAND2 Defines the sub robot hand. 4 Command Statements
42 HOLD Temporarily stops the program. 6 Command Statements

I
43 IF Allows control flow to branch according to conditions. 6 Command Statements
44 INPUT Assigns a value to a variable specified from the 1 Command Statements
programming box.
45 INT Acquires an integer for a specified value by - - Functions
truncating all decimal fractions.

J
46 JTOXY Converts joint coordinate data to main group - - Functions
Cartesian coordinate data. (↔XYTOJ)
46 JTOXY2 Converts joint coordinate data to sub group - - Functions
Cartesian coordinate data. (↔XYTOJ2)

L
48 LEFT$ Extracts a character string comprising a specified - - Functions
number of digits from the left end of a specified
character string.
49 LEFTY Sets the main robot hand system to "Left". 4 Command Statements

8-4 Chapter 8 Robot Language Lists


No. Command Function Condition Direct Type
49 LEFTY2 Sets the sub robot hand system to "Left". 4 Command Statements 8
50 LEN Acquires the length (number of bytes) of a specified - - Functions
character string.
51 LET Executes a specified assignment statement. 1 Command Statements
52 LO Outputs a specified value to the LO port to enable/
disable axis movement.
1 Command Statements
9
53 LOCx Specifies/acquires point data or shift data for a - - Command Statements/
specified axis. Functions
54 LSHIFT Shifts a value to the left by the specified number of - - Functions
bits. (↔RSHIFT) 10
M
55 MCHREF Acquires the return-to-origin or absolute-search - - Functions
machine reference for a specified main group axis.
55 MCHREF2 Acquires the return-to-origin or absolute-search - - Functions 11
machine reference for a specified sub group axis.
56 MID$ Extracts a character string of a desired length from a - - Functions
specified character string.
57 MO Outputs a specified value to the MO port. 1 Command Statements 12
58 MOVE Performs absolute movement of all main robot axes. 5 Command Statements
58 MOVE2 Performs absolute movement of all sub robot axes. 5 Command Statements
59 MOVEI Performs relative movement of all main robot axes. 4 Command Statements
59 MOVEI2 Performs relative movement of all sub robot axes. 4 Command Statements 13
O
60 OFFLINE Sets a specified communication port to the "offline" mode. 1 Command Statements
62 ON ERROR
GOTO
If an error occurs during program execution, this command
allows the program to jump to the error processing routine
6 Command Statements
14
specified by the label without stopping the program, or it
stops the program and displays the error message.
63 ON to GOSUB Jumps to a subroutine with labels specified by 6 Command Statements
a GOSUB statement in accordance with the
conditions, and executes that subroutine. 15
64 ON to GOTO Jumps to label-specified lines in accordance with the 6 Command Statements
conditions.
65 ONLINE Sets the specified communication port to the "online" mode. 1 Command Statements
61 ORD Acquires the character code of the first character in - - Functions
a specified character string.
66 ORGORD Specifies/acquires the axis sequence parameter 4/- Command Statements/
for performing return-to-origin and absolute search Functions
operations in the main group.
66 ORGORD2 Specifies/acquires the axis sequence parameter 4/- Command Statements/
for performing return-to-origin and absolute search Functions
operations in the sub group.
67 ORIGIN Executes a return-to-origin for incremental specs. axes. 4 Command Statements
68 OUT Turns ON the bits of the specified output ports and 6 Command Statements
the command statement ends.
69 OUTPOS Specifies/acquires the OUT enable position 4/- Command Statements/
parameter of the main group. Functions
69 OUTPOS2 Specifies/acquires the OUT enable position 4/- Command Statements/
parameter of the sub group. Functions

P
70 PATH Sets the movement path. 6 Command Statements
71 PATH END Ends the movement path setting. 6 Command Statements
72 PATH SET Starts the movement path setting. 6 Command Statements

Command list in alphabetic order 8-5


No. Command Function Condition Direct Type

8 73 PATH START Starts the PATH motion. 6 Command Statements


74 PDEF Defines the pallet used to execute pallet movement 1 Command Statements
commands.
75 PMOVE Executes the main robot pallet movement command. 4 Command Statements

9 75 PMOVE2 Executes the sub robot pallet movement command. 4 Command Statements
76 Pn Defines points within a program. 1 Command Statements
77 PPNT Creates point data specified by a pallet definition - - Functions
number and pallet position number.

10 78 PRINT Displays a character string at the programming box screen. 1 Command Statements

R
79 RADDEG Converts a specified value to degrees. (↔DEGRAD) - - Functions
80 REM Expresses a comment statement. 6 Command Statements
11 81 RESET Turns the bit of a specified output port OFF. 1 Command Statements
82 RESTART Restarts another task during a temporary stop. 6 Command Statements
83 RESUME Resumes program execution after error recovery 6 Command Statements
processing.
12 85 RIGHT$ Extracts a character string comprising a specified - - Functions
number of digits from the right end of a specified
character string.
86 RIGHTY Sets the main robot hand system to "Right". 4 Command Statements

13 86
87
RIGHTY2
RSHIFT
Sets the sub robot hand system to "Right".
Shifts a value to the right by the specified number of
4
- -
Command Statements
Functions
bits. (↔LSHIFT)

S
14 88 Sn Defines the shift coordinates within the program. 4 Command Statements
89 SELECT CASE Allows control flow to branch according to conditions. 6 Command Statements
to END SELECT
90 SEND Sends a file. 1 Command Statements

15 91 SERVO Controls the servo ON/OFF of specified main group


axes or all main group axes.
4 Command Statements

91 SERVO2 Controls the servo ON/OFF of specified sub group 4 Command Statements
axes or all sub group axes.
92 SET Turns the bit at the specified output port ON. 3 In part Command Statements

94 SHIFT Sets the shift coordinates for the main robot by using 4 Command Statements
the shift data specified by a shift variable.
94 SHIFT2 Sets the shift coordinates for the sub robot by using 4 Command Statements
the shift data specified by a shift variable.
95 SIN Acquires the sine value for a specified value. - - Functions
96 SO Outputs a specified value to the SO port. 1 Command Statements
97 SPEED Changes the main group's program movement speed. 4 Command Statements
97 SPEED2 Changes the sub group's program movement speed. 4 Command Statements
98 START Specifies the task number and priority ranking of a 6 Command Statements
specified task, and starts that task.
99 STR$ Converts a specified value to a character string (↔VAL) - - Functions
100 SQR Acquires the square root of a specified value. - - Functions
102 SUSPEND Temporarily stops another task which is being executed. 6 Command Statements
103 SWI Switches the program being executed, performs 2 Command Statements
compiling, then begins execution from the first line.

T
104 TAN Acquires the tangent value for a specified value. - - Functions

8-6 Chapter 8 Robot Language Lists


No. Command Function Condition Direct Type
105 TCOUNTER Outputs count-up values at 10ms intervals starting
from the point when the TCOUNTER variable is reset.
- - Functions 8
106 TIME$ Acquires the current time as an "hh:mm:ss" format - - Functions
character string.

9
107 TIMER Acquires the current time in seconds, counting from - - Functions
12:00 midnight.
108 TO Outputs a specified value to the TO port. 1 Command Statements
109 TOLE Specifies/acquires the main group tolerance 4/- Command Statements/
parameter. Functions
109 TOLE2 Specifies/acquires the sub group tolerance 4/- Command Statements/ 10
parameter. Functions
110 TORQUE Specifies/acquires the maximum torque command 4/- Command Statements/
value which can be set for a specified main group axis. Functions
110 TORQUE2 Specifies/acquires the maximum torque command
value which can be set for a specified sub group axis.
4/- Command Statements/
Functions 11
111 TRQSTS Acquires the command end status for the DRIVE - - Functions
command with torque limit option executed at the
main group.
111 TRQSTS2 Acquires the command end status for the DRIVE - - Functions 12
command with torque limit option executed at the
sub group.
112 TRQTIME Specifies/acquires the current limit time-out period at 1/- Command Statements/
the specified main group axis when using a torque Functions
limit option in the DRIVE statement. 13
112 TRQTIME2 Specifies/acquires the current limit time-out period 1/- Command Statements/
at the specified sub group axis when using a torque Functions
limit setting option in the DRIVE statement.

V 14
113 VAL Converts the numeric value of a specified character - - Functions
string to an actual numeric value. (↔STR$)
W
114 WAIT Waits until the conditions of the DI/DO conditional 6 Command Statements 15
expression are met (with time-out).
115 WAIT ARM Waits until the main group robot axis operation is completed. 6 Command Statements
115 WAIT ARM2 Waits until the sub group robot axis operation is completed. 6 Command Statements
116 WEIGHT Specifies/acquires the main robot tip weight 4/- Command Statements/
parameter. Functions
116 WEIGHT2 Specifies/acquires the sub robot tip weight 4/- Command Statements/
parameter. Functions
118 WHERE Reads out the current position of the main group - - Functions
robot arm in joint coordinates (pulses).
118 WHERE2 Reads out the current position of the sub group robot - - Functions
arm in joint coordinates (pulses).
119 WHILE to WEND Controls repeated operations. 6 Command Statements
120 WHRXY Reads out the current position of the main group - - Functions
arm as Cartesian coordinates (mm, degrees).
120 WHRXY2 Reads out the current position of the sub group arm - - Functions
as Cartesian coordinates (mm, degrees).
X
121 XYTOJ Converts the point variable Cartesian coordinate data - - Functions
to the main group's joint coordinate data (↔JTOXY).
121 XYTOJ2 Converts the point variable Cartesian coordinate data - - Functions
to the sub group's joint coordinate data (↔JTOXY2).
122 _SYSFLG Axis status monitoring flag. - - Functions

Command list in alphabetic order 8-7


Function Specific
8
Program commands
General commands
9
No. Command Function Condition Direct Type
27 DIM Declares the array variable name and the number of 6 Command Statements
elements.
10 51 LET Executes a specified assignment statement. 1 Command Statements
80 REM Expresses a comment statement. 6 Command Statements

Arithmetic commands
11 No. Command Function Condition Direct Type
1 ABS Acquires the absolute value of a specified value. - - Functions
2 ABSINIT Resets the current position of a specified main group 4 Command Statements
axis.
12 2 ABSINIT2 Resets the current position of a specified sub group 4 Command Statements
axis.
9 ATN Acquires the arctangent of the specified value. - - Functions
9 ATN2 Acquires the arctangent of the specified X-Y - - Functions
13 coordinates.
16 COS Acquires the cosine value of a specified value. - - Functions
23 DEGRAD Converts a specified value to radians (↔RADDEG). - - Functions
26 DIST Acquires the distance between 2 specified points. - - Functions
14 45 INT Acquires an integer for a specified value by - - Functions
truncating all decimal fractions.
54 LSHIFT Shifts a value to the left by the specified number of - - Functions
bits. (↔RSHIFT)
15 79 RADDEG Converts a specified value to degrees. (↔DEGRAD) - - Functions
87 RSHIFT Shifts a value to the right by the specified number of - - Functions
bits. (↔LSHIFT)
95 SIN Acquires the sine value for a specified value. - - Functions
100 SQR Acquires the square root of a specified value. - - Functions
104 TAN Acquires the tangent value for a specified value. - - Functions

Date / time

No. Command Function Condition Direct Type


19 DATE $ Acquires the date as a "yy/mm/dd" format character - - Functions
string.
105 TCOUNTER Outputs count-up values at 10ms intervals starting - - Functions
from the point when the TCOUNTER variable is
reset.
106 TIME $ Acquires the current time as an "hh:mm:ss" format - - Functions
character string.
107 TIMER Acquires the current time in seconds, counting from - - Functions
12:00 midnight.

8-8 Chapter 8 Robot Language Lists


Character string operation

No. Command Function Condition Direct Type 8


15 CHR $ Acquires a character with the specified character code. - - Functions
48 LEFT $ Extracts a character string comprising a specified - - Functions
number of digits from the left end of a specified
character string. 9
50 LEN Acquires the length (number of bytes) of a specified - - Functions
character string.
56 MID $ Extracts a character string of a desired length from a - - Functions

61 ORD
specified character string.
Acquires the character code of the first character in - - Functions
10
a specified character string.
85 RIGHT $ Extracts a character string comprising a specified - - Functions
number of digits from the right end of a specified
character string. 11
99 STR $ Converts a specified value to a character string (↔VAL) - - Functions
113 VAL Converts the numeric value of a specified character - - Functions
string to an actual numeric value. (↔STR$)

12
Point, coordinates, shift coordinates

No. Command Function Condition Direct Type


13 CHANGE Switches the main robot hand. 4
13
Command Statements
13 CHANGE2 Switches the sub robot hand. 4 Command Statements
41 HAND Defines the main robot hand. 4 Command Statements
41 HAND2 Defines the sub robot hand. 4 Command Statements
46 JTOXY Converts joint coordinate data to main group
Cartesian coordinate data. (↔XYTOJ)
- - Functions
14
46 JTOXY2 Converts joint coordinate data to sub group - - Functions
Cartesian coordinate data. (↔XYTOJ2)
49 LEFTY Sets the main robot hand system to "Left". 4 Command Statements
49 LEFTY2 Sets the sub robot hand system to "Left". 4 Command Statements 15
76 Pn Defines points within a program. 1 Command Statements
77 PPNT Creates point data specified by a pallet definition - - Functions
number and pallet position number.
86 RIGHTY Sets the main robot hand system to "Right". 4 Command Statements
86 RIGHTY2 Sets the sub robot hand system to "Right". 4 Command Statements
88 Sn Defines the shift coordinates in the program. 4 Command Statements
94 SHIFT Sets the shift coordinates for the main robot by using 4 Command Statements
the shift data specified by a shift variable.
94 SHIFT2 Sets the shift coordinates for the sub robot by using 4 Command Statements
the shift data specified by a shift variable.
121 XYTOJ Converts the point variable Cartesian coordinate data - - Functions
to the main group's joint coordinate data (↔JTOXY).
121 XYTOJ2 Converts the point variable Cartesian coordinate data - - Functions
to the sub group's joint coordinate data (↔JTOXY2).
53 LOCx Specifies/acquires point data or shift data for a - - Command Statements/
specified axis. Functions

Function Specific 8-9


Branching commands
8 No. Command Function Condition Direct Type
34 EXIT FOR Terminates the FOR to NEXT statement loop. 6 Command Statements
37 FOR to NEXT Controls repetitive operations. Executes the FOR to NEXT 6 Command Statements
statement repeatedly until a specified value is reached.
9 38 GOSUB to Jumps to a subroutine with the label specified by a 6 Command Statements
RETURN GOSUB statement, and executes that subroutine.
39 GOTO Unconditionally jumps to the line specified by a label. 6 Command Statements
43 IF Allows control flow to branch according to conditions. 6 Command Statements
10 63 ON to GOSUB Jumps to a subroutine with labels specified by 6 Command Statements
a GOSUB statement in accordance with the
conditions, and executes that subroutine.
64 ON to GOTO Jumps to label-specified lines in accordance with the 6 Command Statements

11 89 SELECT CASE
conditions.
Allows control flow to branch according to conditions. 6 Command Statements
to END SELECT
119 WHILE to WEND Controls repeated operations. 6 Command Statements

12 Error control

No. Command Function Condition Direct Type


62 ON ERROR If an error occurs during program execution, this 6 Command Statements
13 GOTO command allows the program to jump to the error
processing routine specified by the label without
stopping the program, or it stops the program and
displays the error message.

14 83 RESUME Resumes program execution after error recovery 6 Command Statements


processing.
33 ERL Gives the line No. where an error occurred. - - Functions
33 ERR Gives the error code number of an error which has - - Functions
occurred.
15
Program & task control
Program control

No. Command Function Condition Direct Type


12 CALL Executes (calls) another program. 6 Command Statements
40 HALT Stops the program and performs a reset. 6 Command Statements
42 HOLD Temporarily stops the program. 6 Command Statements
103 SWI Switches the program being executed, performs 2 Command Statements
compiling, then begins execution from the first line.

Task control

No. Command Function Condition Direct Type


14 CHGPRI Changes the priority ranking of a specified task. 6 Command Statements
18 CUT Terminates a task currently being executed or 6 Command Statements
temporarily stopped.
36 EXIT TASK Terminates its own task which is in progress. 6 Command Statements
82 RESTART Restarts another task during a temporary stop. 6 Command Statements
98 START Specifies the task number and priority ranking of a 6 Command Statements
specified task, and starts that task.
102 SUSPEND Temporarily stops another task which is being executed. 6 Command Statements

8-10 Chapter 8 Robot Language Lists


Robot control
Robot operations 8
No. Command Function Condition Direct Type
4 ABSRST Executes a return-to-origin at the robot absolute 4 Command Statements
motor axes. 9
13 CHANGE Switches the main robot hand. 4 Command Statements
13 CHANGE2 Switches the sub robot hand. 4 Command Statements
29 DRIVE Moves a specified main group axis to an absolute position. 4 Command Statements
29 DRIVE2 Moves a specified sub group axis to an absolute position. 4 Command Statements 10
30 DRIVEI Moves a specified main group axis to a relative position. 4 Command Statements
30 DRIVEI2 Moves a specified sub group axis to a relative position. 4 Command Statements
41 HAND Defines the main robot hand. 4 Command Statements
41 HAND2 Defines the sub robot hand. 4 Command Statements 11
49 LEFTY Sets the main robot hand system to "Left". 4 Command Statements
49 LEFTY2 Sets the sub robot hand system to "Left". 4 Command Statements
58 MOVE Performs absolute movement of all main robot axes. 5 Command Statements
58 MOVE2 Performs absolute movement of all sub robot axes. 5 Command Statements 12
59 MOVEI Performs relative movement of all main robot axes. 4 Command Statements
59 MOVEI2 Performs relative movement of all sub robot axes. 4 Command Statements
67 ORIGIN Executes a return-to-origin for incremental specs. axes. 4
13
Command Statements
75 PMOVE Executes the main robot pallet movement command. 4 Command Statements
75 PMOVE2 Executes the sub robot pallet movement command. 4 Command Statements
86 RIGHTY Sets the main robot hand system to "Right". 4 Command Statements
86 RIGHTY2 Sets the sub robot hand system to "Right". 4 Command Statements
14
91 SERVO Controls the servo ON/OFF of specified main group 4 Command Statements
axes or all main group axes.
91 SERVO2 Controls the servo ON/OFF of specified sub group 4 Command Statements
axes or all sub group axes.
15
Status acquisition

No. Command Function Condition Direct Type


3 ABSRPOS Acquires the machine reference of the specified - - Functions
main group axis. (Valid only for axes where the
return-to-origin method is set as "mark method".)
3 ABSRPOS2 Acquires the machine reference of the specified sub - - Functions
group axis. (Valid only for axes where the return-to-
origin method is set as "mark method".)
7 ARMCND Acquires the current arm status of the main robot. - - Functions
7 ARMCND2 Acquires the current arm status of the sub robot. - - Functions
8 ARMTYPE Acquires the current "hand system" setting of the - - Functions
main robot.
8 ARMTYPE2 Acquires the current "hand system" setting of the - - Functions
sub robot.
55 MCHREF Acquires the return-to-origin or absolute-search - - Functions
machine reference for a specified main group axis.
55 MCHREF2 Acquires the return-to-origin or absolute-search - - Functions
machine reference for a specified sub group axis.
111 TRQSTS Acquires the command end status for the DRIVE - - Functions
command with torque limit option executed at the
main group.

Function Specific 8-11


No. Command Function Condition Direct Type

8 111 TRQSTS2 Acquires the command end status for the DRIVE - - Functions
command with torque limit option executed at the
sub group.
118 WHERE Reads out the current position of the main group - - Functions
robot arm in joint coordinates (pulses).
9 118 WHERE2 Reads out the current position of the sub group robot - - Functions
arm in joint coordinates (pulses).
120 WHRXY Reads out the current position of the main group - - Functions
arm as Cartesian coordinates (mm, degrees).
10 120 WHRXY2 Reads out the current position of the sub group arm - - Functions
as Cartesian coordinates (mm, degrees).
115 WAIT ARM Waits until the main group robot axis operation is
completed.
11 115 WAIT ARM2 Waits until the sub group robot axis operation is
completed.
6 × Command Statements

Status change
12 No. Command Function Condition Direct Type
5 ACCEL Specifies/acquires the acceleration coefficient 4/- Command Statements/
parameter of the main group. Functions
5 ACCEL2 Specifies/acquires the acceleration coefficient 4/- Command Statements/
13 parameter of the sub group. Functions
6 ARCH Specifies/acquires the arch position parameter of the 4/- Command Statements/
main group. Functions
6 ARCH2 Specifies/acquires the arch position parameter of the 4/- Command Statements/

14 sub group. Functions


10 ASPEED Changes the AUTO movement speed of the main 4 Command Statements
group.
10 ASPEED2 Changes the AUTO movement speed of the sub 4 Command Statements

15 11 AXWGHT
group.
Specifies/acquires the axis tip weight parameter of 4/- Command Statements/
the main group. Functions
11 AXWGHT2 Specifies/acquires the axis tip weight parameter of 4/- Command Statements/
the sub group. Functions
20 DECEL Specifies/acquires the deceleration rate parameter 4/- Command Statements/
of the main group. Functions
20 DECEL2 Specifies/acquires the deceleration rate parameter 4/- Command Statements/
of the sub group. Functions
66 ORGORD Specifies/acquires the axis sequence parameter 4/- Command Statements/
for performing return-to-origin and absolute search Functions
operations in the main group.
66 ORGORD2 Specifies/acquires the axis sequence parameter 4/- Command Statements/
for performing return-to-origin and absolute search Functions
operations in the sub group.
69 OUTPOS Specifies/acquires the OUT enable position 4/- Command Statements/
parameter of the main group. Functions
69 OUTPOS2 Specifies/acquires the OUT enable position 4/- Command Statements/
parameter of the sub group. Functions
74 PDEF Defines the pallet used to execute pallet movement 1 Command Statements
commands.
97 SPEED Changes the main group's program movement 4 Command Statements
speed.
97 SPEED2 Changes the sub group's program movement speed. 4 Command Statements

8-12 Chapter 8 Robot Language Lists


No. Command Function Condition Direct Type
109 TOLE Specifies/acquires the main group tolerance 4/- Command Statements/ 8
parameter. Functions
109 TOLE2 Specifies/acquires the sub group tolerance 4/- Command Statements/
parameter. Functions
116 WEIGHT Specifies/acquires the main robot tip weight
parameter.
4/- Command Statements/
Functions
9
116 WEIGHT2 Specifies/acquires the sub robot tip weight 4/- Command Statements/
parameter. Functions

Path control 10
No. Command Function Condition Direct Type
70 PATH Sets the movement path. 6 Command Statements
71 PATH END Ends the movement path setting. 6 Command Statements
11
72 PATH SET Starts the movement path setting. 6 Command Statements
73 PATH START Starts the PATH motion. 6 Command Statements

Torque control 12
No. Command Function Condition Direct Type
17 CURTRQ Acquires the current torque value of the specified - Functions

13
main group axis.
17 CURTRQ2 Acquires the current torque value of the specified - Functions
sub group axis.
29 DRIVE (With T-option) Executes an absolute movement 4 Command Statements
command for a specified axis.
110 TORQUE Specifies/acquires the maximum torque command 4/- Command Statements/ 14
value which can be set for a specified main group axis. Functions
110 TORQUE2 Specifies/acquires the maximum torque command 4/- Command Statements/
value which can be set for a specified sub group axis. Functions
112 TRQTIME Specifies/acquires the current limit time-out period at 1/- Command Statements/ 15
the specified main group axis when using a torque Functions
limit option in the DRIVE statement.
112 TRQTIME2 Specifies/acquires the current limit time-out period 1/- Command Statements/
at the specified sub group axis when using a torque Functions
limit setting option in the DRIVE statement.

Input/output & communication control


Input/output control

No. Command Function Condition Direct Type


24 DELAY Waits for the specified period (units: ms). 6 Command Statements
28 DO Outputs a specified value to the DO port. 1 Command Statements
52 LO Outputs a specified value to the LO port to enable/ 1 Command Statements
disable axis movement.
57 MO Outputs a specified value to the MO port. 1 Command Statements
68 OUT Turns ON the bits of the specified output ports and 6 Command Statements
the command statement ends.
81 RESET Turns the bit of a specified output port OFF. 1 Command Statements
92 SET Turns the bit at the specified output port ON. 3 In part Command Statements

96 SO Outputs a specified value to the SO port. 1 Command Statements

Function Specific 8-13


No. Command Function Condition Direct Type

8 108 TO Outputs a specified value to the TO port. 1 Command Statements


114 WAIT Waits until the conditions of the DI/DO conditional 6 Command Statements
expression are met (with time-out).

9 Programming box

No. Command Function Condition Direct Type


44 INPUT Assigns a value to a variable specified from the 1 Command Statements
programming box.
10 78 PRINT Displays a character string at the programming box 1 Command Statements
screen.

Communication control
11
No. Command Function Condition Direct Type
65 ONLINE Sets the specified communication port to the "online" 1 Command Statements
mode.

12 60 OFFLINE Sets a specified communication port to the "offline"


mode.
1 Command Statements

90 SEND Sends a file. 1 Command Statements

13 Other
Other

No. Command Function Condition Direct Type


14 122 _SYSFLG Axis status monitoring flag. - - Functions

15

8-14 Chapter 8 Robot Language Lists


Functions: in alphabetic order
8
No. Function Type Function

A
1 ABS Arithmetic function Acquires the absolute value of a specified value.
9
3 ABSRPOS Arithmetic function Acquires the machine reference of the specified main group
axis. (Valid only for axes where the return-to-origin method is set
as "mark method".)
3 ABSRPOS2 Arithmetic function Acquires the machine reference of the specified sub group axis. 10
(Valid only for axes where the return-to-origin method is set as
"mark method".)
5 ACCEL Arithmetic function Acquires the acceleration coefficient parameter of the main group.
5 ACCEL2 Arithmetic function Acquires the acceleration coefficient parameter of the sub group. 11
6 ARCH Arithmetic function Acquires the arch position parameter of the main group.
6 ARCH2 Arithmetic function Acquires the arch position parameter of the sub group.
7 ARMCND Arithmetic function Acquires the current arm status of the main robot.
7 ARMCND2 Arithmetic function Acquires the current arm status of the sub robot. 12
8 ARMTYPE Arithmetic function Acquires the current "hand system" setting of the main robot.
8 ARMTYPE2 Arithmetic function Acquires the current "hand system" setting of the sub robot.
9 ATN Arithmetic function Acquires the arctangent of the specified value.
9 ATN2 Arithmetic function Acquires the arctangent of the specified X-Y coordinates. 13
11 AXWGHT Arithmetic function Acquires the axis tip weight parameter of the main group.
11 AXWGHT2 Arithmetic function Acquires the axis tip weight parameter of the sub group.

C
14
15 CHR$ Character string Acquires a character with the specified character code.
function
16 COS Arithmetic function Acquires the cosine value of a specified value.
17
17
CURTRQ
CURTRQ2
Arithmetic function
Arithmetic function
Acquires the current torque value of the specified main group axis.
Acquires the current torque value of the specified sub group axis.
15
D
19 DATE$ Character string Acquires the date as a "yy/mm/dd" format character string.
function
20 DECEL Arithmetic function Acquires the deceleration rate parameter of the main group.
20 DECEL2 Arithmetic function Acquires the deceleration rate parameter of the sub group.
23 DEGRAD Arithmetic function Converts a specified value to radians (↔RADDEG).
26 DIST Arithmetic function Acquires the distance between 2 specified points.

E
33 ERL Arithmetic function Gives the line No. where an error occurred.
33 ERR Arithmetic function Gives the error code number of an error which has occurred.

I
45 INT Arithmetic function Acquires an integer for a specified value by truncating all
decimal fractions.

J
46 JTOXY Point function Converts joint coordinate data to main group Cartesian
coordinate data. (↔XYTOJ)

Functions: in alphabetic order 8-15


No. Function Type Function

8 46 JTOXY2 Point function Converts joint coordinate data to sub group Cartesian coordinate
data. (↔XYTOJ2)

L
48 LEFT$ Character string Extracts a character string comprising a specified number of
9 function digits from the left end of a specified character string.
50 LEN Arithmetic function Acquires the length (number of bytes) of a specified character
string.
53 LOCx Point function Acquires point data or shift data for a specified axis.
10 54 LSHIFT Arithmetic function Shifts a value to the left by the specified number of bits.
(↔RSHIFT)

M
55 MCHREF Arithmetic function Acquires the return-to-origin or absolute-search machine
11 reference for a specified main group axis.
55 MCHREF2 Arithmetic function Acquires the return-to-origin or absolute-search machine
reference for a specified sub group axis.
56 MID$ Character string Extracts a character string of a desired length from a specified
12 function character string.

O
61 ORD Arithmetic function Acquires the character code of the first character in a specified
character string.
13 66 ORGORD Arithmetic function Acquires the axis sequence parameter for performing return-to-
origin and absolute search operations in the main group.
66 ORGORD2 Arithmetic function Acquires the axis sequence parameter for performing return-to-
origin and absolute search operations in the sub group.

14 69 OUTPOS Arithmetic function Acquires the OUT enable position parameter of the main group.
69 OUTPOS2 Arithmetic function Acquires the OUT enable position parameter of the sub group.

P
77 PPNT Point function Creates point data specified by a pallet definition number and
15 pallet position number.

R
79 RADDEG Arithmetic function Converts a specified value to degrees. (↔DEGRAD)
85 RIGHT$ Character string Extracts a character string comprising a specified number of
function digits from the right end of a specified character string.
87 RSHIFT Arithmetic function Shifts a value to the right by the specified number of bits.
(↔LSHIFT)

S
95 SIN Arithmetic function Acquires the sine value for a specified value.
100 SQR Arithmetic function Acquires the square root of a specified value.
99 STR$ Character string Converts a specified value to a character string (↔VAL)
function

T
104 TAN Arithmetic function Acquires the tangent value for a specified value.
105 TCOUNTER Arithmetic function Outputs count-up values at 10ms intervals starting from the
point when the TCOUNTER variable is reset.
106 TIME$ Character string Acquires the current time as an "hh:mm:ss" format character
function string.
107 TIMER Arithmetic function Acquires the current time in seconds, counting from 12:00
midnight.
109 TOLE Arithmetic function Acquires the main group tolerance parameter.

8-16 Chapter 8 Robot Language Lists


No. Function Type Function
109 TOLE2 Arithmetic function Acquires the sub group tolerance parameter. 8
110 TORQUE Arithmetic function Acquires the maximum torque command value which can be set
for a specified main group axis.
110 TORQUE2 Arithmetic function Acquires the maximum torque command value which can be set

111 TRQSTS Arithmetic function


for a specified sub group axis.
Acquires the command end status for the DRIVE command with
9
torque limit option executed at the main group.
111 TRQSTS2 Arithmetic function Acquires the command end status for the DRIVE command with
torque limit option executed at the sub group.
112 TRQTIME Arithmetic function Acquires the current limit time-out period at the specified main 10
group axis when using a torque limit option in the DRIVE
statement.
112 TRQTIME2 Arithmetic function Acquires the current limit time-out period at the specified sub
group axis when using a torque limit setting option in the DRIVE
statement.
11
V
113 VAL Arithmetic function Converts the numeric value of a specified character string to an
actual numeric value. (↔STR$) 12
W
116 WEIGHT Arithmetic function Acquires the main robot tip weight parameter.
116 WEIGHT2 Arithmetic function Acquires the sub robot tip weight parameter.
118 WHERE Point function Reads out the current position of the main group robot arm in 13
joint coordinates (pulses).
118 WHERE2 Point function Reads out the current position of the sub group robot arm in joint
coordinates (pulses).
120 WHRXY Point function Reads out the current position of the main group arm as 14
Cartesian coordinates (mm, degrees).
120 WHRXY2 Point function Reads out the current position of the sub group arm as
Cartesian coordinates (mm, degrees).
X 15
121 XYTOJ Point function Converts the point variable Cartesian coordinate data to the
main group's joint coordinate data (↔JTOXY).
121 XYTOJ2 Point function Converts the point variable Cartesian coordinate data to the sub
group's joint coordinate data (↔JTOXY2).
122 _SYSFLG Arithmetic function Axis status monitoring flag.

Functions: in alphabetic order 8-17


Functions: operation-specific
8
Point related functions

No. Function name Function


9 46 JTOXY Converts joint coordinate data to main group Cartesian coordinate data. (↔XYTOJ)
46 JTOXY2 Converts joint coordinate data to sub group Cartesian coordinate data. (↔XYTOJ2)
53 LOCx Acquires point data or shift data for a specified axis.
77 PPNT Creates point data specified by a pallet definition number and pallet position number.
10 118 WHERE Reads out the current position of the main group robot arm in joint coordinates (pulses).
118 WHERE2 Reads out the current position of the sub group robot arm in joint coordinates (pulses).
120 WHRXY Reads out the current position of the main group arm as Cartesian coordinates (mm, degrees).

11 120
121
WHRXY2
XYTOJ
Reads out the current position of the sub group arm as Cartesian coordinates (mm, degrees).
Converts the point variable Cartesian coordinate data to the main group's joint
coordinate data (↔JTOXY).
121 XYTOJ2 Converts the point variable Cartesian coordinate data to the sub group's joint
coordinate data (↔JTOXY2).
12 Parameter related functions

No. Function name Function


3 ABSRPOS Acquires the machine reference of the specified main group axis. (Valid only for
13 axes where the return-to-origin method is set as "mark method".)
3 ABSRPOS2 Acquires the machine reference of the specified sub group axis. (Valid only for
axes where the return-to-origin method is set as "mark method".)
5 ACCEL Acquires the acceleration coefficient parameter of the main group.
14 5 ACCEL2 Acquires the acceleration coefficient parameter of the sub group.
6 ARCH Acquires the arch position parameter of the main group.
6 ARCH2 Acquires the arch position parameter of the sub group.
7 ARMCND Acquires the current arm status of the main robot.
15 7 ARMCND2 Acquires the current arm status of the sub robot.
8 ARMTYPE Acquires the current "hand system" setting of the main robot.
8 ARMTYPE2 Acquires the current "hand system" setting of the sub robot.
11 AXWGHT Acquires the axis tip weight parameter of the main group.
11 AXWGHT2 Acquires the axis tip weight parameter of the sub group.
17 CURTRQ Acquires the current torque value of the specified main group axis.
17 CURTRQ2 Acquires the current torque value of the specified sub group axis.
20 DECEL Acquires the deceleration rate parameter of the main group.
20 DECEL2 Acquires the deceleration rate parameter of the sub group.
50 LEN Acquires the length (number of bytes) of a specified character string.
55 MCHREF Acquires the return-to-origin or absolute-search machine reference for a specified main group axis.
55 MCHREF2 Acquires the return-to-origin or absolute-search machine reference for a specified sub group axis.
61 ORD Acquires the character code of the first character in a specified character string.
66 ORGORD Acquires the axis sequence parameter for performing return-to-origin and
absolute search operations in the main group.
66 ORGORD2 Acquires the axis sequence parameter for performing return-to-origin and
absolute search operations in the sub group.
69 OUTPOS Acquires the OUT enable position parameter of the main group.
69 OUTPOS2 Acquires the OUT enable position parameter of the sub group.
109 TOLE Acquires the main group tolerance parameter.
109 TOLE2 Acquires the sub group tolerance parameter.
110 TORQUE Acquires the maximum torque command value which can be set for a specified main group axis.

8-18 Chapter 8 Robot Language Lists


No. Function name Function
110 TORQUE2 Acquires the maximum torque command value which can be set for a specified sub group axis. 8
111 TRQSTS Acquires the command end status for the DRIVE command with torque limit
option executed at the main group.
111 TRQSTS2 Acquires the command end status for the DRIVE command with torque limit

9
option executed at the sub group.
112 TRQTIME Acquires the current limit time-out period at the specified main group axis when
using a torque limit option in the DRIVE statement.
112 TRQTIME2 Acquires the current limit time-out period at the specified sub group axis when
using a torque limit setting option in the DRIVE statement.
116 WEIGHT Acquires the main robot tip weight parameter. 10
116 WEIGHT2 Acquires the sub robot tip weight parameter.

Numeric calculation related functions

No. Function name Function


11
1 ABS Acquires the absolute value of a specified value.
9 ATN Acquires the arctangent of the specified value.
9 ATN2 Acquires the arctangent of the specified X-Y coordinates.
12
16 COS Acquires the cosine value of a specified value.
23 DEGRAD Converts a specified value to radians (↔RADDEG).
26 DIST Acquires the distance between 2 specified points.
45 INT Acquires an integer for a specified value by truncating all decimal fractions. 13
54 LSHIFT Shifts a value to the left by the specified number of bits. (↔RSHIFT)
79 RADDEG Converts a specified value to degrees. (↔DEGRAD)
87 RSHIFT Shifts a value to the right by the specified number of bits. (↔LSHIFT)
95 SIN Acquires the sine value for a specified value. 14
100 SQR Acquires the square root of a specified value.
104 TAN Acquires the tangent value for a specified value.
113 VAL Converts the numeric value of a specified character string to an actual numeric value. (↔STR$)
15
Character string calculation related functions

No. Function name Function


15 CHR $ Acquires a character with the specified character code.
19 DATE $ Acquires the date as a "yy/mm/dd" format character string.
48 LEFT $ Extracts a character string comprising a specified number of digits from the left
end of a specified character string.
56 MID $ Extracts a character string of a desired length from a specified character string.
85 RIGHT $ Extracts a character string comprising a specified number of digits from the right
end of a specified character string.
99 STR $ Converts a specified value to a character string (↔VAL)

Parameter related functions

No. Function name Function


122 _SYSFLG Axis status monitoring flag.
33 ERL Gives the line No. where an error occurred.
33 ERR Gives the error code number of an error which has occurred.
105 TCOUNTER Outputs count-up values at 10ms intervals starting from the point when the
TCOUNTER variable is reset.
106 TIME $ Acquires the current time as an "hh:mm:ss" format character string.
107 TIMER Acquires the current time in seconds, counting from 12:00 midnight.

Functions: operation-specific 8-19


1 ABS
8 Acquires absolute values

Format

ABS (<expression>)

A Explanation Returns a value specified by an <expression> as an absolute value.

SAMPLE
B A=ABS(-326.55) The absolute value of -362.54
(=362.54) is assigned to
variable A.
C

8-20 Chapter 8 Robot Language Lists


2 ABSINIT / ABSINIT2
Resets the current position of a specified axis 8

n NOTE
Format

1.ABSINIT (<axis number>)


main group

••ABSINIT / ABSINIT2 are


available in the following 2.ABSINIT (<axis number>)=<expression>
software versions:
A
RCX240 Ver. 10.66 onwards,
RCX22x Ver.9.39 onwards, Format sub group
••The ABSINIT / ABSINIT2 1.ABSINIT2 (<axis number>) B
statements can be used
only when the "Limitless
2.ABSINIT2 (<axis number>)=<expression>
motion" parameter is set
to "VALID" in the robot C
axis parameters. (For Values <axis number>........................main group: 1 to 6
details, refer to the User's sub group: 1 to 4
Manual.)
<expression>..........................0 to 1 D

c CAUTION
Explanation Resets the current position of the axis specified by <axis number>.
If the <expression> is "0", a reset is possible only if the robot is positioned as shown
E
••When the <expression>
is 0, the "17.42: Cannot
in the figure below. To perform multi-turn movement in the same direction, the
reset position" error command statement must be executed after each 360° of movement, and the current F
will occur if the robot's position must be reset.
current position is at a
If the <expression> is "1", a reset occurs regardless of the robot's current coordinates.
position where a reset is
impossible. In this case, the robot's absolute function is disabled.
G
The format 1 operation is identical to a format 2 operation where the <expression> = 0.
H
"Reset possible" range within a mechanical angle of 360° (16384 [pulse] × speed reduction ratio)

"0" position determined by absolute reset I


0
Reset execution position J
For a minus axis polarity: 257 to 1791 [pulse]
For a plus axis polarity: -1791 to -257 [pulse]
* When an origin point shift has been set in the K
axis parameters, that shift value is added to the
above range.

33829-R7-00

ABSINIT / ABSINIT2 8-21


2 ABSINIT / ABSINIT2
8
SAMPLE
ABSINIT 1 Resets the main group's 1st
axis at the position where
a current position reset is
possible for that axis. (The
A same applies for ABSINIT 1, 0.)
ABSINIT2 1 Resets the sub group's 1st axis
B at the position where a current
position reset is possible for
that axis. (The same applies
C for ABSINIT2 1, 0.)

D MEMO • Following the reset, the current position and target position values become values from which a
distance equivalent to the motor's number-of-turns has been subtracted.
• The reset time per axis is approximately 100ms.
E • If a "Limitless motion INVALID" axis is specified, the "5.37: Specification mismatch" error
message displays, and execution is stopped.

F
●● Restrictions
1. Only the axis of a single-axis rotary type robot can be specified. Linear robot and dual robot
G axes cannot be used.
2. The ABSINIT / ASBSINIT2 statements cannot be used at YC-Link specification axes.
H 3. The ABSINIT / ASBSINIT2 statements cannot be used at electric gripper specification axes.

8-22 Chapter 8 Robot Language Lists


3 ABSRPOS / ABSRPOS2
Acquires a machine reference 8

Format main group

ABSRPOS (<axis 1>)

Format sub group


A
ABSRPOS2 (<axis 2>)
B
Values <axis 1>..................................main group: 1 to 6
<axis 2>..................................sub group: 1 to 4 C
Explanation The machine reference value for a specified <axis number> is acquired (units: %).
This function is valid only for axes where the return-to-origin method is set as "mark D
method". It is not valid at axes where the return-to-origin method is set as "sensor" or
"stroke end".
E
MEMO • At axes where return-to-origin method is set to "mark" method, absolute reset is possible when
the machine reference value is in a 44 to 56% range. F

SAMPLE
G
A=ABSRPOS(4) The machine reference value
for the main group's axis 4 is
assigned to variable A. H

ABSRPOS / ABSRPOS2 8-23


4 ABSRST
8 Absolute motor axis return-to-origin operation

Format

ABSRST

A Explanation This statement executes a direct return-to-origin operation for the robot's absolute
motor axes (absolute reset).
The return-to-origin will fail if the robot stops en route.
B In systems with a two-robot setting, the main robot group return-to-origin occurs first,
followed by the sub robot group return-to-origin.
C
MEMO • This command is valid at axes where the return-to-origin method is set to other than "mark".
• This command cannot be executed if a return-to-origin is incomplete at an axis where the
D return-to-origin method is set as "mark".
• In systems with both absolute motor axes and incremental motor axes, a return-to-origin will
occur only at the absolute motor axes when the ABSRST command is executed.
E • The ORIGIN command must be used to perform a return-to-origin at incremental motor axes.
Moreover, the return-to-origin operations occur in the parameter-specified sequence, and the
F incremental motor axes will not operate.

SAMPLE
G
*ABS_RST:
IF DI(20)=1 THEN ABSRST executed when DI (20) is "1".
H ABSRST
ENDIF
*START:ABSRST Absolute motor return-to-origin occurs.
I
Related commands ORIGIN, ORGORD, ORGORD2, MCHREF, MCHREF2
J

8-24 Chapter 8 Robot Language Lists


5 ACCEL / ACCEL2
Specifies/acquires the acceleration coefficient parameter 8

Format main group

1. ACCEL <expression>
2. ACCEL (<axis number>)=<expression>
A
n NOTE
Format sub group

••ACCEL2 can be used only 1. ACCEL2 <expression> B


if a "sub group" setting 2. ACCEL2 (<axis number>)=<expression>
has been specified in the
system generation. Values <axis number>........................main group: 1 to 6 C
sub group: 1 to 4
<expression>..........................1 to 100 (units: %)
Explanation Directly changes the acceleration coefficient parameters to the value specified by the <expression>. D
In format 1, the change occurs at all the group axes.
In format 2, the change occurs at the axis specified in <axis number>.
E
MEMO • If an axis that is set to "no axis" in the system generation is specified, a "5.37: Specification
mismatch" error message displays and command execution is stopped. F
• Changes the value which has been set at SYSTEM > PARAMETER > AXIS > ACCEL. Program-
declared values have priority.
G
Functions

Format main group


H
ACCEL (<axis 1>)
I
Format sub group

ACCEL2 (<axis 2>) J


Values <axis 1>..................................main group: 1 to 6
<axis 2>..................................sub group: 1 to 4 K
Explanation The acceleration parameter value is acquired for the axis specified at <axis number>.

SAMPLE L
A=50
ACCEL A The acceleration coefficient M
for all axes becomes 50%.
ACCEL(3)=100 Only axis 3 becomes 100%.
CYCLE WITH INCREASING ACCELERATION
FOR A=10 TO 100 STEP 10 The acceleration coefficient
parameter is increased from
10% to 100% in 10% increments.
ACCEL A
MOVE P,P0
MOVE P,P1
NEXT A
A=ACCEL(3) The acceleration coefficient
parameter for the main group's
axis 3 is assigned to variable A.
HALT "END TEST"

ACCEL / ACCEL2 8-25


6 ARCH / ARCH2
8 Specifies/acquires the acceleration coefficient parameter

Format main group

1. ARCH <expression>
2. ARCH (<axis number>)=<expression>
A

B
n NOTE
Format

1. ARCH2 <expression>
sub group

••ARCH2 can be used only


if a "sub group" setting 2. ARCH2 (<axis number>)=<expression>
has been specified in the
C system generation.
Values <axis number>........................main group: 1 to 6
sub group: 1 to 4
D <expression>..........................1 to 6144000 (Unit: pulses)

E Explanation Changes the parameter's arch position to the value indicated in the <expression>.
In format 1, the change occurs at all the group axes.
In format 2, the change occurs at the arch position parameter for the axis specified in
F <axis number> to the value specified in <expression>.

MEMO • If an axis that is set to "no axis" in the system generation is specified, a "5.37: Specification
G mismatch" error message displays and command execution is stopped.

Functions
H
Format main group
I
ARCH (<axis 1>)

J
Format sub group

K ARCH2 (<axis 2>)

Values <axis 1>..................................main group: 1 to 6


L <axis 2>..................................sub group: 1 to 4

M Explanation Acquires the arch position parameter value of the axis specified at <axis number>.

8-26 Chapter 8 Robot Language Lists


6 ARCH / ARCH2
8
SAMPLE
DIM SAV(3)
GOSUB *SAVE_ARCH
FOR A=1000 TO 10000 STEP 1000
GOSUB *CHANGE_ARCH
MOVE P,P0,Z=0
A
DO3(0)=1 Chuck CLOSE
MOVE P,P1,Z=0 B
DO3(0)=0 Chuck OPEN
NEXT A
GOSUB *RESTORE_ARCH C
HALT
*CHANGE_ARCH:
FOR B=1 TO 4 The arch position parameters D
ARCH (1) to (4) are assigned to
array variables SAV (0) to (3).
ARCH(B)=A E
NEXT B
RETURN F
*SAVE_ARCH:
FOR B=1 TO 4
SAV(B-1)=ARCH(B) G
NEXT B
RETURN
*RESTORE_ARCH: H
FOR B=1 TO 4
ARCH(B)=SAV(B-1)
NEXT B I
RETURN
J

ARCH / ARCH2 8-27


7 ARMCND / ARMCND2
8 Arm status acquisition

Format main group

ARMCND

A Format sub group

ARMCND2
B
Explanation This function acquires the current arm status of the SCARA robot. The arm status is
C "1" for a left-handed system and "0" for a right-handed system.
This function is enabled only when a SCARA robot is used.

D SAMPLE
A=ARMCND The main robot's current arm
E status is assigned to variable A.
IF A=0 THEN Right-handed system status.
MOVE P, P100, Z=0
F ELSE Left-handed system status.
MOVE P, P200, Z=0
ENDIF
G

8-28 Chapter 8 Robot Language Lists


8 ARMTYPE / ARMTYPE2
SCARA robot hand system 8

Format main group

ARMTYPE

Format sub group


A
ARMTYPE2
B
Explanation This function acquires the hand system currently selected for the SCARA robot.
The arm type is "0" for a right-handed system, and "1" for a right-handed system. This C
function is enabled only when a SCARA robot is used.

SAMPLE D
A=ARMTYPE The main robot's arm type
value is assigned. E
IF A=0 THEN The arm type is a right-handed system.
MOVE P,P100,Z=0
ELSE The arm type is a left-handed system. F
MOVE P,P200,Z=0
ENDIF
G

ARMTYPE / ARMTYPE2 8-29


9 ATN / ATN2
8 Acquires the arctangent of the specified value

Format

ATN (<expression>)

A
n NOTE
Format

ATN2 (<expression 1>) (<expression 2>)


••AT N 2 a r e a v a i l a b l e i n
B the following software
versions:
RCX240 Ver. 10.67 onwards,
Explanation ATN: Acquires the arctangent values of the specified <expression> values. The
C acquired values are radians within the following range: -π / 2 to +π / 2
ATN2: Acquires the arctangent values of the specified <expression 1> and
<expression 2> X-Y coordinates. The acquired values are radians within
D the following range: -π to +π

E SAMPLE
A(0)=A*ATN(Y/X) The product of the expression
(Y/X) arctangent value and
F variable A is assigned to
array A (0).
A(0)=ATN(0.5) The 0 . 5 arctangent value is
G assigned to array A (0).
A(0)=ATN2(B,C)-D The difference between the X-Y
H coordinates (B,C) arctangent
value and variable D is
assigned to array A (0).
I A(1)=RADDEG(ATN2(B,C)) The X-Y coordinates (B,C)
arctangent value is converted
to degrees, and is then
J assigned to array A (1).

K Related commands COS, DEGRAD, RADDEG, SIN, TAN

8-30 Chapter 8 Robot Language Lists


10 ASPEED / ASPEED2
Sets the automatic movement speed 8

Format main group

ASPEED <expression>

A
n NOTE
Format

ASPEED2 <expression>
sub group

••ASPEED2 can be used


only if a "sub group" B
setting has been specified
in the system generation. Values <expression>..........................1 to 100 (units: %)
C
n NOTE
Explanation Directly changes the automatic movement speed to the value indicated in the
<expression>.
••A u t o m a t i c m o v e m e n t
speed This speed change applies to all the robot axes and auxiliary axes. The operation D
S p e c i f i e d b y speed is determined by the product of the automatic movement speed (specified
programming box
operation or by the
by programming box operation and by the ASPEED/ASPEED2 commands), and the
E
program movement speed (specified by SPEED/SPEED2 commands, etc.).
ASPEED / ASPEED2
commands. Operation speed = automatic movement speed x program movement speed.
••P r o g r a m m o v e m e n t Example: F
speed Automatic movement speed 80%
Specified by SPEED/ Program movement speed 50%
SPEED2 commands or
Movement speed = 40% (80% × 50%)
G
MOVE/MOVE2, DRIVE/
DRIVE2 speed settings.
SAMPLE H
SPEED 70
ASPEED 100
MOVE P,P0 Movement from the current I
position to P0 occurs at 70%
speed (=100 * 70). J
ASPEED 50
MOVE P,P1 Movement from the current
position to P1 occurs at 35% K
speed (=50 * 70).
MOVE P,P2,S=10 Movement from the current
position to P2 occurs at 5 % L
speed (=50 * 10).
HALT
M
Related commands SPEED, SPEED2

ASPEED / ASPEED2 8-31


11 AXWGHT / AXWGHT2
8 Sets/acquires the axis tip weight

Format main group

AXWGHT (<axis number>)=<expression>

A
n NOTE
Format

AXWGHT2 (<axis number>)=<expression>


sub group

••AXWGHT2 can be used


B only if a "sub group"
setting has been specified
in the system generation. Values <axis number>........................main group: 1 to 6
C sub group: 1 to 4
<expression>..........................Varies according to the specified robot.

D Explanation Directly changes the axis tip weight parameter for the group's axis specified by the
<axis number> to the <expression> value.

E This statement is valid in systems with "MULTI" axes and auxiliary axes (the robot
type and auxiliary axes are factory set prior to shipment).

F Functions

G Format main group

AXWGHT (<axis 1>)


H
Format sub group

I AXWGHT2 (<axis 2>)

J Values <axis 1>..................................main group: 1 to 6


<axis 2>..................................sub group: 1 to 4

K Explanation Acquires the value axis tip weight parameter value for the axis specified by the
<expression>.
This statement is valid in systems with "MULTI" axes and auxiliary axes.
L
SAMPLE
M A=5
B=0
C=AXWGHT(1) Axis tip weight value is
acquired (the current value
is saved to variable C).
AXWGHT(1)=A
DRIVE(1,P0)
AXWGHT(1)=B
DRIVE(1,P1)
AXWGHT(1)=C The axis tip weight value is set again.
HALT

Related commands WEIGHT, WEIGHT2

8-32 Chapter 8 Robot Language Lists


12 CALL
Calls a sub-procedure 8

n NOTE Format
••When a value is passed
on to a sub-procedure, CALL <label> [(<actual argument> [, <actual argument> ])]
the original value of the
actual argument will not
be changed even if it
Explanation This statement calls up sub-procedures defined by the SUB to END SUB statements. A
is changed in the sub- The <label> specifies the same name as that defined by the SUB statement.
procedure.
••W h e n a r e f e r e n c e i s 1. When a constant or expression is specified as an actual argument, its value is
B
passed on to a sub-
procedure, the original passed on to the sub-procedure.
value of the actual 2. When a variable or array element is specified as an actual argument, its value C
argument will also be is passed on to the sub-procedure. It will be passed on as a reference if "REF" is
changed if it is changed
in the sub-procedure. added at the head of the actual argument.
••For details, see Chapter 3. When an entire array (array name followed by parentheses) is specified as an D
3 "8 Value Pass-Along & actual argument, it is passed along as a reference.
Reference Pass-Along".

• CALL statements containing one actual argument can be used up to 15 times in succession.
E
MEMO
Note that this number is reduced if commands which use stacks such as an IF statement or
GOSUB statement are used, or depending on the number of arguments in the CALL statement. F
• Always use the END SUB statement to end a sub-procedure which has been called with the
CALL statement. If another statement such as GOTO is used to jump out of the sub- routine, a
"5.12: Stack overflow" error, etc., may occur. G

SAMPLE 1 H
X%=4
Y%=5
CALL *COMPARE ( REF X%, REF Y% ) I
HALT
SUB ROUTINE: COMPARE
J
SUB *COMPARE ( A%, B% )
IF A% < B% THEN
TEMP%=A% K
A%=B%
B%=TEMP%
ENDIF L
END SUB

M
SAMPLE 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, SHARED

CALL 8-33
13 CHANGE / CHANGE2
8 Switches the hand

Format main group

CHANGE Hn

A Format sub group

CHANGE2 Hn
B
Values n: The range of hand Nos. which can specified for the main group differs from that for
C the sub group.
main group............ 0 to 3
sub group............... 4 to 7
D
Explanation CHANGE / CHANGE2 are used to switch the robot hand.

E Before hand switching can occur, the hands must be defined at the HAND / HAND2
statements. For details, see section "39 HAND / HAND2".

SAMPLE
F
HAND H1= 0 150.0 0.0
HAND H2= -5000 20.00 0.0
G P1=150.00 300.00 0.00 0.00 0.00 0.00
CHANGE H2 Changes to hand 2.
MOVE P,P1 Moves the hand 2 tip to P1 (1).
H CHANGE H1 Changes to hand 1.
MOVE P,P1 Moves the hand 1 tip to P1 (2).
HALT
I

8-34 Chapter 8 Robot Language Lists


14 CHGPRI
Changes the priority ranking of a specified task 8

Format

CHGPRI Tn, p

Values n: Task No .............................2 to 8 A


p: Task priority ranking ..........17 to 47

Explanation Directly changes the priority ranking of the specified task ("n") to "p".
B
The priority ranking of the main task (Task 1) is fixed as 32. Even if a priority ranking
is not specified, "32" is adopted as the priority ranking for this task. C
The smaller the priority number, the higher the priority (high priority: 17 ⇔ low
priority: 47).
When a READY status occurs at a task with higher priority, all tasks with lower D
priority also remain in a READY status.

SAMPLE E
START *SUBTASK,T2,33
*ST: F
MOVE P,P0,P1
IF DI(20) = 1 THEN
CHGPRI T2,32 G
ELSE
CHGPRI T2,33
ENDIF H
GOTO *ST
HALT
SUBTASK ROUTINE I
*SUBTASK:
IF LOCZ(WHERE) > 10000 THEN
J
DO(20) = 1
GOTO *SUBTASK
ENDIF K
DO(20) = 0
GOTO *SUBTASK
EXIT TASK L

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

CHGPRI 8-35
15 CHR$
8 Acquires a character with the specified character code

Format

CHR$ (<expression>)

A Values <expression>..........................0 to 255

Explanation Acquires a character with the specified character code. An error occurs if the
B <expression> value is outside the 0 to 255 range.

SAMPLE
C A$=CHR$(65) "A" is assigned to A$.

D Related commands ORD

8-36 Chapter 8 Robot Language Lists


16 COS
Acquires the cosine value of a specified value 8

Format

COS (<expression>)

Values <expression>..........................Angle (units: radians) A


Explanation Acquires a cosine value for the <expression> value.
B
SAMPLE
A(0)=B*COS(C) The product of the C42 variable's C
cosine value and variable B is
assigned to array A (0).
A(1)=COS(DEGRAD(20)) The 20 . 0 cosine value is D
assigned to array A (1).
E
Related commands ATN, DEGRAD, RADDEG, SIN, TAN

G
17 CURTRQ / CURTRQ2
Acquires the current torque of the specified axis
H

Format main group I


CURTRQ (<expression>)
J
n NOTE
Format sub group

••CURTRQ / CHKTRQ2 are CURTRQ2 (<expression>) K


available in the following
software versions:
Values <expression>..........................1 to 6
RCX240 Ver. 10.65 onwards, L
RCX22x Ver. 9.36 onwards
••If the specified axis has Explanation Acquires the current torque value (-100 to 100) of the axis specified by the
been set to "no axis" in <expression>. The current torque value is expressed as a percentage of the maximum M
the system generation, torque command value. Plus/minus signs indicate the direction.
or if that axis uses the YC-
Link or a power gripper,
a "5.37: Specification
mismatch" error message SAMPLE
displays and command
execution is stopped.
A = CURTRQ(3) The current torque value of
the main group's axis 3 is
assigned to variable "A".

COS 8-37
18 CUT
8 Terminates another sub task which is currently being executed

Format

CUT Tn

A Values n: Task No..............................2 to 8

Explanation Directly terminates another task which is currently being executed or which is
B temporarily stopped.
This statement cannot terminate its own task, nor can it terminate Task 1.
C SAMPLE
TASK1 ROUTINE
D *ST:
MO(20) = 0
START *SUBTASK2,T2
E MOVE P,P0
MOVE P,P1
WAIT MO(20) = 1
F CUT T2
GOTO *ST
HALT
G TASK2 ROUTINE
*SUBTASK2:
H P100=JTOXY(WHERE)
IF LOCZ(P100) >= 100.0 THEN
MO(20) = 1
I ELSE
DELAY 100
ENDIF
J GOTO *SUBTASK2
EXIT TASK
K
Related commands EXIT TASK, CUT, RESTART, START, SUSPEND

8-38 Chapter 8 Robot Language Lists


19 DATE$
Acquires the date 8

Format

DATE$

Explanation Acquires the date as a "yy/mm/dd" format character string. A


"yy" indicates the year (last two digits), "mm" indicates the month, and "dd" indicates
the day.
Date setting is performed at SYSTEM mode initial processing.
B
SAMPLE
A$=DATE$
C
PRINT DATE$
HALT D

Related commands TIME$


E

DATE$ 8-39
20 DECEL / DECEL2
8 Specifies/acquires the deceleration rate parameter

n NOTE
Format

1. DECEL <expression>
main group

••T h e D E C E L / D E C E L 2
statements are only 2. DECEL (<axis number>)=<expression>
A available in software
version 8.15 onwards.
••DECEL2 can be used only Format sub group
if a "sub group" setting
B has been specified in the
1. DECEL2 <expression>
system generation. 2. DECEL2 (<axis number>)=<expression>

C Values <axis number>........................main group: 1 to 6


sub group: 1 to 4
<expression>..........................1 to 100 (units: %)
D
Explanation Changes the deceleration rate parameter to the <expression> value.

E In format 1, the change occurs at all the group axes.


In format 2, the change occurs at the axis specified in <axis number>.

F MEMO • If an axis that is set to "no axis" in the system generation is specified, a "5.37: Specification
mismatch" error message displays and command execution is stopped.
• Command statements DECEL/DECEL2 can be used to change the acceleration parameter.
G
Functions
H
Format main group

DECEL (<axis 1>)


I
Format sub group
J
DECEL2 (<axis 2>)

K Values <axis 1>..................................main group: 1 to 6


<axis 2> .................................sub group: 1 to 4

L Explanation Acquires the deceleration rate parameter value for the axis specified by the <expression>.

SAMPLE
M
A =50
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
A=DECEL(3) The deceleration rate parameter
for the main group's axis 3 is
assigned to variable A.
HALT "END TEST "

8-40 Chapter 8 Robot Language Lists


21 DECLARE
Declares that a sub-routine or sub-procedure is to be used within the COMMON program 8

Format

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


2. DECLARE SUB <name> [(<dummy argument> [, <dummy argument>] )]
A
c CAUTION
Values <label>...................................L abel of the sub-routine defined in the COMMON
program.
••O n l y t h e f o l l o w i n g
<name>..................................Name of the sub-procedure defined in the COMMON
B
external labels can be
used: GOSUB, CALL, ON program.
to GOSUB. <dummy argument>...............S ub-procedure argument. Only the "number of C
arguments" and the "data type" are significant.

Explanation Directly declares that a label or sub-procedure exists in the COMMON program. If a D
sub-procedure is declared, the argument's data type is also checked.
This statement cannot be defined within a sub-procedure.
E
Because the DECLARE statement declares the existence of a label or sub-procedure
within the COMMON program, it cannot be used within the COMMON program
itself. The DECLARE statement is valid throughout the entire program. F
SAMPLE
COMMON program shared label G
Program name: DIST1
================================================
MAIN PROGRAM H
================================================
DECLARE *DISTANCE,*AREA
I
X!=2. 5
Y!=1. 2
GOSUB *DISTANCE J
GOSUB *AREA
HALT
K
Program name: COMMON
================================================
COMMON PROGRAM L
================================================
*DISTANCE:
PRINT SQR(X!^2+Y!^2)
M
RETURN
*AREA:
PRINT X!*Y!
RETURN

DECLARE 8-41
21 DECLEAR
8
SAMPLE
External program shared sub-procedure
Program name: DIST2
======================================================
MAIN PROGRAM
A ======================================================
DECLARE SUB *DISTANCE(X!,Y!,D!)
B DECLARE SUB *AREA(X!,Y!,A!)
CALL *DISTANCE(2. 5,1. 2,REF D!)
PRINT D!
C CALL *AREA(2. 5,1. 2,REF A!)
PRINT A!
HALT
D Program name: COMMON
======================================================
COMMON PROGRAM
E ======================================================
SUB *DISTANCE(X!,Y!,D!)
F D!=SQR(X!^2+Y!^2)
END SUB
SUB *AREA(X!,Y!,A!)
G A!=X!*Y!
END SUB

H
Related commands CALL, EXIT SUB, GOSUB, ON to GOSUB, SUB, END SUB

8-42 Chapter 8 Robot Language Lists


22 DEF FN
Defines functions which can be used by the user 8

Format

DEF FN <name> [ % ] [(<dummy argument>, [<dummy argument> ])] = <function definition expression>
!
$ A
Values <name> .................................Function name. Max. of 16 chars., including "FN".
<dummy argument> ..............Numeric or character string variable.
B

Explanation Defines the functions which can be used by the user. Defined functions are called in C
the FN <name> (<variable>) format.

MEMO • The <dummy argument> names are the same as the variable names used in the <function D
definition expression>. The names of these variables are valid only when the <function
definition expression> is evaluated. There may be other variables with the same name in the
program.
E
• When calling a function that uses a <dummy argument>, specify the constant, variable, or
expression type which is the same as the <dummy argument> type. F
• If a variable used in the <function definition expression> is not included in the <dummy
argument> list, the current value of that particular variable is used for the calculation.
• A space must be entered between "DEF" and "FN". If no space is entered, DEFFN will be G
handled as a variable.
• The DEF FN statement cannot be used in sub-procedures.
• Definition by the DEF FN statement must be declared before statements which use functions.
H

SAMPLE I
DEF FNPAI=3.141592
DEF FNASIN(X)=ATN(X/SQR(-X^2+1)) J
Both the <dummy argument>
and <function definition
expression> use "X". K

A=FNASIN(B)*10 "X" is not required for calling. L

DEF FN 8-43
23 DEGRAD
8 Angle conversion (angle → radian)

Format

DEGRAD (<expression>)

A Values <expression>..........................Angle (units: degrees)

Explanation The <expression> value is converted to radians.


B To convert radians to degrees, use RADDEG.

C SAMPLE
A=COS(DEGRAD(30)) A 30 cosine value is assigned
to variable A.
D
Related commands ATN, COS, RADDEG, SIN, TAN
E

8-44 Chapter 8 Robot Language Lists


24 DELAY
Program execution waits for a specified period of time 8

Format

DELAY <expression>

Values <expression>..........................1 to 3600000 (units: ms) A


Explanation A "program wait" status is established for the period of time specified by the
<expression>. The minimum wait period is 10ms.
B

SAMPLE C
DELAY 3500 3,500ms (3.5 secs) wait
DELAY A*10 D

DELAY 8-45
25 DI
8 Acquires the input status from the parallel port

Format

1. [LET] <expression> = DIm([b, ,b])


2. [LET] <expression> = DI(mb, ,mb)
A
Values m............................................Port No.: 0 to 7, 10 to 17, 20 to 27
b.............................................Bit definition: 0 to 7
B
Explanation Indicates the parallel input signal status.
C If multiple bits are specified, they are expressed from the left in descending order (large
to small).
Enter "0" if no input port exists.
D If the [b,…,b] data is omitted, all 8 bits are processed.

E SAMPLE
A%=DI2() The input status from DI (27)
to DI ( 20 ) is assigned to
F variable A%.
A%=DI5(7,4,0) The DI (57), DI (54), DI (50)
input status is assigned to
G variable A% (when all the above
signals are "1" (ON), A% = 7).
H A%=DI(37,25,20) The DI (37), DI (25), DI (20) input
status is assigned to variable A%
(when all the above signals except
I DI (20) are "1" (ON), A% = 6).

J Reference For details, refer to Chapter 3 "9.5 Parallel input variable".

8-46 Chapter 8 Robot Language Lists


26 DIST
Acquires the distance between 2 specified points 8

Format

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

Values <point expression 1>..............Cartesian coordinate system point A


<point expression 2>..............Cartesian coordinate system point

Explanation Acquires the distance (X,Y,Z)between the 2 points specified by <point expression 1>
B
and <point expression 2>. An error occurs if the 2 points specified by each <point
expression> do not have a Cartesian coordinates. C
SAMPLE
A=DIST(P0,P1) The distance between P0 and P1
D
is assigned to variable A.
E

DIST 8-47
27 DIM
8 Declares array variable

Format

DIM <array definition> [, <array definition>, ]

A Format

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


B !
$
C
Values <constant> .............................Array subscript: 0 to 32,767 (positive integer)

D Explanation Directly 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

E be declared in a single line by using comma ( , ) breakpoints to separate the arrays.

MEMO • Array subscripts can be "0 to a specified value", with their total number being the <constant> + 1.
F • A "9.31: Memory full" error may occur depending on the size of each dimension defined in an
array.

G SAMPLE
DIM A%(10) Defines a integer array
H variable A% ( 0 ) to A% ( 10 ).
(Number of elements: 11).
DIM B(2,3,4) Defines a real array variable
I B (0, 0, 0) to B (2, 3, 4).
(Number of elements: 60).
J DIM C%(2,2),D!(10) Defines an integer array C%
(0,0) to C% (2,2) and a real
array D! (0) to D! (10).
K

8-48 Chapter 8 Robot Language Lists


28 DO
Outputs to parallel port 8

Format

1. [LET] DOm ([b, ,b]) = <expression>


2. [LET] DO (mb, ,mb) = <expression>
A
Values m: Port No..............................2 to 7, 10 to 17, 20 to 27
b: Bit definition.......................0 to 7
The output value is the lower left-side bit of the integer-converted <expression>
B
value.
C
Explanation Directly outputs the specified value to the DO port.
If multiple bits are specified, they are expressed from the left in descending order (large
to small). D
No output will occur if a nonexistent DO port is specified.
If the [b,…,b] data is omitted, all 8 bits are processed.
E
Outputs are not possible to DO0() and DO1(). These ports are for referencing only.

SAMPLE
F
DO2() = &B10111000 DO (27, 25, 24, 23) are turned
ON, and DO (26 , 22 , 21 , 20 )
are turned OFF. G
DO2(6,5,1) = &B010 DO (25) are turned ON, and DO
(26, 21) are turned OFF.
DO3() = 15 DO (33, 32, 31, 30) are turned H
ON, and DO (37 , 36 , 35 , 34 )
are turned OFF.
DO(37,35,27,20) = A The contents of the 4 lower bits
I
acquired when variable A is
converted to an integer are output J
to DO (37, 35, 27, 20) respectively.

Related commands RESET, SET


K

DO 8-49
29 DRIVE / DRIVE2
8 Executes absolute movement of specified axes

Format main group

DRIVE(<axis number>, <expression>)[,(<axis number>,


<expression>)...] [, option]
A
Format sub group
B DRIVE 2 (<axis number>, <expression>)[,(<axis number>,
<expression>)...] [, option]
C
Values <axis number>........................main group: 1 to 6
sub group: 1 to 4
D <expression>..........................M otor position (mm, degrees, pulses) or point
expression

E
Explanation Executes absolute movement commands for specified axes within a group.
This command is also used in the same way for the group's auxiliary axes.
F • Movement type: PTP movement of specified axis.
• Point setting method: By direct numeric value input and point definition.
• Options: Speed setting, STOPON conditions setting, torque limit setting, XY setting.
G movement direction setting.

H Movement type

●● PTP (Point to Point) movement of specified axis:


I PTP movement begins after positioning of all axes specified at <axis number> is complete (within
the tolerance range), and the command terminates when the specified axes enter the OUT

J position range. When two or more axes are specified, they will reach their target positions
simultaneously.
If the next command following the DRIVE / DRIVE2 command is an executable command such
K as a signal output command, that next command will start when the movement axis enters the
OUT position range. In other words, that next command starts before the axis arrives within the
target position tolerance range.
L Example:
Signal output (DO, etc.) Signal is output when axis enters within OUT position range.
M DELAY
DELAY command is executed and standby starts, when axis enters the
OUT position range.
Program stops and is reset when axis enters the OUT position range.
HALT
Therefore, axis movement also stops.
Program temporarily stops when axis enters the OUT position range.
HOLD
Therefore, axis movement also stops.
WAIT WAIT command is executed when axis enters the OUT position range.

8-50 Chapter 8 Robot Language Lists


29 DRIVE / DRIVE2
8
The WAIT ARM / WAIT ARM2 statements are used to execute the next command after the axis
enters the tolerance range.

DRIVE command

DRIVE(1,P1) DRIVE(1,P1)
A
Target position
DO(20)=1 WAIT ARM
DO(20)=1

B
P1

C
Tolerance
OUT position
DO(20) turns ON DO(20) turns ON

D
DRIVE(1,P1) DRIVE(1,P1)
Target position
HOLD WAIT ARM
HOLD
E

Tolerance F
OUT position
HOLD execution HOLD execution
(program temporarily stops) (program temporarily stops)
G
33819-R7-00

SAMPLE H
DRIVE(1,P0) Axis 1 moves from its current
position to the position
specified by P0. I

J
Point data setting types
K
●● Direct numeric value input
The motor position is specified directly in <expression>.
If the motor position's numeric value is an integer, this is interpreted as a "pulse" units. If the
L
motor position's numeric value is a real number, this is interpreted as a "mm/degrees" units,
and each axis will move from the 0-pulse position to a pulse-converted position. M
However, when using the optional XY setting, movement occurs from the coordinate origin
position.

SAMPLE
DRIVE(1,10000) Main group's axis 1 moves
from its current position to
the 10000 pulses position.
DRIVE2(2,90.00) Sub group's axis 2 moves from its current
position to a position which is 90 in the
plus-direction from the 0-pulse position.
(When axis 2 is a rotating axis.)

DRIVE / DRIVE2 8-51


29 DRIVE / DRIVE2
8
●● Point definition
Point data is specified in <expressions>. The axis data specified by the <axis number> is
used. If the point expression is in "mm/degrees" units, movement for each axis occurs from the
0-pulse position to the pulse-converted position.
However, when using the optional XY setting, movement occurs from the coordinate origin position.
A
n NOTE
SAMPLE
DRIVE(1,P1) Main group's axis 1 moves from its current
••If point data is specified
B with both integers and position to the position specified by P1.
real numbers in the same DRIVE(4,P90) Axis 4 moves from its current position to the
statement, all values are
position specified by P90 (deg) relative to the 0
C handled in "mm/degrees"
units. pulse position. (When axis 4 is a rotating axis.)

D Option types

●● Speed setting
E Format

1. SPEED =<expression>
F 2. S =<expression>
n NOTE
Values <expression>..........................1 to 100 (units: %)
G ••This defines the maximum
speed, and does not
guarantee that all Explanation The program's movement speed is specified as an <expression>.
movement will occur at
H specified speed.
The actual speed is determined as shown below.
• Robot's max. speed (mm/sec, or deg/sec) × automatic movement speed (%) ×
program movement speed (%).
I This option is enabled only for the specified DRIVE/ DRIVE2 statement.

SAMPLE
J DRIVE2(1,10000),S=10 Sub group's axis 1 moves from its current
position to the 10000 pulses position at
10% of the automatic movement speed.
K
Format
L 1. DSPEED =<expression>
2. DS =<expression>
M n NOTE
Values <expression>..........................0.01 to 100.00 (units: %)
••Speed setting (DSPEED)
is available only in the
following software Explanation The axis movement speed is specified in <expression>.
versions:
The actual speed is determined as shown below.
RCX14x Ver. 8.71 onwards,
• Robot's max. speed (mm/sec, or deg/sec) × axis movement speed (%).
RCX22x Ver. 9.18 onwards
This option is enabled only for the specified DRIVE/ DRIVE2 statement.
••SPEED option and DSPEED
• Movement always occurs at the DSPEED <expression> value (%) without being
option cannot be used
together affected by the automatic movement speed value (%).

SAMPLE
DRIVE2(1,10000),DS=0.1 Sub group's axis 1 moves from its current
position to the 10000 pulses position at
0.1% of the robot's maximum speed.

8-52 Chapter 8 Robot Language Lists


29 DRIVE / DRIVE2
8
●● STOPON conditions setting

Format

STOPON <conditional expression>

Explanation Stops movement when the conditions specified by the conditional expression A
are met. Because this is a deceleration type stop, there will be some movement
(during deceleration) after the conditions are met.
B
n
If the conditions are already met before movement begins, no movement occurs,
NOTE and the command is terminated.
••This parameter is only This option is enabled only by program execution.
available in the following
software versions: SAMPLE C
RCX14x Ver. 8.63 onwards DRIVE(1,10000),STOPON DI(20)=1
RCX22x Ver. 9.08 onwards Axis 1 moves from its current position toward D
••O n e a r l i e r v e r s i o n the "10000 pulses" position and stops at an
controllers, -1 is "true" and
intermediate point if the "DI (20) = 1" condition
a value other than -1 is
"false" (not changeable). is met. The next step is then executed. E

MEMO • When the conditional expression used to designate the STOPON condition is a numeric F
expression, the conditions for determining a TRUE or FALSE status can be changed at the
controller's "TRUE conditions" in the "Other parameters" mode.
These conditions apply to all the IF, WHILE, WAIT, STOPON, etc., conditional expressions. For
G
details, refer to the controller manual.

c CAUTION
1) -1 (default setting) An expression value of "-1" indicates a TRUE status, and "0" indicates
a FALSE status. A "6.35: Incorrect condition expression" error occurs if
H
••The torque limit setting's
"torque offset setting" is
the expression value is other than "-1" or "0".
available from software 2) not 0 Any expression value other than "0" indicates a TRUE status, and "0" I
version 8.18 onwards. indicates a FALSE status.
••The torque limit setting
cannot be used at ●● Torque limit setting J
axes where YC-Link is
connected, or at axes
Format
where a power gripper
is being used. Attempts 1. T =<torque limit value>
K
to specify this setting
at these axes results in 2. T =(<torque limit value> [,<torque offset value>])
a "5.37 Specification
mismatch" message, and Values <torque limit value>...............1 to 100 (units: %)
L
command execution is <torque offset value>..............-100 to 100
stopped.
••The torque limit setting Explanation Moves the axis while under torque control. M
range differs depending The maximum torque at this time is limited to a value calculated as follows: Rated
on the robot model. torque × <torque limit value> / 100.
Setting a torque limit A <torque offset value> is specified to control the torque at vertical axes, etc.,
higher than the maximum
where a fixed load is constantly applied. When the torque limit value setting is
level may cause robot
malfunctions or failure. omitted, a setting of "0" is adopted (the setting is also "0" in Format 1).
••If the specified torque
Specify the torque offset value with reference to the value which displays at the
limit value is too small, the current command monitor while axis movement is stopped by servo HOLD.
axis movement may not Note, however, that the value displayed at the current command monitor is the
occur. Moreover, vertical maximum torque ratio. As a general guideline, the torque offset value should be set
axes may fall. as approximately 1/3 of the displayed value in order to acquire the rated torque ratio.

MEMO • The current command monitor can be displayed by pressing the [DISPLAY] key at the
programming box. For details, refer to the controller manual.

DRIVE / DRIVE2 8-53


29 DRIVE / DRIVE2
8
When the DRIVE / DRIVE2 statement is executed with this option specified, the axis
moves to the target position while controlling the torque by changing the maximum
torque for the axis to the <torque limit value>.
The maximum movement speed at this time is 10% of the normal operating speed.
No errors will occur even if the axis strikes an obstacle during movement, and the
A axis torque (thrust) will not exceed the limit value.

B n NOTE
• Command END conditions

••Conditions for ending this


command (described 1. The command ends when the axis has reached the target position.
C at right) are only valid 2. The command ends when the time (timeout period) specified by the TRQTIME
from software version / TRQTIME2 statement has elapsed while the axis torque (thrust) has reached
8.45 onwards. On earlier
version controllers, this the limit value.
D command ends at the
following times:
• TRQSTS command value
1. W
 hen, at the point
E when the time required
to move to the target 1. 1 is set at the TRQSTS function when this command has ended due to a time-
position has elapsed, out during which the axis torque has reached its limit value.
F the axis has reached
the target position. 2. "0" is set if the command was ended for any other reason.
2. W h e n , a t t h e p o i n t
when the time required • Cautions
G to move to the target
position has elapsed,
the axis torque has 1. Maximum torque command values which have been changed by the TORQUE
H already reached the
limit value for 1 second
/ TORQUE2 statements do not immediately become effective. They become
or longer. effective at the next movement command (MOVE or DRIVE statement, etc.).
3. W h e n , a t t h e p o i n t 2. Even after this command ends, the maximum torque limit and torque control
I when the time required status remain in effect. The same applies if a stop occurs due to an interlock,
to move to the target
etc., while this command is being executed.
position has elapsed,
J the torque has reached
the limit value, with this
3. Torque control is canceled when an axis related operation is executed.
Such operations include servo ON/OFF switching, and a MOVE command
status continuing for 1
second or longer.
execution, etc.
K 4. To cancel the maximum torque limit, use the TORQUE statement to specify a
new maximum torque command value.

L
c CAUTION 5. Maximum torque limit is cancelled at the following times regardless of
••In driver versions prior to whether or not a TORQUE statement is used:
Ver.2.17, the maximum • When the controller power is turned ON.
torque instruction is
M enabled at the point • When the servo is turned OFF.
when it is changed by • When a return-to-origin or an absolute reset (except by the mark method) is
the TORQUE / TORQUE2
executed.
statement.
• When parameter data has been changed or initialized.

8-54 Chapter 8 Robot Language Lists


29 DRIVE / DRIVE2
8
• Restrictions

1. Two or more axes cannot be specified with this option.


2. Maximum movement speed is set as 10% of the normal operating speed.
3. Manual movement is not possible at axes which are under torque control (axes
where this command has been executed).
A
SAMPLE
TRQTIME(3) 2500 Sets the axis 3 torque control B
time-out period as 2.5 seconds.
DRIVE(3,P1),T (20,15) Sets the maximum torque value to 20% of the
rated torque, and the torque offset to 15, and C
moves the axis 3 from its current position to
the point specified by P1 (pushing action). D
IF TRQSTS(3) 1 THEN Checks to see if a time-out has occurred.
DO(21) 1 Time-out occurred (pushing is complete).
(Result is output to DO(21) in this example.) E
ELSE
DO(21) 0 Time-out has not occurred. (Reached
target position but failed to F
complete pushing.) (Result is
output to DO(21) in this example.)
ENDIF G
TORQUE(3) 100 Maximum torque command value is
returned to original value (100%).
DRIVE(3,P0) Torque limit and torque control
H
end, and movement to P0 occurs.
I
●● XY setting

Format J
XY
K
Explanation Moves multiple specified axes to a position specified by Cartesian coordinates.
All the specified axes arrive at the target position at the same time.
If all axes which can be moved by MOVE / MOVE2 statements have been
L
specified, operation is identical to that which occurs when using MOVE / MOVE2
statements. M
The following restrictions apply to this command:
1. Axes specified by <axis number> must include the axis 1 and 2.
2. This command can be specified at SCARA robots and XY robots.
3. Point settings must be in "mm" or "deg" units (real number setting).

SAMPLE
DRIVE(1,P100),(2,P100),(4,P100),XY
The axis 1, 2 and 4 move from their
current positions to the Cartesian
coordinates position specified by P100.

DRIVE / DRIVE2 8-55


29 DRIVE / DRIVE2
8
●● Movement direction setting

Format

PLS
MNS
A
n NOTE
Explanation <With a "movement direction setting">
• Movement occurs in the specified direction. A PLS setting always results in
B ••The "movement direction
plus-direction movement, and a MNS setting always results in minus-direction
setting" option is available
in the following software movement.
C versions: • If the target position and the current position are the same, a 1-cycle movement
RCX240 Ver.10.66 onwards
amount occurs in the specified direction, then operation stops.
RCX22x Ver.9.39 onwards
D <Without a "movement direction setting">
• Movement occurs in the direction in which the movement distance is shortest.

E • If the target position and the current position are the same, no movement
occurs.

F • Cautions

1. When using this option, the maximum movement distance per operation is the
G distance equivalent to 1 cycle (360°). If movement which exceeds the 1-cycle
distance is desired, the movement must be divided into 2 or more operations.
H 2. When using this option, the DRIVE statement's soft limit values are as shown
below.
Plus-direction soft limit: 67,000,000 [pulse]
I Minus-direction soft limit: -67,000,000 [pulse]

J • Restrictions

1. Only the axis of a single-axis rotary type robot can be specified.


K 2. Simultaneous movement of multiple axes is not possible when a movement
direction has been specified. If such movement is attempted, the
"5.37: Specification mismatch" error will occur (see below).
L Example: DRIVE (3,P1), (4,P1), PLS
3. The PLS and MNS options cannot both be specified simultaneously.
M 4. Attempting to use this option for a "limitless motion INVALID" axis will result
in the "2.29: Cannot move without the limit" error.
5. If a stop is executed by pressing the [STOP] key, etc., during movement which
uses this option (including during a deceleration), the movement distance when
restarted will be equivalent to a 1-cycle distance (360°).

8-56 Chapter 8 Robot Language Lists


29 DRIVE / DRIVE2
8
SAMPLE
DRIVE (4,270.00), PLS
.......When the robot current position is 260 :
Moves 10 in the plus direction from the
current position.
When the robot current position is 280 :
A
Moves 350 in the plus direction from the
current position. B
DRIVE (4,270.00), MNS
.......When the robot current position is 260 :
Moves 350 in the minus direction from the C
current position.
When the robot current position is 280 :
Moves 10 in the minus direction from the D
current position.
DRIVE (4,270.00)
.......When the robot current position is 260 : E
Moves 10 in the plus direction from the
current position. F
When the robot current position is 280 :
Moves 10 in the minus direction from the
current position. G
DRIVE2 (3,270.00), PLS
.......When the robot current position is 260 :
Moves 10 in the plus direction from the H
current position.
When the robot current position is 280 :
Moves 350 in the plus direction from the I
current position.
DRIVE2 (3,270.00), MNS
.......When the robot current position is 260 :
J
Moves 350 in the minus direction from the
current position. K
When the robot current position is 280 :
Moves 10 in the minus direction from the
current position. L
DRIVE2 (3,270.00)
.......When the robot current position is 260 :
Moves 10 in the plus direction from the M
current position.
When the robot current position is 280 :
Moves 10 in the minus direction from the
current position.

Related commands TORQUE, TORQUE2, TRQTIME, TRQTIME2, TRQSYS, TRQSYS2, CURTRQ, CURTRQ2

DRIVE / DRIVE2 8-57


30 DRIVEI / DRIVEI2
8 Moves the specified robot axes in a relative manner

Format main group

DRIVEI(<axis number>, <expression>)[,(<axis number>,


<expression>)...][,option]
A
Format sub group
B DRIVEI2(<axis number>, <expression>)[,(<axis number>,
<expression>)...][,option]
C
Values <axis number>........................1 to 4
<expression>..........................Motor position (mm, deg, pulses) or point expression.
D
Explanation Directly executes relative movement of each axis of a group, including the group's

E auxiliary axes.
• Movement type : PTP movement of a specified axis
• Point data setting : Direct coordinate data input, point definition
F • Options : Speed setting, STOPON conditions setting

MEMO • When DRIVEI motion to the original target position is interrupted and then restarted, the target
G position for the resumed movement can be selected as the "MOVEI/DRIVEI start position" in the
n NOTE controller's "other parameters". For details, refer to the controller manual.

H ••T h i s p a r a m e t e r i s
available in the following
1) KEEP (default setting) Continues the previous (before interruption) movement. The original
target position remains unchanged.
software version:
2) RESET Relative movement begins anew from the current position. The new
RCX14x Ver. 8.66 onwards
I RCX22x Ver. 9.13 onwards
target position is different from the original one (before interruption).
(Backward compatibility)
••In version prior to those

J shown above, a RESET


must be performed at the
controller. Movement type

K ●● PTP (point-to-point) of specified axis


PTP movement begins after positioning of all axes specified at <axis number> is complete (within
the tolerance range), and the command terminates when the specified axes enter the OUT
L position range. When two or more axes are specified, they will reach their target positions
simultaneously.
M If the next command following the DRIVEI / DRIVEI2 command is an executable command
such as a signal output command, that next command will start when the movement axis enters
the OUT position range. In other words, that next command starts before the axis arrives within
the target position tolerance range.
Example:
Signal output (DO, etc.) Signal is output when axis enters within OUT position range.
DELAY command is executed and standby starts, when axis enters the
DELAY
OUT position range.
Program stops and is reset when axis enters the OUT position range.
HALT
Therefore, axis movement also stops.
Program temporarily stops when axis enters the OUT position range.
HOLD
Therefore, axis movement also stops.
WAIT WAIT command is executed when axis enters the OUT position range.

8-58 Chapter 8 Robot Language Lists


30 DRIVEI / DRIVEI2
8
The WAIT ARM / WAIT ARM2 statements are used to execute the next command after the axis
enters the tolerance range.

DRIVEI command
WAIT ARM statement

DRIVEI(1,P1) DRIVEI(1,P1)
A
Target position
DO(20)=1 WAIT ARM
DO(20)=1

B
P1

C
Tolerance
OUT position
DO(20) turns ON DO(20) turns ON

D
DRIVEI(1,P1) DRIVEI(1,P1)
Target position
HOLD WAIT ARM
HOLD
E

Tolerance F
OUT position
HOLD execution HOLD execution
(program temporarily stops)
G
(program temporarily stops)

33820-R7-00

n NOTE
Limitless motion related cautions H
••T h e " l i m i t l e s s m o t i o n "
• When the "limitless motion" parameter is enabled, the DRIVEI / DRIVEI2 statement soft limit
function is available in
the following software check values are as follows: I
versions: Plus-direction soft limit: 67,000,000 [pulse]
RCX240 Ver.10.66 onwards
RCX22x Ver.9.39 onwards
Minus-direction soft limit: -67,000,000 [pulse]
J
•When using the DRIVEI / DRIVEI2 statements, the above values represent the maximum movement
distance per operation.
K
SAMPLE
DRIVEI(1,P0) The axis 1 moves from its L
current position to the
position specified by P0.
M

DRIVEI / DRIVEI2 8-59


30 DRIVEI / DRIVEI2
8
Point data setting types

●● Direct numeric value input


The motor position is specified directly in <expression>.
A If the motor position's numeric value is a real number, this is interpreted as a "mm / deg" units,
and each axis will move from the 0-pulse position to a pulse-converted position.

B SAMPLE
DRIVEI(1,10000) The axis 1 moves from its
current position to the
C "+10000 pulses" position.
DRIVEI(4,90.00) The axis 4 moves from its current
D position to the +90 position
(when axis 4 is a rotating axis).

E
n NOTE
●● Point definition
Point data is specified in <expression>. The axis data specified by the <axis number> is used.
F ••If point data is specified
with both integers and
The motor position is determined in accordance with the point data defined by the point
real numbers in the same expression. If the point expression is in "mm/degrees" units, movement for each axis occurs
statement, all values are from the 0-pulse position to the pulse-converted position.
G handled in "mm/degrees"
units. SAMPLE
DRIVEI(1,P1) The axis 1 moves from its
H current position the distance
specified by P1.
I DRIVEI(4,P90) The axis 4 moves from its
current position the number of
degrees specified by P90 (when
J axis 4 is a rotating axis).

8-60 Chapter 8 Robot Language Lists


30 DRIVEI / DRIVEI2
8
Option types

●● Speed setting

Format

1. SPEED=<expression> A
2. S=<expression>
B

n NOTE
Values <expression>..........................1 to 100 (units: %)
C
••This defines the maximum
speed, and does not Explanation The program's movement speed is specified by the <expression>.
guarantee that all The actual speed is as follows:
movement will occur at • Robot's max. speed (mm/sec, or deg/sec) × automatic movement speed (%) × D
specified speed.
program movement speed (%).
This option is enabled only for the specified DRIVEI / DRIVEI2 statement.
E
SAMPLE
DRIVEI(1,10000),S=10 The axis 1 moves from its current F
position to the +10000 pulses position
at 10% of the automatic movement speed.
G
Format

1. DSPEED=<expression> H
2. DS=<expression>

I
n NOTE
Values <expression>..........................0.01 to 100.00 (units: %)

••Speed setting (DSPEED)


is available only in the Explanation The axis movement speed is specified as an <expression>.
J
following software The actual speed is determined as shown below.
versions: • Robot's max. speed (mm/sec, or deg/sec) × axis movement speed (%).
RCX14x Ver. 8.71 onwards, This option is enabled only for the specified DRIVEI / DRIVEI2 statement. K
RCX22x Ver. 9.18 onwards
• Movement always occurs at the DSPEED <expression> value (%) without being
••SPEED option and DSPEED
affected by the automatic movement speed value (%).
option cannot be used L
together.
SAMPLE
DRIVEI(1,10000),DS=0.1 The axis 1 moves from its current
position to the +10000 pulses position
M
at 0.1% of the automatic movement speed.

DRIVEI / DRIVEI2 8-61


30 DRIVEI / DRIVEI2
8
●● STOPON conditions setting

Format

STOPON <conditional expression>

A Explanation Stops movement when the conditions specified by the conditional expression
are met. Because this is a deceleration type stop, there will be some movement
(during deceleration) after the conditions are satisfied.
B If the conditions are already satisfied before movement begins, no movement
occurs, and the command is terminated.
C This option is enabled only by program execution.

MEMO • When the conditional expression used to designate the STOPON condition is a numeric
D expression, the conditions for determining a TRUE or FALSE status can be changed at the
controller's "TRUE conditions" in the "Other parameters" mode. These conditions apply to all

E n NOTE the IF, WHILE, WAIT, STOPON, etc., conditional expressions. For details, refer to the controller
manual.
••This parameter is only
available in the following 1) -1 (default setting) An expression value of "-1" indicates a TRUE status, and "0" indicates
software versions:
F RCX14x Ver. 8.63 onwards
a FALSE status.
A "6.35: Incorrect condition expression" error occurs if the expression
RCX22x Ver. 9.08 onwards
value is other than "-1" or "0".
G ••O n e a r l i e r v e r s i o n
controllers, -1 is "true" and
2) not 0 Any expression value other than "0" indicates a TRUE status, and "0"
a value other than -1 is indicates a FALSE status.
"false" (not changeable).
H
SAMPLE
DRIVEI(1,10000),STOPON DI(20)=1
I Axis 1 moves from its current position toward
the "+10000 pulses" position and stops at an
intermediate point if the "DI (20) = 1" condition
J become satisfied. The next step is then executed.

8-62 Chapter 8 Robot Language Lists


31 END SELECT
Ends the SELECT CASE statement 8

Format

SELECT [CASE] <expression>


CASE <expression's list 1>
[command block 1] A
CASE <expression's list 2>
[command block 2]
: B
[CASE ELSE
[command block n]
END SELECT C

Explanation Directly ends the SELECT CASE command block. D


For details, see section "87 SELECT CASE".

SAMPLE E
WHILE -1
SELECT CASE DI3() F
CASE 1,2,3
CALL *EXEC(1,10)
CASE 4,5,6,7,8,9,10 G
CALL *EXEC(11,20)
CASE ELSE
CALL *EXEC(21,30) H
END SELECT
WEND
HALT I

Related commands SELECT CASE J

END SELECT 8-63


32 END SUB
8 Ends the sub-procedure definition

Format

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


<command block>
A END SUB

Explanation Ends the sub-procedure definition which begins at the SUB statement.
B For details, see section "99 SUB to ENDSUB".

SAMPLE 1
C I=1
CALL *TEST
D PRINT I
HALT
SUB ROUTINE: TEST
E SUB *TEST
I=50
END SUB
F
Related commands CALL, EXIT SUB, SUB to END SUB
G

8-64 Chapter 8 Robot Language Lists


33 ERR / ERL
Acquires the error code / error line No 8

Format

ERR
ERL
A
Explanation Variables ERR and ERL are used 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
B
in which the error occurred.

SAMPLE 1 C
IF ERR <> &H604 THEN HALT
IF ERL=20 THEN RESUME NEXT D

Related commands ON ERROR GOTO, RESUME


E

ERR / ERL 8-65


34 EXIT FOR
8 Terminates the FOR to NEXT statement loop

Format

EXIT FOR

A Explanation Directly terminates the FOR to NEXT statement loop, then jumps to the command
which follows the NEXT statement.
This statement is valid only between the FOR to NEXT statements.
B
MEMO • The FOR to NEXT statement loop will end when the FOR statement condition is satisfied or

C when the EXIT FOR statement is executed. A "5.12: Stack overflow" error, etc., will occur if
another statement such as GOTO is used to jump out of the loop.

D SAMPLE
*ST:
E WAIT DI(20)=1
FOR A%=101 TO 109
MOVE P,P100,Z=0
F DO(20)=1
MOVE P,P[A%],Z=0
DO(20)=0
G IF DI(20)=0 THEN EXIT FOR
NEXT A%
H GOTO *ST
HALT

I Related commands FOR, NEXT

8-66 Chapter 8 Robot Language Lists


35 EXIT SUB
Terminates the sub-procedure defined by SUB to END 8

Format

EXIT SUB

Explanation The EXIT SUB statement terminates the sub-procedure defined by the SUB to END A
SUB statements, 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 to END
B
SUB statements.
C
MEMO • To end the sub-procedure defined by the SUB to END SUB statements, use the END SUB
statement or EXIT SUB statement. A "5.12: Stack overflow" error, etc., will occur if another
statement such as GOTO is used to jump out of the loop.
D

SAMPLE E
MAIN ROUTINE
CALL *SORT2(REF X%,REF Y%)
HALT
F
SUB ROUTINE: SORT
SUB *SORT2(X%, Y%) G
IF X%>=Y% THEN EXIT SUB
TMP%=Y%
Y%=X% H
X%=TMP%
END SUB
I
Related commands CALL, SUB to END SUB, END SUB
J

EXIT SUB 8-67


36 EXIT TASK
8 Terminates its own task which is in progress

Format

EXIT TASK

A Explanation Terminates its own task which is currently being executed.


This statement is valid for all tasks other than task 1 (Task 1 cannot be terminated).

B MEMO • Even if a task that has started as a subtask jumps to another task processing routine with a
statement such as GO TO, that processing routine is then executed as this subtask processing.

C
SAMPLE
TASK1 ROUTINE
D *ST:
MO(20)=0
E START *SUBTASK2,T2
MOVE P,P0,P1
WAIT MO(20)=1
F GOTO *ST
HALT
TASK2 ROUTINE
G *SUBTASK2:
P100=JTOXY(WHERE)
IF LOCZ(P100)>=100.0 THEN
H MO(20)=1
EXIT TASK
I ENDIF
DELAY 100
GOTO *SUBTASK2
J EXIT TASK

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

8-68 Chapter 8 Robot Language Lists


37 FOR to NEXT
Performs loop processing until the variable-specified value is exceeded 8

Format

FOR <control variable> = <start value> TO <end value> [STEP] <step>]


<command block>
NEXT [<control variable>] A
Explanation These direct statements repeatedly execute commands between the FOR to NEXT
statements for the <start value> to <end value> number of times, while changing the
B
<control variable> value in steps specified by <STEP>. If <STEP> is omitted, its value
becomes "1". C
The <STEP> value may be either positive or negative.
The <control variable> must be a numeric <simple variable> or <array variable>.
The FOR and NEXT statements are always used as a set. D
SAMPLE
'CYCLE WITH CYCLE NUMBER OUTPUT TO DISPLAY E
FOR A=1 TO 10
MOVE P,P0
F
MOVE P,P1
MOVE P,P2
PRINT"CYCLE NUMBER=";A G
NEXT A
HALT
H
Related commands EXIT FOR
I

FOR to NEXT 8-69


38 GOSUB to RETURN
8 Jumps to a sub-routine

Format

GOSUB <label> * GOSUB can also be expressed as "GO SUB".

A <label>:

RETURN
B
Explanation Jumps to the <label> sub-routine specified by the GOSUB statement.
C A RETURN statement within the sub-routine causes a jump to the next line of the
GOSUB statement.

D MEMO • The GOSUB statement can be used up to 29 times in succession. Note that this number of times
is reduced if commands containing a stack such as an IF statement or CALL statement are used.
• When a jump to a subroutine was made with the GOSUB statement, always use the RETURN
E statement to end the subroutine. If another statement such as GOTO is used to jump out of the
subroutine, an error such as "5.12: Stack overflow" may occur.
F
SAMPLE
G *ST:
MOVE P,P0
GOSUB *CLOSEHAND
H MOVE P,P1
GOSUB *OPENHAND
GOTO *ST
I HALT
SUB ROUTINE
*CLOSEHAND:
J DO(20) = 1
RETURN
K *OPENHAND:
DO(20) = 0
RETURN
L
Related commands RETURN

8-70 Chapter 8 Robot Language Lists


39 GOTO
Executes an unconditional jump to the specified line 8

Format

GOTO <label> * GOTO can also be expressed as "GO TO".

Explanation Executes an unconditional jump to the line specified by <label>. A


To select a conditional jump destination, use the ON to GOTO, or IF statements.

SAMPLE B
MAIN ROUTINE
*ST:
MOVE P,P0,P1 C
IF DI(20) = 1 THEN
GOTO *FIN D
ENDIF
GOTO *ST
*FIN: E
HALT

GOTO 8-71
40 HALT
8 Stops the program and performs a reset

Format

HALT[ <expression> ]
<character string>
A
Explanation Directly stops the program and resets it. If restarted after a HALT, the program runs
from its beginning.
B
MEMO • If an <expression> or <character string> is written in the statement, the contents of the

C <expression> or <character string> are displayed on the programming box screen.


• If a "_SELECT" program name exists, processing will switch to that "_SELECT" program after the
HALT command is executed.
D
SAMPLE
E MAIN ROUTINE
*ST:
MOVE P,P0,P1
F IF DI(20) = 1 THEN
GOTO *FIN
ENDIF
G GOTO *ST
*FIN:
H HALT "PROGRAM FIN"

In PTP movement specified by movement commands such as MOVE and DRIVE, the next line's
I command is executed when the axis enters the OUT position range.
Therefore, if a HALT command exists immediately after a PTP movement command, that HALT

J command is executed before the axis arrives in the target position tolerance range.
Likewise, in interpolation movement during MOVE/MOVE2 commands, the next command is
executed immediately after movement starts. Therefore, if a HALT command exists immediately
K after the interpolation movement command during MOVE/MOVE2, that HALT command is
executed immediately after movement starts.
In either of the above cases, use the WAIT ARM/WAIT ARM2 command if desiring to execute the
L HALT command after the axis arrives within the target position tolerance range.

HALT command
M

DRIVE(1,P1) DRIVE(1,P1)
Target position
HALT WAIT ARM
HALT

Tolerance
OUT position
HALT execution HALT execution

33821-R7-00

Reference For details regarding "_SELECT", see Chapter 1 "4 Program Names".

8-72 Chapter 8 Robot Language Lists


41 HAND / HAND2
Defines the hand 8

Format main group

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

B
Format sub group

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

Values n: hand No..............................main group: 0 to 3 → HAND is used.


E
sub group: 4 to 7 → HAND2 is used.

Explanation The HAND / HAND2 statement only defines the hand. To actually change hands, the F
CHANGE / CHANGE2 statement must be used.
For CHANGE / CHANGE2 statement details, see section "12 CHANGE / CHANGE2".
G
MEMO • If a power OFF occurs during execution of the hand definition statement, the "9.7 Hand check-
sum error" may occur.
H

41.1 For SCARA Robots


I

1. When the <4th parameter> “R” is not specified J


Hands installed on the second arm tip are selected (see below).
K
<1st parameter> ................ N
 umber of offset pulses between the standard second arm position
and the virtual second arm position of hand "n". "+" indicates the
counterclockwise direction [pulse].
L
<2nd parameter> . ............. D
 ifference between the hand "n" virtual second arm length and the
standard second arm length. [mm] M
<3rd parameter> ............... Z-axis offset value for hand "n". [mm]

When the <4th parameter> "R" is not specified:

Hand 1 Hand 2
20.00mm

lses
0 pu
-500
m
m
00
0.

m
15

ar
d
2n
d
ar
nd
a
St

33801-R7-00

HAND / HAND2 8-73


41 HAND / HAND2
8
SAMPLE
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
A MOVE P,P1 Tip of hand 2 moves to P1.
CHANGE H1
B MOVE P,P1 Tip of hand 1 moves to P1.
HALT

C
SAMPLE:HAND
D
Y Y

E (150.00, 300.00)
Hand 2

Hand 1
F (150.00, 300.00)

G X
X

H
33802-R7-00

8-74 Chapter 8 Robot Language Lists


41 HAND / HAND2
8
2. When the <4th parameter> "R" is specified

If the R-axis uses a servo motor, the hands that are offset from the R-axis rotating center are selected
(see below).

<1st parameter> ................ W


 hen the current position of R-axis is 0.00, this parameter shows A
the angle of hand "n" from the X-axis plus direction in a Cartesian
coordinate system. ("+"indicates the counterclockwise direction.)
[degree]
B
<2nd parameter> . ............. Length of hand "n". [mm] (>0)
<3rd parameter> ............... Z-axis offset amount for hand "n". [mm] C
When the <4th parameter> "R" is specified
D
Y

Standard 2nd arm 150.00mm


E
X

-90.00 deg.
Hand 1 F
100.00mm Hand 2

33803-R7-00 G
SAMPLE
HAND H1= 0.00 150.0 0.0 R
H
HAND H2= -90.00 100.00 0.0 R
P1= 150.00 300.00 0.00 0.00 0.00 0.00 I
CHANGE H1
MOVE P,P1 Tip of hand 1 moves to P1.
CHANGE H2 J
MOVE P,P1 Tip of hand 2 moves to P1.
HALT
K
SAMPLE:HAND
L
Y Y

M
Hand 1 Hand 2

(150.00, 300.00) (150.00, 300.00)

X X

33804-R7-00

HAND / HAND2 8-75


41 HAND / HAND2
8
41.2 For Cartesian Robots
1. When the <4th parameter> "R" is not specified

Hands installed on the second arm tip are selected (see below).
A
<1st parameter> ................ Hand "n" X-axis offset amount [mm]
<2nd parameter> . ............. Hand "n" Y-axis offset amount [mm]
B <3rd parameter> ............... Hand "n" Z-axis offset amount [mm]

When the <4th parameter> "R" is not specified


C

D
X
Hand 2
E -100.00mm
Hand 1

F 100.00mm

G
Y
33805-R7-00

SAMPLE
H
HAND H1= 0.00 0.00 0.00
HAND H2= 100.0 -100.0 -100.0
I P1= 200.00 250.00 0.00 0.00 0.00 0.00
CHANGE H2
MOVE P,P1 Tip of hand 2 moves to P1.
J CHANGE H1
MOVE P,P1 Tip of hand 1 moves to P1.
HALT
K

L SAMPLE:HAND

X X

Hand 2 Hand 1

(200.00, 250.00) (200.00, 250.00)

Y Y
33806-R7-00

8-76 Chapter 8 Robot Language Lists


41 HAND / HAND2
8
2. When the <4th parameter> "R" is specified

If the R-axis uses a servo motor, the hands that are offset from the R-axis rotating center are selected
(see below).

<1st parameter> ................ W


 hen the current position of R-axis is 0.00, this parameter shows A
the angle of hand "n" from the X-axis plus direction in a Cartesian
coordinate system. ("+"indicates the counterclockwise direction.)
[degree]
B
<2nd parameter> . ............. Length of hand "n". [mm] (>0)
<3rd parameter> ............... Z-axis offset amount for hand "n". [mm] C
When the <4th parameter> "R" is specified
D

X E
Hand1

150.00mm 90 deg.
F
Hand2

100.00mm
G
Y
33807-R7-00
H
SAMPLE
HAND H1= 0.00 100.00 0.00 R I
HAND H2= 90.00 150.00 0.00 R
P1= 200.00 250.00 0.00 0.00 0.00 0.00
CHANGE H2 J
MOVE P,P1 Tip of hand 2 moves to P1.
CHANGE H1 K
MOVE P,P1 Tip of hand 1 moves to P1.
HALT
L
SAMPLE:HAND
M

X X

Hand 2 Hand 1

(200.00, 250.00) (200.00, 250.00)

Y Y
33808-R7-00

HAND / HAND2 8-77


42 HOLD
8 Temporarily stops the program

Format

HOLD[ <expression> ]
<character string>
A
Explanation Temporarily stops the program. When restarted, processing resumes from the next
line after the HOLD statement. If an <expression> or <character string> is written in
B the statement, the contents of the <expression> or <character string> display on the
programming box screen.
C SAMPLE
MAIN ROUTINE
D *ST:
MOVE P,P0,P1
IF DI(20)=1 THEN
E HOLD "PROGRAM STOP"
ENDIF
GOTO *ST
F HALT

G In PTP movement specified by movement commands such as MOVE and DRIVE, the next line's
command is executed when the axis enters the effective OUT position range.
H Therefore, if a HOLD command exists immediately after a PTP movement command, that HOLD
command is executed before the axis arrives in the target position tolerance range.
Likewise, in interpolation movement during MOVE/MOVE2 commands, the next command is
I executed immediately after movement starts. Therefore, if a HOLD command exists immediately
after the interpolation movement command during MOVE/MOVE2, that HOLD command is

J executed immediately after movement starts.


In either of the above cases, use the WAIT ARM/WAIT ARM2 command if desiring to execute the
HOLD command after the axis arrives within the target position tolerance range.
K HOLD command

L
DRIVE(1,P1) DRIVE(1,P1)
Target position
HOLD WAIT ARM
HOLD
M

Tolerance
OUT position
HOLD execution HOLD execution

33822-R7-00

8-78 Chapter 8 Robot Language Lists


43 IF
Evaluates a conditional expression value, and executes the command in accordance with the conditions 8

MEMO • When the conditional expression used to designate the IF statement conditions is a numeric
expression, the conditions for determining a TRUE or FALSE status can be changed at the

n NOTE
controller's "TRUE conditions" in the "Other parameters" mode. These conditions apply to all
the IF, WHILE, WAIT, STOPON, etc., conditional expressions. For details, refer to the controller A
••This parameter is only manual.
available in the following
software versions: 1) -1 (default setting) An expression value of "-1" indicates a TRUE status, and "0" indicates
B
RCX14x Ver. 8.63 onwards a FALSE status.
RCX22x Ver. 9.08 onwards A "6.35 Incorrect condition expression" error occurs if the expression
••O n e a r l i e r v e r s i o n value is other than "-1" or "0". C
controllers, -1 is "true" and 2) not 0 Any expression value other than "0" indicates a TRUE status, and "0"
a value other than -1 is indicates a FALSE status.
"false" (not changeable). D

E
43.1 Simple IF statement

Format F
IF <conditional expression> THEN <label 1> [ELSE <label 2> ]
<command statement 1> <command statement 2> G

Explanation If the condition specified by the <conditional expression> is met, processing jumps H
either to the <label 1> which follows THEN, or to the next line after <command
statement 1> is executed.
If the condition specified by the <conditional expression> is not met, the following I
processing occurs:
1. Processing either jumps to the <label 2> specified after the ELSE statement, or to
J
the next line after <command statement 2> is executed.
2. If nothing is specified after the ELSE statement, no action is taken, and processing
simply jumps to the next line. K
SAMPLE
MAIN ROUTINE L
*ST:
MOVE P,P0,P1
IF DI(20)=1 THEN *L1 If DI (20) is "1", a jump to M
*L1 occurs.
DO(20)=1
DELAY 100
*L1:
IF DI(21)=1 THEN *ST ELSE *FIN
If DI (21) is "1", a jump to
*ST occurs. If other than "1",
a jump to *FIN occurs.
*FIN:
HALT

IF 8-79
43 IF
8
43.2 Block IF statement

n NOTE
Format

IF <conditional expression 1> THEN


••This parameter is only
A available in the following
software versions:
<command block 1>
[ELSEIF <conditional expression 2> THEN
RCX14x Ver. 8.63 onwards <command block 2>]
B RCX22x Ver. 9.08 onwards [ELSE
••O n e a r l i e r v e r s i o n <command block n>]
controllers, -1 is "true" and
a value other than -1 is
ENDIF
C "false" (not changeable).

Explanation If the condition specified by <conditional expression 1> is met, this statement
D executes the instructions specified in <command block 1>, then jumps to the next
line after ENDIF.

E 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.
If all the conditions specified by the conditional expression are not met, <command
F block n> is executed.

G MEMO • The IF statement can be used up to 48 times in succession. Note that the maximum number of
times is reduced if commands containing a stack such as a GOSUB or CALL statement are used.

H SAMPLE
MAIN ROUTINE
I *ST:
MOVE P,P0,P1
IF DI(21,20)=1 THEN
J DO(20)= 1
DELAY 100
WAIT DI(20)=0
K ELSEIF DI(21,20)=2 THEN
DELAY 100
ELSE
L GOTO *FIN
ENDIF
M GOTO *ST
*FIN:
HALT

8-80 Chapter 8 Robot Language Lists


44 INPUT
Assigns a value to a variable specified from the programming box 8

Format

INPUT [<prompt statement> ; ] <variable> [, <variable> ,...]


, <point variable> <point variable>
<shift variable> <shift variable> A
Explanation Assigns a value to the variable specified from the programming box.
The input definitions are as follows:
B

1. When two or more variables are specified by separating them with a comma ( , ), C
the specified input data items must also be separated with a comma ( , ).
2. At the <prompt statement>, enter a character string enclosed in quotation marks
(" ") that will appear as a message requiring data input. When a semicolon ( ; ) is D
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
E
displayed following the message.
3. When the <prompt statement> is omitted, only a question mark ( ? ) and a space
will be displayed. F
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".
G
5. If only the ENTER key is pressed without making any entry, the program interprets
this as a "0" or "null string" input. However, if specifying two or more variables, a H
comma ( , ) must be used to separate them.
6. If the specified variable is a character type and a significant space is to be entered
before and after a comma ( , ), double quotation mark ( " ) or character string, the I
character string must be enclosed in double quotation marks ( " ). Note that in this
case, you must enter two double quotation marks in succession so that they will
J
be identified as a double quotation mark input.
7. Pressing the ESC key skips this command.
K
MEMO • If the variable and the value to be assigned are different types, an "Input again" message displays
and a "waiting for input" status is established. L
• When assigning alphanumeric characters to a character variable, it is not necessary to enclose
the character string in double quotation marks ( " ).
M
SAMPLE
INPUT A
INPUT "INPUT POINT NUMBER";A1
INPUT "INPUT STRING",B$(0),B$(1)
INPUT P100
HALT

INPUT 8-81
45 INT
8 Truncates decimal fractions

Format

INT (<expression>)

A Explanation This function acquires an integer with decimal fractions truncated. The maximum
integer value which does not exceed the <expression> value is acquired.

B SAMPLE
A=INT(A(0))
C B=INT(-1. 233) "-2" is assigned to B.

8-82 Chapter 8 Robot Language Lists


46 JTOXY / JTOXY2
Performs axis unit system conversions (pulse → mm) 8

n NOTE
Format

JTOXY (<point expression>)


main group

••X-arm and Y-arm rotation


information is only
available in software
Ver.10.66 onwards. Format sub group
A
JTOXY2 (<point expression>)
B
Explanation Converts the joint coordinate data (unit: pulses) specified by the <point expression>
into Cartesian coordinate data (unit: mm, deg.). C
On YK500TW model robots, the X-arm and Y-arm rotation information is also set.

SAMPLE D
P10=JTOXY(WHERE) Current position data is
converted to Cartesian
coordinate data. E

Related commands XYTOJ, XYTOJ2 F

JTOXY / JTOXY2 8-83


47 LABEL Statement
8 Defines labels at program lines

Format

*<label> :

A Explanation Defines a <label> on a program line. A <label> must always begin with an asterisk
mark (*), and it must be located at the beginning of the line.
Although a colon mark (:) is required at the end of the <label> when defining it, this
B mark is not required when specifying program jump destinations.

C 1. A <label> must begin with an alphabetic or numeric character.


2. Alphanumeric and underbars (_) can be used as the remaining <label> characters.
Special symbols, etc., cannot be used.
D 3. The <label> must not exceed 16 characters (all characters beyond the 16th
character are ignored).

E SAMPLE
*ST: *ST label is defined.
F MOVE P,P0
DO(20) = 1
MOVE P,P1
G DO(20) = 0
GOTO *ST Jumps to *ST.
HALT
H

8-84 Chapter 8 Robot Language Lists


48 LEFT$
Extracts character strings from the left end 8

Format

LEFT$ (<character string expression> , <expression>)

Values <expression>..........................0 to 75 A
Explanation This function extracts a character string with the digits specified by the <expression>
from the left end of the character string specified by <character string expression>.
B
The <expression> value must be between 0 and 75, otherwise an error will occur.
If the <expression> value is 0, then LEFT$ will be a null string (empty character C
string).
If the <expression> value has more characters than the <character string expression>,
LEFT$ will become the same as the <character string expression>. D

SAMPLE E
B$=LEFT$(A$,4) 4 characters from the left end
of A$ are assigned to B$.
F
Related commands MID$, RIGHT$
G

LEFT$ 8-85
49 LEFTY / LEFTY2
8 Sets the SCARA robot hand system as a left-hand system

Format main group

LEFTY

A Format sub group

LEFTY2
B
Explanation This statement specifies left-handed movement to a point specified in Cartesian
C coordinates.
This statement only selects the hand system, and does not move the robot. If
executed while the robot arm is moving, execution waits until movement is complete
D (positioned within tolerance range).
This command is only valid for SCARA robots.

E SAMPLE
RIGHTY
F MOVE P,P1
LEFTY
MOVE P,P1
G RIGHTY
HALT

H SAMPLE:LEFTY/RIGHTY

I P1

(2) (1)

K Right-handed system
Left-handed system

M
SCARA robot
33809-R7-00

Related commands RIGHTY, RIGHTY2

8-86 Chapter 8 Robot Language Lists


50 LEN
Acquires a character string length 8

Format

LEN(<character string expression>)

Explanation Returns the length (number of bytes) of the <character string expression>. A
SAMPLE
B
B=LEN(A$)

LEN 8-87
51 LET
8 Assigns values to variables

Format

[LET] <arithmetic assignment statement>


<character string assignment statement>
A <point assignment statement>
<shift assignment statement>

B Explanation Directly executes the specified assignment statement. The right-side value is assigned
to the left side. An assignment statement can also be directly written to the program
C without using a LET statement.

• If the controller power is turned off during execution of a <point assignment statement> or
D MEMO
<shift assignment statement>, a memory-related error such as the "9.2: Point check-sum error"
or the "9.6: Shift check-sum error" may occur.
E
1. Arithmetic assignment statement
F
Format
G [LET] <arithmetic variable> = <expression>
<point element variable>
<shift element variable>
H <parallel output variable>
<internal output variable>
<arm lock output variable>
I <timer output variable>
<serial output variable>
J
Values <expression>..........................Variable, function, numeric value
K
Explanation The <expression> value is assigned to the left-side variable.

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

8-88 Chapter 8 Robot Language Lists


51 LET
8
2. Character string assignment statement

Format

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


A
Explanation The <character string expression> value is assigned to the character string variable.
Only the plus (+) arithmetic operator can be used in the <character string
expression>. Other arithmetic operators and parentheses cannot be used.
B
SAMPLE
A$ ="YAMAHA"
C
B$ ="ROBOT"
D$ = A$ + "-" + B$ D
Execution result: YAMAHA-ROBOT
E
MEMO • The "+" arithmetic operator is used to link character strings.
F
3. Point assignment statement
G
Format

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

Explanation Assigns <point expression> values to point variables. I


Only 4 arithmetic operators ( +, - *, / ) can be used in the <point expression>.
Multiplication and division are performed only for constant or variable arithmetic
J
operations.
• Addition/subtraction . ....... A
 ddition/subtraction is performed for each element
of each axis. K
• Multiplication . ................. M
 ultiplication by a constant or variable is performed
for each element of each axis.
• Division ........................... D
 ivision by a constant or variable is performed for
L
each element of each axis.
M
Multiplication results vary according to the point data type.
• For pulse units . ................ Assigned after being converted to an integer.
• For "mm" units . ................ A
 ssigned after being converted to a real number
down to the 2nd decimal position.

LET 8-89
51 LET
8
SAMPLE
P1 =P10 Point 10 is assigned to P1.
P20=P20+P5 Each element of point 20 and
point 5 is summed and assigned
to P20.
A P30=P30-P3 Each element of point 3 is
subtracted from point 30 and
B assigned to P30.
P80=P70*4 Each element of point 70 is
multiplied by 4 and assigned
C to P80.
P60=P5/3 Each element of point 5 is
divided by 3 and assigned to
D P60.

E MEMO • Multiplication & division examples are shown below.


• Permissible examples ........ P15 * 5, P[E]/A, etc.
• Prohibited examples .......... P10 * P11, 3/P10, etc.
F

4. Shift assignment statement


G
Format
H [LET] <shift variable> = <shift expression>

I Explanation Assigns <shift expression> values to shift variables.


Only shift elements can be used in <shift expressions>, and only addition and

J subtraction arithmetic operators are permitted. Parentheses cannot be used.


• Addition/subtraction . .......Addition/subtraction is performed for each element
of each axis.
K SAMPLE
S1=S0 "shift 0" is assigned to
L "shift 1".
S2=S1+S0 Each element of "shift 1 "
and "shift 0" is summed and
M assigned to "shift 2".

MEMO • Examples of <shift expression> addition/subtraction:


• Permissible examples ........ S1 + S2
• Prohibited examples .......... S1 + 3

8-90 Chapter 8 Robot Language Lists


52 LO
Arm lock output 8

Format

1. LO0 ([b, ,b]) = <expression>


2. LO (0b, ,0b) = <expression>
A
Values b: Bit definition ......................0 to 7
<expression>..........................Converted to an integer. The lower bits corresponding
to the bits specified on the left side are valid.
B

Explanation This statement outputs the specified value to the LO port to either prohibit or allow C
axis movement.
LO(00) to LO(07) respectively correspond to axes 1 to 8. An arm lock ON status
occurs at axes where bits are set, and axis movement is prohibited. Multiple bits must D
be specified in descending order from left to right (large → small).

E
MEMO • This statement is valid at axes where movement is started.

SAMPLE F
LO0()=&B00001010 Prohibits movement at axes 2 and 4.
LO0(2,1)=&B10 Prohibits movement at axis 3. G

Related commands RESET, SET H

LO 8-91
53 LOCx
8 Specifies/acquires point data or shift data for a specified axis

n NOTE
Format

1. LOCx (<point expression>) = <expression>


••X-arm and Y-arm rotation
information is only 2. LOCx (<shift expression>) = <expression>
A available in software
Ver.10.66 onwards.
Values Format 1: x . ...........................X,Y,Z,R,A,B (axis setting), F (hand system flag setting),
F1 (X-arm rotation information), F2 (Y-arm rotation
B information).
Format 2: x..............................X,Y,Z,R (axis setting)
C <expression>..........................For axis setting: coordinate value.
For hand system flag setting:
1 (right-handed system) or 2 (left-handed system)
D 0 (no setting)
For specifies the X-arm rotation information and specifies

E the Y-arm rotation information:


0, 1, -1
*1: F or details regarding the X-arm and Y-arm rotation information, refer to
F Chapter 4 "3. Point data format".

Explanation Direct format 1: C


 hanges the value of the point data specified axis, the hand system
G flag, and the X-arm and Y-arm rotation information.
Format 2: Changes the value of a specified axis from the shift data value.
H
MEMO • Points where data is to be changed must be registered in advance. An error will occur if a value
change is attempted at an unregistered point (where there are no coordinate values).
I

8-92 Chapter 8 Robot Language Lists


53 LOCx
8
Functions

Format

1. LOCx (<point expression>)


2. LOCx (<shift expression>)
A
Values Format 1: x . ...........................X,Y,Z,R,A,B (axis setting), F (hand system flag setting),
F1 (X-arm rotation information), F2 (Y-arm rotation
B
information).
Format 2: x..............................X,Y,Z,R (axis setting) C
Explanation Format 1: A
 cquires the value of the point data specified axis, the hand system flag,
and the X-arm and Y-arm rotation information. D
Format 2: Acquires a specified axis value from the shift data.

E
SAMPLE
LOCX(P10)=A(1) The X-axis data of P10 is changed
to the array A (1) value. F
LOCY(S1)=B The Y-axis data of S1 is
changed to the B value.
G
A(1)=LOCX(P10) The X-axis data of P 10 is
assigned to array A (1). H
B(2)=LOCX(S1) The X-axis data of S1 is
assigned to array B (2).
I
Related commands Point element variable, shift element variable

LOCx 8-93
54 LSHIFT
8 Left-shifts a bit

Format

LSHIFT (<expression 1> ,<expression 2>)

A Explanation Shifts the <expression 1> bit value to the left by the amount of <expression 2>.
Spaces left blank by the shift are filled with zeros (0).

B SAMPLE
A=LSHIFT(&B10111011,2) The 2-bit-left-shifted
C &B 10111011 value (&B11101100 )
is assigned to A.

D
Related commands RSHIFT

8-94 Chapter 8 Robot Language Lists


55 MCHREF / MCHREF2
Acquires a machine reference 8

Format main group

MCHREF (<axis 1>)

Format sub group


A
MCHREF2 (<axis 2>)
B
Values <axis 1>..................................main group: 1 to 6
<axis 2>..................................sub group: 1 to 4 C
Explanation This function provides the return-to-origin or absolute-search machine reference (unit:
%) for the axis specified by <axis number>. D
This function can only be used for axes whose return-to-origin method is set to the
sensor or stroke end method.
E
SAMPLE
A=MCHREF(1) The main group's axis 1 F
return-to-origin machine
reference is assigned to
variable A.
G

MCHREF / MCHREF2 8-95


56 MID$
8 Acquires a character string from a specified position

Format

MID$ (<character string expression>,<expression 1>[,<expression 2>])

A Values <expression 1>.......................1 to 75


<expression 2>.......................0 to 75

B Explanation This function extracts a character string of a desired length (number of characters)
from the character string specified by <character string expression>. <expression 1>
C specifies the character where the extraction is to begin, and <expression 2> specifies
the number of characters to be extracted.
An error will occur if the <expression 1> and <expression 2> values violate the
D permissible value ranges.
If <expression 2> is omitted, or if the number of characters to the right of the

E character of <expression 1> is less than the value of <expression 2>, then all
characters to the right of the character specified by <expression 1> will be extracted.
If <expression 1> is longer than the character string, MID$ will be a null string (empty
F character string).

SAMPLE
G
B$=MID$(A$,2,4) The 2nd to 4th characters (up
to the 5th char.) of A$ are
H assigned to B$.

I Related commands LEFT$, RIGHT$

8-96 Chapter 8 Robot Language Lists


57 MO
Outputs a specified value to the MO port (internal output) 8

Format

1. MO0([b, ,b]) = <expression>


2. MO(0b, ,0b) = <expression>
REFERENCE A
••For details regarding bit Values m: port number.......................2 to 7, 10 to 17, 20 to 27
definitions, see Chapter 3 b: bit definition.......................0 to 7
"10 Bit Settings".
<expression>..........................The integer-converted lower bits corresponding to the
B
bit definition specified at the left side are valid.
C
Explanation Outputs a specified value to the MO port.
In order to maintain the sensor status and axis HOLD status at each axis, ports "0" and
"1" cannot be used as output ports (these ports are for referencing only). D
If multiple bits are specified, they are expressed from the left in descending order (large
to small).
E
If the [b,…,b] data is omitted, all 8 bits are processed.

• Ports "0" and "1" outputs F

Bit 7 6 5 4 3 2 1 0
G
Port 0 Axis 8 Axis 7 Axis 6 Axis 5 Axis 4 Axis 3 Axis 2 Axis 1
Origin sensor status 0: OFF; 1: ON
Port 1 Axis 8 Axis 7 Axis 6 Axis 5 Axis 4 Axis 3 Axis 2 Axis 1 H
HOLD status 0: No HOLD / 1: HOLD (1 axis is not used)

I
MEMO • For details regarding MO ports "0" and "1", see Chapter 3 "9.7 Internal output variable".

SAMPLE J
MO2()=&B10111000 MO (27, 25, 24, 23) are turned
ON, and MO (26 , 22 , 21 , 20 ) K
are turned OFF.
MO2(6,5,1)=&B010 MO (25) are turned ON, and MO
(26, 21) are turned OFF. L
MO3() = 15 MO (33, 32, 31, 30) are turned
ON, and MO (37 , 36 , 35 , 34 )
are turned OFF. M
MO(37,35,27,20)=A The contents of the 4 lower bits
acquired when variable A is
converted to an integer are output
to MO (37, 35, 27, 20), respectively.

Related commands RESET, SET

MO 8-97
58 MOVE / MOVE2
8 Performs absolute movement of all robot axes

Format main group

MOVE PTP , <point definition> [, option [, option] ...]


P
A L
C

B
n NOTE
Format

MOVE2 PTP , <point definition> [, option [, option] ...]


sub group

C ••MOVE2 linear and circular


interpolation movement is P
supported in the following L
software versions:
D RCX14x Ver. 8.64 onwards
C
RCX22x Ver. 9.11 onwards

E Explanation Executes direct absolute movement of a group's axes.


The MOVE command is used for axes which have been specified as main robot
axes, and the MOVE2 command is used for axes specified as sub robot axes. It is not
F enabled for other groups, or for auxiliary axes.
• Movement type : PTP, linear interpolation, circular interpolation.
• Point data setting : Direct coordinate data input, point definition.
G • Options : Speed setting, arch motion setting, STOPON condition setting,
CONT setting, acceleration setting, deceleration setting, plane
H coordinate setting, port output setting.

Linear Arch
Options PTP Remarks
I interpolation interpolation
Enabled only for specified
Speed setting (SPEED)
MOVE statement
Enabled only for specified
J Speed setting (VEL)
MOVE statement
Enabled only for specified
Arch motion
MOVE statement
K STOPON condition setting
Enabled only by
execution
program

Enabled only for specified


CONT setting
MOVE statement
L Acceleration setting
Enabled only for specified
MOVE statement
Enabled only for specified
Deceleration setting
MOVE statement
M Plane coordinate setting
Enabled only for specified
MOVE statement
Enabled only for specified
Port output setting
MOVE statement

8-98 Chapter 8 Robot Language Lists


58 MOVE / MOVE2
8
Movement type

●● PTP (point-to-point) movement


Execution START condition: Movement of all specified axes is complete (within the tolerance
range).
Execution END condition: All specified axes have entered the OUT position range. A
When two or more axes are specified, they will reach their target positions simultaneously. The
movement path of the axes is not guaranteed.
B
●● Caution regarding commands which follow the MOVE P / MOVE2 P command:
If the next command following the MOVE P / MOVE2 P command is an executable command C
such as a signal output command, that next command will start when the movement axis enters
the OUT position range. In other words, that next command starts before the axis arrives within
the target position tolerance range. D
Example:
Signal output (DO, etc.) Signal is output when axis enters within OUT position range. E
DELAY command is executed and standby starts, when axis enters the
DELAY
OUT position range.

HALT
Program stops and is reset when axis enters the OUT position range. F
Therefore, axis movement also stops.
Program temporarily stops when axis enters the OUT position range.
HOLD
Therefore, axis movement also stops. G
WAIT WAIT command is executed when axis enters the OUT position range.

The WAIT ARM / WAIT ARM2 statements are used to execute the next command after the H
axis enters the tolerance range.

MEMO • The OUT position value is specified by parameter setting. I


This value can be changed from within the program by using the OUTPOS / OUTPOS2
commands.
J
MOVE command
K
MOVE P,P1 MOVE P,P1
Target position
DO(20)=1 WAIT ARM
DO(20)=1 L

P1
M
Tolerance
OUT position
DO(20) turns ON DO(20) turns ON

MOVE P,P1 MOVE P,P1


Target position
HOLD WAIT ARM
HOLD

Tolerance
OUT position
HOLD execution HOLD execution
(program temporarily stops) (program temporarily stops)

33823-R7-00

MOVE / MOVE2 8-99


58 MOVE / MOVE2
8
SAMPLE
MOVE P,P0 The main robot axis moves from
its current position to the
position specified by P0 (the
same occurs for MOVE PTP, P0).
A

B MEMO • PTP movement is faster than interpolation movement, but when executing continuous
movement to multiple points, a positioning stop occurs at each point.

C ●● Linear interpolation movement


Execution START condition: Movement of all specified axes is complete (within the tolerance
range).
D Execution END condition: Movement of all specified axes has begun.
Execution of the immediately following command occurs immediately after axis movement

E begins.
When executing linear or circular interpolation in a continuous manner, the 2 movement paths
are linked by connecting the deceleration and acceleration sections, enabling continuous
F movement without intermediate stops.
All movement axes arrive at the same time.
However, the following execution END condition applies if a STOPON condition has been
G specified:

H Execution END condition: Movement of all specified axes is complete (within the tolerance
range).
In this case, continuous movement for the 2 linked paths is not possible.
I
●● Caution regarding commands which follow a MOVE L / MOVE2 L command:
J If the next command following the MOVE L / MOVE2 L command is an executable command
such as a signal output command, that next command will start immediately after axis
movement begins.
K Example:
Signal output (DO, etc.) Signal is output immediately after movement begins.

L DELAY
DELAY command is executed and standby starts immediately after
movement begins.
Program stops and is reset immediately after movement begins.
HALT
Therefore, axis movement also stops.
M Program temporarily stops immediately after movement begins.
HOLD
Therefore, axis movement also stops.
WAIT WAIT command is executed immediately after movement begins.

The WAIT ARM / WAIT ARM2 statements are used to execute the next command after the
axis enters the tolerance range.

8-100 Chapter 8 Robot Language Lists


58 MOVE / MOVE2
8
MEMO • On RCX14x controllers earlier than Ver. 8.64, and RCX22x controllers earlier than Ver. 9.11,
linear interpolation can be performed by task 1 only.
• Smooth travel paths and constant speeds between paths may not always be possible, depending
on the axis movement speed, acceleration, and distance between the target points.
• On robots with an R-axis, the R-axis speed may become too fast and cause an error depending A
on the R-axis movement distance.
• If a DELAY statement is executed after a MOVE L / MOVE2 L command, a DELAY timer is
activated after the MOVE L / MOVE2L command is executed. Therefore, if a DELAY is desired B
after reaching the target point, use the WAIT ARM / WAIT ARM2 statement after the MOVE
command.
The same applies for other commands such as HALT, etc.
C
• If the direction changes at an acute angle during interpolation movement, the acceleration/
deceleration speed of the connection section may become too fast, causing an error. In this D
case, specify a slower acceleration/deceleration speed at the connection section, or use the
WAIT ARM command to revise the operation pattern.
E
MOVE command
F
MOVE L,P1 MOVE L,P1
DO(20)=1 Target position WAIT ARM
DO(20)=1
G

P1
H
Tolerance

DO(20) turns ON DO(20) turns ON


I

MOVE L,P1
HOLD
MOVE L,P1
WAIT ARM
J
Target position
HOLD

K
Tolerance

HOLD execution HOLD execution L


(program temporarily stops) (program temporarily stops)

M
33824-R7-00

SAMPLE
MOVE L,P0,P1 The main robot axis moves from its current
position to the position specified by P0, P1.

SAMPLE:MOVE L

P0 P1

Tolerance range

Current position
33810-R7-00

MOVE / MOVE2 8-101


58 MOVE / MOVE2
8
●● Circular interpolation movement
Execution START condition: Movement of all specified axes is complete (within the tolerance
range).
Execution END condition: Movement of all specified axes has begun.
Execution of the immediately following command occurs immediately after axis movement
A begins.
When executing linear or circular interpolation in a continuous manner, the 2 movement paths
are linked by connecting the deceleration and acceleration sections, enabling continuous
B movement without intermediate stops.
All movement axes arrive at the same time.
C In circular interpolation, an arc is generated based on 3 points: the current position, an
intermediate position, and the target position. Therefore, circular interpolation must be
specified by an even number of points.
D
●● Caution regarding commands which follow a MOVE C / MOVE2 C command:
E If the next command following the MOVE C / MOVE2 C command is an executable command
such as a signal output command, that next command will start immediately after axis
movement begins.
F Example:
Signal output (DO, etc.) Signal is output immediately after movement begins.
DELAY command is executed and standby starts immediately after
G DELAY
movement begins.
Program stops and is reset immediately after movement begins.
HALT
Therefore, axis movement also stops.
H Program temporarily stops immediately after movement begins.
HOLD
Therefore, axis movement also stops.
WAIT WAIT command is executed immediately after movement begins.
I
The WAIT ARM / WAIT ARM2 statements are used to execute the next command after the

J axis enters the tolerance range.

MOVE command

K
MOVE C,P1,P2 MOVE C,P1,P2
DO(20)=1 WAIT ARM
L Target position DO(20)=1

M P1
Tolerance
DO(20) turns ON
DO(20) turns ON

MOVE C,P1,P2 MOVE C,P1,P2


HOLD WAIT ARM
Target position HOLD

Tolerance
HOLD execution
(program temporarily stops) HOLD execution
(program temporarily stops)

33825-R7-00

8-102 Chapter 8 Robot Language Lists


58 MOVE / MOVE2
8
SAMPLE
MOVE L,P20 Linear movement occurs from
the current position to P20.
MOVE C,P21,P22,P23,P20 Arc movement occurs through
points P21, P22, P23, P20.
MOVE L,P24 Linear movement occurs to P24.
A

SAMPLE:MOVE C B
P22
C
P23 P21

D
Current position P20 P24
33811-R7-00
E

MEMO • In continuous interpolation operations, too, there are no stops at intermediate points. However, F
the maximum speed is slower than the PTP speed.
• On RCX14x controllers earlier than Ver. 8.64, and RCX22x controllers earlier than Ver. 9.11, G
circular interpolation can be performed by task 1 only.
• Circular interpolation is possible within the following range: radius 1.00mm to 5,000.00mm.
• Circle distortion may occur, depending on the speed, acceleration, and the distance between H
points.
• On robots with an R-axis, the R-axis speed may become too fast and cause an error, depending
on the R-axis movement distance.
I
• If a DELAY statement is executed after a MOVE L / MOVE2 L command, a DELAY timer is
activated after the MOVE L / MOVE2L command is executed. Therefore, if a DELAY is desired J
after reaching the target point, use the WAIT ARM / WAIT ARM2 statement after the MOVE
statement.
The same applies for other commands such as HALT, etc. K
• On "Multi" type robots, the "5.37 : Specification mismatch" error will occur, and circular
interpolation will be disabled.
• If the direction changes at an acute angle during interpolation movement, the acceleration/
L
deceleration speed of the connection section may become too fast, causing an error. In this
case, specify a slower acceleration/deceleration speed at the connection section, or use the M
WAIT ARM command to revise the operation pattern.

MOVE / MOVE2 8-103


58 MOVE / MOVE2
8
Movement command types and the corresponding movement

1. PTP movement

OUT position range


Current position Target position
Tolerance range
A

B Command ends when movement


enters the OUT position range, and
the next command is then executed.

C
2. Interpolation movement
D OUT position range
Current position Target position
Tolerance range

F Command ends immediately after


movement begins, and the next
command is immediately executed1).

G
3. WAIT ARM

H Current position
OUT position range
Target position
Tolerance range

J
The next command is executed when
movement arrives in the tolerance range.

K
4. STOPON conditional expression

OUT position range


L Current position
Tolerance range
Target position

M
The next command is executed when
movement arrives in the tolerance range2).

1) If a DELAY statement is executed after an interpolation operation, a DELAY timer is activated immediately
after the movement starts. Therefore, if a DELAY is desired after reaching the target point, use the WAIT ARM /
WAIT ARM2 statement after the MOVE / MOVE2 command.
2) A deceleration and stop occurs at an intermediate point if the condition specified by the STOPON conditional
expression is met (for details, see the "STOPON Condition Setting" item).
33812-R7-00

8-104 Chapter 8 Robot Language Lists


58 MOVE / MOVE2
8
Point data setting types

●● Direct numeric value input PTP Linear interpolation Circular interpolation

Format

n NOTE X Y Z R A B [F] [F1] [F2]


A
••I f b o t h i n t e g e r s a n d
real numbers are used Values X, Y, Z, R, A, B........................Space-separated coordinate values for each axis.
together (mixed), all F.............................................Hand system flag (SCARA robot only)
coordinate values will
F1...........................................X-arm rotation information (YK500TW model only).
B
be handled in "mm/deg"
units. F2...........................................Y-arm rotation information (YK500TW model only).
••Hand system flags are C
available from software Explanation Directly specifies coordinate values by a numeric value. If an integer is used, this
version 8.08 onwards.
is interpreted as "pulse" units, and if a real number (with decimal point) is used,
••X-arm and Y-arm rotation
information is only this is interpreted as "mm/deg" units, with movement occurring accordingly. If D
available in software both integers and real numbers are used together (mixed), all coordinate values
Ver.10.66 onwards.
will be handled in "mm/deg" units.
E
c CAUTION
This setting method can be used only for PTP and linear interpolation movement types.
Hand system flags can be specified for SCARA robots when directly specifying the
••When performing linear
interpolation with a hand
coordinate values in "mm" units. F
system flag specified, To specify an extended hand system flag for SCARA robots, set either 1 or 2 at "F".
be sure that the same If a number other than 1 or 2 is set, or if no number is designated, 0 will be set to
hand system is used at
indicate that there is no hand system flag.
G
the current position and
target position. If the
same hand system is not 1: Right-handed system is used to move to a specified position.
used, an error will occur 2: Left-handed system is used to move to a specified position. H
and robot movement will
be disabled. Direct numeric value inputs can be used to set the X-arm and Y-arm rotation
••When performing a linear information (*1) only on YK500TW model robots where the coordinate system-of- I
interpolation, the current
position's X-arm and units has been set as "mm".
Y-arm rotation information
must be the same as the
To set extended X-arm and Y-arm rotation information at the YK500TW model
J
robot, a "-1", "0", or "1" value must be specified at F1 and F2. Any other value, or
movement destination's
X-arm and Y-arm rotation no X-arm and Y-arm rotation information at all, will be processed as "0".
infor mation. If the two 0: Indicates arm rotation information where movement to the "0" position has K
are different, an error will
been specified.
occur and movement will
be disabled. 1: Indicates arm rotation information where movement to the "1" position has
been specified.
L
-1: Indicates arm rotation information where movement to the "-1" position
has been specified. M
*1: F or details regarding the X-arm and Y-arm rotation information, refer to
Chapter 4 "3. Point data format".

MEMO • At SCARA robots with a hand system flag set in the movement destination's coordinate data, the
specified hand system will have priority over the current arm type or LEFTY/RIGHTY setting.

SAMPLE
MOVE P,10000 10000 1000 1000 0 0
PTP movement occurs from
current position to the
specified position.

MOVE / MOVE2 8-105


58 MOVE / MOVE2
8
c CAUTION ●● Point definition PTP linear interpolation Circular interpolation
••When moving the robot
by linear or circular Format
interpolation to a point
where a hand system flag <point expression>[,<point expression>...]
is specified, be sure that
A the same hand system is
used at both the current
Explanation Specifies a <point expression>. Two or more data items can be designated by
and target positions. If the separating them with a comma ( , ).
same hand system is not Circular interpolation must be specified by an even number of points.
B used, an error will occur
and robot movement will
be disabled.

C MEMO • At SCARA robots with a hand system flag set in the movement destination's coordinate data, the
specified hand system will have priority over the current arm type or LEFTY/RIGHTY setting.

D
c CAUTION
••When performing a linear SAMPLE
and circular interpolation,
the current position's MOVE P,P1 Moves from the current position
E X-arm and Y-arm rotation to the position specified by P1.
information must be the MOVE P,P20,P0,P100 Moves in sequence from the current position
same as the movement
destination's X-arm to positions specified by P20, P0, P100.
F and Y-arm rotation
infor mation. If the two
are different, an error will
G occur and movement will
be disabled.

8-106 Chapter 8 Robot Language Lists

You might also like