Omron SCARA YRCX Programming Manual

=;76HULHV
&DW1R,((1$
<5&;5RERW&RQWUROOHU
352*5$00,1*
0$18$/
6&$5$5RERWV <5&;6HULHV
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 Identiers 1-4
6 LABELStatement 1-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 VariableTypes 3-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
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
CONTENTS
2 Characterstringoperations 4-4
2.1 Character string connection 4-4
2.2 Character string comparison 4-4
3 Pointdataformat 4-5
4 DI/DOconditionalexpressions 4-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 Taskdenitionmethod 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 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 Executingasequenceprogram 7-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 Timerdenitionstatement 7-7
4.4 Logical operators 7-7
4.5 Priority of logic operations 7-8
4.6 Sequenceprogramspecications 7-8
Chapter 8 Robot Language Lists
How to read the robot language table 8-1
Command list in alphabetic order 8-2
 Operation-specic 8-7
Programming Manual
YRCX
Functions: in alphabetic order 8-13
 Functions:operation-specic 8-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
Species/acquires the acceleration coefcient parameter 8-20
Species/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 specied robot 8-26
Acquires the arctangent of the specied 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 specied task 8-31
Acquires a character with the specied character code 8-32
Closes the specied General Ethernet Port 8-33
Acquires the cosine value of a specied value 8-34
Acquires the current torque value of a specied axis
to the rated torque 8-35
T-4
18 CURTRQ
Acquires the current torque of the specied 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
Species/acquires the deceleration rate parameter 8-39
Denes functions which can be used by the user 8-40
Angle conversion (degree → radian) 8-41
Program execution waits for a specied 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 specied points 8-45
Outputs to parallel port or acquires the output status 8-46
Executes absolute movement of specied axes 8-48
Moves the specied robot axes in a relative manner 8-52
Ends the SELECT CASE statement 8-57
Ends the sub-procedure denition 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 dened 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 specied value 8-64
Acquires the General Ethernet Port status 8-65
Jumps to a subroutine 8-66
Executes an unconditional jump to the specied line 8-67
Stops the program and performs a reset 8-68
Stops all programs and performs reset 8-69
Denes 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 specied 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
Species/acquires point data for a specied axis or shift data for a specied 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 specied position 8-93
Outputs a specied 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 specied axis 8-132
Sets a specied communication port to the "ofine" mode 8-133
Jumps to a specied label when an error occurs 8-134
Executes the subroutine specied by the <expression> value 8-135
Jumps to the label specied by the <expression> value 8-136
Sets the specied communication port to the "online" mode 8-137
Opens the specied General Ethernet Port 8-138
Acquires a character code 8-139
Species/acquires the robot's return-to-origin sequence 8-140
Performs return-to-origin 8-141
Turns ON the specied port output 8-142
Species/acquires the OUT enable position parameter of the robot
Species the motion path 8-145
Ends the path setting 8-151
Starts the path setting 8-152
Starts the PATH motion 8-155
Denes the pallet 8-159
Acquires the task number
in which a specied 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 specied program name 8-161
Executes a pallet movement command for the robot 8-162
Denes points within a program 8-166
Creates pallet point data 8-168
Displays the specied expression value at the programming box 8-169
Species/acquires the pushing force parameter 8-170
Species/acquires the push judge speed parameter 8-171
Species/acquires a pushing type parameter 8-172
Acquires the status when PUSH statement ends 8-173
Species/acquires the push speed parameter 8-174
Species/acquires the push time parameter 8-175
Executes a pushing operation for specied axes 8-176
Performs a unit conversion (radians → degrees) 8-181
Inserts a comment 8-182
Turns OFF the bits of specied 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 specied 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 specied output port ON 8-194
Sets the General Ethernet Port 8-195
Assigns /acquires the value to a specied integer type static variable 8-196
Assigns /acquires the value to a specied real type static variable
Enables sub-procedure referencing without passing on the variable
Sets the shift coordinates 8-199
Acquires specied SI status 8-200
Acquires a specied serial input's double-word information 8-201
Acquires the sine value for a specied 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 specied serial input's word information 8-203
Denes the shift coordinates in the program 8-204
Outputs a specied value
to serial port or acquires the output status 8-205
Outputs a specied serial output's double-word information or acquires the output status 8-207
Outputs a specied 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 specied value 8-210
Starts a new task 8-211
Converts a numeric value to a character string 8-212
Denes 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 specied value 8-217
Timer & counter 8-218
Acquires the current time 8-219
Acquires the current time 8-220
Outputs a specied 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
Species/acquires the tolerance parameter 8-222
Species/acquires the maximum torque command value 8-223
Acquires the program number which is registered in a specied 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
Species/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
T-8
CONTENTS
Programming Manual
Chapter 9 PATH Statements
1 Overview 9-1
2 Fe atur e s 9 -1
3 How to use 9-1
4 Cautions when using this function 9-2
Chapter10Dataledescription
1 Overview 10-1
1.1 Dataletypes 10-1
1.2 Cautions 10-2
2 Programle 10-3
YRCX
2.1 All programs 10-3
2.2 One program 10-4
3 Pointle 10-5
3.1 All points 10-5
3.2 One point 10-7
4 Pointcommentle 10-8
4.1 All point comments 10-8
4.2 One point comment 10-9
5 Pointnamele 10-10
5.1 All point names 10-10
5.2 One point name 10-11
6 Parameterle 10-12
6.1 All parameters 10-12
6.2 One parameter 10-14
7 Shiftcoordinatedenitionle 10-16
7.1 All shift data 10-16
7.2 Oneshiftdenition 10-17
8 Handdenitionle 10-18
8.1 All hand data 10-18
8.2 Onehanddenition 10-19
T-9
CONTENTS
9 Palletdenitionle 10-20
9.1 Allpalletdenitions 10-20
9.2 Onepalletdenition 10-22
10 GeneralEthernetportle 10-24
11 Input/outputnamele 10-26
11.1 All input/output name data 10-26
11.2 One input/output type 10-27
11.3 One input/output port 10-28
11.4 One input/output bit 10-29
Areacheckoutputle 10-30
12
12.1 All area check output data 10-30
12.2 Oneareacheckoutputdenition 10-31
13 Allle 10-32
Programming Manual
YRCX
13.1 Allle 10-32
14 Programdirectoryle 10-34
14.1 Entire program directory 10-34
14.2 One program directory 10-35
15 Parameterdirectoryle 10-36
15.1 Entire parameter directory 10-36
16 Machinereferencele 10-37
16.1 Machine reference (axes: sensor method, stroke-end method) 10-37
16.2 Machine reference (axes: mark method) 10-38
17 Systemcongurationinformationle 10-39
18 Versioninformationle 10-40
19 Optionboardle 10-41
20 Selfcheckle 10-42
T-10
21 Alarmhistoryle 10-43
22 Remainingmemorysizele 10-45
23 Variablele 10-46
CONTENTS
Programming Manual
24 Constantle 10-52
24.1 One character string 10-52
25 Arrayvariablele 10-53
25.1 All array variables 10-53
25.2 One array variable 10-54
26 DIle 10-55
26.1 All DI information 10-55
26.2 One DI port 10-56
27 DOle 10-57
27.1 All DO information 10-57
27.2 One DO port 10-58
28 MOle 10-59
28.1 All MO information 10-59
28.2 One MO port 10-60
YRCX
29 LOle 10-61
29.1 All LO information 10-61
29.2 One LO port 10-62
30 TOle 10-63
30.1 All TO information 10-63
30.2 One TO port 10-64
31 SIle 10-65
31.1 All SI information 10-65
31.2 One SI port 10-66
32 SOle 10-67
32.1 All SO information 10-67
32.2 One SO port 10-68
33 SIWle 10-69
33.1 All SIW data 10-69
33.2 One SIW data 10-70
34 SOWle 10-71
34.1 All SOW 10-71
34.2 One SOW data 10-72
T-11
CONTENTS
35 EOFle 10-73
35.1 EOF data 10-73
36 Serialportcommunicationle 10-74
36.1 Serialportcommunicationle 10-74
37 Ethernetportcommunicationle 10-75
37.1 Ethernetportcommunicationle 10-75
Chapter11Userprogramexamples
1 Basic operation 11-1
1.1 Directly writing point data in program 11-1
1.2 Using point numbers 11-2
1.3 Using shift coordinates 11-3
1.4 Palletizing 11-4
1.4.1 Calculating point coordinates 11-4
1.4.2 Utilizing pallet movement 11-6
1.5 DI/DO (digital input and output) operation 11-7
Programming Manual
YRCX
2 Application 11-8
2.1 Pick and place between 2 points 11-8
2.2 Palletizing 11-10
2.3 Pick and place of stacked parts 11-12
2.4 Parts inspection (Multi-tasking example) 11-14
2.5 Sealing 11-17
2.6 Connection to an external device through RS-232C (example 1) 11-18
2.7 Connection to an external device through RS-232C (example 2) 11-19
Chapter 12 Online commands
1 Online Command List 12-1
1.1 Onlinecommandlist:Operation-specic 12-2
1.2 Online command list: In alphabetic order 12-6
2 Operation and setting commands 12-9
2.1 Program operations 12-9
2.2 MANUAL mode operation 12-17
2.3 Alarm reset 12-18
2.4 Clearingoutputmessagebuer 12-19
2.5 Setting input data 12-20
2.6 Change access level 12-21
2.7 Setting input data 12-22
T-12
CONTENTS
Programming Manual
3 Reference commands 12-23
3.1 Acquiring return-to-origin status 12-23
3.2 Acquiring the servo status 12-24
3.3 Acquire motor power status 12-24
3.4 Acquiring the access level 12-25
3.5 Acquiring the break point status 12-25
3.6 Acquiring the mode status 12-26
3.7 Acquiring the communication port status 12-26
3.8 Acquiring the main program number 12-27
3.9 Acquiring the sequence program execution status 12-27
3.10 Acquiring the version information 12-28
3.11 Acquiring the tasks in RUN or SUSPEND status 12-28
3.12 Acquiring the tasks operation status 12-29
3.13 Acquiring the task end condition 12-29
3.14 Acquiring the shift status 12-30
3.15 Acquiring the hand status 12-30
3.16 Acquiring the remaining memory capacity 12-31
3.17 Acquiring the alarm status 12-31
3.18 Acquiring the emergency stop status 12-32
3.19 Acquiring the manual movement speed 12-32
3.20 Acquiring the inching movement amount 12-33
3.21
Acquiring the last reference point number (current point number) 12-33
3.22 Acquiring the output message 12-34
3.23 Acquiring the input data 12-34
3.24 Acquiring various values 12-35
YRCX
4 Operation commands 12-37
4.1 Absolute reset 12-37
4.2 Return-to-origin operation 12-38
4.3 Manual movement: inching 12-39
4.4 Manual movement: jog 12-40
5 Dataleoperationcommands 12-41
5.1 Copy operations 12-41
5.2 Erase 12-42
5.3 Rename program 12-47
5.4 Changing the program attribute 12-47
5.5 Initialization process 12-48
5.6 Data readout processing 12-50
5.7 Data write processing 12-51
T-13
CONTENTS
6 Utility commands 12-52
6.1 Settingthesequenceprogramexecutionag 12-52
6.2 Setting the date 12-52
6.3 Setting the time 12-53
7 Individualexecutionofrobotlanguage 12-54
8 Control codes 12-55
Chapter13Appendix
1 Reserved word list 13-1
2 Changes from conventional models 13-3
1 Program name 13-3
A) FUNCTION 13-3
B) _SELECT 13-3
2 Multiple Robot Control 13-3
3 Multi-tasking 13-4
4 Robot Language 13-4
5 Online commands 13-5
6 Datale 13-5
Programming Manual
YRCX
Index
T-14
Chapter 1
Writing Programs
1 1
The OMRON Robot Language .................
2 2
Characters ................................................
3 3
Program Basics .........................................
4 4
Program Names ........................................
5 5
Identifiers ...................................................
6 6
LABEL Statement .......................................
7 7
Comment ..................................................
8 8
Command Statement Format .................
1-1
1-1
1-1
1-2
1-4
1-4
1-5
1-5
1
The OMRON Robot Language
1
The OMRON 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 OMRON robot language, including actual examples on how its
commands are used.
2

