Our sincere thanks for your purchase of this OMRON YRCX robot controller.
This manual describes robot program commands and related information for using OMRON YRCX
robot controllers. Be sure to read this manual carefully as well as related manuals and comply with
their instructions for using the OMRON robot controllers safely and correctly.
For details on how to operate OMRON robot controllers, refer to the separate controller user's
manual that comes with the OMRON robot controller.
Applicable controllers:
YRCX
Safety precautions
Be sure to read before using
Before using the OMRON 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 OMRON 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”.
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.
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.
Keep this manual carefully so that the operator can refer to it when needed. Also make sure that this
manual reaches the end user.
CONTENTS
Programming Manual
Introduction
Safety precautions
Chapter 1 Writing Programs
1 The OMRON Robot Language 1-1
2 Characters 1-1
3 Program Basics 1-1
4 Program Names 1-2
5 Identiers1-4
6 LABELStatement1-4
YRCX
7 Comment 1-5
8 Command Statement Format 1-5
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 VariableTypes3-4
T-1
CONTENTS
4.1 Numeric variables 3-4
4.2 Character variables 3-4
5 Array variables 3-5
6 Value Assignments 3-5
7 Type Conversions 3-6
8 Value Pass-Along & Reference Pass-Along 3-6
9 System Variables 3-7
9.1 Point variable 3-7
9.2 Shift variable 3-8
9.3 Parallel input variable 3-8
9.4 Parallel output variable 3-9
9.5 Internal output variable 3-10
9.6 Arm lock output variable 3-11
9.7 Timer output variable 3-12
9.8 Serial input variable 3-13
9.9 Serial output variable 3-14
9.10 Serial word input 3-15
9.11 Serial double word input 3-15
9.12 Serial word output 3-16
9.13 Serial double word output 3-16
Programming Manual
YRCX
T-2
10 Bit Settings 3-17
11 Valid range of variables 3-18
11.1 Valid range of dynamic (array) variables 3-18
11.2 Valid range of static variables 3-18
Clearing variables 3-19
12
12.1 Clearing dynamic variables 3-19
12.2 Clearing static variables 3-19
Chapter4 ExpressionsandOperations
1 Arithmeticoperations4-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
CONTENTS
2 Characterstringoperations4-4
2.1 Character string connection 4-4
2.2 Character string comparison 4-4
3 Pointdataformat4-5
4 DI/DOconditionalexpressions4-6
Programming Manual
Chapter 5 Multiple Robot Control
1 Overview 5-1
2 Command list with a robot setting 5-2
Chapter 6 Multi-tasking
1 Outline 6-1
YRCX
2 Taskdenitionmethod6-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-taskprogramexample6-8
5 Sharing the data 6-8
6 Cautionary Items 6-9
Chapter 7 Sequence fnction
1 Sequence function 7-1
2 Creating a sequence program 7-1
2.1 Programming method 7-1
2.2 Compiling 7-3
3 Executingasequenceprogram7-4
3.1 Sequence program STEP execution 7-4
T-3
CONTENTS
4 Programming a sequence program 7-5
4.1 Assignment statements 7-5
4.2 Input/output variables 7-5
4.2.1 Input variables 7-5
4.2.2 Output variables 7-6
4.3 Timerdenitionstatement7-7
4.4 Logical operators 7-7
4.5 Priority of logic operations 7-8
4.6 Sequenceprogramspecications7-8
Chapter 8 Robot Language Lists
How to read the robot language table 8-1
Command list in alphabetic order 8-2
Operation-specic8-7
Programming Manual
YRCX
Functions: in alphabetic order 8-13
Functions:operation-specic8-16
1 ABS
2 ABSRPOS
3 ACCEL
4 ARCHP1 / ARCHP2
5 ARMCND
6 ARMSEL
7 ARMTYP
8 ASPEED
9 ATN / ATN2
10 AXWGHT
11 CALL
12 CHANGE
13 CHGPRI
14 CHR$
15 CLOSE
16 COS
17 CURTQST
Acquires absolute values 8-18
Acquires the machine reference value (axes: mark method) 8-19
Species/acquires the acceleration coefcient parameter 8-20
Species/acquires the arch position parameter 8-21
Acquires the current arm status 8-23
Sets/acquires the current hand system selection 8-24
Sets/acquires the hand system selection during program reset 8-25
Sets/acquires the AUTO movement speed of a specied robot 8-26
Acquires the arctangent of the specied value 8-27
Sets/acquires the axis tip weight 8-28
Calls a sub-procedure 8-29
Switches the hand 8-30
Changes the priority ranking of a specied task 8-31
Acquires a character with the specied character code 8-32
Closes the specied General Ethernet Port 8-33
Acquires the cosine value of a specied value 8-34
Acquires the current torque value of a specied axis
to the rated torque 8-35
T-4
18 CURTRQ
Acquires the current torque of the specied axis 8-36
CONTENTS
Programming Manual
YRCX
19 CUT
20 DATE$
21 DECEL
22 DEF FN
23 DEGRAD
24 DELAY
25 DI
26 DIM
27 DIST
28 DO
29 DRIVE
30 DRIVEI
31 END SELECT
32 END SUB
33 ERR / ERL
34 ETHSTS
35 EXIT FOR
36 EXIT SUB
Terminates another task which is currently being executed 8-37
Acquires the date 8-38
Species/acquires the deceleration rate parameter 8-39
Denes functions which can be used by the user 8-40
Angle conversion (degree → radian) 8-41
Program execution waits for a specied period of time 8-42
Acquires the input status from the parallel port 8-43
Declares array variable 8-44
Acquires the distance between 2 specied points 8-45
Outputs to parallel port or acquires the output status 8-46
Executes absolute movement of specied axes 8-48
Moves the specied robot axes in a relative manner 8-52
Ends the SELECT CASE statement 8-57
Ends the sub-procedure denition 8-58
Acquires the error code / error line number 8-59
Acquires the Ethernet port status 8-60
Terminates the FOR to NEXT statement loop 8-61
Terminates the sub-procedure dened by the SUB to END SUB
statement 8-62
37 EXIT TASK
38 FOR to NEXT
39 GEPSTS
40 GOSUB to RETURN
41 GOTO
42 HALT
43 HALTALL
44 HAND
44.1 For SCARA Robots 8-70
45 HOLD
46 HOLDALL
47 IF
47.1 Simple IF statement 8-75
47.2 Block IF statement 8-76
48 INPUT
49 INT
Terminates its own task which is in progress 8-63
Performs loop processing until the variable exceeds
the specied value 8-64
Acquires the General Ethernet Port status 8-65
Jumps to a subroutine 8-66
Executes an unconditional jump to the specied line 8-67
Stops the program and performs a reset 8-68
Stops all programs and performs reset 8-69
Denes the hand 8-70
Temporarily stops the program 8-73
Temporality stops all programs 8-74
Evaluates a conditional expression value, and executes
the command in accordance with the conditions 8-75
Assigns a value to a variable specied from the programming box 8-77
Truncates decimal fractions 8-79
T-5
CONTENTS
Programming Manual
YRCX
50 JTOXY
51 LEFT$
52 LEFTY
53 LEN
54 LET
55 LO
56 LOCx
57 LSHIFT
58 MCHREF
59 MID$
60 MO
61 MOTOR
62 MOVE
63 MOVEI
64 MOVET
65 MTRDUTY
66 OFFLINE
67 ON ERROR GOTO
68 ON to GOSUB
69 ON to GOTO
70 ONLINE
71 OPEN
72 ORD
73 ORGORD
74 ORIGIN
75 OUT
76 OUTPOS
77 PATH
78 PATH END
79 PATH SET
80 PATH START
81 PDEF
82 PGMTSK
Performs axis unit system conversions (pulse → mm) 8-80
Extracts character strings from the left end 8-81
Sets the SCARA robot hand system as a left-handed system 8-82
Acquires a character string length 8-83
Assigns values to variables 8-84
Arm lock output or acquires the output status 8-87
Species/acquires point data for a specied axis or shift data
for a specied element 8-89
Left-shifts a bit 8-91
Acquires the machine reference value
(axes: sensor method / stroke-end method) 8-92
Acquires a character string from a specied position 8-93
Outputs a specied value to the MO port
or acquires the output status 8-94
Controls the motor power status 8-96
Performs absolute movement of robot axes 8-97
Performs relative movement of robot axes 8-112
Performs relative movement of all robot axes in tool coordinates 8-122
Acquires the motor load factor of the specied axis 8-132
Sets a specied communication port to the "ofine" mode 8-133
Jumps to a specied label when an error occurs 8-134
Executes the subroutine specied by the <expression> value 8-135
Jumps to the label specied by the <expression> value 8-136
Sets the specied communication port to the "online" mode 8-137
Opens the specied General Ethernet Port 8-138
Acquires a character code 8-139
Species/acquires the robot's return-to-origin sequence 8-140
Performs return-to-origin 8-141
Turns ON the specied port output 8-142
Species/acquires the OUT enable position parameter of the robot
Species the motion path 8-145
Ends the path setting 8-151
Starts the path setting 8-152
Starts the PATH motion 8-155
Denes the pallet 8-159
Acquires the task number
in which a specied program is registered 8-160
8-143
T-6
CONTENTS
Programming Manual
YRCX
83 PGN
84 PMOVE
85 Pn
86 PPNT
87 PRINT
88 PSHFRC
89 PSHJGSP
90 PSHMTD
91 PSHRSLT
92 PSHSPD
93 PSHTIME
94 PUSH
95 RADDEG
96 REM
97 RESET
98 RESTART
99 RESUME
RETURN
100
Acquires the program number from a specied program name 8-161
Executes a pallet movement command for the robot 8-162
Denes points within a program 8-166
Creates pallet point data 8-168
Displays the specied expression value at the programming box 8-169
Species/acquires the pushing force parameter 8-170
Species/acquires the push judge speed parameter 8-171
Species/acquires a pushing type parameter 8-172
Acquires the status when PUSH statement ends 8-173
Species/acquires the push speed parameter 8-174
Species/acquires the push time parameter 8-175
Executes a pushing operation for specied axes 8-176
Performs a unit conversion (radians → degrees) 8-181
Inserts a comment 8-182
Turns OFF the bits of specied ports, or clears variables 8-183
Restarts another task during a temporary stop 8-184
Resumes program execution after error recovery processing 8-185
Processing which was branched by GOSUB, is returned
to the next line after GOSUB 8-186
RIGHT$
101
RIGHTY
102
RSHIFT
103
104
SELECT CASE to END SELECT
SEND
105
SERVO
106
SET
107
SETGEP
108
SGI
109
SGR
110
SHARED
111
SHIFT
112
SI
113
SID
114
SIN
115
Extracts a character string
from the right end of another character string 8-187
Sets the SCARA robot hand system as a right-handed system 8-188
Shifts a bit value to the right 8-189
Executes the specied command block in accordance with the
<expression> value 8-190
Sends readout le data to the write le 8-191
Controls the servo status 8-193
Turns the bit at the specied output port ON 8-194
Sets the General Ethernet Port 8-195
Assigns /acquires the value
to a specied integer type static variable 8-196
Assigns /acquires the value to a specied real type static variable
Enables sub-procedure referencing without passing on the variable
Sets the shift coordinates 8-199
Acquires specied SI status 8-200
Acquires a specied serial input's double-word information 8-201
Acquires the sine value for a specied value 8-202
8-197
8-198
T-7
CONTENTS
Programming Manual
YRCX
SIW
116
Sn
117
SO
118
SOD
119
SOW
120
SPEED
121
SQR
122
START
123
STR$
124
SUB to END SUB
125
SUSPEND
126
SWI
127
TAN
128
TCOUNTER
129
TIME$
130
TIMER
131
TO
132
Acquires a specied serial input's word information 8-203
Denes the shift coordinates in the program 8-204
Outputs a specied value
to serial port or acquires the output status 8-205
Outputs a specied serial output's double-word information
or acquires the output status 8-207
Outputs a specied serial output's word information
or acquires the output status 8-208
Changes the program movement speed 8-209
Acquires the square root of a specied value 8-210
Starts a new task 8-211
Converts a numeric value to a character string 8-212
Denes a sub-procedure 8-213
Temporarily stops another task which is being executed 8-215
Switches the program being executed 8-216
Acquires the tangent value for a specied value 8-217
Timer & counter 8-218
Acquires the current time 8-219
Acquires the current time 8-220
Outputs a specied value to the TO port
or acquires the output status 8-221
TOLE
133
TORQUE
134
TSKPGM
135
VAL
136
WAIT
137
WAIT ARM
138
WEIGHT
139
WEND
140
WHERE
141
WHILE to WEND
142
WHRXY
143
XYTOJ
144
Species/acquires the tolerance parameter 8-222
Species/acquires the maximum torque command value 8-223
Acquires the program number
which is registered in a specied task number 8-225
Converts character strings to numeric values 8-226
Waits until the conditional expression is met 8-227
Waits until the robot axis operation is completed 8-228
Species/acquires the tip weight parameter 8-229
Ends the WHILE statement's command block 8-230
Acquires the arm's current position (pulse coordinates) 8-231
Repeats an operation for as long as a condition is met 8-232
Acquires the arm's current position in Cartesian coordinates 8-233
Converts the Cartesian coordinate data ("mm")
to joint coordinate data ("pulse") 8-234
procedure, refer to "11
CALL" and "125 SUB to
END SUB" in Chapter 8.
NOTE
defined functions, refer to
"22 DEF FN" in Chapter 8.
• Katakana (Japanese phonetic characters) cannot be entered from a programming box. Katakana
can be used when communicating with a host computer (if it handles katakana).
• Spaces are also counted as characters (1 space = 1 character).
Programs are written in a "1 line = 1 command" format, and every line must contain a command.
Blank lines (lines with no command) will cause an error when the program is executed. A line-feed
on the program's final line creates a blank line, so be careful not to do so.
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
within a program named [COMMON], allowing those processing items to be called from multiple
programs.
User functions can be defined for specific calculations. Defined user functions are easily called,
allowing even complex calculations to be easily performed.
6
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 OMRON Robot Language 1-1
1
4
Program Names
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
3
4
5
6
■
Program names may contain no more than 32 characters, comprising a combination of
alphanumeric characters and underscores (_).
■
Each program must have a unique name (no duplications).
The 2 program names shown below are reserved for system operations, and programs with these
names have a special meaning.
A) SEQUENCE
B) COMMON
The functions of these programs are explained below.
A) SEQUENCE
Functions Unlike standard robot programs, the YRCX 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.
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 determined
by the program capacity. For details, refer to "4.6 Sequence program specifications" in
Chapter 7.
This allows sensors, push-button switches, and solenoid valves, etc., to be monitored
and operated by input/output signals.
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
DO(20)=~DI(20)
DO(25)=DI(21) AND DI(22)
MO(26)=DO(26) OR DO(25)
:
REFERENCE For details, refer to "4.6 Sequence program specifications" in Chapter 7.
1-2 Chapter 1 Writing Programs
B) COMMON
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.
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
(SAMPLE 1 and SAMPLE 2).
When SAMPLE1 or SAMPLE2 is executed, the SUB *DISTANCE (A!,B!,C!) and the
*AREA routine are executed.
SAMPLE
Program name: SAMPLE1
X!=2.5
Y!=1.2
CALL *DISTANCE(X!,Y!,REF C!)
GOSUB *AREA
PRINT C!,Z!
HALT
Program name: SAMPLE2
X!=5.5
Y!=0.2
CALL *DISTANCE(X!,Y!,REF C!)
GOSUB *AREA
PRINT C!,Z!
HALT
1
2
3
4
5
6
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.
Program Names 1-3
1
2
3
4
5
5
Identifiers
"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:
■
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 32 characters (all characters beyond the 32th character are
ignored).
■
The maximum number of usable identifiers varies depending on the length of the identifiers.
When all identifier length is 32 characters, the number is at the maximum. Local variables can be
used up to 128 (in one program task) and global variables can be used up to 512.
■
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
character.
SAMPLE
LOOP, SUBROUTINE, GET_DATA
6
REFERENCE For details regarding reserved words, refer to Chapter 13 "1. Reserved word list",
regarding system variables, refer to Chapter 3 "9 System Variables".
6
LABEL Statement
Defines a label on a program line.
Format
*label:
A label must always begin with an asterisk (*), and it must be located at the beginning of the line.
Although a colon (:) is required at the end of the label when defining it, this mark is not required
when writing a jump destination in a program.
1. A label must begin with an alphabetic or numeric character.
2. Alphanumeric and underscore (_) can be used as the remaining label characters. Special
symbols cannot be used.
3. The label must not exceed 32 characters (all characters beyond the 32th character are ignored).
SAMPLE
*ST: ····················· *ST label is defined.
MOVE P,P0
DO(20) = 1
MOVE P,P1
DO(20) = 0
GOTO *ST ····················· Jumps to *ST.
HALT
1-4 Chapter 1 Writing Programs
7
Comment
1
Characters which follow REM or an apostrophe (') are processed as a comment. Comment
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.
2
3
4
8
Command Statement Format
Format
label: statement operand
One robot language command must be written on a single line and arranged in the format shown
below:
• The shaded section can be omitted.
• The italic items should be written in the specific format.
• Items surrounded by | | are selectable.
• 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 written as a branching
destination).
5
6
For details regarding labels, refer to "6 LABEL Statement" in this Chapter.
• Operands may be unnecessary for some commands.
• Programs are executed in order from top to bottom unless a branching instruction is given.