Characters

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

Program Basics

NOTE
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.
1 line may contain no more than 255 characters.
Comment 1-5
Chapter 2
Constants
1 1
Outline .......................................................
2 2
Numeric constants ...................................
3 3
Character constants ................................
2-1
2-1
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
Numeric
type
Character
type
2

Numeric constants

Integer type
Real type Single-precision real numbers
Character
string
Decimal constants
-2,147,483,648 to 2,147,483,647
Binary constants
&B0 to &B11111111
Hexadecimal constants &H80000000 to &H7FFFFFFF
-999,999.9 to +999,999.9
Exponential format single-precision real numbers
-1.0×10
Alphabetic, numeric, special character, or katakana (Japanese)
character string of 255 bytes or less.
38
to +1.0×10
38
2
3
4
5
6

2.1 Integer constants

1. Decimal constants
Integers from -2,147,483,648 to 2,147,483,647 may be used.
2. Binary constants
Unsigned binary numbers of 8 bits or less may be used. The prefix "&B" is attached to the
number to define it as a binary number.
Range: &B0 (decimal: 0) to &B11111111 (decimal: 255)
3. Hexadecimal constants
Signed hexadecimal numbers of 32 bits or less may be used. The prefix "&H" is attached to the
number to define it as a hexadecimal number.
Range: &H80000000 (decimal: -2,147,483,648) to &H7FFFFFFF (decimal: 2,147,483,647)

2.2 Real constants

1. Single-precision real numbers
Real numbers from -999999.9 to +999999.9 may be used.
• 7 digits including integers and decimals. (For example, ".0000001" may be used.)
2. Single-precision real numbers in exponent form
Numbers from -1.0×10
• Mantissas should be 7 digits or less, including integers and decimals.
MEMO
Examples:
3. 14E0
1. E5
• An integer constant range of –1,073,741,824 to 1,073,741,823 is expressed in signed hexadecimal number as &H80000000 to &H7FFFFFFF.
-1. 23456E-12
38
to +1.0×1038 may be used.
Outline 2-1
1
2
3
4
5
3

Character constants

Character type constants are character string data enclosed in double quotation marks ("). The
character string must not exceed 255 bytes in length, and it may contain upper-case alphabetic
characters, numerals, special characters, or katakana (Japanese) characters.
To include a double quotation mark (") in a string, enter two double quotation marks in succession.
SAMPLE
"OMRON ROBOT"
"EXAMPLE OF""A""" ·················· EXAMPLE OF "A"
PRINT "COMPLETED"
"OMRON ROBOT"
6
2-2 Chapter 2 Constants
Loading...
+ 476 hidden pages