SPEL+ Language
SPEL+ Language
SPEL+ Language
0
+
Ver.5.4
SPEL Language
Reference
Rev.3
EM11ZS2268F
FOREWORD
Thank you for purchasing our robot products.
This manual contains the information necessary for the correct use of the Manipulator.
Please carefully read this manual and other related manuals before installing the robot
system.
Keep this manual handy for easy access at all times.
WARRANTY
The robot and its optional parts are shipped to our customers only after being subjected to
the strictest quality controls, tests, and inspections to certify its compliance with our high
performance standards.
Product malfunctions resulting from normal handling or operation will be repaired free of
charge during the normal warranty period. (Please ask your Regional Sales Office for
warranty period information.)
However, customers will be charged for repairs in the following cases (even if they occur
during the warranty period):
1. Damage or malfunction caused by improper use which is not described in the manual,
or careless use.
2. Malfunctions caused by customers unauthorized disassembly.
3. Damage due to improper adjustments or unauthorized repair attempts.
4. Damage caused by natural disasters such as earthquake, flood, etc.
Warnings, Cautions, Usage:
1. If the robot or associated equipment is used outside of the usage conditions and
product specifications described in the manuals, this warranty is void.
2. If you do not follow the WARNINGS and CAUTIONS in this manual, we cannot be
responsible for any malfunction or accident, even if the result is injury or death.
3. We cannot foresee all possible dangers and consequences. Therefore, this manual
cannot warn the user of all possible hazards.
ii
TRADEMARKS
Microsoft, Windows, and Windows logo are either registered trademarks or trademarks of
Microsoft Corporation in the United States and/or other countries. Other brand and
product names are trademarks or registered trademarks of the respective holders.
NOTICE
No part of this manual may be copied or reproduced without authorization.
The contents of this manual are subject to change without notice.
Please notify us if you should find any errors in this manual or if you have any comments
regarding its contents.
INQUIRIES
Contact the following service center for robot repairs, inspections or adjustments.
If service center information is not indicated below, please contact the supplier
office for your region.
Please prepare the following items before you contact us.
-Your controller model and its serial number
-Your manipulator model and its serial number
-Software and its version in your robot system
-A description of the problem
SERVICE CENTER
iii
SUPPLIERS
North & South America EPSON AMERICA, INC.
Factory Automation/Robotics
18300 Central Avenue
Carson, CA 90746
USA
TEL
: +1-562-290-5900
FAX
: +1-562-290-5999
E-MAIL : [email protected]
iv
Europe
China
Taiwan
Southeast Asia
India
Korea
SAFETY PRECAUTIONS
Installation of robots and robotic equipment should only be performed by qualified
personnel in accordance with national and local codes. Please carefully read this
manual and other related manuals when using this software.
Keep this manual in a handy location for easy access at all times.
vi
TABLE OF CONTENTS
Summary of SPEL+ Commands
11
473
Events ............................................................................................................473
Warnings........................................................................................................475
Controller Main...............................................................................................476
Operator Panel...............................................................................................481
Teach Pendant...............................................................................................481
PC ..................................................................................................................482
Interpreter ......................................................................................................483
Parser ............................................................................................................501
Motor Control .................................................................................................509
Servo..............................................................................................................517
Points .............................................................................................................523
Fieldbus .........................................................................................................525
Vision .............................................................................................................526
Simulator........................................................................................................528
GUI Builder.....................................................................................................529
Hardware .......................................................................................................530
EPSON RC+ .................................................................................................534
vii
Table of Contents
535
viii
SysConfig
SysErr
Date
Time
Date$
Time$
Hour
Stat
CtrlInfo
RobotInfo
RobotInfo$
TaskInfo
TaskInfo$
DispDev
EStopOn
CtrlDev
Cls
Toff
Ton
SafetyOn
Jump
Jump3
Jump3CP
Arch
LimZ
Sense
JS
JT
Go
Pass
Pulse
BGo
BMove
TGo
TMove
Till
TillOn
!!
Speed
Accel
Inertia
Weight
Arc
Arc3
Move
Curve
CV Move
SpeedS
AccelS
SpeedR
AccelR
AccelMax
Brake
Home
HomeClr
HomeDef
HomeSet
Hordr
AtHome
InPos
CurPos
TCPSpeed
Pallet
Fine
QP
QPDecelR
QPDecelS
CP
Box
BoxClr
BoxDef
Plane
PlaneClr
PlaneDef
InsideBox
InsidePlane
Find
FindPos
PosFound
WaitPos
RobotModel$
RobotName$
RobotSerial$
RobotType
TargetOK
JRange
Range
XYLim
XYLimClr
XYLimDef
XY
Dist
PTPBoost
Sets / returns boost values for small distance PTP motion.
EPSON RC+ 5.0 (Ver.5.4) SPEL+ Language Reference Rev.3
3
PTPBoostOK
PTPTime
LJM Function
Align Function
AlignECP Function
SoftCP
CX
CY
CZ
CU
CV
CW
Pls
Agl
PAgl
JA
AglToPls
DegToRad
RadToDeg
Joint
JTran
PTran
RealPls
RealPose
PPls
Here
Where
Torque Commands
TC
TCSpeed
TCLim
RealTorque
ATCLR
ATRQ
PTCLR
PTRQ
OLAccel
OLRate
In
InW
InBCD
InReal
Out
OutW
OpBCD
OutReal
MemOn
MemOff
MemSw
MemIn
MemOut
MemInW
MemOutW
Wait
TMOut
Tw
Input
Print
Line Input
Input #
Print #
Line Input #
Lof
SetIn
SetInReal
SetInW
SetSw
IOLabel$
IONumber
OpenCom
CloseCom
SetCom
ChkCom
OpenNet
CloseNet
SetNet
ChkNet
WaitNet
Read
ReadBin
Write
WriteBin
Returns the I/O label for a specified input or output bit, byte,
or word.
Returns the I/O number of the specified I/O label.
Open an RS-232 communication port.
Close the RS-232C port that has been opened with
OpenCom.
Sets or displays parameters for RS-232C port.
Returns number of characters in the reception buffer of a
communication port
Open a TCP/IP network port.
Close the TCP/IP port previously opened with OpenNet.
Sets parameters for a TCP/IP port.
Returns number of characters in the reception buffer of a
network port
Wait for TCP/IP port connection to be established.
Reads characters from a file or communications port.
Reads binary data from a file or communications port.
Writes characters to a file or communication port without
end of line terminator.
Writes binary data to a file or communications port.
P#
PDef
PDel
PLabel
PLabel$
PNumber
PList
PLocal
Tool
TLSet
TLDef
TLClr
ECP
ECPSet
ECPDef
ECPClr
Base
Local
LocalDef
LocalClr
Elbow
Hand
Wrist
J4Flag
J6Flag
J1Flag
J2Flag
VxCalib
VxCalDelete
VxCalInfo
VxCalLoad
VxCalSave
VxTrans
Declare a function.
Executes one or more statements for a specific count.
Execute a subroutine.
Returns from a subroutine.
Branch unconditionally to a line number or label.
Call a user function.
Conditional statement execution
Used with the If instruction to allow statements to be
executed when the condition used with the If instruction is
False. Else is an option for the If/Then instruction.
Do...Loop
Do...Loop construct.
Trap
OnErr
Era
Erf$
Erl
Err
Ert
ErrMsg$
Signal
SyncLock
SynUnlock
WaitSig
ErrorOn
Error
EResume
PauseOn
Exit
Execute a task.
Pause all tasks that have pause enabled.
Resumes the contoller after a Pause statement has been
executed and continues the execution of all tasks.
Suspend a task.
Quits a task.
Resume a task in the halt state.
Returns current task.
TaskDone
TaskState
TaskWait
Cont
Pseudo Statements
#define
#ifdef ... #endif
#ifndef ... #endif
#include
Defines a macro.
Conditional compile.
Conditional compile.
Include a file.
Int
BClr
BSet
BTst
Fix
Hex
Randomize
Redim
Rnd
UBound
String Commands
Asc
Chr$
Left$
Mid$
Right$
Len
LSet$
RSet$
Space$
Str$
Val
LCase$
UCase$
LTrim$
RTrim$
Trim$
ParseStr
FmtStr$
InStr
Tab$
Logical operators
And
Or
LShift
Mod
Not
RShift
Xor
Mask
Variable commands
Boolean
Byte
Double
Global
Integer
Long
Real
String
10
Syntax
Syntax describes the format used for each command. For some
commands, there is more than one syntax shown, along with a
number that is referenced in the command description. Parameters
are shown in italics.
Parameters
Return Values
Description
Notes
See Also
Example
11
SYMBOLS
This manual uses the following symbols to show what context the command can
be used in:
12
>
!...!
!...!
Parallel Processing
Parallel Processing
>
!statements !
Parameters
motion cmd
statements
Any valid motion command included in the following list: Arc, Arc3, Go, Jump,
Jump3, Jump3CP, Move.
Any valid parallel processing I/O statement(s) which can be executed during
motion. (See table below)
Description
Parallel processing commands are attached to motion commands to allow I/O statements to execute
simultaneously with the beginning of motion travel. This means that I/O can execute while the arm is
moving rather than always waiting for arm travel to stop and then executing I/O. There is even a
facility to define when within the motion that the I/O should begin execution. (See the Dn parameter
described in the table below.)
The table below shows all valid parallel processing statements. Each of these statements may be
used as single statements or grouped together to allow multiple I/O statements to execute during one
motion statement.
Used to specify %travel before the next parallel statement is executed. n is a
percentage between 0 and 100 which represents the position within the
motion where the parallel processing statements should begin. Statements
which follow the Dn parameter will begin execution after n% of the motion
travel has been completed.
Dn
When used with the Jump, Jump3, and Jump3CP commands, %travel does
not include the depart and approach motion. To execute statements after the
depart motion has completed, include D0 (zero) at the beginning of the
statement.
Dn may appear a maximum of 16 times in a parallel processing statement.
On / Off n
MemOn / MemOff n
Out p,d
OpBCD p, d
OutW p, d
OutReal p, d
MemOutW p, d
MemOut p, d
Signal s
Wait t
WaitSig s
Wait Sw(n) = j
Delays execution of next parallel processing statement until the input bit n is
equal to the condition defined by j. (On or Off)
Wait MemSw(n) = j
Delays execution of the next parallel processing statement until the memory
I/O bit n is equal to the condition defined by j. (On or Off)
Print / Input
Print # / Input #
Prints data to and inputs data from the specified communications port.
Pn = Point
expression
13
!...!
Parallel Processing
Notes
When Motion is Completed before All I/O Commands are Complete
If, after completing the motion for a specific motion command, all parallel processing statement
execution has not been completed, subsequent program execution is delayed until all parallel
processing statements execution has been completed. This situation is most likely to occur with short
moves with many I/O commands to execute in parallel.
What happens when the Till statement is used to stop the arm prior to completing the intended
motion
If Till is used to stop the arm at an intermediate travel position, the next statement after the motion
statement's execution is delayed until all the execution of all parallel processing statements has been
completed.
Whem the Trap is used to stop the arm before completing the motion
After the arm stops at an intermediate travel position, D statement cannot be executed.
Specifying n near 100% can cause path motion to decelerate
If a large value of n is used during CP motion, the robot may decelerate to finish the current motion.
This is because the position specified would normally be during deceleration if CP was not being used.
To avoid deceleration, consider placing the processing statement after the motion command. For
example, in the example below, the On 1 statement is moved from parallel processing during the jump
to P1 to after the jump.
CP On
Jump P1 !D96; On 1!
Go P2
CP On
Jump P1
On 1
Go P2
The Jump statement and Parallel Processing
It should be noted that execution of parallel processing statements which are used with the Jump
statement begins after the rising motion has completed and ends at the start of falling motion.
The Here statement and Parallel Processing
You cannot use both of the Here statement and parallel processing in one motion command like this:
Go Here :Z(0) ! D10; MemOn 1 !
Be sure to change the program like this:
P999 = Here
Go P999 Here :Z(0) ! D10; MemOn 1 !
See Also
Arc, Arc3, Go, Jump, Jump3, Jump3CP, Move, Pulse
!...! Parallel Processing Example
The following examples show various ways to use the parallel processing feature with Motion
Commands:.
Parallel processing with the Jump command causes output bit 1 to turn on at the end of the Z joint
rising travel and when the 1st, 2nd, and 4th axes begin to move. Then output bit 1 is turned off again
after 50% of the Jump motion travel has completed.
Function test
Jump P1 !D0; On 1; D50; Off 1!
Fend
Parallel processing with the Move command causes output bit 5 to turn on when the joints have
completed 10% of their move to the point P1. Then 0.5 seconds later turn output bit 5 off.
Function test2
Move P1 !D10; On 5; Wait 0.5; Off 5!
Fend
14
#define
#define
Defines identifier to be replaced by specified replacement string.
Syntax
#define identifier [(parameter, [parameter ])] string
Parameters
identifier
Keyword defined by user which is an abbreviation for the string parameter. Rules for
identifiers are as follows:
- The first character must be alphabetic while the characters which follow may be
alphanumeric or an underscore (_).
- Spaces or tab characters are not allowed as part of the identifier .
parameter
Normally used to specify a variable (or multiple variables) which may be used by the
replacement string. This provides for a dynamic define mechanism which can be used
like a macro. A maximum of up to 8 parameters may be used with the #define command.
However, each parameter must be separated by a comma and the parameter list must
be enclosed within parenthesis.
string
This is the replacement string which replaces the identifier when the program is compiled.
Rules regarding replacement strings are as follows:
- Spaces or tabs are allowed in replacement strings.
- Identifiers used with other #define statements cannot be used as replacement strings.
- If the comment symbol (') is included, the characters following the comment symbol
will be treated as a comment and will not be included in the replacement string.
-
The replacement string may be omitted. In this case the specified identifier is
replaced by "nothing" or the null string. This actually deletes the identifier from the
program
Description
The #define instruction causes a replacement to occur within a program for the specified identifier.
Each time the specified identifier is found the identifier is replaced with the replacement string prior to
compilation. However, the source code will remain with the identifier rather than the replacement
string. This allows code to become easier to read in many cases by using meaningful identifier names
rather than long difficult to read strings of code.
The defined identifier can be used for conditional compiling by combining with the #ifdef or #ifndef
commands.
If a parameter is specified, the new identifier can be used like a macro.
Notes
Using #define for variable declaration or label substitutions will cause an error:
It should be noted that usage of the #define instruction for variable declaration will cause an error.
See Also
#ifdef
#ifndef
15
#define
#define Example
' Uncomment next line for Debug mode.
' #define DEBUG
Input #1, A$
#ifdef DEBUG
Print "A$ = ", A$
#endif
Print "The End"
#define SHOWVAL(x) Print "var = ", x
Integer a
a = 25
SHOWVAL(a)
16
#ifdef...#else...#endif
#ifdef...#else...#endif
Provides conditional compiling capabilities.
Syntax
#ifdef identifier
..put selected source code for conditional compile here.
[#else
...put selected source code for false condition here.]
#endif
Parameters
identifier
Keyword defined by the user which when defined allows the source code defined
between #ifdef and #else or #endif to be compiled. Thus the identifier acts as the
condition for the conditional compile.
Description
#ifdef...#else...#endif allows for the conditional compiling of selected source code. The condition as to
whether or not the compile will occur is determined based on the identifier. #ifdef first checks if the
specified identifier is currently defined by #define. The #else statement is optional.
If defined, and the #else statement is not used, the statements between #ifdef and #endif are
compiled. Otherwise, if #else is used, then the statements between #ifdef and #else are compiled.
If not defined, and the #else statement is not used, the statements between #ifdef and #endif are
skipped without being compiled. Otherwise, if #else is used, then the statements between #else and
#endif are compiled.
See Also
#define, #ifndef
#ifdef Example
A section of code from a sample program using #ifdef is shown below. In the example below, the
printing of the value of the variable A$ will be executed depending on the presence or absence of the
definition of the #define DEBUG pseudo instruction. If the #define DEBUG pseudo instruction was
used earlier in this source, the Print A$ line will be compiled and later executed when the program is
run. However, the printing of the string "The End" will occur regardless of the #define DEBUG pseudo
instruction.
' Uncomment next line for Debug mode.
' #define DEBUG
Input #1, A$
#ifdef DEBUG
Print "A$ = ", A$
#endif
Print "The End"
17
#ifndef...#endif
#ifndef...#endif
Provides conditional compiling capabilities.
Syntax
#ifndef identifier
..Put selected source code for conditional compile here.
[#else
...put selected source code for true condition here.]
#endif
Parameters
identifier
Keyword defined by the user which when Not defined allows the source code defined
between #ifndef and #else or #endif to be compiled. Thus the identifier acts as the
condition for the conditional compile.
Description
This instruction is called the "if not defined" instruction. #ifndef...#else...#endif allow for the conditional
compiling of selected source code. The #else statement is optional.
If defined, and the #else statement is not used, the statements between #ifndef and #endif are not
compiled. Otherwise, if #else is used, then the statements between #else and #endif are compiled.
If not defined, and the #else statement is not used, the statements between #ifndef and #endif are
compiled. Otherwise, if #else is used, then the statements between #else and #endif are not compiled.
Notes
Difference between #ifdef and #ifndef
The fundamental difference between #ifdef and #ifndef is that the #ifdef instruction compiles the
specified source code if the identifier is defined. The #ifndef instruction compiles the specified source
code if the identifier is not defined.
See Also
#define, #ifdef
#ifndef Example
A section of code from a sample program using #ifndef is shown below. In the example below, the
printing of the value of the variable A$ will be executed depending on the presence or absence of the
definition of the #define NODELAY pseudo instruction. If the #define NODELAY pseudo instruction
was used earlier in this source, the Wait 1 line will Not be compiled along with the rest of the source
for this program when it is compiled. (i.e. submitted for running.) If the #define NODELAY pseudo
instruction was not used (i.e. NODELAY is not defined) earlier in this source, the Wait 1 line will be
compiled and later executed when the program is run. The printing of the string "The End" will occur
regardless of the #define NODELAY pseudo instruction.
' Comment out next line to force delays.
#define NODELAY 1
Input #1, A$
#ifndef NODELAY
Wait 1
#endif
Print "The End"
18
#include
#include
Includes the specified file into the file where the #include statement is used.
Syntax
#include "fileName.INC"
Parameters
fileName
fileName must be the name of an include file in the current project. All include files have
the INC extension. The filename specifies the file which will be included in the current file.
Description
#include inserts the contents of the specified include file with the current file where the #include
statement is used.
Include files are used to contain #define statements.
The #include statement must be used outside of any function definitions.
An include file may contain a secondary include file. For example, FILE2 may be included within
FILE1, and FILE3 may be included within FILE2. This is called nesting.
See Also
#define, #ifdef, #ifndef
#include Example
Include File (Defs.inc)
#define DEBUG 1
#define MAX_PART_COUNT 20
Program File (main.prg)
#include "defs.inc"
Function main
Integer i
Integer Parts(MAX_PART_COUNT)
Fend
19
#undef
#undef
Undefines an identifier previously defined with #define.
Syntax
#undef identifier
Parameters
identifier
See Also
#define, #ifdef, #ifndef
20
Abs Function
Abs Function
Returns the absolute value of a number.
Syntax
Abs(number)
Parameters
number
Return Values
The absolute value of a number.
Description
The absolute value of a number is its unsigned magnitude. For example, Abs(-1) and Abs(1) both
return 1.
See Also
Atan, Atan2, Cos, Int, Mod, Not, Sgn, Sin, Sqr, Str$, Tan, Val
Abs Function Example
The following examples are done from the command window using the Print instruction.
> print abs(1)
1
> print abs(-1)
1
> print abs(-3.54)
3.54
>
21
Accel Statement
Accel Statement
Sets (or displays) the acceleration and deceleration rates for the point to point
motion instructions Go, Jump and Pulse.
>
Syntax
(1) Accel accel, decel [, departAccel, departDecel, approAccel, approDecel ]
(2) Accel
Parameters
accel
decel
departAccel
departDecel
approAccel
approDecel
Return Values
When parameters are omitted, the current Accel parameters are displayed.
Description
Accel specifies the acceleration and deceleration for all Point to Point type motions. This includes
motion caused by the Go, Jump and Pulse robot motion instructions.
Each acceleration and deceleration parameter defined by the Accel instruction may be an integer
value 1 or more. This number represents a percentage of the maximum acceleration (or
deceleration) allowed. Usually, the maximum value is 100. However, some robots allow setting
larger than 100. Use AccelMax function to get the maximum value available for Accel.
The Accel instruction can be used to set new acceleration and deceleration values or simply to
print the current values. When the Accel instruction is used to set new accel and decel values, the
first 2 parameters (accel and decel ) in the Accel instruction are required.
The optional departAccel, departDecel, approAccel, and approDecel parameters are effective for
the Jump instruction only and specify acceleration and deceleration values for the depart motion at
the beginning of Jump and the approach motion at the end of Jump.
The Accel value initializes to the default values (low acceleration) when any one of the following
conditions occurs:
Controller Power On
Motor On
SFree, SLock
Reset
Stop button or Ctrl + C Key
22
Accel Statement
Notes
Executing the Accel command in Low Power Mode (Power Low)
If Accel is executed when the robot is in low power mode (Power Low), the new values are stored, but
the current values are limited to low values.
The current acceleration values are in effect when Power is set to High, and Teach mode is OFF.
Accel vs. AccelS
It is important to note that the Accel instruction does not set the acceleration and deceleration rates
for straight line and arc motion. The AccelS instruction is used to set the acceleration and deceleration
rates for the straight line and arc type moves.
Accel setting larger than 100
Usually, the maximum value is 100. However, some robots allow setting larger than 100.
In general use, Accel setting 100 is the optimum setting that maintains the balance of acceleration and
vibration when positioning. However, you may require an operation with high acceleration to shorten
the cycle time by decreasing the vibration at positioning. In this case, set the Accel to larger than 100.
Except in some operation conditions, the cycle time may not change by setting Accel to larger than
100.
See Also
AccelR, AccelS, Go, Jump, Jump3, Power, Pulse, Speed, TGo
Accel Statement Example
The following example shows a simple motion program where the acceleration (Accel) and speed
(Speed) is set using predefined variables.
Function acctest
Integer slow, accslow, decslow, fast, accfast, decfast
slow = 20
fast = 100
accslow = 20
decslow = 20
accfast = 100
decfast = 100
'set
'set
'set
'set
'set
'set
slow
high
slow
slow
fast
fast
speed variable
speed variable
acceleration variable
deceleration variable
acceleration variable
deceleration variable
23
Accel Statement
<Example 2>
Assume the robot is currently in Low Power Mode (Power Low) and from the command window the
user tries to set the Accel value to 100. Because the robot is in Low Power Mode, a maximum
acceleration value of 10 will be set automatically. (The system will not allow an acceleration larger
than 10 when in Low Power Mode.)
>Accel 100,100
>
>Accel
Low Power Mode
100
100
100
100
100
100
<Example 3>
Set the Z joint downward deceleration to be slow to allow a gentle placement of the part when using
the Jump instruction. This means we must set the Zdnd parameter low when setting the Accel values.
>Accel 100,100,100,100,100,35
>Accel
100
100
100
>
24
100
100
35
Accel Function
Accel Function
Returns specified acceleration value.
>
Syntax
Accel(paramNumber)
Parameters
paramNumber
Return Values
Integer 1% or more
See Also
Accel Statement
Accel Function Example
This example uses the Accel function in a program:
Integer currAccel, currDecel
' Get current accel and decel
currAccel = Accel(1)
currDecel = Accel(2)
Accel 50, 50
Jump pick
' Restore previous settings
Accel currAccel, currDecel
25
AccelMax Function
AccelMax Function
Returns maximum acceleration value limit available for Accel.
>
Syntax
AccelMax(maxValueNumber)
Parameters
maxValueNumber Integer expression which can have the following values:
1: acceleration maximum value
2: deceleration maximum value
3: depart acceleration maximum value for Jump
4: depart deceleration maximum value for Jump
5: approach acceleration maximum value for Jump
6: approach deceleration maximum value for Jump
Return Values
Integer 1% or more
See Also
Accel
AccelMax Function Example
This example uses the AccelMax function in a program:
' Get maximum accel and decel
Print AccelMax(1), AccelMax(2)
26
AccelR Statement
AccelR Statement
Sets or displays the acceleration and deceleration values for tool rotation control of
CP motion.
>
Syntax
(1) AccelR accel, [decel]
(2) AccelR
Parameters
accel
decel
Return Values
When parameters are omitted, the current AccelR settings are displayed.
Description
AccelR is effective when the ROT modifier is used in the Move, Arc, Arc3, BMove, TMove, and
Jump3CP motion commands.
The AccelR value initializes to the default values when any one of the following conditions occurs:
Controller Power On
Motor On
SFree, SLock
Reset
Stop button or Ctrl + C Key
See Also
Arc, Arc3, BMove, Jump3CP, Power, SpeedR, TMove
AccelR Statement Example
AccelR 360, 200
27
AccelR Function
AccelR Function
Returns specified tool rotation acceleration value.
>
Syntax
AccelR(paramNumber)
Parameters
paramNumber
Return Values
Real value in degrees / second2
See Also
AccelR Statement
AccelR Function Example
Real currAccelR, currDecelR
' Get current accel and decel
currAccelR = AccelR(1)
currDecelR = AccelR(2)
28
AccelS Statement
AccelS Statement
Sets the acceleration and deceleration rates for the Straight Line and Continuous Path
robot motion instructions such as Move, Arc, Arc3, Jump3, etc.
>
Syntax
(1) AccelS accel, [decel ], [departAccel], [departDecel], [approAccel], [approDecel]
(2) AccelS
Parameters
accel
decel
departAccel
Optional. Real expression for depart acceleration value for Jump3, Jump3CP.
departDecel
Optional. Real expression for depart deceleration value for Jump3, Jump3CP.
approAccel
Optional. Real expression for approach acceleration value for Jump3, Jump3CP.
approDecel
Optional. Real expression for approach deceleration value for Jump3, Jump3CP.
departAccel / departDecel
approAccel / approDecel
SCARA robot
0.1 to 25000
0.1 to 25000
6-axis robot
0.1 to 25000
0.1 to 50000
(mm/sec2)
Return Values
Displays Accel and Decel values when used without parameters
Description
AccelS specifies the acceleration and deceleration for all interpolated type motions including linear
and curved interpolations. This includes motion caused by the Move and Arc motion instructions.
The AccelS value initializes to the default values when any one of the following conditions occurs:
Controller Power On
Motor On
SFree, SLock
Reset
Stop button or Ctrl + C Key
Notes
Executing the AccelS command in Low Power Mode (Power Low):
If AccelS is executed when the robot is in low power mode (Power Low), the new values are stored,
but the current values are limited to low values.
The current acceleration values are in effect when Power is set to High, and Teach mode is OFF.
Accel vs. AccelS:
It is important to note that the AccelS instruction does not set the acceleration and deceleration rates
for point to point type motion. (i.e. motions initiated by the Go, Jump, and Pulse instructions.) The
Accel instruction is used to set the acceleration and deceleration rates for Point to Point type motion.
29
AccelS Statement
See Also
Accel, Arc, Arc3, Jump3, Jump3CP, Power, Move, TMove, SpeedS
AccelS Example
The following example shows a simple motion program where the straight line/continuous path
acceleration (AccelS) and straight line/continuous path speed (SpeedS) are set using predefined
variables.
Function acctest
Integer slow, accslow, fast, accfast
slow = 20
fast = 100
accslow = 200
accfast = 5000
AccelS accslow
SpeedS slow
Move P1
On 1
AccelS accfast
SpeedS fast
Jump P2
.
.
.
Fend
'set
'set
'set
'set
slow
high
slow
fast
speed variable
speed variable
acceleration variable
acceleration variable
<Example 2>
Assume the robot is currently in Low Power Mode (Power Low ) and from the command window the
user tries to set the AccelS value to 1000. Because the robot is in Low Power Mode, a maximum
acceleration value of 200 will be set automatically. (The system will not allow an acceleration larger
than 200 when in Low Power Mode.)
>AccelS 1000
>AccelS
Low Power Mode
1000.000
>
30
1000.000
AccelS Function
AccelS Function
Returns acceleration or deceleration for CP motion commands.
>
Syntax
AccelS(paramNumber)
Parameters
paramNumber
Return Values
Real value from 0 - 5000 mm/sec/sec
See Also
AccelS Statement, Arc3, SpeedS, Jump3, Jump3CP
AccelS Function Example
Real savAccelS
savAccelS = AccelS(1)
31
Acos Function
Acos Function
Returns the arccosine of a numeric expression.
Syntax
Acos(number)
Parameters
number
Return Values
Real value, in radians, representing the arccosine of the parameter number.
Description
Acos returns the arccosine of the numeric expression. Values range is from -1 to 1. The value
returned by Acos will range from 0 to PI radians. If number is < -1 or > 1, an error occurs.
To convert from radians to degrees, use the RadToDeg function.
See Also
Abs, Asin, Atan, Atan2, Cos, DegToRad, RadToDeg, Sgn, Sin, Tan, Val
Acos Function Example
Function acostest
Double x
x = Cos(DegToRad(30))
Print "Acos of ", x, " is ", Acos(x)
Fend
32
Agl Function
Agl Function
Returns the joint angle for the selected rotational joint, or position for the selected linear joint.
Syntax
Agl(jointNumber)
Parameters
jointNumber
Return Values
The joint angle for selected rotational joint or position for selected linear joints.
Description
The Agl function is used to get the joint angle for the selected rotational joint or position for the
selected linear joint.
If the selected joint is rotational, Agl returns the current angle, as measured from the selected joint's 0
position, in degrees. The returned value is a real number.
If the selected joint is a linear joint, Agl returns the current position, as measured from the selected
joint's 0 position, in mm. The returned value is a real number.
If an auxiliary arm is selected with the Arm statement, Agl returns the angle (or position) from the
standard arm's 0 pulse position to the selected arm.
See Also
PAgl, Pls, PPls
Agl Function Example
The following examples are done from the command window using the Print instruction.
> print agl(1), agl(2)
17.234 85.355
33
AglToPls Function
AglToPls Function
F
Return Values
A robot point whose location is determined by joint angles converted to pulses.
Description
Use AglToPls to create a point from joint angles.
Note
Assignment to point can cause part of the joint position to be lost.
In certain cases, when the result of AglToPls is assigned to a point data variable, the arm moves to a
joint position that is different from the joint position specified by AglToPls.
For example:
P1 = AglToPls(0, 0, 0, 90, 0, 0)
Go P1 ' moves to AglToPls(0, 0, 0, 0, 0, 90) joint position
Similarly, when the AglToPls function is used as a parameter in a CP motion command, the arm may
move to a different joint position from the joint position specified by AglToPls.
Move AglToPls(0, 0, 0, 90, 0, 0) ' moves to AglToPls(0, 0, 0, 0, 0, 90)
joint position
When using the AglToPls function as a parameter in a PTP motion command, this problem does not
occur.
See Also
Agl, JA, Pls
AglToPls Function Example
Go AglToPls(0, 0, 0, 90, 0, 0)
34
Align Function
Align Function
Returns the point data converted to align the robot orientation (U, V, W) at the specified point
in the tool coordinate system with the nearest axis of the specified local coordinate system.
Syntax
(1) Align (Point, [ localNumber ])
Parameters
Point
localNumber
Description
While operating the 6-axis robot, the robot orientation may have to be aligned with an axis of the
specified local coordinate system without changing the tool coordinate system position (origin) defined
with the point data.
Align Function converts the orientation data (U,V,W) of the specified point data and aligns with the
nearest axis of the specified local coordinate system.
For robots except the 6-axis robot, it returns a specified point.
See Also
AlignECP Function, LJM Function
Align Function Example
Move Align(P0) ROT
P1 = Align(P0, 1)
Move P1 ROT
35
AlignECP Function
AlignECP Function
Returns the point data converted to align the robot orientation (U, V, W) at the specified point
in the tool coordinate system with the nearest axis of the specified ECP coordinate system.
Syntax
(2) AlignECP (Point, ECPNumber)
Parameters
Point
ECPNumber
Description
While operating the 6-axis robot, the robot orientation may have to be aligned with an axis of the
specified local coordinate system without changing the tool coordinate system position (origin) defined
with the point data.
AlignECP Function converts the orientation data (U,V,W) of the specified point data and aligns with
the nearest axis of the specified local coordinate system.
For robots except the 6-axis robot, it returns a specified point.
See Also
Align Function, LJM Function
AlignECP Function Example
Move AlignECP(P0) ROT
P1 = AlignECP(P0, 1)
Move P1 ROT
36
And Operator
And Operator
Operator used to perform a logical or bitwise And of 2 expressions.
Syntax
result = expr1 And expr2
Parameters
expr1, expr2
result
For logical And, any valid expression which returns a Boolean result. For bitwise And,
an integer expression.
For logical And, result is a Boolean value. For bitwise And, result is an integer.
Description
A logical And is used to combine the results of 2 or more expressions into 1 single Boolean result.
The following table indicates the possible combinations.
expr1
expr2
result
True
True
False
False
True
False
True
False
True
False
False
False
A bitwise And performs a bitwise comparison of identically positioned bits in two numeric expressions
and sets the corresponding bit in result according to the following table:
If bit in expr1 is
0
0
1
1
The result is
0
0
0
1
See Also
LShift, Mask, Not, Or, RShift, Xor
And Operator Example
Function LogicalAnd(x As Integer, y As Integer)
If x = 1 And y = 2 Then
Print "The values are correct"
EndIf
Fend
Function BitWiseAnd()
If (Stat(0) And &H800000) = &H800000 Then
Print "The enable switch is open"
EndIf
Fend
>print 15 and 7
7
>
37
Arc moves the arm to the specified point using circular interpolation in the XY plane.
Arc3 moves the arm to the specified point using circular interpolation in 3 dimensions.
These two commands are available for SCARA robots (including RS series) and 6-axis robots.
Syntax
(1) Arc
(2) Arc3
Parameters
midPoint
Point expression. The middle point (taught previously by the user) which the arm travels
through on its way from the current point to endPoint.
endPoint
Point expression. The end point (taught previously by the user) which the arm travels to
during the arc type motion. This is the final position at the end of the circular move.
ROT
ECP
Optional. External control point motion. This parameter is valid when the ECP option is
enabled.
CP
Parallel processing statements may be used with the Arc statement. These are optional.
(Please see the Parallel Processing description for more information.)
Description
Arc and Arc3 are used to move the arm in a circular type motion from the current position to endPoint
by way of midPoint. The system automatically calculates a curve based on the 3 points (current
position, endPoint, and midPoint) and then moves along that curve until the point defined by endPoint
is reached. The coordinates of midPoint and endPoint must be taught previously before executing the
instruction. The coordinates cannot be specified in the statement itself.
Arc and Arc3 use the SpeedS speed value and AccelS acceleration and deceleration values. Refer to
Using Arc3 with CP below on the relation between the speed/acceleration and the
acceleration/deceleration. If, however, the ROT modifier parameter is used, Arc and Arc3 use the
SpeedR speed value and AccelR acceleration and deceleration values. In this case SpeedS speed
value and AccelS acceleration and deceleration value have no effect.
Usually, when the move distance is 0 and only the tool orientation is changed, an error will occur.
However, by using the ROT parameter and giving priority to the acceleration and the deceleration of
the tool rotation, it is possible to move without an error. When there is not an orientational change with
the ROT modifier parameter and movement distance is not 0, an error will occur.
Also, when the tool rotation is large as compared to move distance, and when the rotation speed
exceeds the specified speed of the manipulator, an error will occur. In this case, please reduce the
speed or append the ROT modifier parameter to give priority to the rotational
speed/acceleration/deceleration.
When ECP is used (Arc3 only), the trajectory of the external control point coresponding to the ECP
number specified by ECP instruction moves circular with respect to the tool coordinate system. In this
case, the trajectory of tool center point does not follow a circular line.
38
TCP
Work
ECP
39
P102
P101
P100
Tip
When first trying to use the Arc instruction, it is suggested to try a simple arc with points directly in
front of the robot in about the middle of the work envelope. Try to visualize the arc that would be
generated and make sure that you are not teaching points in such a way that the robot arm would try
to move outside the normal work envelope.
40
Arch Statement
Arch Statement
Defines or displays the Arch parameters for use with the Jump, Jump3, Jump3CP
instructions.
>
Syntax
(1) Arch archNumber, departDist, approDist
(2) Arch archNumber
(3) Arch
Parameters
archNumber Integer expression representing the Arch number to define. Valid Arch numbers are (06) making a total of 7 entries into the Arch table. (see default Arch Table below)
departDist
The vertical distance moved (Z) at the beginning of the Jump move before beginning
horizontal motion. (specified in millimeters)
approDist
The vertical distance required (as measured from the Z position of the point the arm is
moving to) to move in a completely vertical fashion with all horizontal movement
complete. (specified in millimeters)
Return Values
Displays Arch Table when used without parameters.
The Arch table of the specified Arch number will be displayed when only the Arch number is
specified.
Description
The primary purpose of the Arch instruction is to define values in the Arch Table which is required for
use with the Jump motion instruction. The Arch motion is carried out per the parameters
corresponding to the arch number selected in the Jump C modifier. (To completely understand the
Arch instruction, the user must first understand the Jump instruction.)
The Arch definitions allow the user to "round corners" in the Z direction when using the Jump C
instruction. While the Jump instruction specifies the point to move to (including the final Z joint
position), the Arch table entries specify how much distance to move up before beginning horizontal
motion (riseDist) and how much distance up from the final Z joint position to complete all horizontal
motion (fallDist). (See diagram below)
Rise
Distance
Fall
Distance
41
Arch Statement
There are a total of 8 entries in the Arch Definition Table with 7 of them (0-6) being user definable.
The 8th entry (Arch 7)is the default Arch which actually specifies no arch at all which is referred to as
Gate Motion. (See Gate Motion diagram below) The Jump instruction used with the default Arch entry
(Entry 8) causes the arm to do the following:
1) Begin the move with only Z-joint motion until it reaches the Z-Coordinate value specified by the
LimZ command. (The upper Z value)
2) Next move horizontally to the target point position until the final X, Y and U positions are
reached.
3) The Jump instruction is then completed by moving the arm down with only Z-joint motion until
the target Z-joint position is reached.
Gate Motion
(Jump with Arch 7)
P0
P1
Depart
Distance
30
40
50
60
70
80
90
Approach
Distance
30
40
50
60
70
80
90
Notes
Jump Motion trajectory changes depending on motion and speed
Jump motion trajectory is comprised of vertical motion and horizontal motion. It is not a continuous
path trajectory. The actual Jump trajectory of arch motion is not determined by Arch parameters alone.
It also depends on motion and speed.
Always use care when optimizing Jump trajectory in your applications. Execute Jump with the desired
motion and speed to verify the actual trajectory.
When speed is lower, the trajectory will be lower. If Jump is executed with high speed to verify an
arch motion trajectory, the end effector may crash into an obstacle with lower speed.
In a Jump trajectory, the depart distance increases and the approach distance decreases when the
motion speed is set high. When the fall distance of the trajectory is shorter than the expected, lower
the speed and/or the deceleration, or change the fall distance to be larger.
Even if Jump commands with the same distance and speed are executed, the trajectory is affected by
motion of the robot arms. As a general example, for a SCARA robot the vertical upward distance
increases and the vertical downward distance decreases when the movement of the first arm is large.
When the vertical fall distance decreases and the trajectory is shorter than the expected, lower the
speed and/or the deceleration, or change the fall distance to be larger.
42
Arch Statement
Another Cause of Gate Motion
When the specified value of the Rising Distance or Falling Distance is larger than the actual Z-joint
distance which the robot must move to reach the target position, Gate Motion will occur. (i.e. no type
Arch motion will occur.)
Arch values are Maintained
The Arch Table values are permanently saved and are not changed until either the user changes
them.
See Also
Jump, Jump3, JumpCP
Arch Example
The following are examples of Arch settings done from the command window.
>
>
>
>
arch 0, 15, 15
arch 1, 25, 50
jump p1 c1
arch
arch0 =
15.000
arch1 =
25.000
arch2 =
50.000
arch3 =
60.000
arch4 =
70.000
arch5 =
80.000
arch6 =
90.000
15.000
50.000
50.000
60.000
70.000
80.000
90.000
>
43
Arch Function
Arch Function
>
Syntax
Arch(archNumber, paramNumber)
Parameters
archNumber
paramNumber
Return Value
Real number containing distance.
See Also
Arch statement
Arch Function Example
Real archValues(6, 1)
Integer i
' Save current arch values
For i = 0 to 6
archValues(i, 0) = Arch(i, 1)
archValues(i, 1) = Arch(i, 2)
Next i
44
Arm Statement
Arm Statement
Selects or displays the arm number to use.
>
Syntax
(1) Arm armNumber
(2) Arm
Parameters
armNumber
Optional integer expression. Valid range is from 0 - 15. The user may select up
to 16 different arms. Arm 0 is the standard (default) robot arm. Arm 1 - 15 are
auxiliary arms defined by using the ArmSet instruction. When omitted, the
current arm number is displayed.
Return Values
When the Arm instruction is executed without parameters, the system displays the current arm
number.
Description
Allows the user to specify which arm to use for robot instructions. Arm allows each auxiliary arm to
use common position data. If no auxiliary arms are installed, the standard arm (arm number 0)
operates. Since at time of delivery the arm number is specified as 0, it is not necessary to use the
Arm instruction to select an arm. However, if auxiliary arms are used they must first defined with the
ArmSet instruction.
The auxiliary arm configuration capability is provided to allow users to configure the proper robot
parameters for their robots when the actual robot configuration is a little different than the standard
robot. For example, if the user mounted a 2nd orientation joint to the 2nd robot link, the user will
probably want to define the proper robot linkages for the new auxiliary arm which is formed. This will
allow the auxiliary arm to function properly under the following conditions:
- Specifying that a single data point be moved through by 2 or more arms.
- Using Pallet
- Using Continuous Path motion
- Using relative position specifications
- Using Local coordinates
For SCARA robots (including RS series) with rotating joints used with a Cartesian coordinate system,
joint angle calculations are based on the parameters defined by the ArmSet parameters. Therefore,
this command is critical if any auxiliary arm or hand definition is required.
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
Notes
Arm 0
Arm 0 cannot be defined or changed by the user through the ArmSet instruction. It is reserved since it
is used to define the standard robot configuration. When the user sets Arm to 0 this means to use the
standard robot arm parameters.
Arm Number Not Defined
Selecting auxiliary arm numbers that have not been defined by the ArmSet command will result in an
error.
45
Arm Statement
See Also
ArmClr, ArmSet, ECPSet, TLSet
Arm Statement Example
The following examples are potential auxiliary arm definitions using the ArmSet and Arm instructions.
ArmSet defines the auxiliary arm and Arm defines which Arm to use as the current arm. (Arm 0 is the
default robot arm and cannot be adjusted by the user.)
From the command window:
> ArmSet 1, 300, -12, -30, 300, 0
> ArmSet
arm0 250 0 0 300 0
arm1 300 -12 -30 300 0
>
>
>
>
46
Arm 0
Jump P1
Arm 1
Jump P1
Arm Function
Arm Function
Returns the current arm number for the current robot.
>
Syntax
Arm
Return Values
Integer containing the current arm number.
See Also
Arm Statement
Arm Function Example
Print "The current arm number is: ", Arm
47
ArmClr Statement
ArmClr Statement
>
Syntax
ArmClr armNumber
Parameters
armNumber
Description
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
See Also
Arm, ArmSet, ECPSet, Local, LocalClr, Tool, TLSet
ArmClr Example
ArmClr 1
48
ArmDef Function
ArmDef Function
Returns arm definition status.
>
Syntax
ArmDef (armNumber)
Parameters
armNumber
Return Values
True if the specified arm has been defined, otherwise False.
See Also
Arm, ArmClr, ArmSet, ECPSet, Local, LocalClr, Tool, TLClr, TLSet
ArmDef Example
Function DisplayArmDef(armNum As Integer)
Integer i
If ArmDef(armNum) = False Then
Print "Arm ", ArmNum, "is not defined"
Else
Print "Arm ", armNum, " Definition:"
For i = 1 to 5
Print ArmSet(armNum, i)
Next i
EndIf
Fend
49
ArmSet Statement
ArmSet Statement
Specifies and displays auxiliary arms.
>
Syntax
(1) ArmSet armNumber , link2Dist, joint2Offset, zOffset, [link1Dist], [orientAngOffset]
(2) ArmSet armNumber
(3) ArmSet
Parameters
armNumber
Integer expression: Valid range from 1-15. The user may define up to 15 different
auxiliary arms.
Description
Return Values
When the ArmSet instruction is initiated without parameters, the system displays all the auxiliary arm
numbers and parameters.
The specified arm numbers and parameters will be displayed when only the arm number is specified.
Description
Allows the user to specify auxiliary arm parameters to be used in addition to the standard arm
configuration. This is most useful when an auxiliary arm or hand is installed to the robot. When using
an auxiliary arm, the arm is selected by the Arm instruction.
The link1Dist and orientAngOffset parameters are optional. If they are omitted, the default values are
the standard arm values.
The auxiliary arm configuration capability is provided to allow users to configure the proper robot
parameters for their robots when the actual robot configuration is a little different than the standard
robot. For example, if the user mounted a 2nd orientation joint to the 2nd robot link, the user will
probably want to define the proper robot linkages for the new auxiliary arm which is formed. This will
allow the auxiliary arm to function properly under the following conditions:
- Specifying that a single data point be moved through by 2 or more arms.
- Using Pallet
- Using Continuous Path motion
- Using relative position specifications
- Using Local coordinates
For SCARA robots (including RS series) with rotating joints used with a Cartesian coordinate system,
joint angle calculations are based on the parameters defined by the ArmSet parameters. Therefore,
this command is critical if any auxiliary arm or hand definition is required.
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
50
ArmSet Statement
Notes
Arm 0
Arm 0 cannot be defined or changed by the user. It is reserved since it is used to define the standard
robot configuration. When the user sets Arm to 0 this means to use the standard robot arm
parameters.
RS Series:
View from this
direction
Auxiliary Arm
Auxiliary
Arm
Y Axis
Joint #1
Joint #2
Auxiliary Arm
Joint #1
Joint #2
X Axis
Cartesian Robot
SCARA Robot
See Also
Arm, ArmClr
ArmSet Statement Example
The following examples are potential auxiliary arm definitions using the ArmSet and Arm instructions.
ArmSet defines the auxiliary arm and Arm defines which Arm to use as the current arm. (Arm 0 is the
default robot arm and cannot be adjusted by the user.)
From the command window:
> ArmSet 1, 300, -12, -30, 300, 0
> ArmSet
Arm 0: 125.000, 0.000, 0.000, 225.000, 0.000
Arm 1: 300.000, -12.000, -30.000, 300.000, 0.000
>
>
>
>
Arm 0
Jump P1
Arm 1
Jump P1
51
ArmSet Function
ArmSet Function
>
Syntax
ArmSet(armNumber, paramNumber)
Parameters
armNumber
paramNumber
Return Values
Real number containing the value of the specified parameter, as described above.
RS Series:
View from this
direction
Auxiliary Arm
Auxiliary
Arm
Y Axis
Joint #1
Joint #2
Auxiliary Arm
Joint #1
Joint #2
X Axis
SCARA Robot
Cartesian Robot
See Also
ArmClr, ArmSet Statement
ArmSet Function Example
Real x
x = ArmSet(1, 1)
52
Asc Function
Asc Function
Returns the ASCII value of the first character in a character string.
Syntax
Asc(string)
Parameters
string
Return Values
Returns an integer representing the ASCII value of the 1st character in the string sent to the ASC
function.
Description
The Asc function is used to convert a character to its ASCII numeric representation. The character
string send to the ASC function may be a constant or a variable.
Notes
Only the First Character ASCII Value is Returned
Although the Asc instruction allows character strings larger than 1 character in length, only the 1st
character is actually used by the Asc instruction. Asc returns the ASCII value of the 1st character only.
See Also
Chr$, InStr, Left$, Len, Mid$, Right$, Space$, Str$, Val
Asc Function Example
This example uses the Asc instruction in a program and from the command window as follows:
Function asctest
Integer a, b, c
a = Asc("a")
b = Asc("b")
c = Asc("c")
Print "The ASCII value of a is ", a
Print "The ASCII value of b is ", b
Print "The ASCII value of c is ", c
Fend
From the command window:
>print asc("a")
97
>print asc("b")
98
>
53
Asin Function
Asin Function
Returns the arcsine of a numeric expression.
Syntax
Asin(number)
Parameters
number
Return Values
Real value, in radians, representing the arc sine of the parameter number.
Description
Asin returns the arcsine of the numeric expression. Values range is from -1 to 1. The value returned
by Asin will range from -PI / 2 to PI / 2 radians. If number is < -1 or > 1, an error occurs.
To convert from radians to degrees, use the RadToDeg function.
See Also
Abs, Acos, Atan, Atan2, Cos, DegToRad, RadToDeg, Sgn, Sin, Tan, Val
Asin Function Example
Function asintest
Double x
x = Sin(DegToRad(45))
Print "Asin of ", x, " is ", Asin(x)
Fend
54
Atan Function
Atan Function
Returns the arctangent of a numeric expression.
Syntax
Atan(number)
Parameters
number
Return Values
Real value, in radians, representing the arctangent of the parameter number.
Description
Atan returns the arctangent of the numeric expression. The numeric expression (number) may be any
numeric value. The value returned by Atan will range from -PI to PI radans.
To convert from radians to degrees, use the RadToDeg function.
See Also
Abs, Acos, Asin, Atan2, Cos, DegToRad, RadToDeg, Sgn, Sin, Tan, Val
Atan Function Example
Function atantest
Real x, y
x = 0
y = 1
Print "Atan of ", x, " is ", Atan(x)
Print "Atan of ", y, " is ", Atan(y)
Fend
55
Atan2 Function
Atan2 Function
Returns the angle of the imaginary line connecting points (0,0) and (X, Y) in radians.
Syntax
Atan2(X, Y)
Parameters
X
Y
Return Values
Numeric value in radians (-PI to +PI).
Description
Atan2(X, Y) returns the angle of the line which connects points (0, 0) and (X, Y). This trigonometric
function returns an arctangent angle in all four quadrants.
See Also
Abs, Acos, Asin, Atan, Cos, DegToRad, RadToDeg, Sgn, Sin, Tan, Val
Atan2 Function Example
Function at2test
Real x, y
Print "Please enter a number for the X Coordinate:"
Input x
Print "Please enter a number for the Y Coordinate:"
Input y
Print "Atan2 of ", x, ", ", y, " is ", Atan2(x, y)
Fend
56
ATCLR Statement
ATCLR Statement
Clears and intializes the average torque for one or more joints.
>
Syntax
ATCLR [j1], [j2], [j3], [j4], [j5], [j6]
Parameters
j1 - j6
Description
ATCLR clears the average torque values for the specified joints.
You must execute ATCLR before executing ATRQ.
See Also
ATRQ, PTRQ
ATCLR Statement Example
> atclr
> go p1
> atrq 1
0.028
> atrq
0.028
0.029
0.000
>
0.008
0.009
0.000
57
AtHome Function
AtHome Function
Returns if the current robot is in its Home position or not.
Syntax
AtHome
Return Values
True if the current robot is in its Home position, otherwise False.
Description
The AtHome function returns if the current robot is in its Home position or not. To register the Home
position, use HomeSet command or Robot Manager. To move to the Home position, use the Home
command.
See Also
Home, HomeClr, HomeDef, HomeSet, Hordr
58
ATRQ Statement
ATRQ Statement
Displays the average torque for the specified joint.
>
Syntax
ATRQ [jointNumber]
Parameters
jointNumber
Return Values
Displays current average torque values for all joints.
Description
ATRQ displays the average RMS (root-mean-square) torque of the specified joint. The loading state
of the motor can be obtained by this instruction. The result is a real value from 0 to 1 with 1 being
maximum average torque.
You must execute ATCLR before this command is executed.
This instruction is time restricted. You must execute ATRQ within 60 seconds after ATCLR is
executed. When this time is exceeded, error 4030 occurs.
See Also
ATCLR, ATRQ Function, PTRQ
ATRQ Statement Example
> atclr
> go p1
> atrq 1
0.028
> atrq
0.028
0.029
0.000
>
0.008
0.009
0.000
59
ATRQ Function
ATRQ Function
Returns the average torque for the specified joint.
Syntax
ATRQ (jointNumber)
Parameters
jointNumber Integer expression representing the joint number.
Return Values
Real value from 0 to 1.
Description
The ATRQ function returns the average RMS (root-mean-square) torque of the specified joint. The
loading state of the motor can be obtained by this instruction. The result is a real value from 0 to 1
with 1 being maximum average torque.
You must execute ATCLR before this function is executed.
This instruction is time restricted. You must execute ATRQ within 60 seconds after ATCLR is
executed. When this time is exceeded, error 4030 occurs.
See Also
ATRQ Statement, PTCLR, PTRQ Statement
ATRQ Function Example
This example uses the ATRQ function in a program:
Function CheckAvgTorque
Integer i
Go P1
ATCLR
Go P2
Print "Average torques:"
For i = 1 To 4
Print "Joint ", i, " = ", ATRQ(i)
Next i
Fend
60
Base Statement
Base Statement
Defines and displays the base coordinate system.
>
Syntax
(1) Base pCoordinateData
(2) Base pOrigin, pXaxis, pYaxis, [ { X | Y } ]
Parameters
pCoordinateData
Point data representing the coordinate data of the origin and direction.
pOrigin
Integer expression representing the origin point using robot coordinate system.
pXaxis
Integer expression representing a point along the X axis using robot coordinate
system if X alignment is specified.
pYaxis
Integer expression representing a point along the Y axis using robot coordinate
system if Y alignment is specified.
X|Y
Description
Defines the robot base coordinate system by specifying base coordinate system origin and rotation
angle in relation to the robot absolute coordinate system.
To reset the Base coordinate system to default, execute the following statement. This will make the
base coordinate system the same as the robot absolute coordinate system.
Base XY(0, 0, 0, 0)
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
Notes
Changing the base coordinate system affects all local definitions
When base coordinates are changed, all local coordinate systems must be re-defined.
See Also
Local
Base Statement Example
Define base coordinate system origin at 100 mm on X axis and 100 mm on Y axis
> Base XY(100, 100, 0, 0)
61
BClr Function
BClr Function
Clear one bit in a number and return the new value
Syntax
BClr (number, bitNum)
Parameters
number
bitNum
Specifies the numeric value to clear the bit by an expression or numeric value.
Specifies the bit (integer from 0 to 31) to be cleared by an expression or numeric value.
Return Values
Returns the new value of the specified numeric value (integer).
See Also
BSet, BTst
BClr Example
flags = BClr(flags, 1)
62
BGo Statement
BGo Statement
Executes Point to Point relative motion, in the selected local coordinate system.
>
Syntax
BGo destination [CP] [searchExpr] [!...!]
Parameters
destination
CP
searchExpr
!...!
Description
Executes point to point relative motion, in the selected local coordinate system that is specified in the
destination point expression.
If a local coordinate system is not specified, relative motion will occur in local 0 (base coordinate
system).
Arm orientation attributes specified in the destination point expression are ignored. The manipulator
keeps the current arm orientation attributes. However, for a 6-Axis manipulator, the arm orientation
attributes are automatically changed in such a way that joint travel distance is as small as possible.
The Till modifier is used to complete BGo by decelerating and stopping the robot at an intermediate
travel position if the current Till condition is satisfied.
The Find modifier is used to store a point in FindPos when the Find condition becomes true during
motion.
When Till is used and the Till condition is satisfied, the manipulator halts immediately and the motion
command is finished. If the Till condition is not satisfied, the manipulator moves to the destination
point.
When Find is used and the Find condition is satisfied, the current position is stored. Please refer to
Find for details.
When parallel processing is used, other processing can be executed in parallel with the motion
command.
The CP parameter causes acceleration of the next motion command to start when the deceleration
starts for the current motion command. In this case the robot will not stop at the destination
coordinate and will continue to move to the next point.
See Also
Accel, BMove, Find, !....! Parallel Processing, Point Assignment, Speed, Till, TGo, TMove, Tool
63
BGo Statement
BGo Example
> BGo XY(100, 0, 0, 0) 'Move 100mm in X direction
'(in the local coordinate system)
Function BGoTest
Speed 50
Accel 50, 50
Power High
P1 = XY(300, 300, -20, 0)
P2 = XY(300, 300, -20, 0) /L
Local 1, XY(0, 0, 0, 45)
GoP1
Print Here
BGo XY(0, 50, 0, 0)
Print Here
Go P2
Print Here
BGo XY(0, 50, 0, 0)
Print Here
BGo XY(0, 50, 0, 0) /1
Print Here
Fend
[Output]
X: 300.000
X: 300.000
X: 300.000
X: 300.000
X: 264.645
64
Y:
Y:
Y:
Y:
Y:
300.000
350.000
300.000
350.000
385.355
Z:
Z:
Z:
Z:
Z:
-20.000
-20.000
-20.000
-20.000
-20.000
U:
U:
U:
U:
U:
0.000
0.000
0.000
0.000
0.000
V:
V:
V:
V:
V:
0.000
0.000
0.000
0.000
0.000
W:
W:
W:
W:
W:
0.000
0.000
0.000
0.000
0.000
/R
/R
/L
/L
/L
/0
/0
/0
/0
/0
BMove Statement
BMove Statement
Executes linear interpolation relative motion, in the selected local coordinate system
>
Syntax
BMove destination [ROT] [CP] [ searchExpr ] [ !...! ]
Parameters
destination
ROT
Optional.
rotation.
CP
searchExpr
!...!
Description
Executes linear interpolated relative motion, in the selected local coordinate system that is specified in
the destination point expression.
If a local coordinate system is not specified, relative motion will occur in local 0 (base coordinate
system).
Arm orientation attributes specified in the destination point expression are ignored. The manipulator
keeps the current arm orientation attributes. However, for a 6-Axis manipulator, the arm orientation
attributes are automatically changed in such a way that joint travel distance is as small as possible.
BMove uses the SpeedS speed value and AccelS acceleration and deceleration values. Refer to
Using BMove with CP below on the relation between the speed/acceleration and the
acceleration/deceleration. If, however, the ROT modifier parameter is used, BMove uses the SpeedR
speed value and AccelR acceleration and deceleration values. In this case SpeedS speed value and
AccelS acceleration and deceleration value have no effect.
Usually, when the move distance is 0 and only the tool orientation is changed, an error will occur.
However, by using the ROT parameter and giving priority to the acceleration and the deceleration of
the tool rotation, it is possible to move without an error. When there is not an orientational change with
the ROT modifier parameter and movement distance is not 0, an error will occur.
Also, when the tool rotation is large as compared to move distance, and when the rotation speed
exceeds the specified speed of the manipulator, an error will occur. In this case, please reduce the
speed or append the ROT modifier parameter to give priority to the rotational
speed/acceleration/deceleration.
The Till modifier is used to complete BMove by decelerating and stopping the robot at an intermediate
travel position if the current Till condition is satisfied.
The Find modifier is used to store a point in FindPos when the Find condition becomes true during
motion.
When Till is used and the Till condition is satisfied, the manipulator halts immediately and the motion
command is finished. If the Till condition is not satisfied, the manipulator moves to the destination
point.
When Find is used and the Find condition is satisfied, the current position is stored. Please refer to
Find for details.
65
BMove Statement
When parallel processing is used, other processing can be executed in parallel with the motion
command.
Notes
Using BMove with CP
The CP parameter causes the arm to move to destination without decelerating or stopping at the point
defined by destination. This is done to allow the user to string a series of motion instructions together
to cause the arm to move along a continuous path while maintaining a specified speed throughout all
the motion. The BMove instruction without CP always causes the arm to decelerate to a stop prior to
reaching the point destination.
See Also
AccelS, BGo, Find, !....! Parallel Processing, Point Assignment, SpeedS, TGo, Till, TMove, Tool
BMove Example
> BMove XY(100, 0, 0, 0)
Function BMoveTest
Speed 50
Accel 50, 50
SpeedS 100
AccelS 1000, 1000
Power High
P1 = XY(300, 300, -20, 0)
P2 = XY(300, 300, -20, 0) /L
Local 1, XY(0, 0, 0, 45)
Go P1
Print Here
BMove XY(0, 50, 0, 0)
Print Here
Go P2
Print Here
BMove XY(0, 50, 0, 0)
Print Here
BMove XY(0, 50, 0, 0) /1
Print Here
Fend
[Output]
X: 300.000
X: 300.000
X: 300.000
X: 300.000
X: 264.645
66
Y:
Y:
Y:
Y:
Y:
300.000
350.000
300.000
350.000
385.355
Z:
Z:
Z:
Z:
Z:
-20.000
-20.000
-20.000
-20.000
-20.000
U:
U:
U:
U:
U:
0.000
0.000
0.000
0.000
0.000
V:
V:
V:
V:
V:
0.000
0.000
0.000
0.000
0.000
W:
W:
W:
W:
W:
0.000
0.000
0.000
0.000
0.000
/R
/R
/L
/L
/L
/0
/0
/0
/0
/0
Boolean Statement
Boolean Statement
Declares variables of type Boolean. (1 byte whole number).
Syntax
Boolean varName [(subscripts)], [ varName [(subscripts)]...]
Parameters
varName
subscripts
Description
Boolean is used to declare variables as type Boolean. Variables of type Boolean can contain one of
two values, False and True. Local variables should be declared at the top of a function. Global and
module variables must be declared outside of functions.
See Also
Byte, Double, Global, Integer, Long, Real, String
Boolean Statement Example
Boolean
Boolean
Boolean
Boolean
partOK
A(10)
'Single dimension array of boolean
B(10, 10)
'Two dimension array of boolean
C(5, 5, 5) 'Three dimension array of boolean
partOK = CheckPart()
If Not partOK Then
Print "Part check failed"
EndIf
67
Box Statement
Box Statement
>
Syntax
(1) Box AreaNum, minX, maxX, mixY, maxY, minZ, maxZ [,Remote output logic]
(2) Box AreaNum
(3) Box
Parameters
AreaNum
minX
The minimum X coordinate position which can be set to the approach check area.
maxX
The maximum X coordinate position which can be set to the approach check area.
minY
The minimum Y coordinate position which can be set to the approach check area.
maxY
The maximum Y coordinate position which can be set to the approach check area.
minZ
The minimum Z coordinate position which can be set to the approach check area.
maxZ
The maximum Z coordinate position which can be set to the approach check area.
On | Off
Set the Remote output logic. To set I/O output to On when the Box approaches,
use On. To set I/O output to Off when the Box approaches, use Off. When the
parameter is omitted, On will be used.
Return Values
When only AreaNum is specified, the area setting of the specified area is displayed. When all the
parameters are omitted, the area settings for all area numbers are displayed.
Description
Box is used to set the approach check area. The approach check area is for checking approaches of
the robot end effector in the approach check area. The position of the end effector is calculated by the
current tool. The approach check area is set on the base coordinate system of the robot and is
between the specified maximum and minimum X, Y, and Z.
When the approach check area is used, the system detects approaches in any motor power status
during the controller is ON.
You can also use InsideBox function to get the result of the approach check. InsideBox can be used
for wait condition of Wait command. You can provide the check result to the I/O by setting the remote
output setting.
100
Box1
Robot
100
200
68
Box Statement
shorten the Compact Flash life.
recommended.
Notes
Turning Off Approach Check Area by coordinate axis
You can turn off the approach check area of each coordinate axis. To turn off only the Z axis, definthe
minZ and maxZ to be 0. For example Box 1, 200, 300, 0, 500, 0, 0.
Default values of Approach Check Area
The default values for the Box statement are "0, 0, 0, 0, 0, 0". (Approach Check Area Checking is
turned off.)
Tool Selection
The approach check is executed for the current tool. When you change the tool, the approach check
may display the tool approach from inside to outside of the area or the other way although the robot is
not operating.
Tip
Set Box statement from Robot Manager
EPSON RC+ 5.0 has a point and click dialog box for defining the approach check area. The simplest
method to set the Box values is by using the Box page on the Robot Manager .
See Also
BoxClr, BoxDef, InsideBox, Plane
Box Statement Example
These are examples to set the approach check area using Box statement.
> Box 1, -200, 300, 0, 500, -100, 0
> Box
Box 1: -200.000, 300.000, 0.000, 500.000, -100.000, 0.000
69
Box Function
Box Function
Returns the specified approach check area.
Syntax
Box(AreaNum, limit)
Parameters
AreaNum
limit
Return Values
When you select 1 for limit, the point contains the lower limit of the X, Y, Z coordinates.
When you select 2 for limit, the point contains the upper limit of the X, Y, Z coordinates.
See Also
Box, BoxClr, BoxDef, InsideBox
Box Function Example
P1 = Box(1,1)
P2 = Box(1,2)
70
BoxClr Statement
BoxClr Statement
Clears the definition of approach check area.
>
Syntax
BoxClr AreaNum
Parameters
AreaNum
Description
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
See Also
Box, BoxDef, InsideBox
BoxClr Function Example
This example uses BoxClr function in a program.
Function ClearBox
If BoxDef(1) = True Then
BoxClr 1
EndIf
Fend
71
BoxDef Function
BoxDef Function
Returns whether Box has been defined or not.
Syntax
BoxDef(AreaNum)
Parameters
AreaNum
Return Values
True if approach check area is defined for the specified area number, otherwise False.
See Also
Box, BoxClr, InsideBox
BoxDef Function Example
This example uses BoxDef function in a program.
Function ClearBox
If BoxDef(1) = True Then
BoxClr 1
EndIf
Fend
72
Brake Statement
Brake Statement
Turns brake on or off for specified joint of the current robot.
>
Syntax
Brake status, jointNumber
Parameters
status
The keyword On is used to turn the brake on. The keyword Off is used to turn the brake
off.
WARNING
Use extreme caution when turning off a brake. Ensure that the joint is
properly supported, otherwise the joint can fall and cause damage to the
robot and personel.
Before releasing the brake, be ready to use the emergency stop switch so that you can immediately
press it. When the controller is in emergency stop status, the motor brakes are locked. Be aware that
the robot arm may fall by its own weight when the brake is turned off with Brake command.
See Also
Motor, Power, Reset, SFree, SLock
Brake Example
> brake on, 1
> brake off, 1
73
Brake Function
Brake Function
Returns brake status for specified joint.
>
Syntax
Brake (jointNumber)
Parameters
jointNumber Integer expression representing the joint number. Value are from 1 to the number of
joints on the robot.
Return Values
0 = Brake off, 1 = Brake on.
See Also
Brake Statement
Brake Example
If Brake(1) = Off Then
Print Joint 1 brake is off
EndIf
74
BSet Function
BSet Function
Sets a bit in a number and returns the new value.
Syntax
BSet (number, bitNum)
Parameters
number
bitNum
Specifies the value to set the bit with an expression or numeric value.
Specifies the bit (integer from 0 to 31) to be set by an expression or numeric value.
Return Values
Returns the bit set value of the specified numeric value (integer).
See Also
BClr, BTst
BSet Example
flags = BSet(flags, 1)
75
BTst Function
BTst Function
Returns the status of 1 bit in a number.
Syntax
BTst (number, bitNum)
Parameters
number
bitNum
Specifies the number for the bit test with an expression or numeric value.
Specifies the bit (integer from 0 to 31) to be tested.
Return Values
Returns the bit test results (integer 1 or 0) of the specified numeric value.
See Also
BClr, Bset
BTst Example
If BTst(flags, 1) Then
Print "Bit 1 is set"
EndIf
76
Byte Statement
Byte Statement
Declares variables of type Byte. (1 byte whole number).
Syntax
Byte varName [(subscripts)] [, varName [(subscripts)]...]
Parameters
varName
subscripts
Description
Byte is used to declare variables as type Byte. Variables of type Byte can contain whole numbers
ranging in value from -128 to +127. Local variables should be declared at the top of a function.
Global and module variables must be declared outside of functions.
See Also
Boolean, Double, Global, Integer, Long, Real, String
Byte Example
The following example declares a variable of type Byte and then assigns a value to it. A bitwise And is
then done to see if the high bit of the value in the variable test_ok is On (1) or Off (0). The result is
printed to the display screen. (Of course in this example the high bit of the variable test_ok will always
be set since we assigned the variable the value of 15.)
Function Test
Byte A(10)
'Single dimension array of byte
Byte B(10, 10)
'Two dimension array of byte
Byte C(5, 5, 5) 'Three dimension array of byte
Byte test_ok
test_ok = 15
Print "Initial Value of test_ok = ", test_ok
test_ok = (test_ok And 8)
If test_ok <> 8 Then
Print "test_ok high bit is ON"
Else
Print "test_ok high bit is OFF"
EndIf
Fend
77
Call Statement
Call Statement
S
Description
The Call instruction causes the transfer of program control to a function (defined in Function...Fend).
This means that the Call instruction causes program execution to leave the current function and
transfer to the function specified by Call. Program execution then continues in that function until an
Exit Function or Fend instruction is reached. Control is then passed back to the original calling
function at the next statement after the Call instruction.
You may omit the Call keyword and argument parentheses. For example, here is a call statement
used with or without the Call keyword:
Call MyFunc(1, 2)
MyFunc 1, 2
To execute a subroutine within a function, use GoSub...Return.
See Also
Function, GoSub
Call Statement Example
<File1: MAIN.PRG>
Function main
Call InitRobot
Fend
<File2: INIT.PRG>
Function InitRobot
If Motor = Off Then
Motor On
EndIf
Power High
Speed 50
Accel 75, 75
Fend
78
ChkCom Function
ChkCom Function
Returns number of characters in the reception buffer of a communication port
Syntax
ChkCom (portNumber)
Parameters
portNumber Integer expression for port number to check.
Return Values
Number of characters received (integer).
If the port cannot receive characters, the following negative values are returned to report the current
port status:
-2
-3
See Also
CloseCom, OpenCom, Read, Write
ChkCom Example
Integer numChars
numChars = ChkCom(1)
79
ChkNet Function
ChkNet Function
Returns number of characters in the reception buffer of a network port
Syntax
ChkNet (portNumber)
Parameters
portNumber Integer expression for port number to check.
Return Values
Number of characters received (integer).
If the port cannot receive characters, the following negative values are returned to report the current
port status:
-1
-2
-3
See Also
CloseNet, OpenNet, Read, Write
ChkNet Example
Integer numChars
numChars = ChkNet(201)
80
Chr$ Function
Chr$ Function
Returns the character specified by a numeric ASCII value.
Syntax
Chr$(number)
Parameters
number
Return Values
Returns a character that corresponds with the specified ASCII code specified by the value of number.
Description
Chr$ returns a character string (1 character) having the ASCII value of the parameter number. When
the number specified is outside of the range 1-255 an error will occur.
See Also
Asc, Instr, Left$, Len, Mid$, Right$, Space$, Str$, Val
Chr$ Function Example
The following example declares a variable of type String and then assigns the string "ABC" to it. The
Chr$ instruction is used to convert the numeric ASCII values into the characters "A", "B" and "C". The
&H means the number following is represented in hexadecimal form. (&H41 means Hex 41)
Function Test
String temp$
temp$ = Chr$(&H41) + Chr$(&H42) + Chr$(&H43)
Print "The value of temp = ", temp$
Fend
81
ClearPoints Statement
ClearPoints Statement
Erases the robot position data memory.
Syntax
ClearPoints
Description
ClearPoints initializes the robot position data area. Use this instruction to erase point definitions
which reside in memory before teaching new points.
See Also
Plist, LoadPoints, SavePoints
ClearPoints Statement Example
The example below shows simple examples of using the ClearPoints command (from the command
window). Notice that no teach points are shown when initiating the Plist command once the
ClearPoints command is given.
>P1=100,200,-20,0/R
>P2=0,300,0,20/L
>plist
P1=100,200,-20,0/R
P2=0,300,0,20/L
>clearpoints
>plist
>
82
CloseCom Statement
CloseCom Statement
Close the RS-232C port previously opened with OpenCom.
Syntax
CloseCom #portNum | All
Parameters
portNum
See Also
ChkCom, OpenCom
CloseCom Statement Example
CloseCom #1
83
CloseNet Statement
CloseNet Statement
Close the TCP/IP port previously opened with OpenNet.
Syntax
CloseNet #portNumber
Parameters
portNumber
See Also
ChkNet, OpenNet
CloseNet Statement Example
CloseNet #201
84
Cls Statement
Cls Statement
Clears the EPSON RC+ 5.0 Run, Operator, or Command window text area.
Syntax
(1) Cls #deviceID
(2) Cls
Parameters
deviceID
21 RC+
23 OP
24 TP
When deviceID is omitted, the display device is cleared.
Description
Cls clears either the current EPSON RC+ Run or Operator window text area, depending on where the
program was started from.
If Cls is executed from a program that was started from the Command window, the command window
text area is cleared.
When deviceID is omitted, the display of the current display device is cleared.
Cls Example
If this example is run from the Run window or Operator window, the text area of the window will be
cleared when Cls executes.
Function main
Integer i
Do
For i = 1 To 10
Print i
Next i
Wait 3
Cls
Loop
Fend
85
Cont Statement
Cont Statement
Resumes the contoller after a Pause statement has been executed and continues the
execution of all tasks.
This command is for the experienced user and you need to understand the command specification
before the use.
Syntax
Cont
Description
This command can be executed only when it is called from the event handler function. It cannot be
executed from the normal command or command line.
The Cont command resumes the controller tasks paused by the Pause statement or safeguard open
and continues all tasks execution. It has the same function as the <Continue> button on the Run
Window, Operator Window, and the Continue Remote input.
When executing Cont command from a program, you must understand the
CAUTION
command specification and confirm that the system has the proper conditions for
the Cont command. Improper use such as continuous execution of a command
within a loop may deteriorate the system safety.
See Also
Pause
Cont Example
Function frmmain_btnCont_Click(Sender$ As String)
Cont
Fend
86
Cos Function
Cos Function
Returns the cosine of a numeric expression.
Syntax
Cos(number)
Parameters
number
Return Values
Numeric value in radians representing the cosine of the numeric expression number.
Description
Cos returns the cosine of the numeric expression. The numeric expression (number) must be in
radian units. The value returned by the Cos function will range from -1 to 1
To convert from degrees to radians, use the DegToRad function.
See Also
Abs, Atan, Atan2, Int, Mod, Not, Sgn, Sin, Sqr, Str$, Tan, Val
Cos Function Example
The following example shows a simple program which uses Cos.
Function costest
Real x
Print "Please enter a value in radians"
Input x
Print "COS of ", x, " is ", Cos(x)
Fend
The following examples use Cos from the Command window.
Display the cosine of 0.55:
>print cos(0.55)
0.852524522059506
>
Display cosine of 30 degrees:
>print cos(DegToRad(30))
0.866025403784439
>
87
CP Statement
CP Statement
Sets CP (Continuous Path) motion mode.
Syntax
CP { On | Off }
Parameters
On | Off
The keyword On is used to enable path motion. The keyword Off is used to disable CP
mode.
Description
CP (Continuous Path) motion mode can be used for the Arc, Arc3, Go, Jump, Jump3, Jump3CP, and
Move robot motion instructions.
When CP mode is On, each motion command executes the next statement as deceleration starts.
Continuous path motion will continue regardless of whether the CP parameter is specified in each
motion command or not.
When CP is Off, this function is active only when the CP parameter is specified in each motion
command.
speed
Normal Motion
speed
Path Motion
time
Start deceleration
Start acceleration
time
When CP is On, path motion will continue without full deceleration between two CP motions (Arc, Arc3,
Jump3, Jump3CP, Move), or two PTP motions (Go, Jump).
In contrast, full deceleration will occur between a CP motion and a PTP motion.
CP will be set to Off in the following cases
Controller startup
Reset
All task stop
Switching the Auto / Programming operation mode
Motor On
SFree, SLock
See Also
CP Function, Arc, Move, Go
CP Statement Example
CP On
Move P1
Move P2
CP Off
88
CP Function
CP Function
Returns status of path motion.
Syntax
CP
Return Values
0 = Path motion off, 1 = Path motion on.
See Also
CP Statement
CP Function Example
If CP = Off Then
Print "CP is off"
EndIf
89
Ctr Function
Ctr Function
Returns the counter value of the specified Hardware Input counter.
Syntax
Ctr(bitNumber)
Parameters
bitNumber
Number of the Hardware Input bit set as a counter. Only 16 counters can be
active at the same time.
Return Values
The current count of the specified Hardware Input Counter. (Integer expression from 0-65535)
Description
Ctr works with the CTReset statement to allow Hardware inputs to be used as counters.
Each time a hardware input specified as a counter is switched from the Off to On state that input
causes the counter to increment by 1.
The Ctr function can be used at any time to get the current counter value for any counter input. Any of
the Hardware Inputs can be used as counters. However, only 16 counters can be active at the same
time.
Counter Pulse Input Timing Chart
High (ON)
4 msec or longer
Low (OFF)
4 msec or longer
See Also
CTReset
Ctr Function Example
The following example shows a sample of code which could be used to get a hardware input counter
value.
CTReset 3 'Reset counter for input 3 to 0
On 0
'Turn an output switch on
Do While Ctr(3) < 5
Loop
Off 0
'When 5 input cycles are counted for Input 3 turn
'switch off (output 0 off)
90
CTReset Statement
CTReset Statement
Resets the counter value of the specified input counter and enables the input to be
a counter input.
>
Syntax
CTReset(bitNumber)
Parameters
bitNumber
Number of the input bit set as a counter. This must be an integer expression
representing a valid input bit. Only 16 counters can be active at the same time.
Description
CTReset works with the CTR function to allow inputs to be used as counters. CTReset sets the
specified input bit as a counter and then starts the counter. If the specified input is already used as a
counter, it is reset and started again.
Notes
Turning Off Power and Its Effect on Counters
Turning off main power releases all counters.
Using the Ctr Function
Use the Ctr Function to retrieve current Hardware Input counter values.
See Also
Ctr
CTReset Example
The following example shows a sample of code which could be used to get a hardware input counter
value.
CTReset 3 'Reset Counter 3 to 0
On 0
'Turn an output switch on
Do While Ctr(3) < 5
Loop
Off 0
'When 5 input cycles are counted for Input 3 turn
'switch off (output 0 off)
91
CtrlDev Function
CtrlDev Function
Returns the current control device number.
Syntax
CtrlDev
Return Values
21
22
23
26
29
PC
Remote I/O
OP
Remote Ethernet
Remote RS232
See Also
CtrlInfo Function
CtrlDev Function Example
Print "The current control device is: ", CtrlDev
92
CtrlInfo Function
CtrlInfo Function
F
Description
The following table shows the information that is available from the CtrlInfo function:
Index
0
Bit
N/A
Value
0
1
2
3-7
8
9
10
11
12
13-31
0
1-31
0
1
2
3-31
&H1
&H2
&H4
N/A
N/A
N/A
N/A
N/A
N/A
&H100
&H200
&H400
&H800
&H1000
&H1
&H1
&H2
&H4
Description
Obtained for compatibility.
Use index 9 to get the firmware version of the controller.
Ready state
Start state
Pause state
Undefined
Estop state
Safeguard open
Error state
Critical error state
Warning
Undefined
Enable switch is on
Undefined
Teach mode circuit problem detected
Safeguard circuit problem detected
Estop circuit problem detected
Undefined
0 - Normal mode
1 - Dry run mode
Control device:
21 - RC+
22 - Remote
23 - OP
Undefined
Operation mode:
0 - Program mode
1 - Auto mode
1 - Motors off
0 - Hold (motor setting is on, but currently held off)
Firmware verision of the Controller
Major No.*1000000 + Minor No.*10000 + Rev No.*100 + Build No.
(Example) Version 1.6.2.4 is 1060204
Return Values
Long value of the desired data
See Also
CtrlInfo$, RobotInfo, TaskInfo
CtrlInfo Function Example
Print "The controller version: ", CtrlInfo(0)
93
CurPos Function
CurPos Function
Returns the current target position of the specified robot.
Syntax
CurPos
Return Values
A robot point representing the current target position of the specified robot.
See Also
InPos, FindPos, RealPos
CurPos Function Example
Function main
Xqt showPosition
Do
Jump P0
Jump P1
Loop
Fend
Function showPosition
Do
P99 = CurPos
Print CX(P99), CY(P99)
Loop
Fend
94
Curve Statement
Curve Statement
Defines the data and points required to move the arm along a curved path. Many data points
can be defined in the path to improve precision of the path.
Syntax
Curve fileName, closure, mode, numAxes, pointList
Parameters
fileName
closure
A string expression for the name of the file in which the point data is stored. The
specified fileName will have the extension .CVT appended to the end so no extension is
to be specified by the user. When the Curve instruction is executed, file will be created.
Specifies whether or not the defined Curve is Closed or left Open at the end of the
curved motion. This parameter must be set to one of two possible values, as shown
below.
C - Closed Curve
O - Open Curve
When specifying the open curve, the Curve instruction creates the data to stop the arm
at the last point of the specified point series. When specifying the closed curve, the
Curve instruction creates the data required to continue motion through the final specified
point and then stopping motion after returning the arm to the starting point of the
specified point series for the Curve instruction.
mode
Specifies whether or not the arm is automatically interpolated in the tangential direction of
the U-Axis. It can also specify the ECP number in the upper four bits.
Mode Setting
Hexadecimal
Decimal
&H00
0
&H10
16
&H20
32
&HA0
160
&HB0
176
&HC0
192
&HD0
208
&HE0
224
&HF0
240
&H02
2
&H12
18
&H22
34
&HA2
162
&HB2
178
&HC2
194
&HD2
210
&HE2
226
&HF2
242
Tangential
Correction
No
Yes
ECP
Number
0
1
2
10
11
12
13
14
15
0
1
2
10
11
12
13
14
15
95
Curve Statement
When specifying tangential correction, Curve uses only the U-Axis coordinate of the
starting point of the point series. Tangential correction continuously maintains tool
alignment tangent to the curve in the XY plane. It is specified when installing tools such
as cutters that require continuous tangential alignment. When specifying a closed curve
(using the closure parameter) with Automatic Interpolation in the tangential direction of
the U-Axis, the U-Axis rotates 360 degrees from the start point. Therefore, before
executing the CVMove instruction, set the U-Axis movement range using the Range
instruction so the 360 degree rotation of the U-Axis does not cause an error.
When using ECP, specify the ECP number in the upper four bits.
numAxes
Integer number 2, 3, 4, or 6 which specifies the number of axes controlled during the
curve motion as follows:
2 - Generate a curve in the XY plane with no Z Axis movement or U Axis rotation.
3 - Generate a curve in the XYZ space with no U axis rotation.
4 - Generate a curve in the XYZ space with U-Axis rotation.
6 - Generate a curve in the XYZ space with U, V, and W axes rotation (6-Axis
robots only).
The axes not selected to be controlled during the Curve motion maintain their previous
encoder pulse positions and do not move during Curve motion.
pointList
Description
Curve creates data that moves the manipulator arm along the curve defined by the point series
pointList and stores the data in a file on the controller. The CVMove instruction uses the data in the file
created by Curve to move the manipulator in a continuous path type fashion.
Curve calculates independent X, Y, Z, U, V, W coordinate values for each point using a cubic spline
function to create the trajectory. Therefore, if points are far apart from each other or the orientation of
the robot is changed suddenly from point to point, the desired trajectory may not to be realized.
It is not necessary to specify speeds or accelerations prior to executing the Curve instruction. Arm
speed and acceleration parameters can be changed anytime prior to executing CVMove by using the
SpeedS or AccelS instructions.
Points defined in a local coordinate system may be used in the series to locate the curve at the
desired position. By defining all of the specified points in the point series for the Curve instruction as
points with local attributes, the points may be changed as points on the local coordinate system by the
Local instruction following the Curve instruction.
96
Curve Statement
Note
Use tangential correction when possible
It is recommended that you use tangential correction whenever possible, especially when using
CVMove in a continuous loop throught the same points. If you do not use tangential correction, the
robot may not follow the correct path at higher speeds.
Open Curve Min and Max Number of Points Allowed
Open Curves may be specified by using from 3 to 200 points.
Closed Curve Min and Max Number of Points Allowed
Closed Curves may be specified by using from 3 to 50 points.
Potential Errors
Attempt to Move Arm Outside Work Envelope
The Curve instruction cannot check the movement range for the defined curve path. This means that
a user defined path may cause the robot arm to move outside the normal work envelope. In this case
an "out of range" error will occur.
See Also
AccelS Function, Arc, CVMove, ECP, Move, SpeedS
Curve Statement Example
The following example designates the free curve data file name as MYCURVE.CVT, creates a curve
tracing P1-P7, switches ON output port 2 at P2, and decelerates the arm at P7.
Set up curve
> curve "mycurve", O, 0, 4, P1, P2, On 2, P(3:7)
Move the arm to P1 in a straight line
> jump P1
Move the arm according to the curve definition called mycurve
> cvmove "mycurve"
97
CVMove Statement
CVMove Statement
Performs the continuous spline path motion defined by the Curve instruction.
Syntax
CVMove fileName [CP] [searchExpr]
Parameters
fileName
CP
String expression for the path and name of the file to use for the continuous path motion
data. This file must be previously created by the Curve instruction and stored on a PC
hard disk.
Optional. Specifies continuous path motion after the last point.
98
Syntax
CX(point) = value
CY(point) = value
CZ(point) = value
CU(point) = value
CV(point) = value
CW(point) = value
Parameters
point
value
See Also
CX, CY, CZ, CU, CV, CW Functions
CX, CY, CZ, CU, CV, CW StatementS Example
CX(pick) = 25.34
99
Syntax
CX(point)
CY(point)
CZ(point)
CU(point)
CV(point)
CW(point)
Parameters
point
Point expression.
Return Values
Returns the specified coordinate value. The return values for CX, CY, CZ are real numbers in
millimeters. The return values for CU, CV, CW are real numbers in degrees.
Description
Used to retrieve an individual coordinate value from a point.
To obtain the coordinate from the current robot position, use Here for the point parameter.
See Also
Point expression
CX, CY, CZ, CU, CV, CW Statements
CX, CY, CZ, CU, CV, CW Functions Example
The following example extracts the X axis coordinate value from point "pick" and puts the coordinate
value in the variable x.
Function cxtest
Real x
x = CX(pick)
Print "The X Axis Coordinate of point 'pick' is", x
Fend
100
Date Statement
Date Statement
Specifies and displays the current date in the controller.
>
Syntax
Date yyyy, mm, dd
Date
Parameters
yyyy
mm
dd
Return Values
When the Date command is entered without any parameters, the current date is displayed.
Description
Specifies the current Date for the controller. This date is used for the files inside the controller. All files
residing in the controller are date stamped. Date automatically calculates the day of the week for the
Date display.
See Also
Time, Date$
Date Example
The following examples are done from the command window.
> Date
2006/09/27
> Date 2006,10,1
> Date
2006/10/01
101
Date$ Function
Date$ Function
F
Description
Date$ is used to get the controller system date in a program statement. To set the system date, you
must use the Date statement.
See Also
Date, Time, Time$
Date$ Function Example
Print "Today's date: ", Date$
102
DegToRad Function
DegToRad Function
Converts degrees to radians.
>
Syntax
DegToRad(degrees)
Parameters
degrees
Return Values
A double value containing the number of radians.
See Also
ATan, ATan2, RadToDeg Function
DegToRad Function Example
s = Cos(DegToRad(x))
103
DispDev Statement
DispDev Statement
S
See Also
DispDev Function
DispDev Statement Example
DispDev 23
104
DispDev Function
DispDev Function
Returns the current display device.
Syntax
DispDev
Return Values
Integer value containing the deviceID.
21 RC+
23 OP
24 TP
See Also
DispDev Statement
DispDev Function Example
Print "The current display device is ", DispDev
105
Dist Function
Dist Function
Returns the distance between two robot points.
Syntax
Dist (point1, point2)
Parameters
point1, point2
Return Values
Returns the distance between both points (real value in mm).
See Also
CU, CV, CW, CX, CY, CZ
Dist Function Example
Real distance
distance = Dist(P1, P2)
106
Do...Loop Statement
Do...Loop Statement
Repeats a block of statements while a condition is True or until a condition becomes True.
Syntax
Do [ { While | Until } condition ]
[statements]
[Exit Do]
[statements]
Loop
Or, you can use this syntax:
Do
[statements]
[Exit Do]
[statements]
Loop [ { While | Until } condition ]
The Do Loop statement syntax has these parts:
Part
condition
statements
Description
Optional. Numeric expression or string expression that is True or False. If condition is
Null, condition is treated as False.
One or more statements that are repeated while, or until, condition is True.
Description
Any number of Exit Do statements may be placed anywhere in the Do...Loop as an alternate way to
exit a Do...Loop. Exit Do is often used after evaluating some condition, for example, If...Then, in
which case the Exit Do statement transfers control to the statement immediately following the Loop.
When used within nested Do...Loop statements, Exit Do transfers control to the loop that is one
nested level above the loop where Exit Do occurs. Nesting of DoLoop statements is supported
up to 256 levels deep including other statements (IfThenElseEndIf, SelectSend).
See Also
For...Next, Select...Send
Do Example
Do While Not Lof(1)
Line Input #1, tLine$
Print tLine$
Loop
107
Double Statement
Double Statement
Declares variables of type Double. (8 byte double precision number).
Syntax
Double varName [(subscripts)] [, varName [(subscripts)]...]
Parameters
varName
subscripts
Description
Double is used to declare variables as type Double. Local variables should be declared at the top of
a function. Global and module variables must be declared outside of functions.
Valid number of digits for Double is 14.
See Also
Boolean, Byte, Global, Integer, Long, Real, String
Double Example
The following example shows a simple program which declares some variables using Double.
Function doubletest
Double var1
Double A(10)
'Single dimension array of double
Double B(10, 10)
'Two dimension array of double
Double C(5, 5, 5) 'Three dimension array of double
Double arrayvar(10)
Integer i
Print "Please enter a Number:"
Input var1
Print "The variable var1 = ", var1
For i = 1 To 5
Print "Please enter a Number:"
Input arrayvar(i)
Print "Value Entered was ", arrayvar(i)
Next i
Fend
108
ECP Statement
ECP Statement
Selects or displays the current ECP (external control point).
>
Syntax
(1) ECP ECPNumber
(2) ECP
Parameters
ECPNumber
Return Values
Displays current ECP when used without parameters.
Description
ECP selects the external control point specified by the ECPnumber (ECPNumber).
Note
This command will only work if the External Control Point option is installed.
Power Off and Its Effect on the ECP Selection
Turning main power off clears the ECP selection.
See Also
ECPSet
ECP Statement Example
>ecpset 1, 100, 200, 0, 0
>ecp 1
109
ECP Function
ECP Function
Returns the current ECP (external control point) number.
Syntax
ECP
Return Values
Integer containing the current ECP number.
Note
This command will only work if the External Control Point option is installed.
See Also
ECP Statement
ECP Function Example
Integer savECP
savECP = ECP
ECP 2
Call Dispense
ECP savECP
110
ECPClr Statement
ECPClr Statement
Clears (undefines) an external control point.
>
Syntax
ECPClr ECPNumber
Parameters
ECPNumber
Description
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
Note
This command will only work if the External Control Point option is installed.
See Also
Arm, ArmClr, ArmSet, ECPSet, Local, LocalClr, Tool, TLSet
ECPClr Example
ECPClr 1
111
ECPDef Function
ECPDef Function
>
Syntax
ECPDef (ECPNumber)
Parameters
ECPNumber
Return Values
True if the specified ECP has been defined, otherwise False.
See Also
Arm, ArmClr, ArmSet, ECPSet, Local, LocalClr, Tool, TLClr, TLSet
ECPDef Example
Function DisplayECPDef(ecpNum As Integer)
If ECPDef(ecpNum) = False Then
Print "ECP ", ecpNum, "is not defined"
Else
Print "ECP ", ecpNum, ": ",
Print ECPSet(ecpNum)
EndIf
Fend
112
ECPSet Statement
ECPSet Statement
Defines or displays an external control point.
>
Syntax
(1) ECPSet ECPNum, ECPPoint
(2) ECPSet ECPNum
(3) ECPSet
Parameters
ECPNum
ECPPoint
Integer number from 1-15 representing which of 15 external control points to define.
Pnumber or P(expr) or point label or point expression.
Return Values
When parameters are omitted, displays the current ECPSet definitions.
When only the ECP number is specified, displays the specified ECPSet definitions.
Description
Defines an external control point.
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
Note
This command will only work if the External Control Point option is installed.
ECPSet Example
ECPSet 1, P1
ECPSet 2, 100, 200, 0, 0
113
ECPSet Function
ECPSet Function
Returns a point containing the external control point definition for the specified ECP.
Syntax
ECPSet(ECPNumber)
Parameters
ECPNumber
Return Values
A point containing the ECP definition.
Note
This command will only work if the External Control Point option is installed.
See Also
ECPSet Statement
ECPSet Function Example
P1 = ECPSet(1)
114
Elbow Statement
Elbow Statement
>
Syntax
(1) Elbow point, [value ]
(2) Elbow
Parameters
point
value
Return Values
When both parameters are omitted, the elbow orientation is displayed for the current robot position.
If value is ommited, the elbow orientation for the specified point is displayed.
See Also
Elbow Function, Hand, J4Flag, J6Flag, Wrist
Elbow Statement Example
Elbow P0, Below
Elbow pick, Above
Elbow P(myPoint), myElbow
P1 = 0.000,
490.000,
515.000,
90.000,
-40.000,
180.000
115
Elbow Function
Elbow Function
Returns the elbow orientation of a point.
Syntax
Elbow [(point)]
Parameters
point
Optional. Point expression. If point is omitted, then the elbow orientation of the current
robot position is returned.
Return Values
1
Above (/A)
2
Below (/B)
See Also
Elbow Statement, Hand, Wrist, J4Flag, J6Flag
Elbow Function Example
Print
Print
Print
Print
116
Elbow(pick)
Elbow(P1)
Elbow
Elbow(P1 + P2)
Era Function
Era Function
Returns the joint number for which an error occurred.
Syntax
Era[(taskNum)]
Parameters
taskNum
Return Values
The joint number that caused the error in the range 0-6 as described below:
0 - The current error was not caused by a servo axis.
1 - The error was caused by joint number 1
2 - The error was caused by joint number 2
3 - The error was caused by joint number 3
4 - The error was caused by joint number 4
5 - The error was caused by joint number 5
6 - The error was caused by joint number 6
Description
Era is used when an error occurs to determine if the error was caused by one of the robot joints and to
return the number of the joint which caused the error. If the current error was not caused by any joint,
Era returns zero.
See Also
Erl, Err, ErrMsg$, Ert, OnErr, Trap
Era Function Example
Function main
OnErr Goto eHandler
Do
Call PickPlace
Loop
Exit Function
eHandler:
Print "The Error code is ", Err
Print "The Error Message is ", ErrMsg$(Err)
errTask = Ert
If errTask > 0 Then
Print "Task number in which error occurred is ", errTask
Print "The line where the error occurred is Line ", Erl(errTask)
If Era(errTask) > 0 Then
Print "Joint which caused the error is ", Era(errTask)
EndIf
EndIf
Fend
117
EResume Statement
EResume Statement
Resumes execution after an error-handling routine is finished.
Syntax
EResume [{ label | Next }]
Description
EResume
If the error occurred in the same procedure as the error handler, execution resumes with the
statement that caused the error. If the error occurred in a called procedure, execution resumes at the
Call statement in the procedure containing the error handler.
EResume Next
If the error occurred in the same procedure as the error handler, execution resumes with the
statement immediately following the statement that caused the error. If the error occurred in a called
procedure, execution resumes with the statement immediately following the Call statement that last in
the procedure containing the error handler.
EResume { label }
If the error occurred in the same procedure as the error handler, execution resumes at the statement
containing the label.
See Also
OnErr
EResume Statement Example
Function main
Integer retry
OnErr GoTo eHandler
Do
RunCycle
Loop
Exit Function
eHandler:
Select Err
Case MyError
retry = retry + 1
If retry < 3 Then
EResume ' try again
Else
Print "MyError has occurred ", retry, " times
EndIf
Send
Fend
118
Erf$ Function
Erf$ Function
Returns the name of the function in which the error occurred.
Syntax
Erf$[(taskNumber)]
Parameters
taskNumber
Return Values
The name of thefunction where the last error occurred.
Description
Erf$ is used with OnErr. Erf$ returns the function name in which the error occurred. Using
Erf$ combined with Err, Ert, Erl and Era the user can determine much more about the error which
occurred.
See Also
Era, Erl, Err, ErrMsg$, Ert, OnErr
Erf$ Function Example
The following example shows a simple program using the Ert function to determine which task the
error occurred in along with; Erf$: the name of the function the error occurred in; Erl: the line number
where the error occurred; Era: if a joint caused the error....
Function main
OnErr Goto eHandler
Do
Call PickPlace
Loop
Exit Function
eHandler:
Print "The Error code is ", Err
Print "The Error Message is ", ErrMsg$(Err)
errTask = Ert
If errTask > 0 Then
Print "Task number in which error occurred is ", errTask
Print "Function at which error occurred is ", Erf$(errTask)
Print "The line where the error occurred is Line ", Erl(errTask)
If Era(errTask) > 0 Then
Print "Joint which caused the error is ", Era(errTask)
EndIf
EndIf
Fend
119
Erl Function
Erl Function
Returns the line number in which the error occurred.
Syntax
Erl[(taskNumber)]
Parameters
taskNumber
Return Values
The line number where the last error occurred.
Description
Erl is used with OnErr. Erl returns the line number in which the error occurred. Using Erl combined
with Err, Ert and Era the user can determine much more about the error which occurred.
See Also
Era, Erf$, Err, ErrMsg$, Ert, OnErr
Erl Function Example
The following example shows a simple program using the Ert function to determine which task the
error occurred in along with; Erl: where the error occurred; Era: if a joint caused the error....
Function main
OnErr Goto eHandler
Do
Call PickPlace
Loop
Exit Function
eHandler:
Print "The Error code is ", Err
Print "The Error Message is ", ErrMsg$(Err)
errTask = Ert
If errTask > 0 Then
Print "Task number in which error occurred is ", errTask
Print "The line where the error occurred is Line ", Erl(errTask)
If Era(errTask) > 0 Then
Print "Joint which caused the error is ", Era(errTask)
EndIf
EndIf
Fend
120
Err Function
Err Function
Returns the most recent error status.
Syntax
Err [ (taskNumber) ]
Parameters
taskNumber
Return Values
Returns a numeric error code in integer form.
Description
Err allows the user to read the current error code. This along with the SPEL+ Error Handling
capabilities allows the user to determine which error occurred and react accordingly. Err is used with
OnErr.
To get the controller error, use SysErr function.
See Also
Era, Erf$, Erl, ErrMsg$, EResume, Ert, OnErr, Return, SysErr
Err Example
The following example shows a simple utility program which checks whether points P0-P399 exist. If
the point does not exist, then a message is printed on the screen to let the user know this point does
not exist. The program uses the CX instruction to test each point for whether or not it has been
defined. When a point is not defined control is transferred to the error handler and a message is
printed on the screen to tell the user which point was undefined.
Function errtest
Integer i, errnum
Real x
OnErr GoTo eHandle
For i = 0 To 399
x = CX(P(i))
Next i
Exit Function
'
'
'*********************************************
'* Error Handler
*
'*********************************************
eHandle:
errnum = Err
' Check if using undefined point
If errnum = 78 Then
Print "Point number P", i, " is undefined!"
Else
Print "ERROR: Error number ", errnum, " Occurred."
EndIf
EResume Next
Fend
121
ErrMsg$ Function
ErrMsg$ Function
Returns the error message which corresponds to the specified error number.
Syntax
ErrMsg$(errNumber, langID)
Parameters
errNumber
langID
Integer expression containing the error number to get the message for.
Optional. Integer expression containing the language ID based on the following values.
0 - English
1 - Japanese
2 - German
3 - French
4 - Simplified Chinese
5 - Traditional Chinese
If omitted, English is used.
Return Values
Returns the error message which is described in the Error Codes table.
See Also
Era, Erl, Err, Ert, OnErr, Trap
ErrMsg$ Example
The following example shows a simple program using the Ert function to determine which task the
error occurred in along with; Erl: where the error occurred; Era: if a joint caused the error....
Function main
OnErr Goto eHandler
Do
Call PickPlace
Loop
Exit Function
eHandler:
Print "The Error code is ", Err
Print "The Error Message is ", ErrMsg$(Err)
errTask = Ert
If errTask > 0 Then
Print "Task number in which error occurred is ", errTask
Print "The line where the error occurred is Line ", Erl(errTask)
If Era(errTask) > 0 Then
Print "Joint which caused the error is ", Era(errTask)
EndIf
EndIf
Fend
122
ErrorOn Funcion
ErrorOn Funcion
Returns the error status of the controller.
Syntax
ErrorOn
Return Values
True if the controller is in error status, otherwise False.
DeThis scription
ErrorOn function is used only for NoEmgAbort task (special task using NoEmgAbort at Xqt).
See Also
ErrorOn, SafetyOn, SysErr, Wait, Xqt
ErrorOn Function Example
The following example shows a program that monitors the controller error and switches the I/O On/Off
according to the error number when error occurs.
Notes
Forced Flag
This program example uses Forced flag for On/Off command.
Be sure that the I/O outputs change during error, or at Emergency Stop or Safety Door Open when
designing the system.
After Error Occurence
As this program, finish the task promptly after completing the error handling.
Function main
Xqt ErrorMonitor, NoEmgAbort
:
:
Fend
Function ErrorMonitor
Wait ErrorOn
If 4000 < SysErr Then
Print "Motion Error = ", SysErr
Off 10, Forced
On 12, Forced
Else
Print "Other Error = ", SysErr
Off 11, Forced
On 13, Forced
EndIf
Fend
123
Error Statement
Error Statement
S
Description
Use the Error statement to generate system or user defined errors. You can define user error labels
and descriptions by using the User Error Editor in the EPSON RC+ 5.0 development environment.
See Also
Era, Erl, Err, OnErr
Error Statement Example
#define ER_VAC 8000
If Sw(vacuum) = Off Then
Error ER_VAC
EndIf
124
Ert Function
Ert Function
Returns the task number in which an error occurred.
>
Syntax
Ert
Return Values
The task number in which the error occurred.
Description
Ert is used when an error occurs to determine in which task the error occurs. The number returned
will be between 1and 16.
See Also
Era, Erl, Err, ErrMsg$, OnErr, Trap
Ert Function Example
The following example shows a simple program using the Ert function to determine which task the
error occurred in along with; Erl: where the error occurred; Err: what error occurred; Era: if a joint
caused the error....
Function main
OnErr Goto eHandler
Do
Call PickPlace
Loop
Exit Function
eHandler:
Print "The Error code is ", Err
Print "The Error Message is ", ErrMsg$(Err)
errTask = Ert
If errTask > 0 Then
Print "Task number in which error occurred is ", errTask
Print "The line where the error occurred is Line ", Erl(errTask)
If Era(errTask) > 0 Then
Print "Joint which caused the error is ", Era(errTask)
EndIf
EndIf
Fend
125
EStopOn Function
EStopOn Function
F
126
Exit Statement
Exit Statement
Exits a loop construct or function.
Syntax
Exit { Do | For | Function }
Description
The Exit statement syntax has these forms:
Statement
Exit Do
Exit For
Exit Function
Description
Provides a way to exit a Do...Loop statement. It can be used only inside a Do...Loop
statement. Exit Do transfers control to the statement following the Loop statement.
When used within nested Do...Loop statements, Exit Do transfers control to the loop
that is one nested level above the loop where Exit Do occurs.
Provides a way to exit a For loop. It can be used only in a For...Next loop. Exit For
transfers control to the statement following the Next statement. When used within
nested For loops, Exit For transfers control to the loop that is one nested level above
the loop where Exit For occurs.
Immediately exits the Function procedure in which it appears. Execution continues
with the statement following the statement that called the Function.
See Also
Do...Loop, For...Next, Function...Fend
Exit Statement Example
For i = 1 To 10
If Sw(1) = On Then
Exit For
EndIf
Jump P(i)
Next i
127
Find Statement
Find Statement
Specifies or displays the condition to store coordinates during motion.
>
Syntax
Find [inputCondition]
Parameters
inputCondition
Find Sw(5) = On
Find Sw(5) = On And Sw(6) = Off
Description
Find statement can be used by itself or as a modifier of a motion command.
The Find condition must include at least one of the functions above.
When variables are included in the Find condition, their values are computed when setting the Find
condition. No use of variable is recommended. Otherwise, the condition may be an unintended
condition. Multiple Find statements are permitted. The most recent Find condition remains current.
When parameters are omitted, the current Find definition is displayed.
Notes
Find Setting at Main Power On
At power on, the Find condition is:
Find Sw(0) = On 'Input bit 0 is on
Use of PosFound Function to Verify Find
Use PosFound function to verify if the Find condition has been satisfied after executing a motion
command using Find modifier.
See Also
Sw, In, InW, Oport, Out, FindPos, Go, Jump, PosFound
Find Statement Example
Find Sw(5) = On
Go P10 Find
If PosFound Then
Go FindPos
Else
Print "Cannot find the sensor signal."
EndIf
128
FindPos Function
FindPos Function
Returns a robot point stored by Fine during a motion command.
Syntax
FindPos
Return Values
A robot point that was stored during a motion command using Find.
See Also
Find, Go, Jump, PosFound, CurPos, InPos
FindPos Function Example
Find Sw(5) = On
Go P10 Find
If PosFound Then
Go FindPos
Else
Print "Cannot find the sensor signal."
EndIf
129
Fine Statement
Fine Statement
Specifies and displays the positioning accuracy for target points.
>
Syntax
(1) Fine axis1, axis2, axis3, axis4, [axis5], [axis6]
(2) Fine
Parameters
axis1
Integer expression ranging from (0-65535) which represents the allowable positioning
error for the 1st joint.
axis2
Integer expression ranging from (0-65535) which represents the allowable positioning
error for the 2nd joint.
axis3
Integer expression ranging from (0-65535) which represents the allowable positioning
error for the 3rd joint.
axis4
Integer expression ranging from (0-65535) which represents the allowable positioning
error for the 4th joint.
axis5
Optional. Integer expression ranging from (0-65535) which represents the allowable
positioning error for the 5th joint.
axis6
Optional. Integer expression ranging from (0-65535) which represents the allowable
positioning error for the 6th joint.
Return Values
When used without parameters, Fine displays the current fine values for each of the 4 or 6 axes,
depending on the robot type.
Description
Fine specifies, for each joint, the allowable positioning error for detecting completion of any given
move.
This positioning completion check begins after the CPU has completed sending the target position
pulse to the servo system. Due to servo delay, the robot will not yet have reached the target position.
This check continues to be executed every few milliseconds until each joint has arrived within the
specified range setting. Positioning is considered complete when all axes have arrived within the
specified ranges. Once positioning is complete program control is passed to the next statement,
however, servo system keeps the control of the robot target position.
When relatively large ranges are used with the Fine instruction, the positioning will be confirmed
relatively early in the move, and executes the next statement.
The default Fine settings depend on the robot type. Refer to your robot manual for details.
Notes
Cycle Times and the Fine Instruction
The Fine value does not affect the acceleration or deceleration control of the manipulator arm.
However, smaller Fine values can cause the system to run slower because it may take the servo
system extra time (a few milliseconds) to get within the acceptable position range. Once the arm is
located within the acceptable position range (defined by the Fine instruction), the CPU executes the
next user instruction. (Keep in mind that all activated axes must be in position before the CPU can
execute the next user instruction.)
130
Fine Statement
Initialization of Fine (by Motor On, SLock, SFree)
Any time the following commands are used the Fine value is initialized to default values: SLock,
SFree, Motor instructions.
Make sure that you reset Fine values after one of the above commands execute.
Potential Errors
If Fine positioning is not completed within about 2 seconds, Error 4024 will occur. This error normally
means the servo system balance needs to be adjusted. (Call your distributor for assistance)
See Also
Accel, AccelR, AccelS, Arc, Go, Jump, Move, Speed, SpeedR, SpeedS, Pulse
Fine Statement Example
The examples below show the Fine statement used in a program function, and used from the monitor
window.
Function finetest
Fine 5, 5, 5, 5
Go P1
Go P2
Fend
131
Fine Function
Fine Function
Returns Fine setting for a specified joint.
Syntax
Fine(joint)
Parameters
joint
Integer expression representing the joint number for which to retrieve the Fine setting.
Return Values
Real value.
See Also
Accel, AccelS, Arc, Go, Jump, Move, Speed, SpeedS, Pulse
Fine Function Example
This example uses the Fine function in a program:
Function finetst
Integer a
a = Fine(1)
Fend
132
Fix Function
Fix Function
Returns the integer portion of a real number.
Syntax
Fix(number)
Parameters
number
Return Values
An integer value containing the integer portion of the real number.
See Also
Int
Fix Function Example
>print Fix(1.123)
1
>
133
FmtStr$ Function
FmtStr$ Function
F
Digit placeholder. Display a digit or nothing. If the expression has a digit in the position
where the # appears in the format string, display it; otherwise, display nothing in that
position. This symbol works like the 0 digit placeholder, except that leading and trailing
zeros aren't displayed if the number has the same or fewer digits than there are #
characters on either side of the decimal separator in the format expression.
(.)
Decimal placeholder. In some locales, a comma is used as the decimal separator. The
decimal placeholder determines how many digits are displayed to the left and right of the
decimal separator. If the format expression contains only number signs to the left of this
symbol, numbers smaller than 1 begin with a decimal separator. To display a leading
zero displayed with fractional numbers, use 0 as the first digit placeholder to the left of
the decimal separator. The actual character used as a decimal placeholder in the
formatted output depends on the Number Format recognized by your system.
(,)
134
FmtStr$ Function
See Also
Left$, Right$, Str$
FmtStr$ Example
Function SendDateCode
String d$, f$
f$ = FmtStr$(10, "000.00")
OpenCom #1
Print #1, f$
CloseCom #1
Fend
135
For...Next Statement
For...Next Statement
The For...Next instructions are used together to create a loop where instructions located
between For and Next are executed multiple times as specified by the user.
Syntax
For var = initValue To finalValue [Step increment ]
statements
Next [var]
Parameters
var
The counting variable used with the For...Next loop. This variable is normally
defined as an integer but may also be defined as a Real variable.
initValue
finalValue
The final value of the counter var. Once this value is met, the For...Next loop is
complete and execution continues starting with the statement following the Next
instruction.
increment
An optional parameter which defines the counting increment for each time the
Next statement is executed within the For...Next loop. This variable may be
positive or negative. However, if the value is negative, the initial value of the
variable must be larger than the final value of the variable. If the increment value
is left out the system automatically increments by 1.
statements
+
Any valid SPEL statements can be inserted inside the For...Next loop.
Description
For...Next executes a set of statements within a loop a specified number of times. The beginning of
the loop is the For statement. The end of the loop is the Next statement. A variable is used to count
the number of times the statements inside the loop are executed.
The first numeric expression (initValue ) is the initial value of the counter. This value may be positive
or negative as long as the finalValue variable and Step increment correspond correctly.
The second numeric expression (finalValue ) is the final value of the counter. This is the value which
once reached causes the For...Next loop to terminate and control of the program is passed on to the
next instruction following the Next instruction.
Program statements after the For statement are executed until a Next instruction is reached. The
counter variable (var) is then incremented by the Step value defined by the increment parameter. If
the Step option is not used, the counter is incremented by 1 (one).
The counter variable (var) is then compared with the final value. If the counter is less than or equal to
the final value, the statements following the For instruction are executed again. If the counter variable
is greater than the final value, execution branches outside of the For...Next loop and continues with
the instruction immediately following the Next instruction.
136
For...Next Statement
Notes
Negative Step Values:
If the value of the Step increment (increment) is negative, the counter variable (var) is decremented
(decreased) each time through the loop and the initial value must be greater than the final value for
the loop to work.
Variable Following Next is Not Required:
The variable name following the Next instruction may be omitted. However, for programs that contain
nested For...Next loops, it is recommended to include the variable name following the Next instruction
to aid in quickly identifying loops.
See Also
Do...Loop
For...Next Example
Function fornext
Integer counter
For counter = 1 to 10
Go Pctr
Next counter
For counter = 10 to 1 Step -1
Go Pctr
Next counter
Fend
137
Function...Fend Statement
Function...Fend Statement
A function is a group of program statements which includes a Function statement as the first
statement and a Fend statement as the last statement.
Syntax
Function funcName [(argList)] [As type]
statements
Fend
Parameters
funcName
argList
The name which is given to the specific group of statements bound between the
Function and Fend instructions. The function name must contain alphanumeric
characters and may be up to 32 characters in length. Underscores are also
allowed.
Optional. List of variables representing arguments that are passed to the
Function procedure when it is called. Multiple variables are separated by
commas.
Optional. Specify ByRef when you want any changes in the value of the variable
to be seen by the calling function.
ByVal
Optional. Specify ByVal when you do not want any changes in the value of the
variable to be seen by the calling function. This is the default.
varName
As type
Return Values
Value whose data type is specified with the As clause at the end of the function declaration.
Description
+
The Function statement indicates the beginning of a group of SPEL statements. To indicate where a
function ends we use the Fend statement. All statements located between the Function and Fend
statements are considered part of the function.
The Function...Fend combination of statements could be thought of as a container where all the
statements located between the Function and Fend statements belong to that function. Multiple
functions may exist in one program file.
See Also
Call, Fend, Halt, Quit, Return, Xqt
138
Function...Fend Statement
Function...Fend Example
The following example shows 3 functions which are within a single file. The functions called task2 and
task3 are executed as background tasks while the main task called main executes in the foreground.
Function main
Xqt 2, task2 'Execute task2 in background
Xqt 3, task3 'Execute task3 in background
'....more statements here
Fend
Function task2
Do
On 1
On 2
Off 1
Off 2
Loop
Fend
Function task3
Do
On 10
Wait 1
Off 10
Loop
Fend
139
Global Statement
Global Statement
Declares variables with the global scope. Global variables can be accessed from anywhere.
Syntax
Global [ Preserve ] dataType varName [(subscripts)] [, varName [(subscripts)] , ...]
Parameters
Preserve
If Preserve is specified, then the variable retains its values. The values are
cleared by project changes. If Preserve is omitted, the variable doesnt retain its
values.
dataType
Data type including Boolean, Integer, Long, Real, Double, Byte, or String.
varName
subscripts
Description
Global variables are variables which can be used in more than 1 file within the same project. They are
cleared whenever a function is started from the Run window or Operator window unless they are
declared with the Preserve option.
When declared in Preserve option, the variable retains the value at turning off the controller.
Global Preserve variables can be used with the VB Guide option.
It is recommended that global variable names begin with a "g_" prefix to make it easy to recognize
globals in a program. For example:
Global Long g_PartsCount
See Also
Boolean, Byte, Double, Integer, Long, Real, String
140
Global Statement
Global Statement Example
The following example shows 2 separate program files. The first program file defines some global
variables and initializes them. The second file then uses these global variables.
FILE1 (MAIN.PRG)
Global Integer status1
Global Real numsts
Function Main
Integer I
status1 = 10
The following example shows 2 separate program files. The first program file defines some global
variables and initializes them. The second file then also uses these global variables.
FILE1 (MAIN.PRG)
Global Integer g_Status
Global Real g_MaxValue
Function Main
g_Status = 10
g_MaxValue = 1.1
.
.
Fend
FILE2 (TEST.PRG)
Function Test
Print "status1 = , g_Status
Print "MaxValue = , g_MaxValue
.
.
Fend
141
Go Statement
Go Statement
Moves the arm using point to point motion from the current position to the specified
point or X,Y,Z,U, V, W position. The Go instruction can move any combination of
1-6 joints at the same time.
>
Syntax
Go destination [CP] [LJM [orientationFlag]] [searchExpr] [!...!]
Parameters
destination
CP
LJM
orientationFlag
Optional. Specifies a parameter that selects an orientation flag for LJM function.
searchExpr
!...!
Optional. Parallel Processing statements can be added to execute I/O and other
commands during motion.
Description
Go simultaneously moves all joints of the robot arm using point to point motion. The destination for the
Go instruction can be defined in a variety of ways:
- Using a specific point to move to. For example: Go P1.
- Using an explicit coordinate position to move to. For example: Go XY(50, 400, 0, 0).
- Using a point with a coordinate offset. For example: Go P1 +X(50).
- Using a point but with a different coordinate value. For example: Go P1 :X(50).
The path is not predictable because the each joint interpolates between the current point and the
target point. Be careful of the interference with peripherals.
The Speed instruction determines the arm speed for motion initiated by the Go instruction. The Accel
instruction defines the acceleration.
With CP parameter, the arm can accelerate for the next motion command while the arm starts
decelerating to a stop. In this case, the arm is not positioned at the target point.
With LJM parameter, the arm moves to the point into where the target point is converted using LJM
function, with the current point as reference point,
can be
142
Go Statement
Notes
Difference between Go and Move
The Move instruction and the Go instruction each cause the robot arm to move. However, the primary
difference between the 2 instructions is that the Go instruction causes point to point motion where as
the Move instruction causes the arm to move in a straight line. The Go instruction is used when the
user is primarily concerned with the orientation of the arm when it arrives on point. The Move
instruction is used when it is important to control the path of the robot arm while it is moving.
Difference between Go and Jump
The Jump instruction and the Go instruction each cause the robot arm to move in a point to point type
fashion. However, the JUMP instruction has 1 additional feature. Jump causes the robot end effector
to first move up to the LimZ value, then in a horizontal direction until it is above the target point, and
then finally down to the target point. This allows Jump to be used to guarantee object avoidance and
more importantly to improve cycle times for pick and place motions.
Proper Speed and Acceleration Instructions with Go
The Speed and Accel instructions are used to specify the speed and acceleration of the manipulator
during motion caused by the Go instruction. Pay close attention to the fact that the Speed and Accel
instructions apply to point to point type motion (like that for the Go instruction) while linear and circular
interpolation motion uses the SpeedS and AccelS instructions.
Using Go with the Optional Till Modifier
The optional Till modifier allows the user to specify a condition to cause the robot to decelerate to a
stop at an intermediate position prior to completing the motion caused by the Go instruction. If the Till
condition is not satisfied, the robot travels to the target position. The Go with Till modifier can be used
in 2 ways as described below:
(1) Go with Till Modifier
Checks if the current Till condition becomes satisfied. If satisfied, this command completes by
decelerating and stopping the robot at an intermediate position prior to completing the motion
caused by the Go instruction.
(2) Go with Till Modifier, Sw(Input bit number) Modifier, and Input Condition
This version of the Go with Till modifier allows the user to specify the Till condition on the
same line with the Go instruction rather than using the current definition previously defined
for Till. The condition specified is simply a check against one of the inputs. This is
accomplished through using the Sw instruction. The user can check if the input is On or Off
and cause the arm to stop based on the condition specified. This feature works almost like an
interrupt where the motion is interrupted (stopped) once the Input condition is met. If the input
condition is never met during the robot motion then the arm successfully arrives on the point
specified by destination.
Using Go with the Optional Find Modifier
The optional Find modifier allows the user to specify a condition to cause the robot to record a position
during the motion caused by the Go instruction. The Go with Find modifier can be used in 2 ways as
described below:
(1) Go with Find Modifier:
Checks if the current Find condition becomes satisfied. If satisfied, the current position is
stored in the special point FindPos.
(2) Go with Find Modifier, Sw(Input bit number) Modifier, and Input Condition:
This version of the Go with Find modifier allows the user to specify the Find condition on the
same line with the Go instruction rather than using the current definition previously defined
for Find. The condition specified is simply a check against one of the inputs. This is
accomplished through using the Sw instruction. The user can check if the input is On or Off
and cause the current position to be stored in the special point FindPos.
Go Instruction Always Decelerates to a Stop
The Go instruction always causes the arm to decelerate to a stop prior to reaching the final destination
of the move.
143
Go Statement
Potential Errors
Attempt to Move Outside of Robots Work Envelope
When using explicit coordinates with the Go instruction, you must make sure that the coordinates
defined are within the robots valid work envelope. Any attempt to move the robot outside of the valid
work envelope will result in an error.
See Also
!...! Parallel Processing, Accel, Find, Jump, Move, Pass, Pn= (Point Assignment), Pulse, Speed, Sw,
Till
Go Example
The example shown below shows a simple point to point move between points P0 and P1 and then
moves back to P0 in a straight line. Later in the program the arm moves in a straight line toward point
P2 until input #2 turns on. If input #2 turns On during the Move, then the arm decelerates to a stop
prior to arriving on point P2 and the next program instruction is executed.
Function sample
Integer i
Home
Go P0
Go P1
For i = 1 to 10
Go P(i)
Next i
Go P2 Till Sw(2) = On
If Sw(2) = On Then
Print "Input #2 came on during the move and"
Print "the robot stopped prior to arriving on"
Print "point P2."
Else
Print "The move to P2 completed successfully."
Print "Input #2 never came on during the move."
EndIf
Fend
Some syntax examples from the command window are shown below:
>Go Here +X(50)
>Go
>Go
>Go
>Go
'
P1
'
P1 :U(30)
'
'
P1 /L
'
'
XY(50, 450, 0, 30) '
144
GoSub...Return
GoSub...Return
GoSub transfers program control to a subroutine. Once the subroutine is complete, program
control returns back to the line following the GoSub instruction which initiated the subroutine.
Syntax
GoSub { label }
{ label:}
statements
Return
Parameters
label
When the user specifies a label, the program execution will jump to the line on
which this label resides. The label can be up to 32 characters in length.
However, the first character must be an alphabet character (not numeric).
Description
The GoSub instruction causes program control to branch to the user specified statement label. The
program then executes the statement on that line and continues execution through subsequent line
numbers until a Return instruction is encountered. The Return instruction then causes program control
to transfer back to the line which immediately follows the line which initiated the GoSub in the first
place. (i.e. the GoSub instruction causes the execution of a subroutine and then execution returns to
the statement following the GoSub instruction.) Be sure to always end each subroutine with Return.
Doing so directs program execution to return to the line following the GoSub instruction.
Potential Errors
Branching to Non-Existent Statement
If the GoSub instruction attempts to branch control to a non-existent label then an Error 3108 will be
issued.
Return Found Without GoSub
A Return instruction is used to "return" from a subroutine back to the original program which issued
the GoSub instruction. If a Return instruction is encountered without a GoSub having first been
issued then an Error 2383 will occur. A stand alone Return instruction has no meaning because the
system doesn't know where to Return to.
See Also
GoTo, OnErr, Return
145
GoSub...Return
GoSub Statement Example
The following example shows a simple function which uses a GoSub instruction to branch to a label
and execute some I/O instructions then return.
Function main
Integer var1, var2
GoSub checkio
On 1
On 2
Exit Function
checkio:
'Subroutine starts here
var1 = In(0)
var2 = In(1)
If var1 = 1 And var2 = 1 Then
On 1
Else
Off 1
EndIf
Return 'Subroutine ends here
Fend
146
GoTo Statement
GoTo Statement
The GoTo instruction causes program control to branch unconditionally to a designated
statement label.
Syntax
GoTo { label }
Parameters
label
Program execution will jump to the line on which the label resides. The label can
be up to 32 characters. However, the first character must be an alphabetic
character (not numeric).
Description
The GoTo instruction causes program control to branch to the user specified label. The program then
executes the statement on that line and continues execution from that line on. GoTo is most
commonly used for jumping to an exit label because of an error.
Notes
Using Too Many GoTo's
Please be careful with the GoTo instruction since using too many GoTo's in a program can make the
program difficult to understand. The general rule is to try to use as few GoTo instructions as possible.
Some GoTo's are almost always necessary. However, jumping all over the source code through
using too many GoTo statements is an easy way to cause problems.
See Also
GoSub, OnErr
GoTo Statement Example
The following example shows a simple function which uses a GoTo instruction to branch to a line label.
Function main
If Sw(1) = Off Then
GoTo mainAbort
EndIf
Print "Input 1 was On, continuing cycle"
.
.
Exit Function
mainAbort:
Print "Input 1 was OFF, cycle aborted!"
Fend
147
Halt Statement
Halt Statement
Temporarily suspends execution of a specified task.
Syntax
Halt taskIdentifier
Parameters
taskIdentifier
Description
Halt temporarily suspends the task being executed as specified by the task name or number.
To continue the task where it was left off, use Resume. To stop execution of the task completely, use
Quit. To display the task status, click the Task Manager Icon on the EPSON RC+ Toolbar to run the
Task manager.
Halt also pauses the task when the specified task is NoPause task or NoEmgAbort task (special task
using NoPause or NoEmgAbort at Xqt).
See Also
Quit, Resume, Xqt
Halt Statement Example
The example below shows a function named "flicker" that is started by Xqt, then is temporarily
stopped by Halt and continued again by Resume.
Function main
Xqt flicker
Do
Wait 3
Halt flicker
Wait 3
Resume flicker
Loop
Fend
Function flicker
Do
On 1
Wait 0.2
Off 1
Wait 0.2
Loop
Fend
148
Hand Statement
Hand Statement
>
Syntax
(1) Hand point, [Lefty | Righty]
(2) Hand
Parameters
point
Lefty | Righty
Return Values
When both parameters are omitted, the hand orientation is displayed for the current robot position.
If Lefty | Righty is ommited, the hand orientation for the specified point is displayed.
See Also
Elbow, Hand Function, J4Flag, J6Flag, Wrist, J1Flag, J2Flag
Hand Statement Example
Hand P0, Lefty
Hand pick, Righty
Hand P(myPoint), myHand
P1 = -364.474, 120.952, 469.384, 72.414, 1.125, -79.991
149
Hand Function
Hand Function
Returns the hand orientation of a point.
Syntax
Hand [(point)]
Parameters
point
Optional. Point expression. If point is omitted, then the hand orientation of the current
robot position is returned.
Return Values
1
Righty (/R)
2
Lefty (/L)
See Also
Elbow, Wrist, J4Flag, J6Flag, J1Flag, J2Flag
Hand Function Example
Print
Print
Print
Print
150
Hand(pick)
Hand(P1)
Hand
Hand(P1 + P2)
Here Statement
Here Statement
Teach a robot point at the current position.
Syntax
Here point
Parameters
point
See Also
Here Function
Here Statement Example
Here P1
Here pick
151
Here Function
Here Function
Returns current robot position as a point.
Syntax
Here
Return Values
A point representing the current robot position.
Description
Use Here to retrieve the current position of the current manipulator.
See Also
Here Statement
Here Function Example
P1 = Here
152
Hex$ Function
Hex$ Function
Returns a string representing a specified number in hexadecimal format.
>
Syntax
Hex$(number)
Parameters
number
Integer expression.
Return Values
Returns a string containing the ASCII representation of the number in hexadecimal format.
Description
Hex$ returns a string representing the specified number in hexadecimal format. Each character is
from 0-9 or A-F. Hex$ is especially useful for examining the results of the Stat function.
See Also
Str$, Stat, Val
Hex$ Function Example
> print hex$(stat(0))
A00000
> print hex$(255)
FF
153
Home Statement
Home Statement
Moves the robot arm to the user defined home position.
>
Syntax
Home
Description
Executes low speed Point to Point motion to the Home (standby) position specified by HomeSet, in
the homing order defined by Hordr.
Normally, for SCARA robots (including RS series), the Z joint (J3) returns first to the HomeSet position,
then the J1, J2 and J4 joints simultaneously return to their respective HomeSet coordinate positions.
The Hordr instruction can change this order of the axes returning to their home positions.
Note
Home Status Output:
When the robot is in its Home position, the controller's system Home output is turned ON.
Potential Errors
Attempting to Home without HomeSet Values Defined
Attempting to Home the robot without setting the HomeSet values will result in an Error 143 being
issued.
See Also
HomeClr, HomeDef, HomeSet, Hordr
Home Example
The Home instruction can be used in a program such as this:
Function InitRobot
Reset
If Motor = Off Then
Motor On
EndIf
Home
Fend
Or it can be issued from the Command window like this:
> home
>
154
HomeClr Function
HomeClr Function
Clears the home position definition.
Syntax
HomeClr
Description
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
See Also
HomeDef, HomeSet
HomeClr Function Example
This example uses the HomeClr function in a program:
Function ClearHome
If HomeDef = True Then
HomeClr
EndIf
Fend
155
HomeDef Function
HomeDef Function
Returns whether home position has been defined or not.
Syntax
HomeDef
Return Values
True if home position has been defined, otherwise False.
See Also
HomeClr, HomeSet
HomeDef Function Example
This example uses the HomeDef function in a program:
Function DisplayHomeSet
Integer i
If HomeDef = False Then
Print "Home is not defined"
Else
Print "Home values:"
For i = 1 To 4
Print "J", i, " = ", HomeSet(i)
Next i
EndIf
Fend
156
HomeSet Statement
HomeSet Statement
Specifies and displays the Home position.
>
Syntax
(1) HomeSet j1Pulses, j2Pulses, j3Pulses, j4Pulses, [j5Pulses], [j6Pulses]
(2) HomeSet
Parameters
j1Pulses
j2Pulses
j3Pulses
j4Pulses
j5Pulses
Optional for 6-axis robots. The home position encoder pulse value for joint 5.
j6Pulses
Optional for 6-axis robots. The home position encoder pulse value for joint 6.
Return Values
Displays the pulse values defined for the current Home position when parameters are omitted.
Description
Allows the user to define a new home (standby) position by specifying the encoder pulse values for
each of the robot joints.
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
Potential Errors
Attempting to Home without HomeSet Values Defined:
Attempting to Home the robot without setting the HomeSet values will result in an Error 2228 being
issued.
Attempting to Display HomeSet Values without HomeSet Values Defined:
Attempting to display home position pulse values without HomeSet values defined causes an Error
2228.
See Also
Home, HomeClr, HomeDef, Hordr, Pls
HomeSet Example
The following examples are done from the command window:
> homeset 0,0,0,0
> homeset
0 0
0 0
> home
Using the Pls function, specify the current position of the arm as the Home position.
> homeset Pls(1), Pls(2), Pls(3), Pls(4)
157
HomeSet Function
HomeSet Function
Returns pulse values of the home position for the specified joint.
Syntax
HomeSet(jointNumber)
Parameters
jointNumber Integer expression representing the joint number to retrieve the HomeSet value for.
Return Values
Returns pulse value of joint home position. When jointNumber is 0, returns 1 when HomeSet has
been set or 0 if not.
See Also
HomeSet Statement
HomeSet Function Example
This example uses the HomeSet function in a program:
Function DisplayHomeSet
Integer i
If HomeSet(0) = 0 Then
Print "HomeSet is not defined"
Else
Print "HomeSet values:"
For i = 1 To 4
Print "J", i, " = ", HomeSet(i)
Next i
EndIf
Fend
158
Hordr Statement
Hordr Statement
>
Specifies or displays the order of the axes returning to their Home positions.
Syntax
(1) Hordr step1, step2, step3, step4, [step5] ,[step6]
(2) Hordr
Parameters
step1
Bit pattern that defines which joints should home during the 1st step of the homing
process.
step2
Bit pattern that defines which joints should home during the 2nd step of the homing
process.
step3
Bit pattern that defines which joints should home during the 3rd step of the homing
process.
step4
Bit pattern that defines which joints should home during the 4th step of the homing
process.
step5
For 6 axis robots. Bit pattern that defines which joints should home during the 5th step of
the homing process.
step6
For 6 axis robots. Bit pattern that defines which joints should home during the 6th step of
the homing process.
Return Values
Displays current Home Order settings when parameters are omitted.
Description
Hordr specifies joint motion order for the Home command. (i.e. Defines which joint will home 1st,
which joint will home 2nd, 3rd, etc.)
The purpose of the Hordr instruction is to allow the user to change the homing order. The homing
order is broken into 4 or 6 separate steps, depending on robot type. The user then uses Hordr to
define the specific joints which will move to the Home position during each step. It is important to
realize that more than one joint can be defined to move to the Home position during a single step.
This means that all joints can potentially be homed at the same time. For SCARA robots (including
RS series, 4 axis robots), it is recommended that the Z joint normally be defined to move to the Home
position first (in Step 1) and then allow the other joints to follow in subsequent steps.
The Hordr instruction expects that a bit pattern be defined for each of the steps. Each joint is assigned
a specific bit. When the bit is set to 1 for a specific step, then the corresponding joint will home. When
the bit is cleared to 0, then the corresponding axis will not home during that step. The joint bit patterns
are assigned as follows:
Joint:
Bit Number:
Binary Code:
bit 0
&B0001
bit 1
&B0010
bit 2
&B0100
bit 3
&B1000
bit 4
&B10000
bit 5
&B100000
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
159
Hordr Statement
See Also
Home, HomeSet
Hordr Statement Example
Following are some command window examples for SCARA robots (including RS series, 4 axis
robots):
This example defines the home order as J3 in the first step, J1 in second step, J2 in third step, and J4
in the fourth step. The order is specified with binary values.
>hordr
This example defines the home order as J3 in the first step, then J1, J2 and J4 joints simultaneously in
the second step. The order is specified with decimal values.
>hordr
4, 11, 0, 0
160
Hordr Function
Hordr Function
Returns Hordr value for a specified step.
>
Syntax
Hordr(stepNumber)
Parameters
stepNumber
Return Values
Integer containing the Hordr value for the specified step.
See Also
Home, HomeSet
Hordr Function Example
Integer a
a = Hordr(1)
161
Hour Statement
Hour Statement
Displays the accumulated controller operating time.
>
Syntax
Hour
Description
Displays the amount of time the controller has been turned on and running SPEL. (Accumulated
Operating Time) Time is always displayed in units of hours.
See Also
Time
Hour Example
The following example is done from the Command window:
> hour
2560
>
162
Hour Function
Hour Function
Returns the accumulated controller operating time.
Syntax
Hour
Return Values
Returns accumulated operating time of the controller (real number, in hours).
See Also
Time
Hour Function Example
Print "Number of controller operating hours: ", Hour
163
IfThenElseEndIf Statement
IfThenElseEndIf Statement
Executes instructions based on a specified condition.
Syntax
(1) If condition Then
stmtT1
.
.
[ElseIf condition Then]
stmtT1
.
.
[Else]
stmtF1
.
.
EndIf
(2) If condition Then stmtT1 [; stmtT2...] [Else stmtF1 [; stmtF2...]]
Parameters
condition
Any valid test condition which returns a True (any number besides 0) or False result
(returned as a 0). (See sample conditions below)
stmtT1
Executed when the condition is True. (Multiple statements may be put here in a blocked
If...Then...Else style.)
stmtF1
Executed when the condition is False. (Multiple statements may be put here in a blocked
If...Then...Else style.)
Description
(1) If...Then...Else executes stmtT1, etc. when the conditional statement is True. If the condition is
False then stmtF1, etc. are executed. The Else portion of the If...Then...Else instruction is optional.
If you omit the Else statement and the conditional statement is False, the statement following the
EndIf statement will be executed. For blocked If...Then...Else statements the EndIf statement is
required to close the block regardless of whether an Else is used or not.
(2) If...Then...Else can also be used in a non blocked fashion. This allows all statements for the
If...Then...Else to be put on the same line. Please note that when using If...Then...Else in a non
blocked fashion, the EndIf statement is not required. If the If condition specified in this line is
satisfied (True), the statements between the Then and Else are executed. If the condition is not
satisfied (False), the statements following Else are executed. The Else section of the
If...Then...Else is not required. If there is no Else keyword then control passes on to the next
statement in the program if the If condition is False.
The logical output of the conditional statement is any number excluding 1 when it is True, and 0 when
it is false.
164
IfThenElseEndIf Statement
Notes
Sample Conditions:
a=b
a<b
a >= b
a <> b
a>b
a <= b
:a is equal to b
:b is larger than a
:a is greater than or equal to b
:a is not equal to b
:b is smaller than a
:a is less than or equal to b
165
In Function
In Function
Returns the status of the specified Byte port. Each port contains 8 input channels.
Syntax
In(byteportNumber)
Parameters
byteportNumber
Return Values
Returns an integer value between 0-255. The return value is 8 bits, with each bit corresponding to 1
input channel.
Description
In provides the ability to look at the value of 8 input channels at the same time. The In instruction can
be used to store the 8 I/O channels status into a variable or it can be used with the Wait instruction to
Wait until a specific condition which involves more than 1 I/O channel is met.
Since 8 channels are checked at a time, the return values range from 0-255. Please review the chart
below to see how the integer return values correspond to individual input channels.
Input Channel Result (Using Byte port #0)
Return Value
1
5
15
255
Off
Off
Off
On
Off
Off
Off
On
Off
Off
Off
On
Off
Off
Off
On
Off
Off
On
On
Off
On
On
On
Off
Off
On
On
On
On
On
On
Return Value
3
7
32
255
23
22
21
20
19
18
17
16
Off
Off
Off
On
Off
Off
Off
On
Off
Off
On
On
Off
Off
Off
On
Off
Off
Off
On
Off
On
Off
On
On
On
Off
On
On
On
Off
On
See Also
InBCD, MemIn, MemOff, MemOn, MemSw, Off, On, OpBCD, Oport, Out, Sw, Wait
166
In Function
In Function Example
For the example below lets assume that input channels 20, 21, 22, and 23 are all connected to
sensory devices such that the application should not start until each of these devices are returning an
On signal indicating everything is OK to start. The program example gets the 8 input channels status
of byte port 2 and makes sure that channels 20, 21, 22, and 23 are each On before proceeding. If
they are not On (i.e. returning a value of 1) an error message is given to the operator and the task is
stopped.
In the program, the variable "var1" is compared against the number 239 because in order for inputs 20,
21, 22, and 23 to all be On, then the result of In(2) will be 240 or larger. (We don't care about Inputs
16, 17, 18, and 19 in this case so any values between 240-255 will allow the program to proceed.)
Function main
Integer var1
var1 = In(2)
'Get 8 input channels status of byte port 2
If var1 > 239 Then
Go P1
Go P2
'Execute other motion statements here
'.
'.
Else
Print "Error in initialization!"
Print "Sensory Inputs not ready for cycle start"
Print "Please check inputs 20,21,22, and 23 for"
Print "proper state for cycle start and then"
Print "start program again"
EndIf
Fend
We cannot set inputs from the command window but we can check them. For the examples shown
below, we will assume that the Input channels 1, 5, and 15 are On. All other inputs are Off.
> print In(0)
34
> print In(1)
128
> print In(2)
0
167
InBCD Function
InBCD Function
F
Returns the input status of 8 inputs using BCD format. (Binary Coded Decimal )
Syntax
InBCD(portNumber)
Parameters
portNumber
Return Values
Returns as a Binary Coded Decimal (0-9), the input status of the input port (0-99).
Description
InBCD simultaneously reads 8 input lines using the BCD format. The portNumber parameter for the
InBCD instruction defines which group of 8 inputs to read where portNumber = 0 means inputs 0-7,
portNumber = 1 means inputs 8-15, etc.
The resulting value of the 8 inputs is returned in BCD format. The return value may have 1 or 2 digits
between 0 and 99. The 1st digit (or 10's digit) corresponds to the upper 4 outputs of the group of 8
outputs selected by portNumber. The 2nd digit (or 1's digit) corresponds to the lower 4 outputs of the
group of 8 outputs selected by portNumber.
Since valid entries in BCD format range from 0-9 for each digit, every I/O combination cannot be met.
The table below shows some of the possible I/O combinations and their associated return values
assuming that portNumber is 0.
7
Off
Off
Off
Off
Off
Off
Off
On
6
Off
Off
Off
Off
Off
Off
Off
Off
5
Off
Off
Off
Off
Off
Off
Off
Off
4
Off
Off
Off
Off
Off
On
On
On
3
Off
Off
Off
On
On
Off
Off
On
2
Off
Off
Off
Off
Off
Off
Off
Off
1
Off
On
On
Off
Off
Off
Off
Off
0
On
Off
On
Off
On
Off
On
On
Notice that the Binary Coded Decimal format only allows decimal values to be specified. This means
that through using Binary Coded Decimal format it is impossible to retrieve a valid value if all inputs for
a specific port are turned on at the same time when using the InBCD instruction. The largest value
possible to be returned by InBCD is 99. In the table above it is easy to see that when 99 is the return
value for InBCD, all inputs are not on. In the case of a return value of 99, inputs 0, 3, 4, and 7 are On
and all the others are Off.
InBCD function cannot be used for the Wait command or wait condition of Till, Find, Sense.
168
InBCD Function
Notes
Difference between InBCD and In
The InBCD and In instructions are very similar in the SPEL+ language. However, there is one major
difference between the two. This difference is shown below:
- The InBCD instruction uses the Binary Coded Decimal format for specifying the return value
format for the 8 inputs. Since Binary Coded Decimal format precludes the values of &HA, &HB,
&HC, &HD, &HE or &HF from being used, all combinations for the 8 inputs cannot be satisfied.
- The In instruction works very similarly to the InBCD instruction except that In allows the return
value for all 8 inputs to be used. (i.e. 0-255 vs. 0-99 for InBCD) This allows all possible
combinations for the 8 bit input groups to be read.
See Also
In, MemOff, MemOn, MemOut, MemSw, Off, On, OpBCD, Oport, Out, Sw, Wait
InBCD Example
Some simple examples from the Command window are as follows:
Assume that inputs 0, 4, 10, 16, 17, and 18 are all On (The rest of the inputs are Off).
> Print InBCD(0)
11
> Print InBCD(1)
04
> Print InBCD(2)
07
>
169
Inertia Statement
Inertia Statement
Specifies load inertia and eccentricity for current robot.
>
Syntax
Inertia [ loadInertia ], [ eccentricity ]
Inertia
Parameters
loadInertia
Optional. Real expression that specifies total moment of inertia in kgm2 around the center
of the end effector joint, including end effector and part.
eccentricity Optional. Real expression that specifies eccentricity in mm around the center of the end
effector joint, including end effector and part.
Return Values
When parameters are omitted, the current Inertia parameters are displayed.
Description
Use the Inertia statement to specify the total moment of inertia for the load on the end effector joint.
This allows the system to more accurately compensate acceleration, deceleration, and servo gains for
end effector joint. You can also specify the distance from the center of end effector joint to the center
of gravity of the end effector and part using the eccentricity parameter.
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
See Also
Inertia Function
Inertia Statement Example
Inertia 0.02, 1
170
Inertia Function
Inertia Function
Returns inertia parameter value.
Syntax
Inertia(paramNumber)
Parameters
paramNumber
Return Values
Real value of the specified setting.
See Also
Inertia Statement
Inertia Function Example
Real loadInertia, eccentricity
loadInertia = Inertia(1)
eccentricity = Inertia(2)
171
InPos Function
InPos Function
Returns the position status of the specified robot.
Syntax
InPos
Return Values
True if position has been completed successfully, otherwise False.
See Also
CurPos, FindPos, WaitPos
InPos Function Example
Function main
P0 = XY(0, -100, 0, 0)
P1 = XY(0, 100, 0, 0)
Xqt MonitorPosition
Do
Jump P0
Wait .5
Jump P1
Wait .5
Loop
Fend
Function MonitorPosition
Boolean oldInPos, pos
Do
Pos = InPos
If pos <> oldInPos Then
Print "InPos = ", pos
EndIf
oldInPos = pos
Loop
Fend
172
Input Statement
Input Statement
Allows numeric data to be received from the keyboard and stored in a variable(s).
>
Syntax
Input varName [ , varName, varName,... ]
Parameters
varName
Variable name. Multiple variables can be used with the Input command as long
as they are separated by commas.
Description
Input receives numeric data from the display device and assigns the data to the variable(s) used with
the Input instruction.
When executing the Input instruction, a (?) prompt appears at the display device. After inputting data
press the return key (Enter) on the keyboard.
Notes
Rules for Numeric Input
When inputting numeric values and non-numeric data is found in the input other than the delimiter
(comma), the Input instruction discards the non-numeric data and all data following that non-numeric
data.
Rules for String Input
When inputting strings, numeric and alpha characters are permitted as data.
Other Rules for the Input Instruction
- When more than one variable is specified in the instruction, the numeric data input intended for each
variable has to be separated by a comma (",") character.
- Numeric variable names and string variable names are allowed. However, the input data type must
match the variable type.
Potential Errors
Number of variables and input data differ
For multiple variables, the number of input data must match the number of Input variable names.
When the number of the variables specified in the instruction is different from the number of numeric
data received from the keyboard, an Error 2505 will occur.
See Also
Input #, Line Input, Line Input #, Print, String
173
Input Statement
Input Statement Example
This is a simple program example using Input statement.
Function InputNumbers
Integer A, B, C
Print
Input
Print
Input
Print
Print
Fend
"Please
A
"Please
B, C
"A = ",
"B = ",
enter 1 number"
enter 2 numbers separated by a comma"
A
B, "C = ", C
174
Input # Statement
Input # Statement
Allows string or numeric data to be received from a communications port or a device
and stored in a variable(s).
>
Syntax
Input PortNum, varName [ , varName, varName,... ]
Parameters
PortNum
varName
Description
The Input # instruction receives numeric or string data from the device specified by PortNum, and
assigns the data to the variable(s).
Notes
Rules for Numeric Input
When inputting numeric values and non-numeric data is found in the input other than the delimiter
(comma), the Input instruction discards the non-numeric data and all data following that non-numeric
data.
Rules for String Input
When inputting strings, numeric and alpha characters are permitted as data.
Other Rules for the Input Instruction
- When more than one variable is specified in the instruction, the numeric data input intended for each
variable has to be separated by a comma (",") character.
- Numeric variable names and string variable names are allowed. However, the input data type must
match the variable type.
Potential Errors
Number of variables and input data differ
When the number of the variables specified in the instruction is different from the number of numeric
data received from the device, an Error 2505 will occur.
See Also
Input, Line Input, Line Input #
175
Input # Statement
Input # Statement Example
This is a simple program example using Input # statement.
Function GetData
Integer A
String B$
OpenCom #1
Print #1, "Send"
Input #1, A
'Accept numeric data from port #1
Input #1, B$ 'Get string data from port #1
CloseCom #1
Fend
176
InReal Function
InReal Function
Returns the input data of 2 words (32 bits) as the floating-point data (IEEE754 compliant)
of 32 bits.
Syntax
InReal(WordPortNumber)
Parameter
WordPortNumber
Return Values
Returns the input port status in Real type number.
Description
From the input word port specified by the word port number, retrieve the 2 input word values as
IEEE754 Real type value. Input word label can be used for the word port number parameter.
InReal Function cannot be used for the Wait command, or the condition of Till, Find, Sense.
See Also
In, InW, InBCD, Out, OutW, OpBCD, OutReal
InW Function Example
Real realVal
realVal = InReal(0)
177
InsideBox Function
InsideBox Function
Returns the check status of the approach check area.
Syntax
InsideBox(AreaNum)
Parameters
AreaNum
Return Values
True if the robot end effector approaches the specified approach check area, otherwise False.
See Also
Box, BoxClr, BoxDef, InsidePlane
InsideBox Function Example
This is an example to start up different task from Main function and display the approach check status.
Function Main
:
:
Xqt PrintInsideBox
:
:
Fend
Function PrintInsideBox
Do
Wait InsideBox(1) = True
Print Inside Box1
Wait InsideBox(1) = False
Print Outside Box1
Loop
Fend
This is a program example to parallel process the motion command. I/O turns ON when the robot
approaches the specific approach check area at running.
Function
Motor
Power
Speed
Main
On
High
30; Accel 30, 30
178
InsidePlane Function
InsidePlane Function
Returns the check status of the approach check plane.
Syntax
InsidePlane(PlaneNum)
Parameters
PlaneNum
Return Values
True if the robot end effector approaches the specified approach check plane, otherwise False.
See Also
InsideBox, Plane, PlaneClr, PlaneDef
InsidePlane Function Example
This is an example to start up different task from Main function and display the approach check status.
Function Main
:
:
Xqt PrintInsidePlane
:
:
Fend
Function PrintInsidePlane
Do
Wait InsidePlane(1) = True
Print Inside Plane1
Wait InsidePlane(1) = False
Print Outside Plane1
Loop
Fend
This is a program example to parallel process the motion command. I/O turns ON when the robot
comes through the specific approach check plane at running.
Function
Motor
Power
Speed
Main
On
High
30; Accel 30, 30
179
InStr Function
InStr Function
Returns position of one string within another.
Syntax
InStr(string, searchString)
Parameters
string
searchString
Return Values
Returns the position of the search string if the location is found, otherwise -1.
See Also
Mid$
Instr Function Example
Integer pos
pos = InStr("abc", "b")
180
Int Function
Int Function
Converts a Real number to Integer. Returns the largest integer that is less than or equal to the
specified value.
Syntax
Int(number)
Parameters
number
Return Values
Returns an Integer value of the real number used in number.
Description
Int(number) takes the value of number and returns the largest integer that is less than or equal to
number.
Note
For Values Less than 1 (Negative Numbers)
If the parameter number has a value of less than 1 then the return value have a larger absolute value
than number. (For example, if number = -1.35 then -2 will be returned.)
See Also
Abs, Atan, Atan2, Cos, Mod, Not, Sgn, Sin, Sqr, Str$, Tan, Val
Int Function Example
Some simple examples from the Command window are as follows:
> Print Int(5.1)
5
> Print Int(0.2)
0
> Print Int(-5.1)
-6
>
181
Integer Statement
Integer Statement
Declares variables of type Integer. (2 byte whole number).
Syntax
Integer varName [(subscripts)] [, varName [(subscripts)]...]
Parameters
varName
subscripts
Description
Integer is used to declare variables as type integer. Variables of type integer can contain whole
numbers with values from -32768 to 32767. Local variables should be declared at the top of a function.
Global and module variables must be declared outside of functions.
See Also
Boolean, Byte, Double, Global, Long, Real, String
Integer Statement Example
The following example shows a simple program that declares some variables using Integer.
Function inttest
Integer A(10)
'Single dimension array of integer
Integer B(10, 10)
'Two dimension array of integer
Integer C(5, 5, 5) 'Three dimension array of integer
Integer var1, arrayvar(10)
Integer i
Print "Please enter an Integer Number"
Input var1
Print "The Integer variable var1 = ", var1
For i = 1 To 5
Print "Please enter an Integer Number"
Input arrayvar(i)
Print "Value Entered was ", arrayvar(i)
Next I
Fend
182
InW Function
InW Function
Returns the status of the specified input word port. Each word port contains 16 input bits.
Syntax
InW(WordPortNum)
Parameters
WordPortNum Integer expression representing the I/O Input Word.
Return Values
Returns the current status of inputs (long integers from 0 to 65535).
See Also
In, Out, OutW
InW Function Example
Long word0
word0 = InW(0)
183
IOLabel$ Function
IOLabel$ Function
Returns the I/O label for a specified input or output bit, byte, or word.
Syntax
IOLabel$(IOType, IOWidth, portNumber)
Parameters
IOType
IOWidth
portNumber Integer expression representing the bit, byte, or word port number to return the label for.
Return Values
String containing the label.
See Also
PLabel$, IONumber
IOLabel$ Function Example
Integer i
For i = 0 To 15
Print "Input ", i, ": ", IOLabel$(0, 1, i)
Next i
184
IONumber Function
IONumber Function
Returns the I/O number of the specified I/O label.
Syntax
IONumber(IOlabel)
Parameters
IOlabel
String expression that specifies the standard I/O or memory I/O label.
Return Values
Returns the I/O port number (bit, byte, word) of the specified I/O label. If there is no such I/O label, an
error will be generated.
See Also
IOLabel$
IONumber Function Example
Integer IObit
IObit = IONumber("myIO")
IObit = IONUmber("Station" + Str$(station) + "InCycle")
185
J1Flag Statement
J1Flag Statement
Specifies the J1Flag attribute of a point.
>
Syntax
(1) J1Flag point, [value ]
(2) J1Flag
Parameters
point
value
Return Values
The J1Flag attribute specifies the range of values for joint 1 for one point. If value is ommited, the
J1Flag value for the specified point is displayed. When both parameters are omitted, the J1Flag value
is displayed for the current robot position.
See Also
Hand, J1Flag Function, J2Flag
J1Flag Statement Example
J1Flag P0, 1
J1Flag P(mypoint), 0
186
J1Flag Function
J1Flag Function
Returns the J1Flag attribute of a point.
Syntax
J1Flag [(point)]
Parameters
point
Optional. Point expression. If point is omitted, then the J1Flag setting of the current
robot position is returned.
Return Values
0
/J1F0
1
/J1F1
See Also
Hand, J1Flag Statement, J2Flag
J1Flag Function Example
Print
Print
Print
Print
J1Flag(pick)
J1Flag(P1)
J1Flag
J1Flag(Pallet(1, 1))
187
J2Flag Statement
J2Flag Statement
>
Syntax
(1) J2Flag point, [value ]
(2) J2Flag
Parameters
point
value
Return Values
The J2Flag attribute specifies the range of values for joint 2 for one point. If value is ommited, the
J2Flag value for the specified point is displayed. When both parameters are omitted, the J2Flag value
is displayed for the current robot position.
See Also
Hand, J1Flag, J2Flag Function
J2Flag Statement Example
J2Flag P0, 1
J2Flag P(mypoint), 0
188
J2Flag Function
J2Flag Function
Returns the J2Flag attribute of a point.
Syntax
J2Flag [(point)]
Parameters
point
Optional. Point expression. If point is omitted, then the J2Flag setting of the current
robot position is returned.
Return Values
0
/J2F0
1
/J2F1
See Also
Hand, J1Flag, J2Flag Statement
J2Flag Function Example
Print
Print
Print
Print
J2Flag(pick)
J2Flag(P1)
J2Flag
J2Flag(P1 + P2)
189
J4Flag Statement
J4Flag Statement
>
Syntax
(1) J4Flag point, [value ]
(2) J4Flag
Parameters
point
value
Return Values
The J4Flag attribute specifies the range of values for joint 4 for one point. If value is ommited, the
J4Flag value for the specified point is displayed. When both parameters are omitted, the J4Flag value
is displayed for the current robot position.
See Also
Elbow, Hand, J4Flag Function, J6Flag, Wrist
J4Flag Statement Example
J4Flag P0, 1
J4Flag P(mypoint), 0
190
J4Flag Function
J4Flag Function
Returns the J4Flag attribute of a point.
Syntax
J4Flag [(point)]
Parameters
point
Optional. Point expression. If point is omitted, then the J4Flag setting of the current
robot position is returned.
Return Values
0
/J4F0
1
/J4F1
See Also
Elbow, Hand, Wrist, J4Flag Statement, J6Flag
J4Flag Function Example
Print
Print
Print
Print
J4Flag(pick)
J4Flag(P1)
J4Flag
J4Flag(Pallet(1, 1))
191
J6Flag Statement
J6Flag Statement
>
Syntax
(1) J6Flag point, [value ]
(2) J6Flag
Parameters
point
value
Return Values
The J6Flag attribute specifies the range of values for joint 6 for one point. If value is ommited, the
J6Flag value for the specified point is displayed. When both parameters are omitted, the J6Flag value
is displayed for the current robot position.
See Also
Elbow, Hand, J4Flag, J6Flag Function, Wrist
J6Flag Statement Example
J6Flag P0, 1
J6Flag P(mypoint), 0
192
J6Flag Function
J6Flag Function
Returns the J6Flag attribute of a point.
Syntax
J6Flag [(point)]
Parameters
point
Optional. Point expression. If point is omitted, then the J6Flag setting of the current
robot position is returned.
Return Values
0 - 127
/J6F0 - /J6F127
See Also
Elbow, Hand, Wrist, J4Flag, J6Flag Statement
J6Flag Function Example
Print
Print
Print
Print
J6Flag(pick)
J6Flag(P1)
J6Flag
J6Flag(P1 + P2)
193
JA Function
JA Function
Returns a robot point specified in joint angles.
Syntax
JA(j1, j2, j3, j4, [j5], [j6])
Parameters
j1 - j6
Return Values
A robot point whose location is determined by the specified joint angles.
Description
Use JA to specify a robot point using joint angles.
When the points returned from JA function specify a singularity of the robot, the joint angles of the robot
do not always agree with the joint angles supplied to the JA function as arguments during the execution
of a motion command for the points. To operate the robot using the joint angles specified for the JA
function, avoid a singularity of the robot.
For example:
> go ja(0,0,0,90,0,-90)
> where
WORLD: X: 0.000 mm Y: 655.000 mm Z: 675.000 mm U: 0.000 deg V: -90.000 deg W: -90.000 deg
JOINT: 1: 0.000 deg 2: 0.000 deg 3: 0.000 deg 4: 0.000 deg 5: 0.000 deg 6: 0.000 deg
PULSE: 1:
0 pls 2:
0 pls 3:
0 pls 4:
0 pls 5:
0 pls 6:
0 pls
> go ja(0,0,0,90,0.001,-90)
> where
WORLD: X: -0.004 mm Y: 655.000 mm Z: 675.000 mm U: 0.000 deg V: -90.000 deg W: -89.999 deg
JOINT: 1: 0.000 deg 2: 0.000 deg 3: 0.000 deg 4: 90.000 deg 5: 0.001 deg 6: -90.000 deg
PULSE: 1:
0 pls 2:
0 pls 3:
0 pls 4: 2621440 pls 5:
29 pls 6: -1638400 pls
See Also
AglToPls, XY
JA Function Example
P10 = JA(60, 30, -50, 45)
Go JA(135, 90, -50, 90)
P3 = JA(0, 0, 0, 0, 0, 0)
194
Joint Statement
Joint Statement
Displays the current position for the robot in joint coordinates.
>
Syntax
Joint
See Also
Pulse, Where
Joint Statement Example
>joint
JOINT: 1: -6.905 deg 2: 23.437 deg 3: -1.999 mm 4: -16.529 deg
>
195
JRange Statement
JRange Statement
Defines the permissible working range of the specified joint in pulses.
>
Syntax
JRange jointNumber, lowerLimit, upperLmit
Parameters
jointNumber
Integer expression between 1-6 representing the joint for which JRange will be
specified.
lowerLmit
Long integer expression representing the encoder pulse count position for the lower
limit range of the specified joint.
upperLmit
Long Integer expression representing the encoder pulse count position for the upper
limit range of the specified joint.
Description
Defines the permissible working range for the specified joint with upper and lower limits in encoder
pulse counts. JRange is similar to the Range command. However, the Range command requires
that all joint range limits be set while the JRange command can be used to set each joint working
limits individually thus reducing the number of parameters required. To confirm the defined working
range, use the Range command.
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
Notes
Lower Limits Must Not Exceed Upper Limits:
The Lower limit defined in the JRange command must not exceed the Upper limit. A lower limit in
excess of the Upper limit will cause an error, making it impossible to execute a motion command.
Factors Which can Change JRange:
Once JRange values are set they remain in place until the user modifies the values either by the
Range or JRange commands. Turning controller power off will not change the JRange joint limit
values.
Maximum and Minimum Working Ranges:
Refer to the specifications in the Robot manual for maximum working ranges for each robot model
since these vary from model to model.
See Also
Range, JRange Function
JRange Statement Example
The following examples are done from the Command window:
196
JRange Function
JRange Function
Returns the permissible working range of the specified joint in pulses.
Syntax
JRange(jointNumber, paramNumber)
Parameters
jointNumber
paramNumber
Return Values
Range setting (integer value, pulses) of the specified joint.
See Also
Range, JRange Statement
JRange Function Example
Long i, oldRanges(3, 1)
For i = 0 To 3
oldRanges(i, 0) = JRange(i + 1, 1)
oldRanges(i, 1) = JRange(i + 1, 2)
Next i
197
JS Function
JS Function
Jump Sense detects whether the arm stopped prior to completing a Jump, Jump3, or Jump3CP
instruction which used a Sense input or if the arm completed the move.
Syntax
JS
Return Values
Returns a True or a False.
True : When the arm was stopped prior to reaching its target destination because a Sense
Input condition was met JS returns a True.
False : When the arm completes the normal move and reaches the target destination as
defined in the Jump instruction JS returns a False.
Description
JS is used in conjunction with the Jump and Sense instructions. The purpose of the JS instruction is
to provide a status result as to whether an input condition (as defined by the Sense instruction) is met
during motion caused by the Jump instruction or not. When the input condition is met, JS returns a
True. When the input condition is not met and the arm reaches the target position, JS returns a False.
JS is simply a status check instruction and does not cause motion or specify which Input to check
during motion. The Jump instruction is used to initiate motion and the Sense instruction is used to
specify which Input (if any) to check during Jump initiated motion.
Note
JS Works only with the Most Recent Jump, Jump3, Jump3CP Instruction:
JS can only be used to check the most recent Jump instruction's input check (which is initiated by the
Sense instruction.) Once a 2nd Jump instruction is initiated, the JS instruction can only return the
status for the 2nd Jump instruction. The JS status for the first Jump is gone forever. So be sure to
always do any JS status check for Jump instructions immediately following the Jump instruction to be
checked.
See Also
JT, Jump, Jump3, Jump3CP, Sense
JS Function Example
Function SearchSensor As Boolean
Sense Sw(5) = On
Jump P0
Jump P1 Sense
If JS = TRUE Then
Print "Sensor was found"
SearchSensor = TRUE
EndIf
Fend
198
JT Function
JT Function
Returns the status of the most recent Jump, Jump3, or Jump3CP instruction for the current
robot.
Syntax
JT
Return Values
JT returns a long with the following bits set or clear:
Bit 0
Bit 1
Bit 2
Bit 16
Bit 17
Bit 18
Description
Use JT to determine the status of the most recent Jump command that was stopped before
completion by Sense, Till, abort, etc.
See Also
JS, Jump, Jump3, Jump3CP, Sense, Till
JT Function Example
Function SearchTill As Boolean
Till Sw(5) = On
Jump P0
Jump P1 Till
If JT And 4 Then
Print "Motion stopped during descent"
SearchTill = TRUE
EndIf
Fend
199
JTran Statement
JTran Statement
S
Description
Use JTran to move one joint a specified distance from the current position.
See Also
Go, Jump, Move, Ptran
JTran Statement Example
JTran 1, 20
200
Jump Statement
Jump Statement
Moves the arm from the current position to the specified destination point using
point to point motion by first moving in a vertical direction up, then horizontally and then
finally vertically downward to arrive on the final destination point.
>
Syntax
Jump destination [CarchNumber] [LimZ zLimit ] [CP] [searchExpr] [!...!]
Parameters
destination
archNumber
Optional. The arch number (archNumber) specifies which Arch Table entry to use for
the Arch type motion caused by the Jump instruction. archNumber must always be
proceeded by the letter C. (Valid entries are C0-C7.)
zLimit
Optional. This is a Z limit value which represents the maximum position the Z joint
will travel to during the Jump motion. This can be thought of as the Z Height Ceiling
for the Jump instruction. Any valid Z joint Coordinate value is acceptable.
CP
searchExpr
!...!
Description
Jump moves the arm from the current position to destination using what is called Arch Motion. Jump
can be thought of as 3 motions in 1. For example, when the Arch table entry defined by archNumber is
7, the following 3 motions will occur.
1) The move begins with only Z-joint motion until it reaches the Z joint height calculated by the
Arch number used for the Jump command.
2) Next the arm moves horizontally (while still moving upward in Z) towards the target point
position until the upper Z Limit (defined by LimZ ) is reached. Then the arm begins to move
downward in the Z direction (while continuing X, Y and U joint motion) until the final X, and Y
and U joint positions are reached.
3) The Jump instruction is then completed by moving the arm down with only Z-joint motion until
the target Z-joint position is reached.
The coordinates of destination (the target position for the move) must be taught previously before
executing the Jump instruction. The coordinates cannot be specified in the Jump instruction itself.
Acceleration and deceleration for the Jump is controlled by the Accel instruction. Speed for the move
is controlled by the Speed instruction.
archNumber Details
The Arch for the Jump instruction can be modified based on the archNumber value optionally
specified with the Jump instruction. This allows the user to define how much Z to move before
beginning the X, Y, and U joint motion. (This allows the user to move the arm up and out of the way of
parts, feeders and other objects before beginning horizontal motion.) Valid archNumber entries for the
Jump instruction are between C0-C7. The Arch table entries for C0-C6 are user definable with the
Arch instruction. However, C7 is a special Arch entry which always defines what is called Gate Motion.
Gate Motion means that the robot first moves Z all the way to the coordinate defined by LimZ before
beginning any X, Y, or U joint motion. Once the LimZ Z limit is reached, X, Y and U joint motion
begins. After the X, Y, and U joints each reaches its final destination position, then the Z joint can
begin moving downward towards the final Z joint coordinate position as defined by destination (the
target point). Gate Motion looks as follows:
201
Jump Statement
LIMZ
Origin Pt.
Destination Pt.
Pend
LimZ Details
LimZ zLimit specifies the upper Z coordinate value for the horizontal movement plane in the current
local coordinate system. The specified arch settings can cause the X, Y, and U joints to begin
movement before reaching LimZ, but LimZ is always the maximum Z height for the move. When the
LimZ optional parameter is omitted, the previous value specified by the LimZ instruction is used for the
horizontal movement plane definition.
It is important to note that the LimZ zLimit height limit specification is the Z value for the local robot
coordinate system. It is not the Z value for Arm or Tool. Therefore take the necessary precautions
when using tools or hands with different operating heights.
Sense Details
The Sense optional parameter allows the user to check for an input condition or memory I/O condition
before beginning the final Z motion downward. If satisfied, this command completes with the robot
stopped above the target position where only Z motion is required to reach the target position. It is
important to note that the robot arm does not stop immediately upon sensing the Sense input modifier.
The JS or Stat commands can then be used to verify whether the Sense condition was satisfied and
the robot stopped prior to its target position or that the Sense condition was not satisfied and the robot
continued until stopping at its target position.
Till Details
The optional Till qualifier allows the user to specify a condition to cause the robot to decelerate to a
stop prior to completing the Jump. The condition specified is simply a check against one of the I/O
inputs or one of the memory I/O. This is accomplished through using either the Sw or MemSw function.
The user can check if the input is On or Off and cause the arm to decelerate and stop based on the
condition specified.
The Stat function can be used to verify whether the Till condition has been satisfied and this command
has been completed, or the Till condition has not been satisfied and the robot stopped at the target
position.
202
Jump Statement
Notes
Jump cannot be executed for 6-axis robots
Use Jump3 or Jump3CP for 6-axis robots.
Jump Motion trajectory changes depending on motion and speed
Jump motion trajectory is comprised of vertical motion and horizontal motion. It is not a continuous
path trajectory. The actual Jump trajectory of arch motion is not determined by Arch parameters alone.
It also depends on motion and speed.
Always use care when optimizing Jump trajectory in your applications. Execute Jump with the desired
motion and speed to verify the actual trajectory.
When speed is lower, the trajectory will be lower. If Jump is executed with high speed to verify an
arch motion trajectory, the end effector may crash into an obstacle with lower speed.
In a Jump trajectory, the depart distance increases and the approach distance decreases when the
motion speed is set high. When the fall distance of the trajectory is shorter than the expected, lower
the speed and/or the deceleration, or change the fall distance to be larger.
Even if Jump commands with the same distance and speed are executed, the trajectory is affected by
motion of the robot arms. As a general example, for a SCARA robot the vertical upward distance
increases and the vertical downward distance decreases when the movement of the first arm is large.
When the vertical fall distance decreases and the trajectory is shorter than the expected, lower the
speed and/or the deceleration, or change the fall distance to be larger.
Omitting archNumber Parameter
If the archnum optional parameter is omitted, the default Arch entry for use with the Jump instruction is
C7. This will cause Gate Motion, as described above.
Difference between Jump and Jump3, Jump3CP
The Jump3 and Jump3CP instructions can be used for 6-axis robots. On the other hand the Jump
instruction cannot be used for 6-axis robots. For SCARA robots (including RS series), using the Jump
instruction shortens the joint motion time for depart and approach motion. The depart and approach
motions in Jump3 can be executed along the Z axis and in other directions.
Difference between Jump and Go
The Go instruction is similar to Jump in that they both cause Point to Point type motion, however there
are many differences. The most important difference is that the Go instruction simply causes Point to
Point motion where all joints start and stop at the same time (they are synchronized). Jump is different
since it causes vertical Z movement at the beginning and end of the move. Jump is ideal for pick and
place type applications.
Decelerating to a Stop With the Jump Instruction
The Jump instruction always causes the arm to decelerate to a stop prior to reaching the destination
point.
Proper Speed and Acceleration Instructions with Jump:
The Speed and Accel instructions are used to specify the speed and acceleration of the robot during
Jump motion. Pay close attention to the fact that Speed and Accel apply to point to point type motion
(Go, Jump, Etc.). while linear and circular interpolated motion instructions such as Move or Arc use
the SpeedS and AccelS instructions. For the Jump instruction, it is possible to separately specify
speeds and accelerations for Z joint upward motion, horizontal travel including U joint rotation, and Z
joint downward motion.
203
Jump Statement
Pass function of Jump
When the CP parameter is specified for Jump with 0 downward motion, the Jump horizontal travel
does not decelerate to a stop but goes on smoothly to the next PTP motion.
When the CP parameter is specified for a PTP motion command right before a Jump with 0 upward
motion, the PTP motion does not decelerate to a stop but connects smoothly with the Jump horizontal
travel.
This is useful when you want to replace the horizontal travel of Jump (a PTP motion) with several PTP
motions.
(Example)
P3
Go P1
Jump P2 :Z(-50) C0 LimZ -50 CP
Go P3 :Z(0) CP
Jump P4 C0 LimZ 0
P2
P4
P1
Potential Errors
LimZ Value Not High Enough
When the current arm position of the Z joint is higher than the value set for LimZ and a Jump
instruction is attempted, an Error 4005 will occur.
See Also
Accel, Arc, Arch, Go, JS, JT, LimZ, Point Expression, Pulse, Sense, Speed, Stat, Till
Jump Statement Example
The example shown below shows a simple point to point move between points P0 and P1 and then
moves back to P0 using the Jump instruction. Later in the program the arm moves using the Jump
instruction. If input #4 never goes high then the arm starts the approach motion and moves to P1. If
input #4 goes high then the arm does not execute the approach motion.
Function jumptest
Home
Go P0
Go P1
Sense Sw(4) = On
Jump P0 LimZ -10
Jump P1 LimZ -10 Sense
'Check input #4
If Js(0) = 1 Then
Print "Input #4 came on during the move and"
Print "the robot stopped prior to arriving on"
Print "point P1."
Else
Print "The move to P1 completed successfully."
Print "Input #4 never came on during the move."
EndIf
Fend
> Jump P10+X50 C0 LimZ-20 Sense !D50;On 0;D80;On 1!
204
>
Syntax
(1) Jump3
Parameters
depart
The departure point above the current position using a point expression.
approach
destination
ROT
archNumber
Optional. The arch number (archNumber) specifies which Arch Table entry to use for
the Arch type motion caused by the Jump instruction. archNumber must always be
proceeded by the letter C. (Valid entries are C0-C7.)
CP
LJM
orientationFlag
Optional. Specifies a parameter that selects an orientation flag for LJM function.
searchExpr
!...!
Description
Moves the arm from the current position to the destination point with 3D gate motion. 3D gate motion
consists of depart motion, span motion, and approach motion. The depart motion form the current
position to the depart point is always CP motion. The span motion from the depart point to the start
approach point is PTP motion in Jump3, and the CP motion in Jump3CP.
The approach motion from the starting approach point to the target point is always CP motion.
Span motion
PTP/CP
Depart point
Approach point
Approach motion
CP
Depart
motion
CP
Destination point
Current position
205
Approach distance
ARCH downward
Depart distance
ARCH Upward
Jump3CP uses the SpeedS speed value and AccelS acceleration and deceleration values. Refer to
Using Jump3CP with CP below on the relation between the speed/acceleration and the
acceleration/deceleration. If, however, the ROT modifier parameter is used, Jump3CP uses the
SpeedR speed value and AccelR acceleration and deceleration values. In this case SpeedS speed
value and AccelS acceleration and deceleration value have no effect.
Usually, when the move distance is 0 and only the tool orientation is changed, an error will occur.
However, by using the ROT parameter and giving priority to the acceleration and the deceleration of
the tool rotation, it is possible to move without an error. When there is not an orientational change with
the ROT modifier parameter and movement distance is not 0, an error will occur.
Also, when the tool rotation is large as compared to move distance, and when the rotation speed
exceeds the specified speed of the manipulator, an error will occur. In this case, please reduce the
speed or append the ROT modifier parameter to give priority to the rotational
speed/acceleration/deceleration.
Notes
Jump3 span motion is PTP (point to point)
It is difficult to predict Jump3 span motion trajectory. Therefore, be careful that the robot doesn't
collide with peripheral equipment and that robot arms dont collide with the robot.
Jump3 Motion trajectory changes depending on motion and speed
Jump3 motion trajectory is comprised of depart, span, and approach motions. It is not a continuous
path trajectory. The actual Jump3 trajectory of arch motion is not determined by Arch parameters
alone. It also depends on motion and speed.
Always use care when optimizing Jump3 trajectory in your applications. Execute Jump3 with the
desired motion and speed to verify the actual trajectory.
When speed is lower, the trajectory will be lower. If Jump3 is executed with high speed to verify an
arch motion trajectory, the end effector may crash into an obstacle with lower speed.
In a Jump3 trajectory, the depart distance increases and the approach distance decreases when the
motion speed is set high. When the approach distance of the trajectory is shorter than the expected,
lower the speed and/or the deceleration, or change the approach distance to be larger.
206
(Example 2)
Jump3CP P1,P2,P2 CP
Move P3,P4 CP
Jump3CP P4,P5,P5+tlz(50)
Start
End
207
208
LCase$ Function
LCase$ Function
Returns a string that has been converted to lowercase.
Syntax
LCase$(string)
Parameters
string
Return Values
The converted lower case string.
See Also
LTrim$, Trim$, RTrim$, UCase$
LCase$ Function Example
str$ = "Data"
str$ = LCase$(str$)
209
Left$ Function
Left$ Function
F
count
The number of characters to copy from string starting with the leftmost character.
Return Values
Returns a string of the leftmost number characters from the character string specified by the user.
Description
Left$ returns the leftmost number characters of a string specified by the user. Left$ can return up to
as many characters as are in the character string.
See Also
Asc, Chr$, InStr, Len, Mid$, Right$, Space$, Str$, Val
Left$ Function Example
The example shown below shows a program which takes a part data string as its input and parses out
the part number, part name, and part count.
Function ParsePartData(DataIn$ As String, ByRef PartNum$
ByRef PartName$ As String, ByRef PartCount As Integer)
As
String,
Integer pos
String temp$
pos = Instr(DataIn$, ",")
PartNum$ = Left$(DataIn$, pos - 1)
DataIn$ = Right$(datain$, Len(DataIn$) - pos)
pos = Instr(DataIn$, ",")
PartName$ = Left$(DataIn$, pos - 1)
PartCount = Val(Right$(datain$, Len(DataIn$) - pos))
Fend
Some other example results from the Left$ instruction from the Command window.
> Print Left$("ABCDEFG", 2)
AB
> Print Left$("ABC", 3)
ABC
210
Len Function
Len Function
F
String expression.
Return Values
Returns an integer number representing the number of characters in the string string which was given
as an argument to the Len instruction.
Description
Len returns an integer number representing the number of characters in a string specified by the user.
Len will return values between 0-255 (since a string can contain between 0-255 characters).
See Also
Asc, Chr$, InStr, Left$, Mid$, Right$, Space$, Str$, Val
Len Function Example
The example shown below shows a program which takes a part data string as its input and parses out
the part number, part name, and part count.
Function ParsePartData(DataIn$ As String, ByRef PartNum$
ByRef PartName$ As String, ByRef PartCount As Integer)
As
String,
Integer pos
String temp$
pos = Instr(DataIn$, ",")
PartNum$ = Left$(DataIn$, pos - 1)
DataIn$ = Right$(datain$, Len(DataIn$) - pos)
pos = Instr(DataIn$, ",")
PartName$ = Left$(DataIn$, pos - 1)
PartCount = Val(Right$(datain$, Len(DataIn$) - pos))
Fend
Some other example results from the Len instruction from the command window.
> ? len("ABCDEFG")
7
> ? len("ABC")
3
> ? len("")
0
>
211
LimZ Statement
LimZ Statement
Determines the default value of the Z joint height for Jump commands.
>
Syntax
(1) LimZ zLimit
(2) LimZ
Parameters
zLimit
Return Values
Displays the current LimZ value when parameter is omitted.
Description
LimZ determines the maximum Z joint height which the arm move to when using the Jump instruction,
wherein the robot arm raises on the Z joint, moves in the X-Y plane, then lowers on the Z joint. LimZ
is simply a default Z joint value used to define the Z joint ceiling position for use during motion caused
by the Jump instruction. When a specific LimZ value is not specified in the Jump instruction, the last
LimZ setting is used for the Jump instruction.
Note
Resetting LimZ to 0
Restarting the controller, or executing the SFree, SLock, Motor On commands will initialize LimZ to 0.
LimZ Value is Not Valid for Arm, Tool, or Local Coordinates:
LimZ Z joint height limit specification is the Z joint value for the robot coordinate system. It is not the Z
joint value for Arm, Tool, or Local coordinates. Therefore take the necessary precautions when using
tools or end effectors with different operating heights.
LimZ does not affect Jump3 and Jump3CP
LimZ has no affect on Jump3 or Jump3CP since the span motion is not necessarily perpendicular to
the Z axis of the coordinate system.
See Also
Jump
LimZ Statement Example
The example below shows the use of LimZ in Jump operations.
Function
LimZ
Jump
Jump
Jump
Fend
212
main
-10
'Set the
P1
'Move up
P2 LimZ -20
'Move up
P3
'Move up to
LimZ Function
LimZ Function
Returns the current LimZ setting.
Syntax
LimZ
Return Values
Real number containing the current LimZ setting.
See Also
LimZ Statement
LimZ Function Example
Real savLimz
savLimz = LimZ
LimZ -25
Go pick
LimZ savLimZ
213
>
Syntax
Line Input stringVar$
Parameters
stringVar$
A string variable name. (Remember that the string variable must end with the
$ character.)
Description
Line Input reads input data of one line from the display device and assigns the data to the string
variable used in the Line Input instruction. When the Line Input instruction is ready to receive data
from the user, it causes a "?" prompt to be displayed on the display device. The input data line after
the prompt is then received as the value for the string variable. After inputting the line of data press
the [ENTER] key.
See Also
Input, Input #, Line Input#, ParseStr
Line Input Example
The example below shows the use of Line Input.
Function Main
String A$
Line Input A$
Print A$
Fend
Run the program above using the F5 key or Run menu from EPSON RC+ main
screen. A resulting run session may be as follows:
?A, B, C
A, B, C
214
>
Syntax
Line Input #handle, stringVar$
Parameters
handle
stringVar$
A string variable. (Remember that string variables must end with a $ character.)
Description
Line Input # reads string data of one line from the device specified with the handle parameter, and
assigns the data to the string variable stringVar$.
See Also
Input, Input #, Line Input
Line Input # Example
This example receives the string data from the communication port number 1, and assigns the data to
the string variable A$.
Function lintest
String a$
Print #1, "Please input string to be sent to robot"
Line Input #1, a$
Print "Value entered = ", a$
Fend
215
LJM Function
LJM Function
Returns the point data with the orientation flags converted to enable least joint motion when
moving to a specified point based on the reference point.
Syntax
(3) LJM (Point, [ refPoint, [orientationFlag] ])
Parameters
Point
refPoint
orientationFlag
6-axis robot
RS series
Description
When the 6-axis robot moves to a point calculated by such as pallet or relative offsets, the wrist part
may rotate to an unintended direction. The point calculation above does not depend on robot models
and results in motion without converting the required point flag.
LJM function can be used to convert the point flag to prevent the unintended wrist rotation.
In the same way, when the RS series robot moves to a point calculated by such as pallet or relative
offsets, Arm #1 may rotate to an unintended direction. LJM function can be used to convert the point
flag to prevent the unintended rotation of Arm #1.
In addition, the U axis of an RS series robot may go out of motion range when the orientation flag is
converted, which will cause an error.
To prevent this error, the LJM function adjusts the U axis target angle so that it is inside the motion
range. This is available when 2 is selected for orientationFlag.
Returns the specified point for all robots except the 6-axis and RS series robot.
See Also
Pallet
216
LJM Function
LJM Function Example
Function main
Integer i, j
P0
P1
P2
P3
=
=
=
=
'Point chaeck
217
LoadPoints Statement
LoadPoints Statement
Loads a point file into the point memory area for the current robot.
>
Syntax
LoadPoints fileName [, Merge]
Parameters
fileName
Merge
String expression containing the specific file to load into the current robot's point
memory area. The extension is .PTS appended to the end so no extension is to
be specified by the user. The file must exist in the current project. No path can
be specified.
Optional. If supplied, then the current points are not cleared before loading the
new points. Points in the file are added the to the current points. If a point exists
in the file, it will overwrite the point in memory.
Description
LoadPoints loads point files into the main memory area of the controller.
Use Merge to combine point files. For example, you could have one main point file that includes
common points for locals, parking, etc in the range 0 - 100. Then use Merge to load other point files
for each part being run without clearing the common points. The range could be 101 - 999.
Potential Errors
File Does Not Exist
If fileName does not exist, an error will be issued.
See Also
ClearPoints, SavePoints
LoadPoints Statement Example
Function main
' Load common points for the current robot
LoadPoints "R1Common.pts"
' Merge points for part model 1
LoadPoints "R1Model1.pts", Merge
Fend
218
Local Statement
Local Statement
Defines and displays local coordinate systems.
>
Syntax
(1) Local localNumber, ( pLocal1 : pBase1 ), ( pLocal2 : pBase2 ), [ { L | R } ], [ BaseU ]
(2) Local localNumber, pCoordinateData
(3) Local localNumber, pOrigin, [pXaxis], [pYaxis], [ { X | Y } ]
(4) Local localNumber
Parameters
localNumber
The local coordinate system number. A total of 15 local coordinate systems (of
the integer value from 1 to 15) may be defined.
pLocal1, pLocal2
pBase1, pBase2
L|R
Optional. Align local origin to left (first) or right (second) base points.
BaseU
Optional. When supplied, U axis coordinates are in the base coordinate system.
When omitted, U axis coordinates are in the local coordinate system.
pCoordinateData
Point data representing the coordinate data of the origin and direction.
pOrigin
Integer expression representing the origin point using robot coordinate system.
pXaxis
Optional. Integer expression representing a point along the X axis using robot
coordinate system if X alignment is specified.
pYaxis
Optional. Integer expression representing a point along the Y axis using robot
coordinate system if Y alignment is specified.
X|Y
If X alignment is specified, then pXaxis lies on the X axis of the local. The Y axis
and Z axis are calculated to be orthogonal to X in the plane that is created by the
3 local points. If Y alignment is specified, then pYaxis lies on the Y axis of the
local. The X axis and Z axis are calculated to be orthogonal to Y in the plane
that is created by the 3 local points.
Description
(1) Local defines a local coordinate system by specifying 2 points, pLocal1 and pLocal2, contained in
it that coincide with two points, pBase1 and pBase2, contained in the base coordinate system.
Example:
Local 1, (P1:P11), (P2:P12)
P1 and P2 are local coordinate system points. P11 and P12 are base coordinate system points.
If the distance between the two specified points in the local coordinate system is not equal to that
between the two specified points in the base coordinate system, the XY plane of the local
coordinate system is defined in the position where the midpoint between the two specified points
in the local coordinate system coincides with that between the two specified points in the base
coordinate system.
Similarly, the Z axis of the local coordinate system is defined in the position where the midpoints
coincide with each other.
219
Local Statement
(2) Defines a local coordinate system by specifying the origin and axis rotation angles with respect to
the base coordinate system.
Example:
Local 1, XY(x, y, z, u)
Local 1, XY(x, y, z, u, v, w)
Local 1, P1
(3) Defines a 3D local coordinate system by specifying the origin point, x axis point, and y axis point.
Only the X, Y, and Z coordinates of each point are used. The U, V, and W coordinates are
ignored. When the X alignment parameter is used, then pXaxis is on the X axis of the local and
only the Z coordinate of pYaxis is used. When the Y alignment parameter is used, then pYaxis is
on the Y axis of the local and only the Z coordinate of pXaxis is used.
Example:
Local 1, P1, P2, P3
Local 1, P1, P2, P3, X
Local 1, P1, P2, P3, Y
(4) Displays the specified local settings.
Using L and R parameters
While Local basically uses midpoints for positioning the axes of your local coordinate system as
described above, you can optionally specify left or right local by using the L and R parameters.
Left Local
Left local defines a local coordinate system by specifying point pLocal1 corresponding to point pBase1
in the base coordinate system (Z axis direction is included.)
Right Local
Right local defines a local coordinate system by specifying point pLocal2 corresponding to point
pBase2 in the base coordinate system. (Z axis direction is included.)
Using the BaseU parameter
If the BaseU parameter is omitted, then the U axis of the local coordinate system is automatically
corrected in accordance with the X and Y coordinate values of the specified 4 points. Therefore, the 2
points in the base coordinate system may initially have any U coordinate values.
It may be desired to correct the U axis of the local coordinate system based on the U coordinate
values of the two points in the base coordinate system, rather than having it automatically corrected
(e.g. correct the rotation axis through teaching). To do so, supply the BaseU parameter.
Description
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
See Also
ArmSet, Base, ECPSet, LocalClr, TLSet, Where
220
Local Statement
Local Examples
Here are some examples from the command window:
Left aligned local:
>
>
>
>
>
>
>
p1 = 0, 0, 0, 0/1
p2 = 100, 0, 0, 0/1
p11 = 150, 150, 0, 0
p12 = 300, 150, 0, 0
local 1, (P1:P11), (P2:P12), L
p21 = 50, 0, 0, 0/1
go p21
221
Local Function
Local Function
F
Return Values
Specified local coordinate system data as point data.
See Also
Local Statement
Local Function Example
P1 = Local(1)
222
LocalClr Statement
LocalClr Statement
Clears (undefines) a local coordinate system.
>
Syntax
LocalClr localNumber
Parameters
localNumber
Description
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
See Also
Arm, ArmSet, ECPSet, Local, Tool, TLClr, TLSet
LocalClr Example
LocalClr 1
223
LocalDef Function
LocalDef Function
>
Syntax
LocalDef (localCoordinateNumber)
Parameters
localCoordinateNumber
Return Values
True if the specified local has been defined, otherwise False.
See Also
Arm, ArmClr, ArmSet, ECPSet, Local, LocalClr, Tool, TLClr, TLSet
LocalDef Example
Function DisplayLocalDef(localNum As Integer)
If LocalDef(localNum) = False Then
Print "Local ", localNum, "is not defined"
Else
Print "Local 1: ",
Print Local(localNum)
EndIf
Fend
224
Lof Function
Lof Function
Checks whether the specified RS-232 or TCP/IP port has any lines of data in its buffer.
Syntax
Lof(portNumber)
Parameters
portNumber
Return Values
The number of lines of data in the buffer. If there is no data in the buffer, Lof returns 0.
Description
Lof checks whether or not the specified port has received data lines. The data received is stored in
the buffer irrespective of the Input# instruction.
See Also
ChkCom, ChkNet, Input#
Lof Function Example
This Command window example prints out the number of lines of data received through the
communication port number 1.
>print lof(1)
5
>
225
Long Statement
Long Statement
Declares variables of type long integer. (4 byte whole number).
Syntax
Long varName [(subscripts)] [, varName [(subscripts)]...]
Parameters
varName
subscripts
Description
Long is used to declare variables as type Long. Variables of type Long can contain whole numbers
with values between -2,147,483,648 to 2,147,483,647. Local variables should be declared at the top
of a function. Global and module variables must be declared outside of functions.
See Also
Boolean, Byte, Double, Global, Integer, Real, String
Long Statement Example
The following example shows a simple program which declares some variables as Longs using Long.
Function longtest
Long A(10)
'Single dimension array of long
Long B(10, 10)
'Two dimension array of long
Long C(5, 5, 5) 'Three dimension array of long
Long var1, arrayVar(10)
Long i
Print "Please enter a Long Number"
Input var1
Print "The Integer variable var1 = ", var1
For i = 1 To 5
Print "Please enter a Long Number"
Input arrayVar(i)
Print "Value Entered was ", arrayVar(i)
Next I
Fend
226
LSet$ Function
LSet$ Function
Returns the specified string with trailing spaces appended up to the specified length..
Syntax
LSet$ (string, length)
Parameters
string
length
String expression.
Integer expression for the total length of the string returned.
Return Values
Specified string with trailing spaces appended.
See Also
RSet$, Space$
LSet$ Function Example
temp$ = "123"
temp$ = LSet$(temp$, 10)
"
227
LShift Function
LShift Function
Shifts numeric data to the left by a user specified number of bits.
Syntax
LShift(number, shiftBits)
Parameters
number
shiftBits
Return Values
Returns a numeric result which is equal to the value of number after shifting left shiftBits number of
bits.
Description
LShift shifts the specified numeric data (number) to the left (toward a higher order digit) by the
specified number of bits (shiftBits). The low order bits shifted are replaced by 0.
The simplest explanation for LShift is that it simply returns the result of number * 2shiftBits.
Note
Numeric Data Type:
The numeric data number may be any valid numeric data type. LShift works with data types: Byte,
Integer, Long, and Real.
See Also
And, Not, Or, RShift, Xor
LShift Function Example
Function lshiftst
Integer i
Integer num, snum
num = 1
For i = 1 to 10
Print "i =", i
snum = LShift(num, i)
Print "The shifted num is ", snum
Next i
Fend
Some other example results from the LShift instruction from the command window.
> Print LShift(2,2)
8
> Print LShift(5,1)
10
> Print LShift(3,2)
12
>
228
LTrim$ Function
LTrim$ Function
Returns a string equal to specified string without leading spaces.
Syntax
LTrim$ (string)
Parameters
string
String expression.
Return Values
Specified string with leading spaces removed.
See Also
RTrim$, Trim$
LTrim$ Function Example
str$ = " data "
str$ = LTrim$(str$)
"
229
Mask Operator
Mask Operator
Bitwise mask for Wait statement condition expression.
Syntax
Wait expr1 Mask exrp2
Parameters
expr1
expr2
Description
The Mask operator is a bitwise And for Wait statement input condition expressions.
See Also
Wait
Mask Operator Example
' Wait for the lower 3 bits of input port 0 to equal 1
Wait In(0) Mask 7 = 1
230
MemIn Function
MemIn Function
F
Returns the status of the specified memory I/O port. Each port contains 8 memory bits.
Syntax
MemIn(portNumber)
Parameters
portNumber Integer expression representing memory I/O bytes.
Return Values
Returns an integer value between 0-255. The return value is 8 bits, with each bit corresponding to 1
memory I/O bit.
Description
MemIn provides the ability to look at the value of 8 memory I/O bits at the same time. The MemIn
instruction can be used to store the 8 memory I/O bit status into a variable or it can be used with the
Wait instruction to Wait until a specific condition which involves more than 1 memory I/O bit is met.
Since 8 bits are retrieved at a time, the return value ranges from 0-255. Please review the chart below
to see how the integer return values correspond to individual memory I/O bits.
1
5
15
255
Off
Off
Off
On
Off
Off
Off
On
Off
Off
Off
On
Off
Off
Off
On
Off
Off
On
On
Off
On
On
On
Off
Off
On
On
On
On
On
On
255
Off
Off
Off
On
254
Off
Off
Off
On
253
Off
Off
On
On
252
Off
Off
Off
On
251
Off
Off
Off
On
250
Off
On
Off
On
249
On
On
Off
On
248
On
On
Off
On
Notes
Difference Between MemIn and MemSw
The MemSw instruction allows the user to read the value of 1 memory I/O bit. The return value from
MemSw is either a 1 or a 0 which indicates that the memory I/O bit is either On or Off. MemSw can
check each of the memory I/O bits individually. The MemIn instruction is very similar to the MemSw
instruction in that it also is used to check the status of the memory I/O bits. However there is 1 distinct
difference. The MemIn instruction checks 8 memory I/O bits at a time vs. the single bit checking
functionality of the MemSw instruction. MemIn returns a value between 0-255 which tells the user
which of the 8 I/O bits are On and which are Off.
See Also
In, InBCD, Off, MemOff, On, MemOn, OpBCD, Oport, Out, MemOut, Sw, MemSw, Wait
231
MemIn Function
MemIn Example
The program example below gets the current value of the first 8 memory I/O bits and then makes sure
that all 8 I/O are currently set to 0 before proceeding. If they are not 0 an error message is given to the
operator and the task is stopped.
Function main
Integer var1
var1 = MemIn(0) 'Get 1st 8 memory I/O bit values
If var1 = 0 Then
Go P1
Go P2
Else
Print "Error in initialization!"
Print "First 8 memory I/O bits were not all set to 0"
EndIf
Fend
Other simple examples from the Command window are as follows:
>
>
1
>
>
3
>
>
3
>
>
1
>
232
memout 0, 1
print MemIn(0)
memon 1
print MemIn(0)
memout 31,3
print MemIn(31)
memoff 249
print MemIn(31)
MemInW Function
MemInW Function
Returns the status of the specified memory I/O word port.
Each word port contains 16 memory I/O bits.
Syntax
MemInW(WordPortNum)
Parameters
WordPortNum Integer expression from 0 to 15 representing the memory I/O Word.
Return Values
Returns the current status of the memory I/O (long integers from 0 to 65535).
See Also
MemIn, MemOut, MemOutW
MemInW Function Example
Long word0
word0 = MemInW(0)
233
MemOff Statement
MemOff Statement
Turns Off the specified bit of the memory I/O.
>
Syntax
MemOff { bitNumber | memIOLabel }
Parameters
bitNumber
memIOLabel
Description
MemOff turns Off the specified bit of memory I/O. The 256 memory I/O bits are typically excellent
choices for use as status bits for uses such as On/Off, True/False, Done/Not Done, etc. The MemOn
instruction turns the memory bit On, the MemOff instruction turns it Off, and the MemSw instruction is
used to check the current state of the specified memory bit. The Wait instruction can also be used with
the memory I/O bit to cause the system to wait until a specified memory I/O status is set.
Note
Memory outputs off
All memory I/O bits are turned off when the controller are restarted. They are not turned off by
Emergency stop, safeguard open, program end, Reset command, or EPSON RC+ restart.
See Also
In, MemIn, InBCD, Off, On, MemOn, OpBCD, Oport, Out, MemOut, Sw, MemSw, Wait
MemOff Statement Example
The example shown below shows 2 tasks each with the ability to initiate motion instructions. However,
a locking mechanism is used between the 2 tasks to ensure that each task gains control of the robot
motion instructions only after the other task is finished using them. This allows 2 tasks to each execute
motion statements as required and in an orderly predictable fashion. MemSw is used in combination
with the Wait instruction to wait until the memory I/O #1 is the proper value before it is safe to move
again. MemOn and MemOff are used to turn on and turn off the memory I/O for proper
synchronization.
Function main
Integer I
MemOff 1
Xqt 2, task2
For i = 1 to 100
Wait MemSw(1) = Off
Go P(i)
MemOn 1
Next I
Fend
Function task2
Integer I
For i = 101 to 200
Wait MemSw(1) = On
Go P(i)
MemOff 1
Next I
Fend
234
MemOff Statement
Other simple examples from the command window are as follows:
>
>
1
>
>
0
MemOn 1
'Switch memory I/O bit #1 on
Print MemSw(1)
MemOff 1
'Switch memory I/O bit #1 off
Print MemSw(1)
235
MemOn Statement
MemOn Statement
Turns On the specified bit of the memory I/O.
>
Syntax
MemOn { bitNumber | memIOLabel }
Parameters
bitNumber
memIOLabel
Description
MemOn turns on the specified bit of the robot memory I/O. The 256 memory I/O bits are typically used
as task communication status bits. The MemOn instruction turns the memory bit On, the MemOff
instruction turns it Off, and the MemSw instruction is used to check the current state of the specified
memory bit. The Wait instruction can also be used with the memory bit to cause the system to wait
until a specified status is set.
Note
Memory outputs off
All memory I/O bits are turned off when the controller are restarted. They are not turned off by
Emergency stop, safeguard open, program end, Reset command, or EPSON RC+ restart.
See Also
In, MemIn, InBCD, Off, MemOff, On, OpBCD, Oport, Out, MemOut, Sw, MemSw, Wait
The example shown below shows 2 tasks each with the ability to initiate motion instructions. However, a
locking mechanism is used between the 2 tasks to ensure that each task gains control of the robot motion
instructions only after the other task is finished using them. This allows 2 tasks to each execute motion
statements as required and in an orderly predictable fashion. MemSw is used in combination with the
Wait instruction to wait until the memory I/O #1 is the proper value before it is safe to move again.
MemOn and MemOff are used to turn on and turn off the memory I/O for proper synchronization.
Function main
Integer I
MemOff 1
Xqt 2, task2
For i = 1 to 100
Wait MemSw(1) = Off
Go P(i)
MemOn 1
Next I
Fend
Function task2
Integer I
For i = 101 to 200
Wait MemSw(1) = On
Go P(i)
MemOff 1
Next I
Fend
236
MemOn Statement
Other simple examples from the command window are as follows:
>
>
1
>
>
0
memon 1
print memsw(1)
memoff 1
print memsw(1)
237
MemOut Statement
MemOut Statement
>
Syntax
MemOut portNumber, outData
Parameters
portNumber Integer expression representing memory I/O bit port number. The portNumber selection
corresponds to the following:
outData
Portnum
Outputs
0-7
8-15
Integer expression between 0-255 representing the output pattern for the output group
selected by portNumber. If represented in hexadecimal form the range is from &H0 to
&HFF. The lower digit represents the least significant digits (or the 1st 4 outputs) and the
upper digit represents the most significant digits (or the 2nd 4 outputs).
Description
MemOut simultaneously sets 8 memory I/O bits using the combination of the portNumber and outData
values specified by the user to determine which outputs will be set. The portNumber parameter
specifies which group of 8 outputs to use where portNumber = 0 means outputs 0-7, portNumber = 1
means outputs 8-15, etc.
Once a portNumber is selected, a specific output pattern must be defined. This is done using the
outData parameter. The outData parameter may have a value between 0-255 and may be
represented in hexadecimal or integer format. (i.e. &H0-&HFF or 0-255)
The table below shows some of the possible I/O combinations and their associated outData values
assuming that portNumber is 0, and 1 accordingly.
238
7
Off
Off
Off
Off
Off
Off
Off
Off
On
6
Off
Off
Off
Off
Off
Off
Off
On
On
5
Off
Off
Off
Off
Off
Off
Off
On
On
4
Off
Off
Off
Off
Off
On
On
Off
On
3
Off
Off
Off
On
On
Off
Off
Off
On
2
Off
Off
Off
Off
Off
Off
Off
Off
On
1
Off
On
On
Off
Off
Off
Off
On
On
0
On
Off
On
Off
On
Off
On
On
On
MemOut Statement
15
Off
Off
Off
Off
Off
Off
Off
Off
On
14
Off
Off
Off
Off
Off
Off
Off
On
On
13
Off
Off
Off
Off
Off
Off
Off
On
On
12
Off
Off
Off
Off
Off
On
On
Off
On
11
Off
Off
Off
On
On
Off
Off
Off
On
10
Off
Off
Off
Off
Off
Off
Off
Off
On
9
Off
On
On
Off
Off
Off
Off
On
On
8
On
Off
On
Off
On
Off
On
On
On
See Also
In, MemIn, InBCD, MemOff, MemOn, MemSw, Off, On, OpBCD, Oport, Out, Sw, Wait
MemOut Example
The example below shows main task starting a background task called iotask. The iotask is a simple
task to toggle memory I/O bits 0 - 3 On and Off. The MemOut instruction makes this possible using
only 1 command rather than turning each memory I/O bit on and off individually.
Function main
Xqt 2, iotask
Go P1
.
.
Fend
Function iotask
Do
Wait 1
MemOut 0, &H0
Wait 1
Loop
Fend
Other simple examples from the command window are as follows:
> MemOut 1,6
> MemOut 2,1
> MemOut 3,91
239
MemOutW Statement
MemOutW Statement
Simultaneously sets 16 memory I/O bits.
>
Syntax
MemOutW wordPortNum, outputData
Parameters
wordPortNum
outputData
Description
Changes the current status of memory I/O port group specified by the word port number to the
specified output data.
See Also
MemIn, MemInW, MemOut
MemOutW Example
MemOutW 0, 25
240
MemSw Function
MemSw Function
Returns the status of the specified memory I/O bit.
Syntax
MemSw(bitNumber)
Parameters
bitNumber
Return Values
Returns a 1 when the specified bit is On and a 0 when the specified bit is Off.
Description
MemSw returns the status of one memory I/O bit. Valid entries for MemSw range from bit 0 to bit 511.
MemOn turns the specified bit on and MemOff turns the specified bit Off.
See Also
In, MemIn, InBCD, MemOff, MemOn, MemOut, Off, On, OpBCD, Oport, Out, Sw, Wait
MemSw Example
The example shown below shows 2 tasks each with the ability to initiate motion instructions. However,
a locking mechanism is used between the 2 tasks to ensure that each task gains control of the robot
motion instructions only after the other task is finished using them. This allows 2 tasks to each execute
motion statements as required and in an orderly predictable fashion. MemSw is used in combination
with the Wait instruction to wait until the memory I/O bit 1 is the proper value before it is safe to move
again.
Function main
Integer I
MemOff 1
Xqt 2, task2
For i = 1 to 100
Wait MemSw(1) = Off
Go P(i)
MemOn 1
Next I
Fend
Function task2
Integer I
For i = 101 to 200
Wait MemSw(1) = On
Go P(i)
MemOff 1
Next I
Fend
Other simple examples from the Command window are as follows:
>
>
1
>
>
0
memon 1
print memsw(1)
memoff 1
print memsw(1)
241
Mid$ Function
Mid$ Function
Returns a substring of a string starting from a specified position.
Syntax
Mid$(string, position, [count])
Parameters
string
position
The starting position in the character string for copying count characters.
count
Optional. The number of characters to copy from string starting with the
character defined by position. If omitted, then all characters from position to the
end of the string are returned.
Return Values
Returns a substring of characters from string.
Description
Mid$ returns a substring of as many as count characters starting with the position character in string.
See Also
Asc, Chr$, InStr, Left$, Len, Right$, Space$, Str$, Val
Mid$ Function Example
The example shown below shows a program that extracts the middle 2 characters from the string
"ABCDEFGHIJ" and the remainder of the string starting at position 5.
Function midtest
String basestr$, m1$, m2$
basestr$ = "ABCDEFGHIJ"
m1$ = Mid$(basestr$, (Len(basestr$) / 2), 2)
Print "The middle 2 characters are: ", m1$
m2$ = Mid$(basestr$, 5)
Print "The string starting at 5 is: ", m2$
Fend
242
Mod Operator
Mod Operator
Returns the remainder obtained by dividing a numeric expression by another numeric expression.
Syntax
number Mod divisor
Parameters
number
divisor
Return Values
Returns the remainder after dividing number by divisor.
Description
Mod is used to get the remainder after dividing 2 numbers. The remainder is a whole number. One
clever use of the Mod instruction is to determine if a number is odd or even. The method in which the
Mod instruction works is as follows: number is divided by divisor. The remainder left over after this
division is then the return value for the Mod instruction.
See Also
Abs, Atan, Atan2, Cos, Int, Not, Sgn, Sin, Sqr, Str$, Tan, Val
Mod Operator Example
The example shown below determines if a number (var1) is even or odd. When the number is even
the result of the Mod instruction will return a 0. When the number is odd, the result of the Mod
instruction will return a 1.
Function modtest
....Integer var1, result
....Print "Enter an integer number:"
....Input var1
....result = var1 Mod 2
....Print "Result = ", result
....If result = 0 Then
........Print "The number is EVEN"
....Else
........Print "The number is ODD"
....EndIf
Fend
Some other example results from the Mod instruction from the Command window.
> Print
> 0
36 Mod 6
> Print
> 5
>
25 Mod 10
243
Motor Statement
Motor Statement
Turns motor power for all axes on or off for the current robot.
>
Syntax
Motor ON | OFF
Parameters
ON | OFF
The keyword ON is used to turn the Motor Power on. The keyword OFF is used to turn
Motor Power Off.
Description
The Motor On command is used to turn Motor Power On and release the brakes for all axes. Motor
Off is used to turn Motor Power Off and set the brakes.
In order to move the robot, motor power must be turned on.
After an emergency stop, or after an error has occurred that requires resetting with the Reset
command, execute Reset, and then execute Motor On.
Motor On automatically sets the following items:
Power
Low
Fine
Default values
Speed
Default values
SpeedR
Default values
SpeedS
Default values
Accel
Default values
AccelS
Default values
AccelR
Default values
PTPBoost
Default values
LimZ
0
See Also
Brake, Power, Reset, SFree, SLock
Motor Example
The following examples are done from the command window:
> Motor On
> Motor Off
244
Motor Function
Motor Function
Returns status of motor power for the current robot.
Syntax
Motor
Return Values
0 = Motors off, 1 = Motors on.
See Also
Motor Statement
Motor Function Example
If Motor = Off Then
Motor On
EndIf
245
Move Statement
Move Statement
Moves the arm from the current position to the specified point using linear interpolation
(i.e. moving in a straight line) at a constant tool center point velocity).
>
Syntax
Move destination [ROT] [ECP] [CP] [searchExpr] [!...!]
Parameters
destination
ROT
Optional.
rotation.
ECP
Optional. External control point motion. This parameter is valid when the
ECP option is enabled.
CP
searchExpr
!...!
Description
Move moves the arm from the current position to destination in a straight line. Move coordinates all
axes to start and stop at the same time. The coordinates of destination must be taught previously
before executing the Move instruction. Acceleration and deceleration for the Move is controlled by
the AccelS instruction. Speed for the move is controlled by the SpeedS instruction. If the SpeedS
speed value exceeds the allowable speed for any joint, power to all four joint motors will be turned off,
and the robot will stop.
Move uses the SpeedS speed value and AccelS acceleration and deceleration values. Refer to Using
Move with CP below on the relation between the speed/acceleration and the acceleration/deceleration.
If, however, the ROT modifier parameter is used, Move uses the SpeedR speed value and AccelR
acceleration and deceleration values. In this case SpeedS speed value and AccelS acceleration and
deceleration value have no effect.
Usually, when the move distance is 0 and only the tool orientation is changed, an error will occur.
However, by using the ROT parameter and giving priority to the acceleration and the deceleration of
the tool rotation, it is possible to move without an error. When there is not an orientational change with
the ROT modifier parameter and movement distance is not 0, an error will occur.
Also, when the tool rotation is large as compared to move distance, and when the rotation speed
exceeds the specified speed of the manipulator, an error will occur. In this case, please reduce the
speed or append the ROT modifier parameter to give priority to the rotational
speed/acceleration/deceleration.
When ECP is used, the trajectory of the external control point coresponding to the ECP number
specified by ECP instruction moves straight with respect to the tool coordinate system. In this case,
the trajectory of tool center point does not follow a straight line.
246
Move Statement
TCP
Work
ECP
The optional Till qualifier allows the user to specify a condition to cause the robot to decelerate to a
stop prior to completing the Move. The condition specified is simply a check against one of the inputs.
This is accomplished through using the Sw instruction. The user can check if the input is On or Off
and cause the arm to stop based on the condition specified. This feature works almost like an
interrupt where the Move is interrupted (stopped) once the Input condition is met. If the input
condition is never met during the Move then the arm successfully arrives on the point specified by
destination. For more information about the Till qualifier see the Till command.
Notes
Move Cannot
Move cannot execute range verification of the trajectory prior to starting the move itself. Therefore,
even for target positions that are within an allowable range, it is possible for the system to find a
prohibited position along the way to a target point. In this case, the arm may abruptly stop which may
cause shock and a servo out condition of the arm. To prevent this, be sure to perform range
verifications at low speed prior to using Move at high speeds. In summary, even though the target
position is within the range of the arm, there are some Moves which will not work because the arm
cannot physically make it to some of the intermediate positions required during the Move.
Using Move with CP
The CP parameter causes the arm to move to destination without decelerating or stopping at the point
defined by destination. This is done to allow the user to string a series of motion instructions together
to cause the arm to move along a continuous path while maintaining a specific speed throughout all
the motion. The Move instruction without CP always causes the arm to decelerate to a stop prior to
reaching the point destination destination.
Proper Speed and Acceleration Instructions with Move
The SpeedS and AccelS instructions are used to specify the speed and acceleration of the
manipulator during Move motion. Pay close attention to the fact that SpeedS and AccelS apply to
linear and circular interpolated motion while point to point motion uses the Speed and Accel
instructions.
Potential Errors
Attempt to Change Only Tool Orientation
Changing only tool orientation during the move is impossible. If this is attempted, an error will occur.
In this case, use the ROT parameter.
247
Move Statement
Joint Overspeed Errors
When the motion requested results in the speed of one of the axes to exceed its maximum allowable
speed an overspeed error occurs. In the case of a motor overspeed error, the robot arm is brought to
a stop and servo power is turned off.
Attempt to Pass the Original Point (RS series)
It is impossible to operate the arm of RS series to pass near an original point. If attempted this, an
overspeed error will occur. For the operation near an original point, take the following actions.
z Lower the speed of SpeedS
z Find a different path to prevent an original point
z Use PTP motion such as Go command instead of Move command.
See Also
AccelS, Arc, CP, Go, Jump, Jump3, Jump3CP, SpeedS, Sw, Till
Move Statement Example
The example shown below shows a simple point to point move between points P0 and P1 and then
moves back to P0 in a straight line. Later in the program the arm moves in a straight line toward point
P2 until input #2 turns on. If input #2 turns On during the Move, then the arm decelerates to a stop
prior to arriving on point P2 and the next program instruction is executed.
Function movetest
Home
Go P0
Go P1
Move P2 Till Sw(2) = On
If Sw(2) = On Then
Print "Input #2 came on during the move and"
Print "the robot stopped prior to arriving on"
Print "point P2."
Else
Print "The move to P2 completed successfully."
Print "Input #2 never came on during the move."
EndIf
Fend
This example uses Move with CP. The diagram below shows arc motion which originated at the point
P100 and then moves in a straight line through P101, at which time the arm begins to form an arc.
The arc is then continued through P102 and on to P103. Next the arm moves in a straight line to
P104 where it finally decelerates to a stop. Note that the arm doesn't decelerate between each point
until its final destination of P104. The following function would generate such a motion.
P103
P104
P102
P101
P100
Function CornerArc
Go P100
Move P101 CP
Arc P102, P103 CP
Move P104
Fend
248
MyTask Function
MyTask Function
Returns the task number of the current program.
Syntax
MyTask
Return Values
The task number of the current task. Valid entries are integer numbers 1-16.
Description
MyTask returns the task number of the current program with a numeral. The MyTask instruction is
inserted inside a specific program and when that program runs the MyTask function will return the
task number that the program is running in.
See Also
Xqt
MyTask Function Example
The following program switches On and Off the I/O ports from 1 to 8.
Function main
Xqt 2, task
Xqt 3, task
Xqt 4, task
Xqt 5, task
Xqt 6, task
Xqt 7, task
Xqt 8, task
Call task
Fend
Function task
Do
On MyTask
Off MyTask
'Execute
'Execute
'Execute
'Execute
'Execute
'Execute
'Execute
task
task
task
task
task
task
task
2.
3.
4.
5.
6.
7.
8.
Loop
Fend
249
Next Statement
Next Statement
The For/Next instructions are used together to create a loop where instructions located
between the For and Next instructions are executed multiple times as specified by
the user.
>
Syntax
For var1 = initval To finalval [Step Increment ]
statements
Next var1
Parameters
var1
The counting variable used with the For/Next loop. This variable is normally
defined as an integer but may also be defined as a Real variable.
initval
finalval
The final value of the counter var1. Once this value is met, the For/Next loop is
complete and execution continues starting with the statement following the Next
instruction.
Increment
An optional parameter which defines the counting increment for each time the
Next statement is executed within the For/Next loop. This variable may be
positive or negative. However, if the value is negative, the initial value of the
variable must be larger than the final value of the variable. If the increment value
is left out the system automatically increments by 1.
statements
Any valid SPEL+ statements can be inserted inside the For/Next loop.
Return Values
None
Description
For/Next executes a set of statements within a loop a specified number of times. The beginning of the
loop is the For statement. The end of the loop is the Next statement. A variable is used to count the
number of times the statements inside the loop are executed.
The first numeric expression (initval ) is the initial value of the counter. This value may be positive or
negative as long as the finalval variable and Step increment correspond correctly.
The second numeric expression (finalval ) is the final value of the counter. This is the value which
once reached causes the For/Next loop to terminate and control of the program is passed on to the
next instruction following the Next instruction.
Program statements after the For statement are executed until a Next instruction is reached. The
counter variable (var1) is then incremented by the Step value defined by the increment parameter. If
the Step option is not used, the counter is incremented by one.
The counter variable (var1) is then compared with the final value (finalval). If the counter is less than
or equal to the final value (finalval), the statements following the For instruction are executed again. If
the counter variable is greater than the final value (finalval), execution branches outside of the
For/Next loop and continues with the instruction immediately following the Next instruction.
Nesting of For/Next statements is supported up to 10 levels deep. This means that a For/Next Loop
can be put inside of another For/Next loop and so on and so on until there are 10 "nests" of For/Next
loops.
250
Next Statement
Notes
Negative Step Values
If the value of the Step increment (increment) is negative, the counter variable (var1) is decremented
(decreased) each time through the loop and the initial value (initval) must be greater than the final
value (finalval) for the loop to work.
See Also
For
For/Next Example
Function fornext
Integer ctr
For ctr = 1 to 10
Go Pctr
Next ctr
'
For ctr = 10 to 1 Step -1
Go Pctr
Next ctr
Fend
251
Not Operator
Not Operator
Performs the bitwise complement on the value of the operand.
Syntax
Not operand
Parameters
operand
Integer expression.
Return Values
1s complement of the value of the operand.
Description
The Not function performs the bitwise complement on the value of the operand. Each bit of the result
is the complement of the corresponding bit in the operand, effectively changing 0 bits to 1, and 1 bits
to 0.
See Also
Abs, And, Atan, Atan2, Cos, Int, LShift, Mod, Or, RShift, Sgn, Sin, Sqr, Str$, Tan, Val, Xor
Not Operator Example
This is a simple Command window example on the usage of the Not instruction.
>print not(1)
-2
>
252
Off Statement
Off Statement
Turns Off the specified output and after a specified time can turn it back on.
>
Syntax
Off { bitNumber | outputLabel }, [ time ], [ parallel ] [,Forced]
Parameters
bitNumber
Optional. Specifies a time interval in seconds for the output to remain Off. After the time
interval expires, the Output is turned back on. The minimum time interval is 0.01
seconds and maximum time interval is 10 seconds.
parallel
Optional. When a timer is set, the parallel parameter may be used to specify when the
next command executes:
0 - immediately after the output is turned off
1 - after the specified time interval elapses. (default value)
Forced
Description
Off turns off (sets to 0) the specified output.
If the time interval parameter is specified, the output bit specified by bitNumber is switched off, and
then switched back on after the time interval elapses. If prior to executing Off, the Output bit was
already off, then it is switched On after the time interval elapses.
The parallel parameter settings are applicable when the time interval is specified as follows:
1: Switches the output off, switches it back on after specified interval elapses, then executes the next
command. (This is also the default value for the parallel parameter. If this parameter is omitted, this is
the same as setting the parameter to 1.)
0: Switches the output off, and simultaneously executes the next command.
Notes
Output bits Configured as Remote Control output
If an output bit which was set up as a system output is specified, an error will occur. Remote control
output bits are turned on or off automatically according to system status.
Outputs and When an Emergency Stop Occurs:
EPSON RC+ has a feature which causes all outputs to go off when an E-Stop occurs. This feature is
set or disabled from Setup | Controller | Preferences.
Forced Flag
This flag is used to turn Off the I/O output at Emergency Stop and Safety Door Open from NoPause
task or NoEmgAbort task (special task using NoPause or NoEmgAbort at Xqt).
Be sure that the I/O outputs change by Emergency Stop and Safety Door Open when designing the
system.
See Also
In, InBCD, MemOn, MemOff, MemOut, MemSw, OpBCD, Oport, Out, Wait
253
Off Statement
Off Statement Example
The example shown below shows main task start a background task called iotask. The iotask is a
simple task to turn discrete output bits 1 and 2 on and then off, Wait 10 seconds and then do it again.
Function main
Xqt 2, iotask
Go P1
.
.
.
Fend
Function iotask
Do
On 1
On 2
Off 1
Off 2
Wait 10
Loop
Fend
Other simple examples from the Command window are as follows:
>
>
>
>
254
on 1
off 1, 10
on 2
off 2
OLAccel Statement
OLAccel Statement
Sets up the automatic adjustment of acceleration/deceleration that is adjusted
according to the overload rating.
>
Syntax
OLAccel {On | Off}
Parameters
On | Off
Description
OLAccel can be used to enable the automatic adjustment function of acceleration and
deceleration that is adjusted according to the robot loading rate (OLRate). When OLAccel is On,
the acceleration and deceleration are automatically adjusted in accordance with the robot loading
rate at PTP motion commands. This is done to prevent the over load error by reducing the
acceleration/deceleration automatically when the loading rate is exceeding a certain value at PTP
motion. Heretofore, when users were executing motion with heavy duty that may cause over load
error, users had to stop the robot by the program or adjust the speed and acceleration to prevent
the error. OLAccel statement lessens these measures. However, this statement do not prevent
over load error at all types of cycles. When the cycle has very heavy duty and load, the over load
error may occur. In this case, users need to stop the robot or adjust the speed and acceleration.
In some operation environment, the motor temperature may rise by operating the robot without
over load error and result in over heat error.
This statement is unnecessary at proper load operation.
Use OLRate in the test cycle to check whether the over load error may occur or not.
The OLAccel value initializes to the default values (low acceleration) when any one of the following
conditions occurs:
Controller Power On
Motor On
SFree, SLock
Reset
Stop button or Ctrl + C Key
Notes
If OLAccel On is executed to a robot that does not support the automatic adjustment function of
acceleration and deceleration, an error occurs.
See Also
OLAccel Function, OLRate
255
OLAccel Statement
OLAccel Statement Example
>olrate on
>olrate
OLACCEL is ON
Function main
Motor On
Power High
Speed 100
Accel 100, 100
OLAccel On
Xqt 2, MonitorOLRate
Do
Jump P0
Jump P1
Loop
Fend
Function MonitorOLRate
Do
'Displays OLRate
OLRate
Wait 1
Loop
Fend
256
OLAccel Function
OLAccel Function
Returns the automatic adjustment setting.
Syntax
OLAccel
Return Values
Off = Automatic adjustment of acceleration/deceleration that is adjusted according to the overload
rating is disabled.
On = Automatic adjustment of acceleration/deceleration that is adjusted according to the overload
rating is enabled.
See Also
OLAccel, OLRate
OLAccel Function Example
If OLAccel = Off Then
Print OLAccel is off
EndIf
257
OLRate Statement
OLRate Statement
Display overload rating for one or all joints for the current robot.
>
Syntax
OLRate [jointNumber]
Parameters
jointNumber
Description
OLRate can be used to check whether a cycle is causing stress on the servo system. Factors such
as temperature and current can cause servo errors during applications with high duty cycles. OLRate
can help to check if the robot system is close to having a servo error.
During a cycle, run another task to command OLRate. If OLRate exceeds 1.0 for any joint, then a
servo error will occur.
Servo errors are more likely to occur with heavy payloads. By using OLRate during a test cycle, you
can help insure that the speed and acceleration settings will not cause a servo error during production
cycling.
To get valid readings, you must execute OLRate while the robot is moving.
See Also
OLRate Function
OLRate Statement Example
>olrate
0.10000
0.30000
0.50000
0.20000
0.40000
0.60000
Function main
Power High
Speed 50
Accel 50, 50
Xqt 2, MonitorOLRate
Do
Jump P0
Jump P1
Loop
Fend
Function MonitorOLRate
Do
OLRate
' Display OLRate
Wait 1
Loop
Fend
258
OLRate Function
OLRate Function
Returns overload rating for one joint for the current robot.
Syntax
OLRate(jointNumber)
Parameters
jointNumber
Return Values
Returns the OLRate for the specified joint. Values are between 0.0 and 2.0.
Description
OLRate can be used to check whether a cycle is causing stress on the servo system. Factors such
as temperature and current can cause servo errors during applications with high duty cycles. OLRate
can help to check if the robot system is close to having a servo error.
During a cycle, run another task to command OLRate. If OLRate exceeds 1.0 for any joint, then a
servo error will occur.
Servo errors are more likely to occur with heavy payloads. By using OLRate during a test cycle, you
can help insure that the speed and acceleration settings will not cause a servo error during production
cycling.
To get valid readings, you must execute OLRate while the robot is moving.
See Also
OLRate Statement
OLRate Function Example
Function main
Power High
Speed 50
Accel 50, 50
Xqt 2, MonitorOLRate
Do
Jump P0
Jump P1
Loop
Fend
Function MonitorOLRate
Integer i
Real olRates(4)
Do
For i = 1 to 4
olRates(i) = OLRate(i)
If olRate(i) > .5 Then
Print "Warning: OLRate(", i, ") is over .5"
EndIf
Next i
Loop
Fend
259
On Statement
On Statement
Turns on the specified output and after a specified time can turn it back off.
>
Syntax
On { bitNumber | outputLabel }, [ time ], [ parallel ] [,Forced]
Parameters
bitNumber
Optional. Specifies a time interval in seconds for the output to remain On. After the time
interval expires, the Output is turned back off. (Minimum time interval is 0.01 seconds)
parallel
Optional. When a timer is set, the parallel parameter may be used to specify when the
next command executes:
0 - immediately after the output is turned on
1 - after the specified time interval elapses. (default value)
Forced
Description
On turns On (sets to 1) the specified output.
If the time interval parameter is specified, the output bit specified by outnum is switched On, and then
switched back Off after the time interval elapses.
The parallel parameter settings are applicable when the time interval is specified as follows:
1: Switches the output On, switches it back Off after specified interval elapses, then executes the next
command. (This is also the default value for the parallel parameter. If this parameter is omitted, this is
the same as setting the parameter to 1.)
0: Switches the output On, and simultaneously executes the next command.
Notes
Output bits Configured as remote
If an output bit which was set up as remote is specified, an error will occur. Remote output bits are
turned On or Off automatically according to system status. For more information regarding remote,
refer to the EPSON RC+ User's Guide. The individual bits for the remote connector can be set as
remote or I/O from the EPSON RC+ remote configuration dialog accessible from the setup menu.
Outputs and When an Emergency Stop Occurs
The Controller has a feature which causes all outputs to go off when an E-Stop occurs. This feature is
set or disabled from one of the Option Switches. To configure this go to the Setup | Controller |
Preferences.
Forced Flag
This flag is used to turn On the I/O output at Emergency Stop and Safety Door Open from NoPause
task or NoEmgAbort task (special task using NoPause or NoEmgAbort at Xqt).
Be sure that the I/O outputs change by Emergency Stop and Safety Door Open when designing the
system.
See Also
In, InBCD, MemOff, MemOn, Off, OpBCD, Oport, Out, Wait
260
On Statement
On Statement Example
The example shown below shows main task start a background task called iotask. The iotask is a
simple task to turn discrete output bits 1 and 2 on and then off, Wait 10 seconds and then do it again.
Function main
Xqt iotask
Go P1
.
.
.
Fend
Function iotask
Do
On 1
On 2
Off 1
Off 2
Wait 10
Loop
Fend
Other simple examples from the command window are as follows:
>
>
>
>
on 1
off 1, 10
on 2
off 2
261
OnErr Statement
OnErr Statement
Sets up interrupt branching to cause control to transfer to an error handing subroutine when
an error occurs. Allows users to perform error handling.
Syntax
OnErr GoTo {label | 0}
Parameters
label
Description
OnErr enables user error handling. When an error occurs without OnErr being used, the task is
terminated and the error is displayed. However, when OnErr is used it allows the user to "catch" the
error and go to an error handler to automatically recover from the error. Upon receiving an error,
OnErr branches control to the designated label specified in the EResume instruction. In this way the
task is not terminated and the user is given the capability to automatically handle the error. This makes
work cells run much smoother since potential problems are always handled and recovered from in the
same fashion.
When the OnErr command is specified with the 0 parameter, the current OnErr setting is cleared. (i.e.
After executing OnErr 0, if an error occurs program execution will stop)
See Also
Err, EResume
OnErr Example
The following example shows a simple utility program which checks whether points P0-P399 exist. If
the point does not exist, then a message is printed on the screen to let the user know this point does
not exist. The program uses the CX instruction to test each point for whether or not it has been
defined. When a point is not defined control is transferred to the error handler and a message is
printed on the screen to tell the user which point was undefined.
Function errDemo
Integer i, errNum
OnErr GoTo errHandler
For i = 0 To 399
temp = CX(P(i))
Next i
Exit Function
'
'
'*********************************************
'* Error Handler
*
'*********************************************
errHandler:
errNum = Err
' Check if using undefined point
If errNum = 7007 Then
Print "Point number P", i, " is undefined!"
Else
Print "ERROR: Error number ", errNum, " occurred while"
Print "
trying to process point P", i, " !"
EndIf
EResume Next
Fend
262
OpBCD Statement
OpBCD Statement
>
Simultaneously sets 8 output lines using BCD format. (Binary Coded Decimal )
Syntax
OpBCD portNumber, outData [,Forced]
Parameters
portNumber
outData
Forced
Outputs
0-7
8-15
16-23
24-31
...
Integer expression between 0-99 representing the output pattern for the output group
selected by portNumber. The 2nd digit (called the 1's digit) represents the lower 4
outputs in the selected group and the 1st digit (called the 10's digit) represents the
upper 4 outputs in the selected group.
Optional. Usually omitted.
Description
OpBCD simultaneously sets 8 output lines using the BCD format. The standard and expansion user
outputs are broken into groups of 8. The portNumber parameter for the OpBCD instruction defines
which group of 8 outputs to use where portNumber = 0 means outputs 0-7, portNumber = 1 means
outputs 8-15, etc..
Once a port number is selected (i.e. a group of 8 outputs has be selected), a specific output pattern
must be defined. This is done in Binary Coded Decimal format using the outdata parameter. The
outdata parameter may have 1 or 2 digits. (Valid entries range from 0 to 99.) The 1st digit (or 10's
digit) corresponds to the upper 4 outputs of the group of 8 outputs selected by portNumber. The 2nd
digit (or 1's digit) corresponds to the lower 4 outputs of the group of 8 outputs selected by portNumber.
Since valid entries in BCD format range from 0-9 for each digit, every I/O combination cannot be met.
The table below shows some of the possible I/O combinations and their associated outnum values
assuming that portNumber is 0.
Output Settings (Output number)
Outnum Value
7
6
Off
Off
01
Off
Off
02
Off
Off
03
Off
Off
08
Off
Off
09
Off
Off
10
Off
Off
11
On
Off
99
5
Off
Off
Off
Off
Off
Off
Off
Off
4
Off
Off
Off
Off
Off
On
On
On
3
Off
Off
Off
On
On
Off
Off
On
2
Off
Off
Off
Off
Off
Off
Off
Off
1
Off
On
On
Off
Off
Off
Off
Off
0
On
Off
On
Off
On
Off
On
On
Notice that the Binary Coded Decimal format only allows decimal values to be specified. This means
that through using Binary Coded Decimal format it is impossible to turn on all outputs with the OpBCD
instruction. Please note that the maximum value for either digit for outnum is 9. This means that the
largest value possible to use with OpBCD is 99. In the table above it is easy to see that 99 does not
turn all Outputs on. Instead it turns outputs 0, 3, 4, and 7 On and all the others off.
Notes
263
OpBCD Statement
Difference between OpBCD and Out
The OpBCD and Out instructions are very similar in the SPEL+ language. However, there is one major
difference between the two. This difference is shown below:
- The OpBCD instruction uses the Binary Coded Decimal format for specifying an 8 bit value to use
for turning the outputs on or off. Since Binary Coded Decimal format precludes the values of &HA,
&HB, &HC, &HD, &HE or &HF from being used, all combinations for setting the 8 output group
cannot be satisfied.
- The Out instruction works very similarly to the OpBCD instruction except that Out allows the range
for the 8 bit value to use for turning outputs on or off to be between 0-255 (vs. 0-99 for OpBCD).
This allows all possible combinations for the 8 bit output groups to be initiated according to the
users specifications.
Output bits Configured as Remote:
If an output bit which was set up as remote is specified to be turned on by OpBCD, an error will occur.
Remote output bits are turned On or Off automatically according to system status. For more
information regarding remote, refer to the EPSON RC+ User's Guide. The individual bits for the
remote connector can be set as remote or I/O from the EPSON RC+ remote configuration dialog
accessible from the setup menu.
Outputs and When an Emergency Stop Occurs:
The Controller has a feature which causes all outputs to go off when an E-Stop occurs. This feature is
set or disabled from one of the Option Switches. To configure this go to Setup | Controller |
Preferences.
Forced Flag
This flag is used to turn On the I/O output at Emergency Stop and Safety Door Open from NoPause
task or NoEmgAbort task (special task using NoPause or NoEmgAbort at Xqt).
Be sure that the I/O outputs change by Emergency Stop and Safety Door Open when designing the
system.
See Also
In, InBCD, MemOff, MemOn, MemSw, Off, On, Oport, Out, Sw, Wait
OpBCD Function Example
The example shown below shows main task start a background task called iotask. The iotask is a
simple task to flip flop between turning outputs 1 & 2 on and then outputs 0 and 3 on. When 1 & 2 are
turned on, then 0 & 3 are also turned off and vice versa.
Function main
Xqt 2, iotask
Go P1
.
.
Fend
Function iotask
Do
OpBCD 0, 6
OpBCD 0, 9
Wait 10
Loop
Fend
Other simple examples from the command window are as follows:
> OpBCD 1,6 'Turns on Outputs 1 and 2
> OpBCD 2,1 'Turns on Output 8
> OpBCD 3, 91
'Turns on Output 24, 28, and 31
264
OpenCom Statement
OpenCom Statement
Open an RS-232 communication port.
Syntax
OpenCom #portNumber
Parameters
portNumber Integer expression for port number to open.
Description
The specified RS-232 port must be installed on the controller.
See Also
ChkCom, CloseCom, SetCom
OpenCom Statement Example
OpenCom #1
265
OpenNet Statement
OpenNet Statement
S
One system should open as Server and the other as Client. It does not matter which one executes
first.
See Also
ChkNet, CloseNet, SetNet
OpenNet Statement Example
For this example, two controllers have their TCP/IP settings configured as follows:
Controller #1:
Port: #201
Host Name: 192.168.0.2
TCP/IP Port: 1000
Function tcpip
OpenNet #201 As Server
WaitNet #201
Print #201, "Data from host 1"
Fend
Controller #2:
Port: #201
Host Name: 192.168.0.1
TCP/IP Port: 1000
Function tcpip
String data$
OpenNet #201 As Client
WaitNet #201
Input #201, data$
Print "received '", data$, "' from host 1"
Fend
266
Oport Function
Oport Function
Returns the state of the specified output.
Syntax
Oport(outnum)
Parameters
outnum
Return Values
Returns the specified output bit status as either a 0 or 1.
0: Off status
1: On status
Description
Oport provides a status check for the outputs. It functions much in the same way as the Sw instruction
does for inputs. Oport is most commonly used to check the status of one of the outputs which could
be connected to a feeder, conveyor, gripper solenoid, or a host of other devices which works via
discrete I/O. Obviously the output checked with the Oport instruction has 2 states (1 or 0). These
indicate whether the specified output is On or Off.
Notes
Difference between Oport and Sw
It is very important for the user to understand the difference between the Oport and Sw instructions.
Both instructions are used to get the status of I/O. However, the type of I/O is different between the
two. The Sw instruction works inputs. The Oport instruction works with the standard and expansion
hardware outputs. These hardware ports are discrete outputs which interact with devices external to
the controller.
See Also
In, InBCD, MemIn, MemOn, MemOff, MemOut, MemSw, Off, On, OpBCD, Out, Sw, Wait
267
Oport Function
OPort Function Example
The example shown below turns on output 5, then checks to make sure it is on before continuing.
Function main
TMOut 10
OnErr errchk
Integer errnum
On 5
'Turn on output 5
Wait Oport(5)
Call mkpart1
Exit Function
errchk:
errnum = Err(0)
If errnum = 94 Then
Print "TIME Out Error Occurred during period"
Print "waiting for Oport to come on. Check"
Print "Output #5 for proper operation. Then"
Print "restart this program."
Else
Print "ERROR number ", errnum, "Occurred"
Print "Program stopped due to errors!"
EndIf
Exit Function
Fend
Other simple examples are as follows from the command window:
>
>
1
>
>
0
>
268
On 1
Print Oport(1)
Off 1
Print Oport(1)
Or Operator
Or Operator
Performs a bitwise or logical OR operation on two operands.
Syntax
expr1 Or expr2
Parameters
expr1, exrp2
Return Values
Bitwise OR value of the operands if the expressions are integers. Logical OR if the expressions are
Boolean.
Description
For integer expressions, the Or operator performs the bitwise OR operation on the values of the
operands. Each bit of the result is 1 if one or both of the corresponding bits of the two operands is 1.
For Boolean expressions, the result is True if either of the expressions evaluates to True.
See Also
And, LShift, Mod, Not, RShift, Xor
Or Operator Example
Here is an example of a bitwise OR.
>print 1 or 2
3
Here is an example of a logical OR.
If a = 1 Or b = 2 Then
c = 3
EndIf
269
Out Statement
Out Statement
>
Syntax
Out portNumber, outData [,Forced]
Parameters
portNumber Integer expression representing I/O output bytes. The portnum selection corresponds to
the following outputs:
Portnum
0
1
...
Outputs
0-7
8-15
...
outData
Integer number between 0-255 representing the output pattern for the output group
selected by portNumber. If represented in hexadecimal form the range is from &H0 to
&HFF. The lower digit represents the least significant digits (or the 1st 4 outputs) and the
upper digit represents the most significant digits (or the 2nd 4 outputs).
Forced
Description
Out simultaneously sets 8 output lines using the combination of the portNumber and outdata values
specified by the user to determine which outputs will be set. The portNumber parameter defines
which group of 8 outputs to use where portNumber = 0 means outputs 0-7, portNumber = 1 means
outputs 8-15, etc..
Once a portnum is selected (i.e. a group of 8 outputs has be selected), a specific output pattern must
be defined. This is done using the outData parameter. The outData parameter may have a value
between 0-255 and may be represented in Hexadecimal or Integer format. (i.e. &H0-&HFF or 0255)
The table below shows some of the possible I/O combinations and their associated outData values
assuming that portNumber is 0, and 1 accordingly.
270
7
Off
Off
Off
Off
Off
Off
Off
Off
On
6
Off
Off
Off
Off
Off
Off
Off
On
On
5
Off
Off
Off
Off
Off
Off
Off
On
On
4
Off
Off
Off
Off
Off
On
On
Off
On
3
Off
Off
Off
On
On
Off
Off
Off
On
2
Off
Off
Off
Off
Off
Off
Off
Off
On
1
Off
On
On
Off
Off
Off
Off
On
On
0
On
Off
On
Off
On
Off
On
On
On
Out Statement
15
Off
Off
Off
Off
Off
Off
Off
Off
On
14
Off
Off
Off
Off
Off
Off
Off
On
On
13
Off
Off
Off
Off
Off
Off
Off
On
On
12
Off
Off
Off
Off
Off
On
On
Off
On
11
Off
Off
Off
On
On
Off
Off
Off
On
10
Off
Off
Off
Off
Off
Off
Off
Off
On
9
Off
On
On
Off
Off
Off
Off
On
On
8
On
Off
On
Off
On
Off
On
On
On
Notes
Difference between OpBCD and Out
The Out and OpBCD instructions are very similar in the SPEL+ language. However, there is one major
difference between the two. This difference is shown below:
- The OpBCD instruction uses the Binary Coded Decimal format for specifying 8 bit value to use for
turning the outputs on or off. Since Binary Coded Decimal format precludes the values of &HA, &HB,
&HC, &HD, &HE or &HF from being used, all combinations for setting the 8 output group cannot be
satisfied.
- The Out instruction works very similarly to the OpBCD instruction except that Out allows the range
for the 8 bit value to use for turning outputs on or off to be between 0-255 (vs. 0-99 for OpBCD). This
allows all possible combinations for the 8 bit output groups to be initiated according to the users
specifications.
Forced Flag
This flag is used to turn On the I/O output at Emergency Stop and Safety Door Open from NoPause
task or NoEmgAbort task (special task using NoPause or NoEmgAbort at Xqt).
Be sure that the I/O outputs change by Emergency Stop and Safety Door Open when designing the
system.
See Also
In, InBCD, MemOff, MemOn, MemOut, MemSw, Off, On, Oport, Sw, Wait
Out Example
The example shown below shows main task start a background task called iotask. The iotask is a
simple task to flip flop between turning output bits 0-3 On and then Off. The Out instruction makes
this possible using only 1 command rather than turning each output On and Off individually.
Function main
Xqt iotask
Do
Go P1
Go P2
Loop
Fend
Function iotask
Do
Out 0, &H0F
Out 0, &H00
Wait 10
Loop
Fend
271
Out Statement
Other simple examples from the command window are as follows:
> Out 1,6 'Turns on Outputs 9 & 10
> Out 2,1 'Turns on Output 8
> Out 3,91 'Turns on Outputs 24, 25, 27, 28, and 30
272
Out Function
Out Function
Returns the status of one byte of outputs.
Syntax
Out(portNumber)
Parameters
portNumber
Outputs
0-7
8-15
...
Return Values
The output status 8 bit value for the specified port.
See Also
Out Statement
Out Function Example
Print Out(0)
273
OutReal Statement
OutReal Statement
The output data of real value is the floating-point data (IEEE754 compliant) of 32 bits.
Set the status of output port 2 word (32 bits).
Syntax
OutReal WordPortNumber, OutputData [,Forced]
Parameters
WordPortNumber
OutputData
Specifies the integer expression representing the output data (Real type value).
Forced
Description
Outputs the specified IEEE754 Real value to the output word port specified by word port number and
the following output word port.
Output word lable can be used for the word port number parameter.
Note
Forced Flag
This flag is used to turn On the I/O output at Emergency Stop and Safety Door Open from NoPause
task or NoEmgAbort task (special task initiated by specidying NoPause or NoEmgAbort at Xqt).
Carefully design the system because the I/O output changes by Emergency Stop and Safety Door
Open.
See Also
In, InW, InBCD, InReal, Out, OutW, OpBCD, OutReal Function
OutReal Example
OutReal 0, 2.543
274
OutReal Function
OutReal Function
Retieve the output port status as the 32 bits floating-point data (IEEE754 compliant).
Syntax
OutReal (WordPortNumber)
Parameter
WordPortNumber
Return Values
Returns the specified output port status in 32 bits floating-point data (IEEE754 compliant).
See Also
In, InW, InBCD, InReal, Out, OutW, OpBCD, OutReal
OutReal Function Example
Real rdata01
rdata01 = OutReal(0)
275
OutW Statement
OutW Statement
Simultaneously sets 16 output bits.
Syntax
OutW wordPortNum, outputData [,Forced]
Parameters
wordPortNum
outputData
Forced
Description
Changes the current status of user I/O output port group specified by the word port number to the
specified output data.
Note
Forced Flag
This flag is used to turn On the I/O output at Emergency Stop and Safety Door Open from NoPause
task or NoEmgAbort task (special task initiated by specidying NoPause or NoEmgAbort at Xqt).
Carefully design the system because the I/O output changes by Emergency Stop and Safety Door
Open.
See Also
In, InW, InBCD, InReal, Out, OpBCD, OutReal
OutW Example
OutW 0, 25
276
OutW Function
OutW Function
Returns the status of one word (2 bytes) of outputs.
Syntax
OutW(wordPortNum)
Parameters
wordPortNum
Return Values
The output status 16 bit value for the specified port.
See Also
In, InW, InBCD, InReal, Out, OutW, OpBCD, OutReal
OutW Function Example
Long wdata01
wdata01 = OutW(0)
277
PAgl Function
PAgl Function
Return a joint value from a specified point.
Syntax
PAgl (point, jointNumber)
Parameters
point
jointNumber
Point expression.
Specifies the joint number (integer from 1 to 6) using an expression or numeric
value.
Return Values
Returns the calculated joint position (real value, deg for rotary joint, mm for prismatic joint).
See Also
Agl, CX, CY, CZ, CU, CV, CW, PPls
PAgl Function Example
Real joint1
joint1 = PAgl(P10, 1)
278
Pallet Statement
Pallet Statement
>
Syntax
Pallet [Outside,] [ palletNumber, Pi, Pj, Pk [,Pm ], columns, rows ]
Parameters
Outside
Optional. Allow row and column indexes outside of the range of the specified
rows and columns. Range is from -32768 to 32767.
palletNumber
Pi, Pj, Pk
Pm
Optional. Point variable which is used with Pi, Pj and Pk to define 4 point pallet.
columns
Integer expression representing the number of points on the Pi-to-Pj side of the
pallet. Range is from 1-32767.
rows
Integer expression representing the number of points on the Pi-to-Pk side of the
pallet. Range is from 1-32767.
Return Values
Displays all defined pallets when parameters are omitted.
Description
Defines a pallet by teaching the robot, as a minimum, points Pi, Pj and Pk and by specifying the
number of points from Pi to Pj and from Pi to Pk.
If the pallet is a well ordered rectangular shape, only 3 of the 4 corner points need to be specified.
However, in most situations it is better to use 4 corner points for defining a pallet.
To define a pallet, first teach the robot either 3 or 4 corner points, then define the pallet as follows:
A pallet defined with 4 points: P1, P2, P3 and P4 is shown below. There are 3 positions from P1-P2
and 4 positions from P1-P3. This makes a pallet which has 12 positions total. To define this pallet the
syntax is as follows:
P3
P4
P1
10
11 12
P2
Points that represent divisions of a pallet are automatically assigned division numbers, which, in this
example, begin at P1. These division numbers are also required by the Pallet Function.
When Outside is specified, row and column indexes outside of the range of rows and columns can be
specified. The Outside should be specified by two-dimensional division.
279
Pallet Statement
For example:
Pallet Outside 1, P1, P2, P3, 4, 5
Jump Pallet(1, -2, 10)
-2,10
1,5
2,5
3,5
4,5
1,4
2,4
3,4
4,4
1,3
2,3
3,3
4,3
1,2
2,2
3,2
4,2
1,1
2,1
3,1
4,1
Sample
1,6
-1,4
-1,1
4,6
1,4
2,4
3,4
4,4
1,3
2,3
3,3
4,3
1,2
2,2
3,2
4,2
1,1
2,1
3,1
4,1
1,-1
6,4
6,1
4,-1
Notes
The Maximum Pallet Size
The total number of points defined by a specific pallet must be less than 32,767.
Incorrect Pallet Shape Definitions
Be aware that incorrect order of points or incorrect number of divisions between points will result in an
incorrect pallet shape definition.
Pallet Plane Definition
The pallet plane is defined by the Z axis coordinate values of the 3 corner points of the pallet.
Therefore, a vertical pallet could also be defined.
280
Pallet Statement
Pallet Definition for a Single Row Pallet
A single row pallet can be defined with a 3 point Pallet statement or command. Simply teach a point at
each end and define as follows: Specify 1 as the number of divisions between the same point.
> Pallet 2, P20, P21, P20, 5, 1
'Defines a 51 pallet
See Also
Pallet Function
Pallet Statement Example
The following instruction from the command window sets the pallet defined by P1, P2 and P3 points,
and divides the pallet plane into 15 equally distributed pallet point positions, with the pallet point
number 1, the pallet point number 2 and the pallet point number 3 sitting along the P1-to-P2 side.
> pallet 1, P1, P2, P3, 3, 5
> jump pallet(1, 2)
'Jump to position on pallet
P1
P2
281
Pallet Function
Pallet Function
Specifies a position in a previously defined pallet.
Syntax
(1) Pallet ( palletNumber, palletPosition )
(2) Pallet ( palletNumber, column, row )
Parameters
palletNumber
PalletPosition
column
row
Description
Pallet returns a position in a pallet which was previously defined by the Pallet statement. Use this
function with the Go or the Jump instruction to cause the arm to move the specified pallet position.
The pallet position number can be defined arithmetically or simply by using an integer.
Notes
Pallet Motion of 6-axis Robot
When the 6-axis robot moves to a point calculated by such as pallet or relative offsets, the wrist part
may rotate to an unintended direction. The point calculation above does not depend on robot models
and results in motion without converting the required point flag.
LJM function prevents the unintended wrist rotation.
Pallet Motion of RS series
In the same way as the 6-axis, when the RS series robot moves to a point calculated by such as pallet
or relative offsets, Arm #1 may rotate to an unintended direction. LJM function can be used to convert
the point flag to prevent the unintended rotation of Arm #1.
In addition, the U axis of RS series may go out of the motion range when the orientation flag is
converted, and it causes an error.
To prevent this error, LJM function adjusts the U axis target angle to inside the motion range. It is
available when the orientation flag 2 is selected.
See Also
LJM, Pallet
Pallet Function Example
The following program transfers parts from pallet 1 to pallet 2.
Function main
Integer index
Pallet 1, P1, P2, P3, 3, 5
'Define pallet 1
Pallet 2, P12, P13, P11, 5, 3
'Define pallet 2
For index = 1 To 15
Jump Pallet(1, index)
'Move to point index on pallet 1
On 1
'Hold the work piece
Wait 0.5
Jump Pallet(2, index)
'Move to point index on pallet 2
Off 1
'Release the work piece
Wait 0.5
Next I
Fend
282
Pallet Function
Function main
Integer i, j
P0
P1
P2
P3
=
=
=
=
'Point chaeck
283
Syntax
ParseStr inputString$, tokens$(), delimiters$
numTokens = ParseStr(inputString$, tokens$(), delimiters$)
Parameters
inputString$
tokens$()
delimiters$
Return Values
When used as a function, the number of tokens parsed is returned.
See Also
Redim, String
ParseStr Statement Example
String toks$(0)
Integer i
ParseStr "1 2 3 4", toks$(), " "
For i = 0 To UBound(toks)
Print "token ", i, " = ", toks$(i)
Next i
284
Pass Statement
Pass Statement
Executes simultaneous four joint Point to Point motion, passing near but not through
the specified points.
>
Syntax
Pass point [, {On | Off | MemOn | MemOff} bitNumber [, point ... ]] [LJM [orientationFlag]]
Parameters
point
bitNumber
The I/O output bit or memory I/O bit to turn on or off. Integer number between 0 511 or output label.
LJM
Optional. Convert the depart point, approach point, and target destination using
LJM function.
orientationFlag
Optional. Specifies a parameter that selects an orientation flag for LJM function.
Description
Pass moves the robot arm near but not through the specified point series.
To specify a point series, use points (P0,P1, ...) with commas between points.
To turn output bits on or off while executing motion, insert an On or Off command delimited with
commas between points. The On or Off is executed before the robot reaches the point immediately
preceding the On or Off.
If Pass is immediately followed by another Pass, control passes to the following Pass without the
robot stopping at the preceding Pass final specified point.
If Pass is immediately followed by a motion command other than another Pass, the robot stops at the
preceding Pass final specified point, but Fine positioning will not be executed.
If Pass is immediately followed by a command, statement, or function other than a motion command,
the immediately following command, statement or function will be executed prior to the robot reaching
the final point of the preceding Pass.
If Fine positioning at the target position is desired, follow the Pass with a Go, specifying the target
position as shown in the following example:
Pass P5; Go P5; On 1; Move P10
The larger the acceleration / deceleration values, the nearer the arm moves toward the specified point.
The Pass instruction can be used such that the robot arm avoids obstacles.
With LJM parameter, the program using LJM function can be more simple.
For example, the following four-line program
P11 = LJM(P1, Here, 1)
P12 = LJM(P2, P11, 1)
P13 = LJM(P3, P12, 1)
Pass P11, P12, P13
can be one-line program.
Pass P1, P2, P3 LJM 1
LJM parameter is available for 6-axis and RS series robots.
When using orientationFlag with the default value, it can be omitted.
Pass P1, P2, P3 LJM
285
Pass Statement
See Also
Accel, Go, Jump, Speed
Pass Example
The example shows the robot arm manipulation by Pass instruction:
Function main
Jump P1
Pass P2
'Move the arm toward P2, and perform
'the next instruction before reaching P2.
On 2
Pass P3
Pass P4
Off 0
Pass P5
Fend
286
Pause Statement
Pause Statement
Temporarily stops program execution all tasks for which pause is enabled.
Syntax
Pause
Description
When the Pause instruction is executed, program execution for all tasks with pause enabled (tasks
that do not use NoPause or NoEmgAbort in Xqt command) is suspended. Also, if any task is
executing a motion statement, it will be paused even if pause is not enabled for that task.
Notes
QP and its Affect on Pause
The QP instruction is used to cause the arm to stop immediately upon Pause or to complete the
current move and then Pause the program. See the QP instruction help for more information.
Pause Statement Example
The example below shows the use of the Pause instruction to temporarily stop execution. The task
executes program statements until the line containing the Pause command. At that point the task is
paused. The user can then click the Run Window Continue Button to resume execution.
Function main
Xqt monitor
Go P1
On 1
Jump P2
Off 1
Pause
'Suspend program execution
Go P40
Jump P50
Fend
287
PauseOn Function
PauseOn Function
F
Description
PuseOn function is used only for NoPause and NoEmgAbort task (special task using NoPause or
NoEmgAbort at Xqt).
See Also
ErrorOn, EstopOn, SafetyOn, Xqt
PauseOn Function Example
The following example shows a program that monitors the controller pause and switches the I/O
On/Off when pause occurs. However, when the status changes to pause by Safety Door open, the
I/O does not turn On/Off.
Function main
Xqt PauseMonitor, NoPause
:
:
Fend
Function PauseMonitor
Boolean IsPause
IsPause = False
Do
Wait 0.1
If SafetyOn = On Then
If IsPause = False Then
Print "Saftey On"
IsPause = True
EndIf
ElseIf PauseOn = On Then
If IsPause = False Then
Print "InPause"
If SafetyOn = Off Then
Off 10
On 12
EndIf
IsPause = True
EndIf
Else
If IsPause = True Then
Print "OutPause"
On 10
Off 12
IsPause = False
EndIf
EndIf
Loop
Fend
288
PDef Function
PDef Function
Returns the definition status of a specified point.
Syntax
PDef (point)
Parameters
point
Return Values
True if the point is defined, otherwise False.
See Also
Here Statement, Pdel
PDef Function Example
If Not PDef(1) Then
Here P1
Endif
289
PDel Statement
PDel Statement
>
Description
Deletes specified position data from the controller's point memory for the current robot. Deletes all
position data from firstPointNum up to and including lastPointNum. To prevent Error 2 from occurring,
firstPointNum must be less than lastPointNum.
PDel Example
> p1=10,300,-10,0/L
> p2=0,300,-40,0
> p10=-50,350,0,0
> pdel 1,2
'Delete points 1 and 2
> plist
P10 =
-50.000, 350.000,
0.000,
0.000 /R /0
> pdel 50
'Delete point 50
> pdel 100,200
'Delete from point 100 to point 200
>
290
PLabel Statement
PLabel Statement
Defines a label for a specified point.
>
Syntax
PLabel pointNumber, newLabel
Parameters
pointNumber An integer expression representing a point number.
newLabel
A string expression representing the label to use for the specified point.
See Also
PDef Function, PLabel Function, PNumber Function
PLabel Statement Example
PLabel 1, "pick"
291
PLabel$ Function
PLabel$ Function
Returns the point label associated with a point number.
Syntax
PLabel$(point)
Parameters
point
See Also
PDef Function, PLabel Statement, PNumber Function
PLabel$ Function Example
Print PLabel$(1)
Print PLabel$(P(i))
292
Plane Statement
Plane Statement
Specifies and displays the approach check plane.
>
Syntax
(1) Plane PlaneNum, pCoordinateData
(2) Plane PlaneNum, pOrigin, pXaxis, pYaxis
(3) Plane PlaneNum
(4) Plane
Parameters
PlaneNum
pCoordinateData
Point data representing the coordinate data of the approach check plane.
pOrigin
Integer expression representing the origin point using the robot coordinate
system.
pXaxis
Integer expression representing a point along the X axis using the robot
coordinate system if X alignment is specified.
pYaxis
Integer expression representing a point along the Y axis using the robot
coordinate system if Y alignment is specified.
Return Values
When only PlaneNum is specified, the plane setting of the specified plane is displayed. When all the
parameters are omitted, the plane settings for all plane numbers are displayed.
Description
Plane is used to set the approach check plane. The approach check plane is for checking whether
the robot end effector is in one of the two areas devided by the specified approach check plane. The
position of the end effector is calculated by the current tool. The approach check plane is set using
the XY plane of the base coordinate system. The approach check plane detects the end effector
when it approaches the area on the + Z side of the the approach check plane.
When the approach check plane is used, the system detects approaches in any motor power status
during the controller is ON.
The details of each syntax are as follows.
(1) Specifies a coordinate system to create the approach check plane using the point data
representing the translation and rotation based on the base coordinate system, and sets the
approach check plane.
Example:
Plane 1, XY(x, y, z, u, v, w)
Plane 1, P1
(2) Defines the approach check plane (XP coordinate) by specifying the orgin point, point along the X
axis, and point along the Y axis. Uses the X, Y, Z coordinates and ignores U, V, W coordinates.
Calculates the Z axis in righty and sets the approach checking direction.
Example:
Plane 1, P1, P2, P3
(3) Displays the setting of the specified approach check plane.
(4) Displays all the approach check plane.
293
Plane Statement
You can use InsidePlane function to get the result of the approach check plane. InsidePlane can be
used for wait condition of Wait command. You can provide the detection result to the I/O by setting
the remote output setting.
Coordinate system of
approach check plane
Robot
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
Notes
Tool Selection
The approach check is executed for the current tool. When you change the tool, the approach check
may display the tool approach from inside to outside of the plane or the other way although the robot
is not operating.
See Also
Box, InsidePlane, PlaneClr, PlaneDef
Tip
Set Plane statement from Robot Manager
EPSON RC+ 5.0 has a point and click dialog box for defining the approach check plane. The simplest
method to set the Plane values is by using the Plane page on the Robot Manager .
Plane Statement Example
These are examples to set the approach check plane using Plane statement.
Check direction is the lower side of the horizontal plane that is 20 mm in Z axis direction in the robot
coordinate system:
> plane 1, xy(100, 200, -20, 90, 0, 180)
Approach check plane is the XY coordinate created by moving 50 mm in X axis and 200 mm in Y axis,
rotating 45 degrees around Y axis
> plane 2, xy(50, 200, 0, 0, 45, 0)
Set the approach check plane using the tool coordinate system of the robot. (6-axis robot)
> plane 3, here
294
Plane Function
Plane Function
Returns the specified approach check plane.
Syntax
Plane(PlaneNum)
Parameters
PlaneNum
Return Values
Returns coordinate data for specified approach check plane.
See Also
InsidePlane, Plane, PlaneClr, PlaneDef
Plane Function Example
P1 = Plane(1)
295
PlaneClr Statement
PlaneClr Statement
Clears (undifines) the Plane definition.
>
Syntax
PlaneClr PlaneNum
Parameters
PlaneNum
Description
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
See Also
Box, InsidePlane, Plane, PlaneDef
PlaneClr Statement Example
PlaneClr 1
296
PlaneDef Function
PlaneDef Function
Returns the setting of the approach check plane.
Syntax
PlaneDef(PlaneNum)
Parameters
PlaneNum
Return Values
True if approach detection plane is defined for the specified plane number, otherwise False.
See Also
Box, InsidePlane, Plane, PlaneClr
PlaneDef Function Example
Function DisplayPlaneDef(planeNum As Integer)
If PlaneDef(planeNum) = False Then
Print "Plane ", planeNum, "is not defined"
Else
Print "Plane 1: ",
Print Plane(PlaneNum)
EndIf
Fend
297
PList Statement
PList Statement
>
startPoint
endPoint
Return Values
Point data.
Description
Plist displays point data in memory for the current robot.
When there is no point data within the specified range of points, no data will be displayed.
When a start point number is specified larger than the end point number, then an error occurs.
(1) PList
Displays the coordinate data for all points.
(2) PList pointIndex
Displays the coordinate data for the specified point.
(3) PList startPoint,
Displays the coordinate data for all points starting with startPoint.
(4) PList startPoint, endPoint
Displays the coordinate data for all points starting with startPoint and ending with endPoint.
PList Example
This example displays the point data of the current arm position for the current robot.
> plist
WORLD:
JOINT:
PULSE:
*
X:
1:
1:
360.000 mm Y:
0.000 deg 2:
0 pls 2:
10.000 mm Z:
0.000 deg 3:
0 pls 3:
0.000 mm U:
0.000 mm 4:
0 pls 4:
0.000 deg
0.000 deg
0 pls
298
0.000,
-20.000,
0.000 /R /0
PList Statement
This example displays the point data within the range of 10 and 20. In this example, only three points
are found in this range.
> plist 10, 20
P10 =
290.000,
P12 =
300.000,
P20 =
285.000,
>
0.000,
0.000,
10.000,
-20.000,
0.000,
-30.000,
0.000 /R /0
0.000 /R /0
45.000 /R /0
This example displays the point data starting with point number 10.
> plist 10,
P10 =
290.000,
P12 =
300.000,
P20 =
285.000,
P30 =
310.000,
>
0.000,
0.000,
10.000,
20.000,
-20.000,
0.000,
-30.000,
-50.000,
0.000
0.000
45.000
90.000
/R
/R
/R
/R
/0
/0
/0
/0
299
PLocal Statement
PLocal Statement
>
Syntax
PLocal(point) = localNumber
Parameters
point
localNumber
See Also
PLocal Function
PLocal Statement Example
PLocal(pick) = 1
300
PLocal Function
PLocal Function
Returns the local number for a specified point.
Syntax
PLocal(point)
Parameters
point
Return Values
Local number for specified point.
See Also
PLocal Statement
PLocal Function Example
Integer localNum
localNum = PLocal(pick)
301
Pls Function
Pls Function
Returns the current encoder pulse count for each joint at the current position.
Syntax
Pls(jointNumber)
Parameters
jointNumber
The specific joint for which to get the current encoder pulse count.
Return Values
Returns a number value representing the current encoder pulse count for the joint specified by
jointNumber.
Description
Pls is used to read the current encoder position (or Pulse Count) of each joint. These values can be
saved and then used later with the Pulse command.
See Also
CX, CY, CZ, CU, CV, CW, Pulse
Pls Function Example
Shown below is a simple example to get the pulse values for each joint and print them.
Function plstest
Real t1, t2, z, u
t1 = pls(1)
t2 = pls(2)
z = pls(3)
u = pls(4)
Print "T1 joint current Pulse Value: ", t1
Print "T2 joint current Pulse Value: ", t2
Print "Z joint current Pulse Value: ", z
Print "U joint current Pulse Value: ", u
Fend
302
PNumber Function
PNumber Function
Returns the point number associated with a point label.
Syntax
PNumber(pointLabel)
Parameters
pointLabel
A point label used in the current point file or string expression containing a point label.
See Also
PDef Function, PLabel$ Function
PNumber Function Example
Integer pNum
String pointName$
pNum = PNumber(pick)
pNum = PNumber("pick")
pointName$ = "place"
pNum = PNumber(pointName$)
303
Point Assignment
Point Assignment
Defines a robot point by assigning it to a point expression.
>
Syntax
point = pointExpr
Parameters
point
pointExpr
Description
Define a robot point by setting it equal to another point or point expression.
See Also
Local, Pallet, PDef, PDel, Plist
Point Assignment Example
The following examples are done from the command window:
Subtract 50 from Y coordinate of P2, substitute -30 for Z coordinate, and define the resulting point P4
as right arm posture:
>P4=P2 -Y(50) :Z(-30) /R
304
Point Expression
Point Expression
Specifies a robot point for assignment and motion commands.
>
Syntax
point [ { + | - } point ] [local] [hand] [elbow] [wrist] [j4flag] [j6flag] [j1flag] [j2flag] [relativeOffsets]
[absoluteCoords]
Parameters
point
local
hand
Optional for SCARA robot (including RS series) and 6-axis robots. Specify /L or /R
for lefty or righty hand orientation.
elbow
wrist
Optional for 6-axis robots. Specify /F or /NF for flip or no flip orientation.
j4flag
j6flag
j1flag
j2flag
relativeOffsets
absoluteCoords
Description
Point expressions are used in point assignment statements and motion commands.
You can add or subtract points if direct coordinates are not used. For example:
Go P1 + P2
P1 = P2 + XY(100, 100, 0, 0)
Using relative offsets
You can offset one or more coordinates relative to the base point. For example, the following
statement moves the robot 20 mm in the positive X axis from the current position:
Go Here +X(20)
If you execute the same statement again, the robot will move an additional 20 mm along the X axis,
because this is a relative move.
305
Point Expression
You can also use relative tool offsets:
Go Here +TLX(20) -TLY(5.5)
When the 6-axis robot moves to a point calculated by such as pallet or relative offsets, the wrist part
may rotate to an unintended direction. The point calculation above does not depend on robot models
and results in motion without converting the required point flag.
LJM function prevents the unintended wrist rotation.
Go LJM(Here +X(20))
Using absolute coordinates
You can change one or more coordinates of the base point by using absolute coordinates. For
example, the following statement moves the robot to the 20 mm position on the X axis:
Go Here :X(20)
If you execute the same statement again, the robot will not move because it is already in the absolute
position for X from the previous move.
Relative offsets and absolute coordinates make is easy to temporarily modify a point. For example,
this code moves quickly above the pick point by 10 mm using a relative offset for Z or 10 mm, then
moves slowly to the pick point.
Speed fast
Jump pick +Z(10)
Speed slow
Go pick
This code moves straight up from the current position by specifying an absolute value of 0 for the Z
joint:
LimZ 0
Jump Here :Z(0)
Using Locals
You can specify a local number using a forward slash or at sign. Each has a separate function.
Use the forward slash to mark the coordinates in a local. For example, adding a /1 in the following
statement says that P1 will be at location 0,0,0,0 in local 1.
P1 = XY(0, 0, 0, 0) /1
Use the at sign to translate the coordinates into local coordinates. For example, here is how to teach
a point in a local:
P1 = Here @1
306
Point Expression
Point Expression Example
Here are some examples of using point expressions in assignments statements and motion
commands:
P1 = XY(300,200,-50,100)
P2 = P1 /R
P3 = pick /1
P4 = P5 + P6
P(i) = XY(100, 200, CZ(P100), 0)
Go P1 -X(20) :Z(-20) /R
Go Pallet(1, 1) -Y(25.5)
Move pick /R
Jump Here :Z(0)
Go Here :Z(-25.5)
Go JA(25, 0, -20, 180)
pick = XY(100, 100, -50, 0)
P1 = XY(300,200,-50,100, -90, 0)
P2 = P1 /F /B
P2 = P1 +TLV(25)
307
PosFound Function
PosFound Function
F
308
Power Statement
Power Statement
>
Previously Called - Lp
Switches Power Mode to high or low and displays the current status.
Power Syntax
(1) Power { High | Low }
(2) Power
Parameters
High | Low The setting can be High or Low. The default is Low.
Return Values
Displays the current Power status when parameter is omitted.
Description
Switches Power Mode to High or Low. It also displays the current mode status.
Low - When Power is set to Low, Low Power Mode is On. This means that the robot will run slow
(below 250 mm/sec) and the servo stiffness is set light so as to remove servo power if the robot
bumps into an object. This is the normal mode of operation for teaching points.
High - When Power is set to High, Low Power Mode is Off. This means that the robot can run at full
speed with the full servo stiffness. This is the normal mode of operation for running actual
applications.
The following operations will switch to low power mode. In this case, speed and acceleration settings
will be limited to low values.
Power
Low
Values Limited
Speed
Accel
SpeedS
AccelS
Notes
Low Power Mode (Power Low) and Its Effect on Max Speed:
In low power mode, motor power is limited, and effective motion speed setting is lower than the default
value. If, when in Low Power mode, a higher speed is specified from the Command window (directly)
or in a program, the speed is set to the default value. If a higher speed motion is required, set Power
High.
High Power Mode (Power High) and Its Effect on Max Speed:
In high power mode, higher speeds than the default value can be set.
309
Power Statement
See Also
Accel, AccelS, Speed, SpeedS
Power Example
The following examples are executed from the command window:
310
> Speed 50
> Jump P1
> Speed
Low Power Mode
50
50
50
> Accel
Low Power
100
100
100
> Jump P2
Power Function
Power Function
Returns status of power.
Syntax
Power
Return Values
0 = Power Low, 1 = Power High.
See Also
Power Statement
Power Function Example
If Power = 0 Then
Print "Low Power Mode"
EndIf
311
PPls Function
PPls Function
Return the pulse position of a specified joint value from a specified point.
Syntax
PPls (point, jointNumber)
Parameters
point
jointNumber
Point expression.
Specifies the joint number (integer from 1 to 6) using an expression or numeric
value.
Return Values
Returns the calculated joint position (long value, in pulses).
See Also
Agl, CX, CY, CZ, CU, CV, CW, Pagl
PPls Example
Long pulses1
pulses1 = PPls(P10, 1)
312
Print Statement
Print Statement
Outputs data to the current display window, including the Run window, Operator window,
Command window, and Macro window.
>
Syntax
Print expression [ , expression... ] [ , ]
Print
Parameters
expression
, (comma)
Return Values
Variable data or the specified character string.
Description
Print displays variable data or the character string on the display device.
An end of line CRLF (carriage return and line feed) is automatically appended to each output unless a
comma is used at the end of the statement.
Notes
Make Sure Print is used with Wait or a motion within a loop
Tight loops (loops with no Wait or no motion) are generally not good, especially with Print.
The controller may freeze up in the worst case.
Be sure to use Print with Wait command or a motion command within a loop.
Bad example
Do
Print "1234"
Loop
Good example
Do
Print "1234"
Wait 0.1
Loop
See Also
Print #
Print Statement Example
The following example extracts the U Axis coordinate value from a Point P100 and puts the coordinate
value in the variable uvar. The value is then printed to the current display window.
Function test
Real uvar
uvar = CU(P100)
Print "The U Axis Coordinate of P100 is ", uvar
Fend
313
Print # Statement
Print # Statement
Outputs data to the specified communications port or device.
>
Syntax
Print #portNumber, expression [ , expression... ]
Parameters
portNumber
expression
, (comma)
Optional. If a comma is provided at the end of the statement, then a CRLF will
not be added.
Description
Print # outputs variable data, numerical values, or character strings to the communication port or the
device specified by portNumber .
See Also
Print
Print # Example
The following are some simple Print # examples:
Function printex
String temp$
Print #1, "5"
'send the character "5" to serial port 1 temp$ =
"hello"
Print #1, temp$
Print #2, temp$
Print #1 " Next message for port 1"
Print #2 " Next message for port 2"
Fend
314
PTCLR Statement
PTCLR Statement
Clears and intializes the peak torque for one or more joints.
>
Syntax
PTCLR [j1], [j2], [j3], [j4], [j5], [j6]
Parameters
j1 - j6
Description
PTCLR clears the peak torque values for the specified joints.
0.118
0.083
0.000
315
PTPBoost Statement
PTPBoost Statement
Specifies or displays the acceleration, deceleration and speed algorithmic boost
parameter for small distance PTP (point to point) motion.
>
Syntax
(1) PTPBoost boost, [departBoost], [approBoost]
(2) PTPBoost
Parameters
boost
departBoost
approBoost
Return Values
When parameters are omitted, the current PTPBoost settings are displayed.
Description
PTPBoost sets the acceleration, deceleration and speed for small distance PTP motion. It is effective
only when the motion distance is small. The PTPBoostOK function can be used to confirm whether or
not a specific motion distance to the destination is small enough to be affected by PTPBoost or not.
PTPBoost does not need modification under normal circumstances. Use PTPBoost only when you
need to shorten the cycle time even if vibration becomes larger, or conversely when you need to
reduce vibration even if cycle time becomes longer.
When the PTPBoost value is large, cycle time becomes shorter, but the positioning vibration
increases. When PTPBoost is small, the positioning vibration becoms smaller, but cycle time
becomes longer. Specifying inappropriate PTPBoost causes errors or can damage the manipulator.
This may degrade the robot, or sometimes cause the manipulator life to shorten.
The PTPBoost value initializes to its default value when any one of the following is performed:
Controller Power On
Motor On
SFree, SLock
Reset
Stop button or Ctrl + C Key
See Also
PTPBoost Function, PTPBoostOK
PTPBoost Statement Example
PTPBoost 50, 30, 30
316
PTPBoost Function
PTPBoost Function
Returns the specified PTPBoost value.
Syntax
PTPBoost(paramNumber)
Parameters
paramNumber
Return Values
Integer value from 0 - 100.
See Also
PTPBoost Statement, PTPBoostOK
317
PTPBoostOK Function
PTPBoostOK Function
Returns whether or not the PTP (Point to Point) motion from a current position to a target
position is a small travel distance.
Syntax
PTPBoostOK(targetPos)
Parameters
targetPos
Return Values
True if is it possible to move to the target position from the current position using PTP motion,
otherwise False.
Description
Use PTPBoostOK to the distance from the current position to the target position is small enough for
PTPBoost to be effective.
See Also
PTPBoost
PTPBoostOK Function Example
If PTPBoostOK(P1) Then
PTPBoost 50
EndIf
Go P1
318
PTPTime Function
PTPTime Function
Returns the estimated time for a point to point motion command without executing it.
Syntax
(1) PTPTime(destination, destArm, destTool)
(2) PTPTime(start, startArm, startTool, destination, destArm, destTool)
Parameters
start
destTool
startArm
startTool
Return Values
Real value in seconds.
Description
Use PTPTime to calculate the time it would take for a point to point motion command (Go). Use
syntax 1 to calculate time from the current position to the destination. Use syntax 2 to calculate time
from a start point to a destination point.
The actual motion operation is not performed when this function is executed. The current position,
arm, and tool settings do not change.
If the position is one that cannot be arrived at or if the arm or tool settings are incorrect, 0 is returned.
See Also
ATRQ, Go, PTRQ
PTPTime Function Example
Real secs
secs = PTPTime(P1, 0, 0, P2, 0, 1)
Print "Time to go from P1 to P2 is:", secs
Go P1
secs = PTPTime(P2, 0, 1)
Print "Time to go from P1 to P2 is:", secs
319
PTran Statement
PTran Statement
Perform a relative move of one joint in pulses.
Syntax
PTran joint, pulses
Parameters
joint
pulses
Description
Use PTran to move one joint a specified number of pulses from the current position.
See Also
Go, JTran, Jump, Move
PTran Statement Example
PTran 1, 2000
320
PTRQ Statement
PTRQ Statement
Displays the peak torque for the specified joint.
>
Syntax
PTRQ [jointNumber]
Parameters
jointNumber
Return Values
Displays current peak torque values for all joints.
Description
Use PTRQ to display the peak torque value for one or all joints since the PTCLR statement was
executed.
0.118
0.083
0.000
321
PTRQ Function
PTRQ Function
Returns the peak torque for the specified joint.
Syntax
PTRQ(jointNumber)
Parameters
jointNumber Integer expression representing the joint number.
Return Values
Real value from 0 to 1.
See Also
ATRQ, PTCLR, PTRQ Statement
PTRQ Function Example
This example uses the PTRQ function in a program:
Function DisplayPeakTorque
Integer i
Print "Peak torques:"
For i = 1 To 4
Print "Joint ", i, " = ", PTRQ(i)
Next i
Fend
322
Pulse Statement
Pulse Statement
Moves the robot arm using point to point motion to the point specified by the pulse
values for each joint.
>
Syntax
(1) Pulse J1, J2, J3, J4 , [J5] , [J6]
(2) Pulse
Parameters
J1, J2, J3, J4
J5, J6
The pulse value for each of the first four joints. The pulse value has to be within
the range defined by the Range instruction and should be an integer or long
expression.
Optional. For use with 6-axis robots.
Return Values
When parameters are omitted, the pulse values for the current robot position are displayed.
Description
Pulse uses the joint pulse value from the zero pulse position to represent the robot arm position,
rather than the orthogonal coordinate system. The Pulse instruction moves the robot arm using Point
to Point motion.
The Range instruction sets the upper and lower limits used in the Pulse instruction.
Note
Make Sure Path is Obstacle Free Before Using Pulse
Unlike Jump, Pulse moves all axes simultaneously, including Z joint raising and lowering in traveling
to the target position. Therefore, when using Pulse, take extreme care so that the hand can move
through an obstacle free path.
Potential Errors
Pulse value exceeds limit:
If the pulse value specified in Pulse instruction exceeds the limit set by the Range instruction, an error
will occur.
See Also
Go, Accel, Range, Speed, Pls, Pulse Function
Pulse Statement Example
Following are examples on the Command window:
This example moves the robot arm to the position which is defined by each joint pulse.
> pulse 16000, 10000, -100, 10
This example displays the pulse numbers of 1st to 4th axes of the current robot arm position.
> pulse
PULSE: 1:
>
27306 pls 2:
11378 pls 3:
-3072 pls 4:
1297 pls
323
Pulse Function
Pulse Function
Returns a robot point whose coordinates are specified in pulses for each joint.
Syntax
Pulse ( J1, J2, J3, J4 , [J5] , [J6] )
Parameters
J1, J2, J3, J4
J5, J6
The pulse value for joints 1 to 4. The pulse value must be within the range
defined by the Range instruction and should be an integer or long expression.
Optional. For use with 6-axis robots.
Return Values
A robot point using the specified pulse values.
See Also
Go, JA, Jump, Move, Pulse Statement, XY
Pulse Function Example
Jump Pulse(1000, 2000, 0, 0)
324
QP Statement
QP Statement
Switches Quick Pause Mode On or Off and displays the current mode status.
>
Syntax
(1) QP { On | Off }
(2) QP
Parameters
On | Off
Return Values
Displays the current QP mode setting when parameter is omitted.
Description
If during motion command execution either the Pause switch is pressed, or a pause signal is input to
the controller, quick pause mode determines whether the robot will stop immediately, or will Pause
after having executed the motion command.
325
QPDecelR Statement
QPDecelR Statement
Sets the deceleration speed of quick pause for the change of tool orientation
during the CP motion.
>
Syntax
(1) QPDecelR QPDecelR
(2) QPDecelR
Parameters
QPDecelR
Real value representing the deceleration speed of quick pause during the CP
motion (deg/sec2).
Result
If omitted the parameter, the current QPDecelR set value will be displayed.
Description
QPDecelR statement is enabled when the ROT parameter is used in the Move, Arc, Arc3, BMove,
TMove, and Jump3CP statements.
While quick pause is executed in these statements, a joint acceleration error may occur. This is
because the deceleration speed of quick pause that is automatically set in a normal quick pause is
over the joint allowable deceleration speed. Specifically, the error is likely to occur when the AccelR
value in the CP motion is too high or jogging the robot near a singularity. In these cases, use the
QPDecelR and set a lower quick pause deceleration speed. But if the setting is too low, the distance
for quick pause will increase. Therefore, set the possible value. Normally, you dont need to set
QPDecelR.
You cannot use values lower than the deceleration speed of orientation change in the CP motion set
with QPDecelR and AccelR. If you do, a parameter out of range error occurs.
Also, after you set QPDecelR, if a higher value than the set QP deceleration speed is set with the
AccelR, the QPDecelR will automatically set the QP deceleration speed same as the decleration
speed set with the AccelR.
The QPDecelR Statement value initializes to the default max deceleration speed when any one of
the following conditions occurs:
Controller Startup
Motor On
SFree, SLock, Brake
Reset, Reset Error
Stop button or QuitAll stops tasks
See Also
QPDecelR function, QPDecelS, AccelR
QPDecelR Example
The following program sets the QPDecelR of the Move statement.
Function QPDecelTest
AccelR 3000
QPDecelR 4000
SpeedR 100
Move P1 ROT
.
.
.
Fend
326
QPDecelR Function
QPDecelR Function
Returns the set deceleration speed of quick pause for the change of tool orientation
during the CP motion.
>
Syntax
QPDecelR
Return Values
Real value that contains the set deceleration speed of quick pause for the tool orientation change in
the CP motion (deg/s2)
See Also
QPDecelR, QPDecelS function
QPDecelR function Example
Real savQPDecelR
savQPDecelR = QPDecelR
327
QPDecelS Statement
QPDecelS Statement
Sets the deceleration speed of quick pause in the CP motion.
>
Syntax
(1) QPDecelS QPDecelS [, departDecel, approDecel ]
(2) QPDecelS
Parameters
QPDecelS
Real value that specifies the deceleration speed of quick pause in the CP
motion. (mm/sec2)
departDecel
Real value that specifies the deceleration speed of quick pause in the Jump3
depart motion (mm/sec2)
approDecel
Real value that specifies the deceleration speed of quick pause in the Jump3
approach motion (mm/sec2)
Return Values
If omitted the parameter, the current QPDecelS set value is displayed.
Description
While quick pause is executed in the CP motion, a joint acceleration error may occur. This is because
the deceleration speed of quick pause that is automatically set in a normal quick pause is over the
joint allowable deceleration speed. Specifically, the error is likely to occur when the AccelS value in
the CP motion is too high or jogging the robot near a singularity. In these cases, use the QPDecelS
and set a lower quick pause deceleration speed. But if the setting is too low, the distance for quick
pause will increase. Therefore, set the possible value. Normally, you dont need to set QPDecelS.
You cannot use values lower than the deceleration speed of the CP motion set with AccelS. If you do,
a parameter out of range error occurs.
Also, after you set QPDecelS, if a higher value than the set QP deceleration speed is set with the
AccelS, the QPDecelS will automatically set the QP deceleration speed same as the decleration
speed set with the AccelS.
The QPDecelS Statement value initializes to the default max deceleration speed when any one of
the following conditions occurs:
Controller Startup
Motor On
SFree, SLock, Brake
Reset, Reset Error
Stop button or QuitAll stops tasks
See Also
QPDecelS Function, QPDecelR, AccelS
QPDecelS Example
The following program sets the QPDecelS of the Move statement.
Function QPDecelTest
AccelS 3000
QPDecelS 4000
SpeedS 100
Move P1
.
.
.
Fend
328
QPDecelS Function
QPDecelS Function
Returns the set deceleration speed of quick pause during the CP motion.
>
Syntax
QPDecelS ( paramNumber )
Parameters
paramNumber
329
Quit Statement
Quit Statement
Terminates execution of a specified task or all tasks.
Syntax
Quit { taskIdentifier | All }
Parameters
taskIdentifier
All
Description
Quit stops the tasks that are currently being executed, or that have been temporarily suspended with
Halt.
Quit also stops the task when the specified task is NoPause task or NoEmgAbort task (special task
using NoPause or NoEmgAbort at Xqt).
Quit All stops all tasks including the tasks above.
See Also
Exit, Halt, Resume, Xqt
Quit Example
This example shows two tasks that are terminated after 10 seconds.
Function main
Xqt winc1
Xqt winc2
Wait 10
Quit winc1
Quit winc2
Fend
Function winc1
Do
On 1; Wait 0.2
Off 1; Wait 0.2
Loop
Fend
Function winc2
Do
On 2; Wait 0.5
Off 2; Wait 0.5
Loop
Fend
330
RadToDeg Function
RadToDeg Function
Converts radians to degrees.
>
Syntax
RadToDeg(radians)
Parameters
radians
Return Values
A double value containing the number of degrees.
See Also
ATan, ATan2, DegToRad Function
RadToDeg Function Example
s = Cos(RadToDeg(x))
331
Randomize Statement
Randomize Statement
Initializes the random-number generator.
Syntax
(1) Randomize seedValue
(2) Randomize
Parameter
seedValue
See Also
Rnd Function
Randomize Example
Function main
Real r
Randomize
Integer randNum
randNum = Int(Rnd(10)) + 1
Print "Random number is:", randNum
Fend
332
Range Statement
Range Statement
Specifies and displays the motion limits for each of the servo joints.
>
Syntax
(1) Range j1Min, j1Max, j2Min, j2Max, j3Min, j3Max, j4Min, j4Max, [j5Min, j5Max, j6Min, j6Max]
(2) Range
Parameters
j1Min
j1Max
j2Min
j2Max
j3Min
j3Max
j4Min
j4Max
j5Min
Optional for 6-Axis robots. The lower limit for joint 5 specified in pulses.
j5Max
Optional for 6-Axis robots. The upper limit for joint 5 specified in pulses.
j6Min
Optional for 6-Axis robots. The lower limit for joint 6 specified in pulses.
j6Max
Optional for 6-Axis robots. The upper limit for joint 6 specified in pulses.
Return Values
Displays the current Range values when Range is entered without parameters
Description
Range specifies the lower and upper limits of each motor joint in pulse counts. These joint limits are
specified in pulse units. This allows the user to define a maximum and minimum joint motion range for
each of the individual joints. XY coordinate limits can also be set using the XYLim instruction.
The initial Range values are different for each robot. The values specified by this instruction remain in
effect even after the power is switched off.
When parameters are omitted, the current Range values are displayed.
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
Potential Errors
Attempt to Move Out of Acceptable Range
If the robot arm attempts to move through one of the joint limits error an will occur
Axis Does Not Move
If the lower limit pulse is equal to or greater than the upper limit pulse, the joint does not move.
See Also
JRange, SysConfig, XYLim
Range Example
This simple example from the command window displays the current range settings and then changes
them.
> range
-18205, 182045, -82489, 82489, -36864, 0, -46695, 46695
>
> range 0, 32000, 0, 32224, -10000, 0, -40000, 40000
>
333
Read Statement
Read Statement
Reads characters from a communications port.
Syntax
Read #portNumber, stringVar$, count
Parameters
portNumber
stringVar$
count
See Also
ChkCom, ChkNet, OpenCom, OpenNet, Write
Read Statement Example
Integer numOfChars
String data$
numOfChars = ChkCom(1)
If numOfChars > 0 Then
Read #1, data$, numOfChars
EndIf
334
ReadBin Statement
ReadBin Statement
Reads binary data from a communications port.
Syntax
ReadBin #portNumber, var
ReadBin #portNumber, array(), count
Parameters
portNumber
var
Name of a byte, integer, or long variable that will receive the data byte.
array()
Name of a byte, integer, or long array variable that will receive the data byte. Specify a
one dimension array variable.
count
Specify the number of bytes to read. The specified count has to be less than or equal
to the number of array elements.
See Also
Write, WriteBin
ReadBin Statement Example
Integer data
Integer dataArray(10)
numOfChars = ChkCom(1)
If numOfChars > 0 Then
ReadBin #1, data
EndIf
NumOfChars = ChkCom(1)
If numOfChars > 10 Then
ReadBin #1, dataArray(), 10
EndIf
335
Real Statement
Real Statement
Declares variables of type Real (4 byte real number).
Syntax
Real varName [(subscripts)] [, varName [(subscripts)]...]
Parameters
varName
subscripts
Description
Real is used to declare variables as type Real. Local variables should be declared at the top of a
function. Global and module variables must be declared outside functions.
Number of valid digits are six digits for Real type.
See Also
Boolean, Byte, Double, Global, Integer, Long, String
Real Example
The following example shows a simple program which declares some variables using Real.
Function realtest
Real var1
Real A(10)
'Single dimension array of real
Real B(10, 10)
'Two dimension array of real
Real C(5, 5, 5) 'Three dimension array of real
Real arrayVar(10)
Integer i
Print "Please enter a Real Number:"
Input var1
Print "The Real variable var1 = ", var1
For i = 1 To 5
Print "Please enter a Real Number:"
Input arrayVar(i)
Print "Value Entered was ", arrayVar(i)
Next i
Fend
336
RealPls Function
RealPls Function
F
Syntax
RealPls(jointNumber)
Parameters
jointNumber
The specific joint for which to get the current pulse count.
Return Values
Returns an integer value representing the current encoder pulse count for the joint specified by
jointNumber.
Description
RealPls is used to read the current encoder position (or Pulse Count) of each joint. These values can
be saved and then used later with the Pulse command.
See Also
CX, CY, CZ, CU, CV, CW, Pulse
RealPls Function Example
Function DisplayPulses
Long joint1Pulses
joint1Pulses = RealPls(1)
Print "Joint 1 Current Pulse Value: ", joint1Pulses
Fend
337
RealPos Function
RealPos Function
Returns the current position of the specified robot.
Syntax
RealPos
Return Values
A robot point representing the current position of the specified robot.
Description
RealPos is used to read the current position of the robot.
See Also
CurPos, CX, CY, CZ, CU, CV, CW, RealPls
RealPos Function Example
Function ShowRealPos
Print RealPos
Fend
P1 = RealPos
338
RealTorque Function
RealTorque Function
Returns the current torque instruction value of the specified joint.
Syntax
RealTorque(jointNumber)
Parameters
jointNumber
Specifies the joint number to acquire the torque instruction value using an
expression or numeric value.
Return values
Returns the real value (0-1) representing the proportion in the maximum torque on current power mode.
See also
TC, TCSpeed, TCLim
RealTorque Function Example
Print "Current Z axis torqueinstruction value:", RealTorque(3)
339
Redim Statement
Redim Statement
Redimension an array at run-time.
Syntax
Redim [Preserve] arrayName (subscripts)
Parameters
Preserve
Optional. Specifies to preserve the previous contents of the array. If omitted, the
array will be cleared.
arrayName
Name of the array variable; follows standard variable naming conventions. The
array must have already been declared.
subscripts
New dimensions of the array variable. You must supply the same number of
dimensions as when the variable was declared. The syntax is as follows
(dim1, [dim2], [dim3])
dim1, dim2, dim3 can be an integer expression from 0-2147483646.
subscripts
Description
Use Redim to change an array's dimensions at run time. Use Preserve to retain previous values.
The array variable declared by Byref cannot use Redim.
See Also
UBound
Redim Statement Example
Integer i, numParts, a(0)
Print "Enter number of parts "
Input numParts
Redim a(numParts)
For i=0 to UBound(a)
a(i) = i
Next
' Redimension the array with 20 more elements
Redim Preserve a(numParts + 20)
' The first element values are retained
For i = 0 to UBound(a)
Print a(i)
Next
340
Reset Statement
Reset Statement
Resets the controller into an initialized state.
>
Syntax
Reset
Description
Reset resets the following items:
341
Resume Statement
Resume Statement
Continues a task which was suspended by the Halt instruction.
Syntax
Resume { taskIdentifier | All }
Parameters
taskIdentifier
All
Description
Resume continues the execution of the tasks suspended by the Halt instruction.
See Also
Halt, Quit, Xqt
Resume Statement Example
This shows the use of Resume instruction after the Halt instruction.
Function main
Xqt 2, flicker
Do
Wait 3
'Allow flicker to execute for 3 seconds
Halt flicker
'Halt the flicker task
Wait 3
Resume flicker 'Resume the flicker task
Loop
Fend
Function flicker
Do
On 1
Wait 0.2
Off 1
Wait 0.2
Loop
Fend
342
Return Statement
Return Statement
The Return statement is used with the GoSub statement. GoSub transfers program control to
a subroutine. Once the subroutine is complete, Return causes program execution to continue
at the line following the GoSub instruction which initiated the subroutine.
Syntax
Return
Description
The Return statement is used with the GoSub statement. The primary purpose of the Return
statement is to return program control back to the instruction following the GoSub instruction which
initiated the subroutine in the first place.
The GoSub instruction causes program control to branch to the user specified statement line number
or label. The program then executes the statement on that line and continues execution through
subsequent line numbers until a Return instruction is encountered. The Return instruction then
causes program control to transfer back to the line which immediately follows the line which initiated
the GoSub in the first place. (i.e. the GoSub instruction causes the execution of a subroutine and then
execution Returns to the statement following the GoSub instruction.)
Potential Errors
Return Found Without GoSub
A Return instruction is used to "return" from a subroutine back to the original program which issued
the GoSub instruction. If a Return instruction is encountered without a GoSub having first been issued
then an error will occur. A stand alone Return instruction has no meaning because the system
doesn't know where to Return to.
See Also
OnErr, GoSub, GoTo
Return Statement Example
The following example shows a simple function which uses a GoSub instruction to branch to a label
called checkio and check the first 16 user inputs. Then the subroutine returns back to the main
program.
Function main
Integer var1, var2
GoSub checkio
On 1
On 2
Exit Function
checkio: 'Subroutine starts here
var1 = In(0)
var2 = In(1)
If var1 <> 0 Or var2 <> 0 Then
Print "Message to Operator here"
EndIf
finished:
Return 'Subroutine ends here and returns to line 40
Fend
343
Right$ Function
Right$ Function
F
count
Return Values
Returns a string of the rightmost count characters from the character string specified by the user.
Description
Right$ returns the rightmost count characters of a string specified by the user. Right$ can return up to
as many characters as are in the character string.
See Also
Asc, Chr$, InStr, Left$, Len, Mid$, Space$, Str$, Val
Right$ Example
The example shown below shows a program which takes a part data string as its input and splits out
the part number, part name, and part count.
Function SplitPartData(DataIn$ As String, ByRef PartNum$
ByRef PartName$ As String, ByRef PartCount As Integer)
As
String,
344
Rnd Function
Rnd Function
Return a random number.
Syntax
Rnd(maxValue)
Parameters
maxValue
Return Values
Random real number from 0 to range.
Description
Use Rnd to generate random number values.
See Also
Int, Randomize
Rnd Function Example
Here's a Rnd example that generates a random number between 1 and 10.
Function main
Real r
Integer randNum
Randomize
randNum = Int(Rnd(9)) + 1
Print "Random number is:", randNum
Fend
345
RobotInfo Function
RobotInfo Function
Returns status information for the robot.
Syntax
RobotInfo(index)
Parameters
index
Return Values
The specified information is returned as an integer.
Description
The information for each bit of the returned value is shown in the table below:
Index
1
2
Bit
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16-31
0-31
0
1-31
0
1
2
3
4
5
6-31
N/A
0
1
2
3
4
5
6-31
Value
&H1
&H2
&H4
&H8
&H10
&H20
&H40
&H80
&H100
&H200
&H400
&H4000
&H8000
&H1
&H1
&H2
&H4
&H8
&H10
&H20
0 - 16
-1
&H1
&H2
&H4
&H8
&H10
&H20
Description
Undefined
Resetable error has occurred
Non-resetable error has occured
Motors are on
Current power is high
Undefined
Undefined
Undefined
Robot is halted
Robot not halted (executing motion or in quick pause)
Robot stopped by pause or safeguard
Undefined
Undefined
Undefined
TILL condition was satisfied by preceding motion command
SENSE condition was satisfied by preceding motion command
Undefined
Undefined
Robot is at home position
Undefined
Joint 1 servo is engaged
Joint 2 servo is engaged
Joint 3 servo is engaged
Joint 4 servo is engaged
Joint 5 servo is engaged
Joint 6 servo is engaged
Undefined
Number of tasks executing robot commands
0 = command executing from command window or macro
-1 = no task is using the manipulator
Joint 1 brake is on
Joint 2 brake is on
Joint 3 brake is on
Joint 4 brake is on
Joint 5 brake is on
Joint 6 brake is on
Undefined
See Also
CtrlInfo, RobotInfo$, TaskInfo
346
RobotInfo Function
RobotInfo Function Example
If (RobotInfo(3) And &H1) = &H1 Then
Print "Joint 1 is locked"
Else
Print "Joint 1 is free"
EndIf
347
RobotInfo$ Function
RobotInfo$ Function
Returns text information for the robot.
Syntax
RobotInfo$(index)
Parameters
index
Return Values
A string containing the specified information.
Description
Index
0
1
2
3
4
Description
Robot name
Model name
Undefined
Undefined
Serial number of robot
See Also
CtrlInfo, RobotInfo, TaskInfo
RobotInfo$ Function Example
Print "Robot Name: ", RobotInfo$(0)
348
RobotModel$ Function
RobotModel$ Function
Returns the robot model name.
Syntax
RobotModel$
Return Values
A string containing the model name. This is the name that is shown on the rear panel of the robot.
See Also
RobotType
RobotModel$ Example
Print "The robot model is ", RobotModel$
349
RobotName$ Function
RobotName$ Function
F
350
RobotSerial$ Function
RobotSerial$ Function
Returns the robot serial number.
Syntax
RobotSerial$
Return Values
A string containing the robot serial number.
See Also
RobotInfo, RobotName$, RobotModel$
RobotSerial$ Example
Print "The robot serial number is ", RobotSerial$
351
RobotType Function
RobotType Function
F
2: Cartesian
3: SCARA
5: 6-AXIS
6: RS series
See Also
RobotModel$
RobotType Example
If RobotType = 3 Then
Print "Robot type is SCARA"
EndIf
352
RSet$ Function
RSet$ Function
Returns the specified string with leading spaces added up to the specified length..
Syntax
RSet$ (string, length)
Parameters
string
length
String expression.
Integer expression for the total length of the string returned.
Return Values
Specified string with leading spaces appended.
See Also
LSet$, Space$
RSet$ Function Example
temp$ = "123"
temp$ = RSet$(temp$, 10)
123"
353
RShift Function
RShift Function
Shifts numeric data to the right by a user specified number of bits.
Syntax
RShift(number, shiftBits)
Parameters
number
shiftBits
Return Values
Returns a numeric result which is equal to the value of number after shifting right shiftbits number of
bits.
Description
RShift shifts the specified numeric data (number) to the right (toward a lower order digit) by the
specified number of bits (shiftBits). The high order bits shifted are replaced by 0.
The simplest explanation for RShift is that it simply returns the result of number / 2shiftBits. (Number
is divided by 2 shiftBit times.)
Notes
Numeric Data Type:
The numeric data (number) may be any valid numeric data type. RShift works with data types: Byte,
Integer, and Real.
See Also
And, LShift, Not, Or, Xor
RShift Example
The example shown below shows a program which shows all the possible RShift values for an Integer
data type starting with the integer set to 0.
Function rshiftst
Integer num, snum, i
num = 32767
For i = 1 to 16
Print "i =", i
snum = RShift(num, 1)
Print "RShift(32767, ", i, ") = ", snum
Next i
Fend
Some other example results from the RShift instruction from the command window.
> Print RShift(10,1)
5
> Print RShift(8,3)
1
> Print RShift(16,2)
4
354
RTrim$ Function
RTrim$ Function
Returns a string equal to specified string without trailing spaces.
Syntax
RTrim$(string)
Parameters
string
String expression.
Return Values
Specified string with trailing spaces removed.
See Also
LTrim$, Trim$
RTrim$ Function Example
str$ = " data "
str$ = RTrim$(str$)
EndIf
355
SafetyOn Function
SafetyOn Function
F
Description
SafetyOn function is used only for NoPause task or NoEmgAbort task (special task using NoPause
or NoEmgAbort at Xqt).
See Also
ErrorOn, EstopOn, PauseOn, Wait, Xqt
SafetyOn Function Example
The following example shows a program that monitors the Safety Door open and switches the I/O
On/Off when Safety Door open occurs.
Notes
Forced Flag
This program example uses Forced flag for On/Off command.
Be sure that the I/O outputs change during error, or at Emergency Stop or Safety Door Open when
designing the system.
Function main
Xqt SafetyOnOffMonitor, NoPause
:
:
Fend
Function SafetyOnOffMonitor
Do
Wait SafetyOn = On
Print "Saftey Open"
Off 10, Forced
On 12, Forced
Loop
Fend
356
SavePoints Statement
SavePoints Statement
Saves point data in main memory.
>
Syntax
SavePoints filename
Parameters
fileName
String expression containing the file into which points will be stored. The specified
fileName will have the extension .PTS appended to the end so no extension is to be
specified by the user.
Description
SavePoints saves points to the specified file. The specified fileName will have the extension .PTS
appended to the end so no extension is to be specified by the user.
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
Potential Errors
Bad File name
If a file name is entered which has spaces in the name, or other bad file name characteristics an error
will be issued.
See Also
ClearPoints, LoadPoints
SavePoints Statement Example
ClearPoints
For i = 1 To 10
P(i) = XY( i, 100, 0, 0 )
Next i
SavePoints "TEST.PTS"
357
Select...Send
Select...Send
Executes one of several groups of statements, depending on the value of an expression.
Syntax
Select selectExpr
Case caseExpr
statements
[Case caseExpr
statements ]
[Default
statements ]
Send
Parameters
selectExpr
caseExpr
Any numeric or string expression that evaluates to the same type as selectExpr.
statements
Description
If any one caseExpr is equivalent to selectExpr, then the statements after the Case statement are
executed. After execution, program control transfers to the statement following the Send statement.
If no caseExpr is equivalent to selectExpr, the Default statements are executed and program control
transfers to the statement following the Send statement.
If no caseExpr is equivalent to selectExpr and Default is omitted, nothing is executed and program
control transfers to the statement immediately following the Send statement.
selectExpr and caseExpr may include constants, variables, and logical operators that use And, Or and
Xor.
See Also
If...Then...Else
Select Example
Shown below is a simple example for Select...Send:
Function Main
Integer I
For i = 0 To 10
Select I
Case 0
Off 1;On 2;Jump P1
Case 3
On 1;Off 2
Jump P2;Move P3;On 3
Case 7
On 4
Default
On 7
Send
Next
Fend
358
Sense Statement
Sense Statement
Specifies and displays input condition that, if satisfied, completes the Jump in progress
by stopping the robot above the target position.
>
Syntax
Sense [ inputCondition ]
Parameters
inputCondition The following functions and operators may be used in the inputCondition:
Functions : Sw, In, InW, Oport, Out, OutW, MemSw, MemIn, MemW, Ctr
Operators : And, Or, Xor
When variables are included in the Sense condition, their values are computed when setting the
Sense condition. No use of variable is recommended. Otherwise, the condition may be an
unintended condition. Multiple Sense statements are permitted. The most recent Sense condition
remains current until superseded with another Sense statement.
Jump, Jump3, Jump3CP with Sense Modifier
Checks if the current Sense condition is satisfied. If satisfied, the Jump instruction completes with the
robot stopped above the target position. (i.e. When the Sense Condition is True, the robot arm
remains just above the target position without executing approach motion. When the Sense condition
is False, the robot arm completes the full Jump instruction motion through to the target position.
359
Sense Statement
Sense Statement Example
This is a simple example on the usage of the Sense instruction.
Function test
.
.
TrySense:
Sense Sw(1) = Off
Jump P1 C2 Sense
If JS = True Then
GoSub ERRPRC
GoTo TrySense
EndIf
On 1; Wait 0.2; Off 1
.
.
Fend
<Other Syntax Examples>
> Sense Sw(1)=1 And MemSw(1)=1
> Sense Sw(0) Or (Sw(1) And MemSw(1))
360
SetCom Statement
SetCom Statement
Sets or displays parameters for RS-232C port.
Syntax
SetCom #portNumber, [baud ], [ dataBits ], [ stopBits ] , [ parity ] , [ terminator] , [ HWFlow ],
[ SWFlow ] , [ timeOut ]
Parameters
portNumber
Specifies which RS232 port to set parameters for. Valid values are 1-8.
Optional. Specifies the baud rate. Valid values are:
baud
110
2400
19200
300
4800
38400
600
9600
56000
1200
14400 115200
(Default: 9600)
dataBits
Optional. Specifies the number of data bits per character. Valid values are 7
and 8.
stopBits
Optional. Specifies the number of stop bits per character. Valid values are 1
and 2.
parity
Optional. Specifies the parity. Valid values are O (Odd), E (Even), and N (None).
terminator
Optional. Specifies the line termination characters. Valid values are CR, LF,
CRLF.
HWFlow
Optional. Specifies hardware control. Valid values are RTS and NONE.
SWFlow
Optional. Specifies software control. Valid values are XON and NONE.
timeOut
Optional. Specifies the maximum time for transmit or receive in seconds. If this
value is 0, then there is no time out.
Description
When all the parameter is omitted, displays a communication port setting.
If the several ports are used in the communication at one time with more than 19200 baud rate, error
2929 or 2922 may occur. In this case, select the lower baud rate or avoid using several ports at one
time.
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
See Also
OpenCom, CloseCom, SetNet
SetCom Example
SetCom #1, 9600, 8, 1, N, CRLF, NONE, NONE, 0
SetCom #2, 4800
361
SetIn Statement
SetIn Statement
For Virtual IO, sets specified input port (8 bits) to the specified value.
>
Syntax
SetIn portNumber, value
Parameters
portNumber Integer expression representing the input port number.
value
Description
SetIn provides the ability to set up to 8 bits of virtual inputs at once.
See Also
SetSW, SetInW
SetIn Function Example
> setin 0, 1
362
SetInReal Statement
SetInReal Statement
For Virtual IO, sets specified input port (2 words (32 bits)) as 32 bits floating-point
data (IEEE754 compliant).
>
Syntax
SetInReal portNumber, value
Parameters
portNumber Integer expression representing the input port word.
value
Description
When Virtual I/O is available, set the value of 2 input words from the input word port specified by
portNumber as IEEE754 32 bits Real type value.
Input word label can be used for the portNumber parameter.
When Virtual I/O is not available, SetInReal will be an error.
See Also
SetSw, SetIn, SetInW
SetInReal Example
> SetInReal 0, 1.23
363
SetInW Statement
SetInW Statement
For Virtual IO, sets specified input word (16 bits) to the specified value.
>
Syntax
SetInW portNumber, value
Parameters
portNumber Integer expression representing the input port number.
value
Description
SetInW provides the ability to set up to 16 bits of virtual inputs at once.
See Also
SetSw, SetIn
SetInW Function Example
> setinw 0, 1
364
SetNet Statement
SetNet Statement
Sets parameters for a TCP/IP port.
Syntax
SetNet #portNumber, hostAddress, TCP_IP_PortNum, terminator, SWFlow, timeout
Parameters
portNumber
Specifies which port to set parameters for. Valid values are 201 - 208.
hostAddress
TCP_IP_PortNum
terminator
Specifies the line termination characters. Valid values are CR, LF, CRLF.
SWFlow
timeOut
Specifies the maximum time for transmit or receive in seconds. If this value is 0,
then there is no time out.
Description
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
See Also
OpenNet, CloseNet, SetCom
SetNet Example
SetNet #201, "192.168.0.1", 2001, CRLF, NONE, 0
365
SetSw Statement
SetSw Statement
For Virtual IO, sets specified input bit to the specified value.
>
Syntax
SetSw bitNumber, value
Parameters
bitNumber
value
Description
SetSw provides the ability to turn on or off one input bit.
See Also
SetIn, SetInW
SetSw Function Example
> setsw 2, on
366
SFree Statement
SFree Statement
Removes servo power from the specified servo axis.
>
Syntax
SFree jointNumber [ , jointNumber,... ]
Parameters
jointNumber
Description
SFree removes servo power from the specified servo joints. This instruction is used for the direct
teaching or the part installation by partially de-energizing a specific joint. To re-engage a joint execute
the SLock instruction or Motor On.
Notes
SFree Sets Some System Items back to Their Initial State:
SFree, for safety purposes, initializes parameters concerning the robot arm speed (Speed and
SpeedS ), acceleration (Accel and AccelS ) and the LimZ parameter.
Notes
SFree and its Use with the Z Joint and U Joint for SCARA robots (including RS series)
The Z joint has electromagnetic brakes so setting SFree for the Z joint does not immediately allow the
Z joint to be moved. To move the Z joint by hand requires the brake to be released continuously by
pressing the brake release switch on the top of the robot arm.
Some model has electronic brake on the U joint. When the robot has the U joint electronic brake,
setting SFree for the U joint does not immediately allow the U joint to be moved. To move the U joint
by hand requires the brake to be released continuously by pressing the brake release switch on the
top of the robot arm.
SFree is Not Valid with 6-Axis robots
All joints of the 6-axis robots have an electromagnetic brake. The brake can be released using the
Brake command with the motor off. In the motor off state, SFree is not valid. If you execute SFree
with the motor on, an electromagnetic brake will be on. You cannot move any joint by hand using
SFree.
Executing motion commands while joints are in SFree state
Attempting to execute a motion command while in the SFree condition will cause an error in the
controller's default state. However, to allow motion while 1 or more of the axes are in the SFree state,
turn on the "Allow Motion with one or more axes free" controller preference. (This preference can be
set from the Setup | Controller | Preferences EPSON RC+ 5.0.)
See Also
Brake, LimZ, Motor, SFree Function, SLock
SFree Statement Example
This is a simple example on the usage of the SFree instruction. The Motion with SFree controller
preference must be enabled for this example to work.
Function GoPick
Speed pickSpeed
SFree 1, 2
'Release the excitation of J1 and J2,
'and control the Z and U joints for part installation.
Go pick
SLock 1, 2
'Restore the excitation of J1 and J2.
Fend
367
SFree Function
SFree Function
Returns SFree status for a specified joint.
Syntax
SFree(jointNumber)
Parameters
jointNumber
Return Values
True if the joint is free, False if not.
See Also
SFree Statement
SetFree Example
If SFree(1) Then
Print "Joint 1 is free"
EndIf
368
Sgn Function
Sgn Function
Determines the sign of the operand.
Syntax
Sgn(Operand )
Parameters
Operand
A numeric expression.
Return Values
1: If the operand is a positive value.
0: If the operand is a 0
-1: If the operand is a negative value.
Description
The Sgn function determines the sign of the numeric value of the operand.
See Also
Abs, And, Atan, Atan2, Cos, Int, Mod, Or, Not, Sin, Sqr, Str$, Tan, Val, Xor
Sgn Function Example
This is a simple command window example on the usage of the Sgn function.
>print sgn(123)
1
>print sgn(-123)
-1
>
369
Signal Statement
Signal Statement
Send a signal to tasks executing WaitSig.
Syntax
Signal signalNumber
Parameters
signalNumber
Description
Signal can be used to synchronize multi-task execution.
370
Sin Function
Sin Function
Returns the sine of a numeric expression.
Syntax
Sin(radians)
Parameters
radians
Return Values
Numeric value representing the sine of the numeric expression radians.
Description
Sin returns the sine of the numeric expression. The numeric expression (radians) must be in radian
units. The value returned by the Sin function will range from -1 to 1
371
SLock Statement
SLock Statement
Restores servo power from servo free condition for the specified servo axis.
>
Syntax
SLock jointNumber [ , jointNumber,... ]
Parameters
jointNumber
Description
SLock restores servo power to the specified servo joint, which was de-energized by the SFree
instruction for the direct teaching or part installation.
372
SoftCP Statement
SoftCP Statement
Specifies the SoftCP motion mode.
Syntax
SoftCP { On | Off }
Parameters
On | Off
Description
SoftCP motion mode controls the vibration caused by CP motion with high acceleration/deceleration.
Normal CP motion focuses on path-tracking and uniform-motion which increases the vibration when
acceleration/deceleration is high. To reduce the vibration, acceleration/deceleration needs to be
reduced with the SpeedS and AccelS commands.
However, some applications dont necessarily require the high performance of path-tracking and
uniform-motion but need CP motion with less vibration when acceleration/deceleration is high.
SoftCP motion mode dampens the path-tracking and uniform-motion performance more than in the
normal CP motion mode and reduces the vibration in CP motion with high acceleration/deceleration.
373
SoftCP Function
SoftCP Function
Returns the status of SoftCP moton mode.
Syntax
SoftCP
Return Values
0 = SoftCP motion mode off, 1 = SoftCP motion mode on.
See Also
SoftCP Statement
SoftCP Function Example
If SoftCP = Off Then
Print "SoftCP is off"
EndIf
374
Space$ Function
Space$ Function
Returns a string of space characters.
Syntax
Space$(count)
Parameters
count
Return Values
Returns a string of count space characters.
Description
Space$ returns a string of count space characters as specified by the user. Space$ can return up to
255 characters (the maximum number of characters allowed in a string variable).
The Space$ instruction is normally used to insert spaces before, after, or between other strings of
characters.
See Also
Asc, Chr$, InStr, Left$, Len, LSet$, Mid$, Right$, RSet$, Str$, Val
Space$ Function Example
> Print "XYZ" + Space$(1) + "ABC"
XYZ ABC
> Print Space$(3) + "ABC"
ABC
>
375
Speed Statement
Speed Statement
Specifies or displays the arm speed for the point to point motion instructions Go,
Jump and Pulse.
>
Syntax
(1) Speed percent, [ departSpeed], [approSpeed ]
(2) Speed
Parameters
percent
departSpeed
Integer expression between 1-100 representing the depart motion speed for the
Jump instruction. Optional. Available only with Jump command.
approSpeed
Integer expression between 1-100 representing the approach motion speed for
the Jump instruction. Optional. Available only with Jump command.
Return Values
Displays current Speed value when used without parameters.
Description
Speed specifies the arm speed for all point to point motion instructions. This includes motion caused
by the Go, Jump and Pulse robot motion instructions. The speed is specified as a percentage of
maximum speed with the range of acceptable values between 1-100. (1 represents 1% of the
maximum speed and 100 represents 100% of maximum speed). Speed 100 represents the maximum
speed possible.
Depart and approach speed values apply only to the Jump instruction. If omitted, each defaults to the
percent value.
The speed value initializes to its default value when any one of the following is performed:
Controller Power On
Motor On
SFree, SLock
Reset
Stop button or Ctrl+C Key
In Low Power Mode, the effective speed setting is lower than the default value. If a higher speed is
specified directly (from the command window) or in a program, the speed is set to the default value.
In High Power Mode, the motion speed setting is the value specified with Speed.
If higher speed motion is required, set high power mode using Power High and close the safety door.
If the safety door is open, the Speed settings will be changed to their default value.
If Speed is executed when the robot is in low power mode, the following message is displayed. The
following example shows that the robot will move at the default speed (5) because it is in Low Power
Mode even though the speed setting value by Speed is 80.
> speed 80
> speed
Low Power Mode
80
80
80
>
376
Speed Statement
See Also
Accel, Go, Jump, Power, Pass, Pulse, SpeedS
Speed Statement Example
Speed can be used from the command window or in a program. Shown below are simple examples of
both methods.
Function speedtst
Integer slow, fast, i
slow = 10
fast = 100
For i = 1 To 10
Speed slow
Go P0
Go P1
Speed fast
Go P0
Go P1
Next i
Fend
From the command window the user can also set Speed values.
> Speed 100,100,50
'Z joint downward speed set to 50
> Speed 50
> Speed
Low Power State: Speed is limited to 5
50
50
50
>
377
Speed Function
Speed Function
Returns one of the three speed settings.
Syntax
Speed[(paramNumber)]
Parameters
paramNumber
Return Values
Integer value from 1 to 100.
See Also
Speed Statement
Speed Function Example
Integer savSpeed
savSpeed = Speed(1)
Speed 50
Go pick
Speed savSpeed
Fend
378
SpeedR Statement
SpeedR Statement
Sets or displays the tool rotation speed for CP motion when ROT is used.
>
Syntax
(1) SpeedR rotSpeed
(2) SpeedR
Parameters
rotSpeed
The SpeedR value initializes to the default value (low speed) when any one of the following conditions
occurs:
Controller Power On
Motor On
SFree, SLock
Reset
Stop button or Ctrl + C Key
See Also
AccelR, Arc, Arc3, BMove, Jump3CP, Power, SpeedR Function, TMove
SpeedR Statement Example
SpeedR 200
379
SpeedR Function
SpeedR Function
>
Syntax
SpeedR
Return Values
Real value in degrees / second
See Also
AccelR Statement, SpeedR Statement
SpeedR Function Example
Real currSpeedR
currSpeedR = SpeedR
380
SpeedS Statement
SpeedS Statement
Specifies or displays the arm speed for use with the continuous path motion instructions
such as Move, Arc, Arc3, Jump3, and Jump3CP.
>
Syntax
(1) SpeedS speed, [departSpeed], [approSpeed ]
(2) SpeedS
Parameters
speed
departSpeed
Optional.
mm/sec.
approSpeed
The SpeedS value initializes to its default value when any one of the following is performed:
Controller Power On
Motor On
SFree, SLock
Reset
Stop button or Ctrl + C Key
In Low Power Mode, the effective SpeedS setting is lower than the default value. If a higher speed is
specified directly (from the command window) or in a program, the speed is set to the default value. In
High Power Mode, the motion SpeedS setting is the value of SpeedS.
If higher speed motion is required, set high power mode using Power High and close the safety door.
If the safety door is open, the SpeedS settings will be changed to their default value.
If SpeedS is executed when the robot is in low power mode, the following message is displayed.
The following example shows that the robot will move at the default speed (50) because it is in Low
Power Mode even though the speed setting value by SpeedS is 800.
> SpeedS 800
Low Power State: SpeedS is limited to 50
>
> SpeedS
Low Power State: SpeedS is limited to 50
800
>
381
SpeedS Statement
See Also
AccelS, Arc, Jump3, Move, Speed
SpeedS Example
SpeedS can be used from the command window or in a program. Shown below are simple examples
of both methods.
Function speedtst
Integer slow, fast, i
slow = 50
fast = 500
For i = 1 To 10
SpeedS slow
Go P0
Move P1
SpeedS fast
Go P0
Move P1
Next i
Fend
From the command window the user can also set SpeedS values.
>
>
>
>
>
>
382
speeds 1000
speeds 500
speed 30
go p0
speeds 100
move P1
SpeedS Function
SpeedS Function
Returns the current SpeedS setting.
Syntax
SpeedS [(paramNumber)]
Parameters
paramNumber
Return Values
Real number, in mm/sec
See Also
SpeedS Statement
SpeedS Example
Real savSpeeds
savSpeeds = SpeedS
Print "Jump3 depart speed = ", SpeedS(2)
383
SPELCom_Event Statement
SPELCom_Event Statement
Generates a user event for a VB Guide SPELCom control used in a host program.
>
Syntax
SPELCom_Event eventNumber [, msgArg1, msgArg2, msgArg3,... ]
Parameters
eventNumber
msgArg1, msgArg2, msgArg3...
Description
This instruction makes it easy to send real time information to another application using the SPELCom
ActiveX control provided in the VB Guide option. For example, you can update parts count, lot
number, etc. by sending an event to your host program.
Note
This command will only work if the VB Guide option is installed.
See Also
VB Guide Manual
SPELCom_Event Example
In this example, a SPEL+ task sends cycle data to the host program.
Function RunParts
Integer cycNum
cycNum = 0
Do
...
...
cycNum = cycNum + 1
Spelcom_Event 3000, cycNum, lot$, cycTime
Loop
Fend
384
Sqr Function
Sqr Function
Computes the non-negative square root value of the operand.
Syntax
Sqr(Operand )
Parameters
Operand
A real expression.
Return Values
Square root value.
Description
The Sqr function returns the non-negative square root value of the operand.
Potential Errors
Negative operand
If the operand is or has a negative numeric value, an error will occur.
See Also
Abs, And, Atan, Atan2, Cos, Int, Mod, Not, Or, Sgn, Sin, Str$, Tan, Val, Xor
Sqr Function Example
This is a simple Command window example on the usage of the Sqr function.
>print sqr(2)
1.414214
>
385
Stat Function
Stat Function
Returns the execution status information of the controller.
Syntax
Stat(address)
Parameters
address
Return Values
Returns a 4 byte value that presents the status of the controller. Refer to table below.
Description
The Stat instruction returns information as shown in the table below:
Address
0
0
to
15
16
17
18
19
20
21
22
23
24
25
26-31
0
&H1
&H2
2
3
&H4
&H8
4
5
6
7
8
9
10
11
12
13
14-31
386
Bit
&H1
to
&H8000
&H10000
&H20000
&H40000
&H80000
&H100000
&H200000
&H400000
&H800000
&H1000000
&H2000000
&H10
&H20
&H40
&H80
&H100
&H200
&H400
&H800
&H1000
&H2000
Stat Function
See Also
EStopOn Function, TillOn Function, PauseOn Function, SafetyOn Function
Stat Example
Function StatDemo
rbt1_sts = RShift((Stat(0) And &H070000), 16)
Select TRUE
Case (rbt1_sts And &H01) = 1
Print "Tasks are running"
Case (rbt1_sts And &H02) = 2
Print "Pause Output is ON"
Case (rbt1_sts And &H04) = 4
Print "Error Output is ON"
Send
Fend
387
Str$ Function
Str$ Function
Converts a numeric value to a string and returns it.
Syntax
Str$(number)
Parameters
number
Return Values
Returns a string representation of the numeric value.
Description
Str$ converts a number to a string. Any positive or negative number is valid.
See Also
Abs, Asc, Chr$, InStr, Int, Left$, Len, Mid$, Mod, Right$, Sgn, Space$, Val
Str$ Function Example
The example shown below shows a program which coverts several different numbers to strings and
then prints them to the screen.
Function strtest
Integer intvar
Real realvar
'
intvar = -32767
Print "intvar = ", Str$(intvar)
'
realvar = 567.9987
Print "realvar = ", Str$(realvar)
'
Fend
Some other example results from the Str$ instruction from the command window.
> Print Str$(99999999999999)
1.000000E+014
> Print Str$(25.999)
25.999
388
String Statement
String Statement
Declares variables of type String. (Character-string variables)
Syntax
String varName$ [(subscripts)] [, varName$ [(subscripts)]...]
Parameters
varName$
subscripts
Description
The String statement is used to declare variables of type String. String variables can contain up to
255 characters. Local variables should be declared at the top of a function. Global and module
variables must be declared outside of functions.
String Operators
The following operators can be used to manipulate string variables:
+ Merges character strings together. Can be used in the assignment statements for string
variables or in the Print instruction.
Example: name$ = fname$ + " " + lname$
= Compares character strings. True is returned only when the two strings are exactly equal,
including case.
Example: If temp1$ = "A" Then GoSub test
< > Compares character strings. True is returned when one or more characters in the two
strings are different.
Example: If temp1$ <> "A" Then GoSub test
Notes
Variable Names Must Include "$" Character:
Variables of type String must have the character "$" as the last character in the variable name.
See Also
Boolean, Byte, Double, Global, Integer, Long, Real
389
String Statement
String Example
String
String
String
String
password$
A$(10)
'Single dimension array of string
B$(10, 10)
'Two dimension array of string
C$(5, 5, 5) 'Three dimension array of string
390
Sw Function
Sw Function
Returns or displays the selected input port status. (i.e. Discrete User I/O)
Syntax
Sw(bitNumber)
Parameters
bitNumber
Return Values
Returns a 1 when the specified input is On and a 0 when the specified input is Off.
Description
Sw provides a status check for hardware inputs. Sw is most commonly used to check the status of
one of the inputs which could be connected to a feeder, conveyor, gripper solenoid, or a host of other
devices which works via discrete I/O. Obviously the input checked with the Sw instruction has 2 states
(1 or 0). These indicate whether the device is On or Off.
See Also
In, InBCD, MemOn, MemOff, MemSw, Off, On, OpBCD, Oport, Out, Wait
Sw Function Example
The example shown below simply checks the discrete input #5 and branches accordingly. On is used
instead of 1 for more clarity.
Function main
Integer i, feed5Ready
feed5Ready = Sw(5)
'Check if feeder is ready
If feed5Ready = On Then
Call mkpart1
Else
Print "Feeder #5 is not ready. Please reset and"
Print "then restart program"
EndIf
Fend
391
SyncLock Statement
SyncLock Statement
Synchronizes tasks using a mutual exclusion lock.
Syntax
SyncLock syncID [, timeOut]
Parameters
syncID
timeOut
Description
Use SyncLock to lock use of a common resource so that only one task at a time can use it. When
the task is finished with the resource, it must call SyncUnlock to release the lock so other tasks can
use it.
392
SyncLock Statement
SyncLock Example
The following example uses SyncLock and SyncUnlock to allow only one task at a time to write a
message to a communcation port.
Function Main
Xqt Func1
Xqt Func2
Fend
Function Func1
Long count
Do
Wait .5
count = count + 1
LogMsg "Msg from Func1, " + Str$(count)
Loop
Fend
Function Func2
Long count
Do
Wait .5
count = count + 1
LogMsg "Msg from Func2, " + Str$(count)
Loop
Fend
The following example uses SyncLock with optional time out. Tw is used to check if the lock was
successful. By using a timeout, you can execute other code periodically while waiting to lock a
resource.
Function MySyncLock(syncID As Integer)
Do
SyncLock syncID, .5
If Tw = 0 Then
Exit Function
EndIf
If Sw(1) = On Then
Off 1
EndIf
Loop
Fend
393
SyncUnlock Statement
SyncUnlock Statement
Unlocks a sync ID that was previously locked with SyncLock.
Syntax
SyncUnlock syncID
Parameters
syncID
Description
Use SyncUnlock to unlock a sync ID previously locked with SyncLock.
task
task
task
task
Function task
Do
SyncLock 1
Print "resource 1 is locked by task", MyTask
Wait .5
SyncUnlock 1
Loop
Fend
394
SysConfig Command
SysConfig Command
Displays system configuration parameter.
Syntax
SysConfig
Return Values
Returns system configuration parameter.
Description
Display current configurated value for system control data. When the robot and controller is received
from the factory or after changing the configuration, it is a good idea to save this data. This can be
done with Backup Controller from te Tools | Controller dialog.
The following data will be displayed. (The following data is for reference only since data will vary from
controller to controller.)
' Version:
' Firmware 1, 0, 0, 0
' Options:
' External Control Point
' VB Guide
' HOUR: 414.634
' Controller:
' Serial #: 0001
' ROBOT 1:
' Name: Mnp01
' Model: PS3-AS10
' Serial #: 0001
' Motor On Time: 32.738
' Motor 1: Enabled, Power = 400
' Motor 2: Enabled, Power = 400
' Motor 3: Enabled, Power = 200
' Motor 4: Enabled, Power = 50
' Motor 5: Enabled, Power = 50
' Motor 6: Enabled, Power = 50
395
SysConfig Command
ARCH 0, 30, 30
ARCH 1, 40, 40
ARCH 2, 50, 50
ARCH 3, 60, 60
ARCH 4, 70, 70
ARCH 5, 80, 80
ARCH 6, 90, 90
ARMSET 0, 0, 0, 0, 0, 0
HOFS 0, 0, 0, 0, 0, 0
HORDR 63, 0, 0, 0, 0, 0
RANGE -7427414, 7427414, -8738134, 2621440, -3145728, 8301227, -5534152, 5534152,
-3640889, 3640889, -6553600, 6553600
BASE 0, 0, 0, 0, 0, 0
WEIGHT 2, 0
INERTIA 0.1, 0
XYLIM 0, 0, 0, 0, 0, 0
' Extended I/O Boards:
' 1: Installed
' 2: Installed
' 3: None installed
' 4: None installed
' Fieldbus I/O Board:
' Installed
' Type: PROFIBUS
' RS232C Boards:
' 1: Installed
' 2: None installed
SysConfig Example
> SysConfig
396
SysErr Function
SysErr Function
Returns the latest error status or warning status.
Syntax
SysErr [(infoNo)]
Parameters
infoNo
Optional. Integer number representing the error code or warning code to get.
0 : Error code (When the parameter is omitted, 0 is automatically selected.)
1 : Warning code
Return Values
An integer representing the error code or warning code of the controller.
Description
SysErr is used only for NoEmgAbort task (special task using NoEmgAbort at Xqt).
Error codes or warning codes of controller are the error codes or warning codes dispayed on the on
the seven-segment LED.
When there are no errors or warnings, the return value will be 0.
See Also
ErrMsg$, ErrOn, Xqt
SysErr Function Example
The following example shows a program that monitors the controller error and switches the I/O On/Off
according to the error number when error occurs.
Notes
Forced Flag
This program example uses Forced flag for On/Off command.
Be sure that the I/O outputs change during error, or at Emergency Stop or Safety Door Open when
designing the system.
After Error Occurence
As this program, finish the task promply after completing the error handling.
Function main
Xqt ErrorMonitor, NoEmgAbort
:
:
Fend
Function ErrorMonitor
Wait ErrorOn
If 4000 < SysErr Then
Print "Motion Error = ", SysErr
Off 10, Forced
On 12, Forced
Else
Print "Other Error = ", SysErr
Off 11, Forced
On 13, Forced
EndIf
Fend
397
Tab$ Function
Tab$ Function
Returns a string containing the specified number of tabs characters.
Syntax
Tab$(number)
Parameters
number
Return Values
String containing tab characters.
Description
Tab$ returns a string containing the specified number of tabs.
See Also
Left$, Mid$, Right$, Space$
Tab$ Function Example
Print "X", Tab$(1), "Y"
Print
For i = 1 To 10
Print x(i), Tab$(1), y(i)
Next i
398
Tan Function
Tan Function
Returns the tangent of a numeric expression.
Syntax
Tan(radians)
Parameters
radians
Return Values
Real number containing the tangent of the parameter radians.
Description
Tan returns the Tangent of the numeric expression. The numeric expression (radians) may be any
numeric value as long as it is expressed in radian units.
The examples shown below show some typical results using the Tan instruction from the Command
window.
> print tan(0)
0.00
> print tan(45)
1.6197751905439
>
399
TargetOK Function
TargetOK Function
Returns a status indicating whether or not the PTP (Point to Point) motion from the current
position to a target position is possible.
Syntax
TargetOK(targetPos)
Parameters
targetPos
Return Values
True if is it possible to move to the target position from the current position, otherwise False.
Description
Use TargetOK to verify that a target position and orientation can be reached before actually moving to
it. The motion trajectory to the target point is not considered.
See Also
CurPos, FindPos, InPos, WaitPos
TargetOK Function Example
If TargetOK(P1) Then
Go P1
EndIf
If TargetOK(P10 /L /F) Then
Go P10 /L /F
EndIf
400
TaskDone Function
TaskDone Function
Returns the completion status of a task.
Syntax
TaskDone (taskIdentifier )
Parameters
taskIdentifier
Return Values
True if the task has been completed, False if not.
Description
Use TaskDone to determine if a task has completed.
See Also
TaskState, TaskWait
TaskDone Function Example
Xqt 2, conveyor
Do
.
.
Loop Until TaskDone(conveyor)
401
TaskInfo Function
TaskInfo Function
F
index
Return Values
An integer containing the specified information.
Description
Index
0
1
4
5
6
7
Description
Task number
Undefined
Task type
0 - Normal task
Nothing specified in Xqt or start the task by Normal
1 - NoPause task
Specified NoPause in Xqt and start the task
2 - NoEmgAbort task
Specified NoEmgAbort in Xqt and start the task
1 - Specified task is not executing.
1 - Specified task is executing.
2 - Specified task is waiting for an event.
3 - Specified task is paused or halted
4 - Specified task is in quick pause state
5 - Specified task is in error state
Timeout has occured during wait for event (same as TW)
Event wait time (milliseconds).
Current robot number selected by the task
Current robot number being used by the task
See Also
CtrlInfo, RobotInfo, TaskInfo
TaskInfo Function Example
If (TaskInfo(1, 3) = 3 Then
Print "Task 1 is runnning"
Else
Print "Task 1 is not running"
EndIf
402
TaskInfo$ Function
TaskInfo$ Function
Returns text information for a task.
Syntax
TaskInfo$( taskIdentifier, index)
Parameters
taskIdentifier
index
Return Values
A string containing the specified information.
Description
The following table shows the information that can be retrieved using TaskInfo$:
Index
0
1
2
3
Description
Task name
Start date / time
Name of function currently executing
Line number in the program file that contains the function
See Also
CtrlInfo, RobotInfo, TaskInfo
TaskInfo$ Function Example
Print "Task 1 started: "TaskInfo$(1, 1)
403
TaskState Function
TaskState Function
F
Return Values
0: Task not running
1: Task is running
2: Task is waiting for an event
3: Task has been halted
4: Task has been paused in QuickPause
5: Task in error condition
Description
Use TaskState to get status for a given task. You can specify task number or task name.
See Also
TaskDone, TaskWait
TaskState Function Example
If TaskState(conveyor) = 0 Then
Xqt 2, conveyor
EndIf
404
TaskWait Statement
TaskWait Statement
Waits to for a task to terminate.
Syntax
TaskWait (taskIdentifier)
Parameters
taskIdentifier
See Also
TaskDone, TaskState
TaskWait Statement Example
Xqt 2, conveyor
TaskWait conveyor
405
TC Statement
TC Statement
Returns the torque control mode setting and current mode.
Syntax
(1) TC { On | Off }
(2) TC
Parameters
On | Off
Return Values
When the parameter are omitted, turns the current torque control mode.
Description
TC On/Off set the torque control mode available/unavailable.
The torque control mode sets the motor output limit to generate the constant force. This is used in
pressing a hand to an object at constant force or making the close contact and coordinate moving of
hand with an object .
Before setting the torque control available, configure the limits of torque control and speed control in
TCLim and TCSpeed.
Under the torque control, the robot moves as positioning to the target while an operation command is
executed. When the robot contact an object and motor output is at the torque control limit, the robot
stops its operation and keeps the constant torque.
406
TCLim Statement
TCLim Statement
Specifies the torque limit of each joint for the torque control mode.
Syntax
TCLim [j1Torque limit, j2Torque limit, j3Torque limit, j4Torque limit, [j5Torque limit], [j6Torque limit] ]
Parameters
j1Torque limit
j2Torque limit
j3Torque limit
j4Torque limit
j5Torque limit
j6Torque limit
Return vlaues
When the parameters are omitted, returns the current torque limit.
Description
Setting to the torque limit becomes available at TC On.
When the limit value is too low, the robot doesnt work and operation command stops before the robot
reaches the target position.
In any of the following cases, TCLim set value is initialized.
Controller power ON
Motor On
SFree, SLock
Reset
STOP button or Ctrl + C key
See Also
TC, TCLim Function, TCSpeed
407
TCLim Statement
TCLim Example
Speed 5
Go ApproachPoint
'Set the Z axis torque limit to 20 %
TCLim -1, -1, 20, -1
'Set the speed in torque control to 5 %
TcSpeed 5
TC On
Go ContactPoint
Wait 3
Go ApproachPoint
TC Off
408
TCLim Function
TCLim Function
Returns the torque limit of specified joint.
Syntax
TCLim (jointNumber)
Parameters
ointNumber
Specifies the joint number to retrieve the torque limit from using an expression or
numeric value.
Return values
Returns the integer number representing the current torque limit (1 - 100). -1 means the torque limit is
invalid.
See Also
TC, TCLim, TCSpeed
TCLim Fuction Example
Print "Current Z axis torque limit:", TCLim(3)
409
TCPSpeed Function
TCPSpeed Function
Returns the calculated current tool center point (TCP) speed.
Syntax
TCPSpeed
Return Values
Real value containing the calculated current tool center point speed in mm/second.
Description
Use TCPSpeed to get the calculated current speed of the tool center point in mm/second when
executing a CP (Continuous Path) motion command. CP motion commands include Move, TMove,
Arc, Arc3, CVMove, and Jump3CP. This is not the actual tool center point speed. It is the speed that
the system has calculated for the tool center point at the time the function is called.
410
TCSpeed Statement
TCSpeed Statement
Specifies the speed limit in the torque contol.
Syntax
TCSpeed [speed]
Parameters
speed
Specifies the proportion to the maximum speed (1 -100 / unit: %) using an expression or
numeric value.
Description
Under the torque control, the speed is limited to the TCSpeed setting despite of the speed settings of
such as Speed command.
Error occurs if the speed goes over the limit in the torque control.
411
TCSpeed Function
TCSpeed Function
Returns the speed limit in the torque control.
Syntax
TCSpeed
Return values
Returns the integer number (1 - 100) representing the current speed limit.
See Also
TC, TCSpeed, TCLim
TCSpeed Example
Integer var
var = TCSpeed
412
TGo Statement
TGo Statement
Executes Point to Point relative motion, in the current tool coordinate system.
>
Syntax
TGo destination [CP] [searchExpr] [!...!]
Parameters
destination
CP
searchExpr
!...!
Description
Executes point to point relative motion in the current tool coordinate system.
Arm orientation attributes specified in the destination point expression are ignored. The manipulator
keeps the current arm orientation attributes. However, for a 6-Axis manipulator, the arm orientation
attributes are automatically changed in such a way that joint travel distance is as small as possible.
The Till modifier is used to complete TGo by decelerating and stopping the robot at an intermediate
travel position if the current Till condition is satisfied.
The Find modifier is used to store a point in FindPos when the Find condition becomes true during
motion.
When Till is used and the Till condition is satisfied, the manipulator halts immediately and the motion
command is finished. If the Till condition is not satisfied, the manipulator moves to the destination
point.
When Find is used and the Find condition is satisfied, the current position is stored. Please refer to
Find for details.
When parallel processing is used, other processing can be executed in parallel with the motion
command.
The CP parameter causes acceleration of the next motion command to start when the deceleration
starts for the current motion command. In this case the robot will not stop at the destination
coordinate and will continue to move to the next point.
See Also
Accel, CP, Find, !....! Parallel Processing, Point Assignment, Speed, Till, TMove, Tool
413
TGo Statement
TGo Example
> TGo XY(100, 0, 0, 0)
Function TGoTest
Speed 50
Accel 50, 50
Power High
Tool 0
P1 = XY(300, 300, -20, 0)
P2 = XY(300, 300, -20, 0) /L
Go P1
Print Here
TGo XY(0, 0, -30, 0)
Print Here
Go P2
Print Here
TGo XY(0, 0, -30, 0)
Print Here
Fend
[Output]
X: 300.000
X: 300.000
X: 300.000
X: 300.000
414
Y:
Y:
Y:
Y:
300.000
300.000
300.000
300.000
Z:
Z:
Z:
Z:
-20.000
-50.000
-20.000
-50.000
U:
U:
U:
U:
0.000
0.000
0.000
0.000
V:
V:
V:
V:
0.000
0.000
0.000
0.000
W:
W:
W:
W:
0.000
0.000
0.000
0.000
/R
/R
/L
/L
/0
/0
/0
/0
Till Statement
Till Statement
Specifies and displays input condition that, if satisfied, completes the motion command
(Jump, Go, Move, etc.) in progress by decelerating and stopping the robot at
an intermediate position.
>
Syntax
Till [ inputCondition ]
Parameters
inputCondition The following functions and operators may be used in the inputCondition:
Functions Sw, In, InW, Oport, Out, OutW, MemSw, MemIn, MemW, Ctr
Operators And, Or, Xor
The Till statement can be used by itself or as a search expression in a motion command statement.
The Till condition must include at least one of the functions above.
When variables are included, their values are computed when setting the Till condition. No use of
variable is recommended. Otherwise, the condition may be an unintended condition. Multiple Till
statements are permitted. The most recent Till condition remains current until superseded.
When parameters are omitted, the current Till definition is displayed.
Notes
Till Setting at Main Power On
At power on, the Till condition is initialized to Till Sw(0) = On.
Use of Stat or TillOn to Verify Till
After executing a motion command which uses the Till qualifier there may be cases where you want to
verify whether or not the Till condition was satisfied. This can be done through using the Stat function
or the TillOn function.
See Also
Find, Go, In, InW, Oport, Out, OutW, Jump, MemIn, MemSw, Move, Stat, Sw, TillOn
Till Example
Shown below are some sample lines from programs using the Till instruction
Till Sw(1) = Off
'Specifies Till condition (Input bit 1 off)
Go P1 Till
'Stop if previous line condition is satisfied
Till Sw(1) = On And Sw($1) = On
'Specify new Till condition
Move P2 Till
'Stop if previous line condition satisfied
Move P5 Till Sw(10) = On
'Stop if condition on this line
'is satisfied
415
TillOn Function
TillOn Function
F
416
Time Command
Time Command
Specifies and displays the current time.
>
Syntax
(1) Time hours, minutes, seconds
(2) Time
Parameters
hours
The hour of the day to set the controller clock to. This is an function expression
between 1 and 24.
minutes
The minute of the day to set the controller clock to. This is an function expression
between 0 and 59.
seconds
The second of the day to set the controller clock to. This is an function
expression between 0 and 59.
Return Values
If parameters are omitted, displays the current time in 24 hour format.
Description
Specifies the current time.
417
Time Function
Time Function
Returns the controller accumulated operating time.
Syntax
Time(unitSelect)
Parameters
unitSelect
An integer number ranging from 0-2. This integer specifies which unit of time the
controller returns:
0: hours
1: minutes
2: seconds
Description
Returns the controller accumulated operating time as an integer.
See Also
Hour
Time Function Example
Shown below are a few examples from the command window:
Function main
Integer h, m, s
h = Time(0)
'Store the time in hours
m = Time(1)
'Store the time in minutes
s = Time(2)
'Store the time in seconds
Print "This controller has been used:"
Print h, "hours, ",
Print m, "minutes, ",
Print s, "seconds"
Fend
418
Time$ Function
Time$ Function
Returns the system time.
Syntax
Time$
Return Values
A string containing the current time in 24 hour format hh:mm:ss.
Description
Time$ is used to get the system time in a program statement. To set the system time, you must use
the Time command from the command window.
See Also
Date, Date$, Time
Time$ Example
Print "The current time is: ", Time$
419
TLClr Statement
TLClr Statement
Clears (undefines) a tool coordinate system.
>
Syntax
TLClr toolNumber
Parameters
toolNumber
Description
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
See Also
Arm, ArmClr, ArmSet, ECPSet, Local, LocalClr, Tool, TLSet
TLClr Example
TLClr 1
420
TLDef Function
TLDef Function
Returns tool definition status.
>
Syntax
TLDef (toolNumber)
Parameters
toolNumber
Return Values
True if the specified tool has been defined, otherwise False.
See Also
Arm, ArmClr, ArmSet, ECPSet, Local, LocalClr, Tool, TLClr, TLSet
TLDef Example
Function DisplayToolDef(toolNum As Integer)
If TlDef(toolNum) = False Then
Print "Tool ", toolNum, "is not defined"
Else
Print "Tool ", toolNum, ": ",
Print TlSet(toolNum)
EndIf
Fend
421
TLSet Statement
TLSet Statement
Defines or displays a tool coordinate system.
>
Syntax
(1) TLSet toolNum, toolDefPoint
(2) TLSet toolNum
(3) TLSet
Parameters
toolNum
toolDefPoint
Integer number from 1-15 representing which of 15 tools to define. (Tool 0 is the
default tool and cannot be modified.)
Pnumber or P(expr) or point label or point expression.
Return Values
When parameters are omitted, displays all TLSet Definition.
When only the tool number is specified, displays specified TLSet Definition.
Description
Defines the tool coordinate systems Tool 1, Tool 2 or Tool 3 by specifying tool coordinate system
origin and rotation angle in relation to the Tool 0 coordinate system (Hand coordinate system).
TLSet 1, XY(50,100,-20,30)
TLSet 2, P10 +X(20)
In this case, the coordinate values of P10 are referenced and 20 is added to the X value. Arm
attribute and local coordinate system numbers are ignored.
422
TLSet Statement
423
TLSet Statement
Tool 0 coordinate systems are defined for ceiling and wall mounted robots as shown in the figures
below.
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
Notes
TLSet values are maintained
The TLSet values are preserved. Use TLClr to clear a tool definition.
See Also
Tool, Arm, ArmSet, Point Expression, TLClr, TLSet Function
TLSet Example
The example shown below shows a good test which can be done from the command window to help
understand the difference between moving when a tool is defined and when no tool is defined.
> TLSet 1, XY(100, 0, 0, 0)
>
>
>
>
424
Tool 1
TGo P1
Tool 0
Go P1
TLSet Function
TLSet Function
Returns a point containing the tool definition for the specified tool.
Syntax
TLSet(toolNumber)
Parameters
toolNumber
Return Values
A point containing the tool definition.
See Also
TLSet Statement
TLSet Function Example
P1 = TLSet(1)
425
TMOut Statement
TMOut Statement
Specifies the number of seconds to wait for the condition specified with the Wait
instruction to come true before issuing a timeout error.
>
Syntax
TMOut seconds
Parameters
seconds
Real expression representing the number of seconds until a timeout occurs. Valid range
is 0-2147483 seconds in 1 second intervals.
Description
TMOut sets the amount of time to wait (when using the Wait instruction) until a timeout error is issued.
If a timeout of 0 seconds is specified, then the timeout is effectively turned off. In this case the Wait
instruction waits indefinitely for the specified condition to be satisfied.
426
TMove Statement
TMove Statement
Executes linear interpolation relative motion, in the current tool coordinate system
>
Syntax
TMove destination [ROT] [CP] [ searchExpr ] [ !...! ]
Parameters
destination
ROT
Optional.
rotation.
CP
searchExpr
!...!
Description
Executes linear interpolated relative motion in the current tool coordinate system.
Arm orientation attributes specified in the destination point expression are ignored. The manipulator
keeps the current arm orientation attributes. However, for a 6-Axis manipulator, the arm orientation
attributes are automatically changed in such a way that joint travel distance is as small as possible.
TMove uses the SpeedS speed value and AccelS acceleration and deceleration values. Refer to
Using TMove with CP below on the relation between the speed/acceleration and the
acceleration/deceleration. If, however, the ROT modifier parameter is used, TMove uses the SpeedR
speed value and AccelR acceleration and deceleration values. In this case SpeedS speed value and
AccelS acceleration and deceleration value have no effect.
Usually, when the move distance is 0 and only the tool orientation is changed, an error will occur.
However, by using the ROT parameter and giving priority to the acceleration and the deceleration of
the tool rotation, it is possible to move without an error. When there is not an orientational change with
the ROT modifier parameter and movement distance is not 0, an error will occur.
Also, when the tool rotation is large as compared to move distance, and when the rotation speed
exceeds the specified speed of the manipulator, an error will occur. In this case, please reduce the
speed or append the ROT modifier parameter to give priority to the rotational
speed/acceleration/deceleration.
The Till modifier is used to complete TMove by decelerating and stopping the robot at an intermediate
travel position if the current Till condition is satisfied.
The Find modifier is used to store a point in FindPos when the Find condition becomes true during
motion.
When Till is used and the Till condition is satisfied, the manipulator halts immediately and the motion
command is finished. If the Till condition is not satisfied, the manipulator moves to the destination
point.
When Find is used and the Find condition is satisfied, the current position is stored. Please refer to
Find for details.
427
TMove Statement
When parallel processing is used, other processing can be executed in parallel with the motion
command.
Notes
Using TMove with CP
The CP parameter causes the arm to move to destination without decelerating or stopping at the point
defined by destination. This is done to allow the user to string a series of motion instructions together
to cause the arm to move along a continuous path while maintaining a specified speed throughout all
the motion. The TMove instruction without CP always causes the arm to decelerate to a stop prior to
reaching the point destination.
See Also
AccelS, CP, Find, !....! Parallel Processing, Point Assignment, SpeedS, TGo, Till, Tool
TMove Example
> TMove XY(100, 0, 0, 0)
Function TMoveTest
Speed 50
Accel 50, 50
SpeedS 100
AccelS 1000, 1000
Power High
Tool 0
P1 = XY(300, 300, -20, 0)
P2 = XY(300, 300, -20, 0) /L
Go P1
Print Here
TMove XY(0, 0, -30, 0)
Print Here
Go P2
Print Here
TMove XY(0, 0, -30, 0)
Print Here
Fend
[Output]
X: 300.000
X: 300.000
X: 300.000
X: 300.000
428
Y:
Y:
Y:
Y:
300.000
300.000
300.000
300.000
Z:
Z:
Z:
Z:
-20.000
-50.000
-20.000
-50.000
U:
U:
U:
U:
0.000
0.000
0.000
0.000
V:
V:
V:
V:
0.000
0.000
0.000
0.000
W:
W:
W:
W:
0.000
0.000
0.000
0.000
/R
/R
/L
/L
/0
/0
/0
/0
Tmr Function
Tmr Function
Timer function which returns the amount of time in seconds which has elapsed since
the timer was started.
Syntax
Tmr(timerNumber)
Parameters
timerNumber
Integer expression representing which of the 16 timers to check the time of.
Return Values
Elapsed time for the specified timer as a real number in seconds. Timer range is from 0 - approx.
1.7E+31. Timer resolution is 0.001 seconds.
Description
Returns elapsed time in seconds since the timer specified was started.
numbered 0 - 15.
'Reset Timer 0
'Perform operation 10 times
'Calculate and display cycle time
429
TmReset Statement
TmReset Statement
Resets the timers used by the Tmr function.
Syntax
TmReset timerNumber
Parameters
timerNumber
Description
Resets and starts the timer specified by timerNumber. 16 timers are available, numbered from 0 - 15.
Use the Tmr function to retrieve the elapsed time for a specific timer.
See Also
Tmr
TmReset Example
TmReset 0
For i = 1 To 10
GoSub CYL
Next
Print Tmr(0)/10
430
'Reset Timer 0
'Perform operation 10 times
'Calculate and display cycle time
Toff Statement
Toff Statement
Turns off execution line display on the seven-segment.
Syntax
Toff
Description
Excution line will not be displayed on the seven-segment.
See Also
Ton
Toff Example
Function main
Ton MyTask
...
Toff
Fend
431
Tool Statement
Tool Statement
>
Syntax
(1) Tool toolNumber
(2) Tool
Parameters
toolNumber
Return Values
Displays current Tool when used without parameters.
Description
Tool selects the tool specified by the tool number (toolNum). When the tool number is 0, no tool is
selected and all motions are done with respect to the center of the end effector joint. However, when
Tool entry 1, 2, or 3 is selected motion is done with respect to the end of the tool as defined with the
tool definition.
Note
Power Off and Its Effect on the Tool Selection
Turning main power off does not change the tool coordinate system selection.
See Also
TGo, TLSet, Tmove
Tool Statement Example
The example shown below shows a good test which can be done from the command window to help
understand the difference between moving when a tool is defined and when no tool is defined.
>tlset 1, 100, 0, 0, 0
>tool 1
>tgo p1
>tool 0
>go p1
432
Tool Function
Tool Function
Returns the current tool number.
Syntax
Tool
Return Values
Integer containing the current tool number.
Description
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
See Also
Tool Statement
Tool Function Example
Integer savTool
savTool = Tool
Tool 2
Go P1
Tool savTool
433
Ton Statement
Ton Statement
Specifies task Turns on debug trace.
Syntax
Ton taskIdentifier
Ton
Parameters
taskIdentifier
Description
Execution line of task 1 is displayed in initial status.
Ton statement displays the specified task execution line on the seven-segment.
When taskIdentifier is omitted, the task execution line with Ton statement execution is displayed on
the seven-segment.
See Also
Toff
Ton Example
Function main
Ton MyTask
...
Toff
Fend
434
Trap Statement
Trap Statement
Defines interrupts and what should happen when they occur.
Syntax
Trap trapNumber, condition GoTo { label}
Trap trapNumber, condition Call funcname
Trap trapNumber, condition Xqt funcname
Trap trapNumber
Parameters
trapNumber
condition
Integer number from 1-4 representing which of 4 Trap numbers to use. (SPEL+
supports up to 4 active Trap interrupts at the same time.)
The following functions and operators may be used in the condition expression:
Functions : Sw, In, InW, Oport, Out, OutW, MemSw, MemIn, MemW, Ctr
Operators : And, Or, Xor
funcName
The function that is executed when Call or Xqt when the Trap condition is
satisfied.
The function with argument cannot be specified.
Note
The functionality of Trap Call in RC+ 4.x or before has been changed to Trap Xqt in RC+ 5.0.
The functionality of Trap GoSub in RC+ 4.x or before has been removed. Use Trap Call instead of
Trap GoSub.
Description
A Trap executes interrupt processing which is specified by GoTo, Call, or Xqt when the specified
condition is satisfied.
The Trap condition must include at least one of the functions above.
When variables are included in the Trap condition, their values are computed when setting the Trap
condition. No use of variable is recommended. Otherwise, the condition may be an unintended
condition.
Once the interrupt process is executed, its Trap setting is cleared. If the same interrupt process is
necessary, the Trap instruction must execute it again.
To cancel a Trap setting simply execute the Trap instruction with only the trapNumber parameter. e.g.
"Trap 3" cancels Trap #3.
When the Function that executed Trap GoTo ends (or exit), the Trap Goto will be canceled
automatically.
When the declared task ends, Trap Call will be cancled.
Trap Xqt will be canceld when all tasks have stopped.
If GoTo is specified
The command being executed will be processed as described below, then control branches to the
specified line number or label.
- Any arm motion will pause immediately
- Waiting status by the Wait or Input commands will discontinue
- All other commands will complete execution before control branches
435
Trap Statement
If Call is specified
After executing the same process as GoTo described above, then control branches to the specified
line number or label.
Once the function ends, program execution returns to the next statement after the statement where
program interruption occurred. Call statements cannot be used in the Trap processing function.
When an error occurs in the trap process function, error handling with OnErr will be invalid and an
error will occur.
If Xqt is specified
Program control executes the specified function as an interrupt processing task. In this case, the task
which executes the Trap command will not wait for the Trap function to finish and will continue to
execute.
See Also
Call, Era, Erl, Err, Ert, ErrMsg$, GoSub, GoTo, OnErr, Xqt
Trap Example
<Example 1> Error process defined by User
Sw(0) Input is regarded as an error input defined by user.
Function Main
Trap 1 Sw(0)= On GoTo EHandle
.
.
.
EHandle:
On 31
'Signal tower lights
OpenCom #1
Print #1, "Error is issued"
CloseCom #1
Fend
'Defines Trap
436
Trim$ Function
Trim$ Function
Returns a string equal to specified string without leading or trailing spaces.
Syntax
Trim$(string)
Parameters
string
String expression.
Return Values
Specified string with leading and trailing spaces removed.
See Also
LTrim$, RTrim$
Trim$ Function Example
str$ = " data "
str$ = Trim$(str$)
437
TW Function
TW Function
Returns the status of the Wait, WaitNet, and WaitSig commands.
Syntax
TW
Return Values
Returns False if Wait condition is satisfied within the time interval.
Returns True if the time interval has elapsed.
Description
The Timer Wait function TW returns the status of the preceding Wait condition with time interval with a
False (Wait condition was satisfied) or a True (time interval has elapsed).
See Also
TMOut, Wait
TW Function Example
Wait Sw(0) = On, 5
If TW = True Then
Print Time Up
EndIf
438
UBound Function
UBound Function
Returns the largest available subscript for the indicated dimension of an array.
Syntax
UBound (arrayName [, dimension])
Parameters
arrayName
dimension
See Also
Redim
UBound Function Example
Integer i, a(10)
For i=0 to UBound(a)
a(i) = i
Next
439
UCase$ Function
UCase$ Function
Returns a string that has been converted to uppercase.
Syntax
UCase$ (string)
Parameters
string
String expression.
Return Values
The converted uppercase string.
See Also
LCase$, LTrim$, Trim$, RTrim$
UCase$ Example
str$ = "Data"
str$ = UCase$(str$)
440
Val Function
Val Function
Converts a character string that consists of numbers into their numerical value and returns
that value.
Syntax
Val(string)
Parameters
string
String expression which contains only numeric characters. The string may also contain
a prefix: &H (hexadecimal), &O (octal), or &B (binary).
Return Values
Returns an integer or floating point result depending upon the input string. If the input string has a
decimal point character than the number is converted into a floating point number. Otherwise the
return value is an integer.
Description
Val converts a character string of numbers into a numeric value. The result may be an integer or
floating point number. If the string passed to the Val instruction contains a decimal point then the
return value will be a floating point number. Otherwise it will be an integer.
See Also
Abs, Asc, Chr$, Int, Left$, Len, Mid$, Mod, Right$, Sgn, Space$, Str$
Val Example
The example shown below shows a program which coverts several different strings to numbers and
then prints them to the screen.
Function ValDemo
String realstr$, intstr$
Real realsqr, realvar
Integer intsqr, intvar
realstr$ = "2.5"
realvar = Val(realstr$)
realsqr = realvar * realvar
Print "The value of ", realstr$, " squared is: ", realsqr
intstr$ = "25"
intvar = Val(intstr$)
intsqr = intvar * intvar
Print "The value of ", intstr$, " squared is: ", intsqr
Fend
441
VxCalib Statement
VxCalib Statement
Note: This command is only for use with external vision systems and cannot be used with Vision Guide.
Integer expression that specifies the calibration data number. The range is from 0 to
15; up to 16 calibrations may be defined.
Integer expression that specifies the camera mounting direction using the following
values:
1 to 3: Available only for syntax (2).
4 to 7: Available only for syntax (3).
1: Standalone
2: Fixed downward
3: Fixed upward
4: Mobile on Joint #2 (SCARA robot)
5: Mobile on Joint #4 (SCARA robot)
6: Mobile on Joint #5 (6-axis robot)
7: Mobile on Joint #6 (6-axis robot)
P(pixel_st : pixel_ed)
Specifies the Pixel coordinates (X, Y only) using the continuous point data.
P(robot_st : robot_ed)
Specifies the robot coordinates using the continuous point data.
The robot coordinates must be set as TOOL: 0, ARM: 0.
TwoRefPoints Available for syntax (1).
True, when using two measuring points. False, when using one measuring point.
Specifying two measuring points makes the calibration more accurate.
Optional.
Default: False
P(ref0)
P(ref180)
Description
The VxCalib comand calculates the vision calibration data for the specified calibration number using
the specified camera orientation, pixel coordinates, robot coordinates, and reference points (Mobile
camera only) given by the parameter.
When you specify only CalNo, the point data and other settings you defined are displayed (only from
the Command Window).
The following figure shows the coordinates system of the pixel coordinates. (Units: pixel)
442
VxCalib Statement
0, 0
+X
0
+Y
For the pixel coordinates and robot coordinates, set the top left position of the window as Point 1 and
set the bottom right position as Point 9 according to the order in the table below.
It is classified into the four categories by the parameter CamOrient and TwoRefPoints.
1) CamOrient = 1 to 3 (Standalone, Fixed Downward, Fixed Upward), TwoRefPoints = False
Data order
Position
1
2
3
4
5
6
7
8
9
Top left
Top center
Top right
Center right
Center
Center left
Bottom left
Bottom center
Bottom right
Pixel coordinates
Detection coordinates 1
Detection coordinates 2
Detection coordinates 3
Detection coordinates 4
Detection coordinates 5
Detection coordinates 6
Detection coordinates 7
Detection coordinates 8
Detection coordinates 9
Robot coordinates
Measuring point coordinates 1
Measuring point coordinates 2
Measuring point coordinates 3
Measuring point coordinates 4
Measuring point coordinates 5
Measuring point coordinates 6
Measuring point coordinates 7
Measuring point coordinates 8
Measuring point coordinates 9
Position
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Top left
Top center
Top right
Center right
Center
Center left
Bottom left
Bottom center
Bottom right
Top left
Top center
Top right
Center right
Center
Center left
Bottom left
Bottom center
Bottom right
Pixel coordinates
Detection coordinates 1
Detection coordinates 2
Detection coordinates 3
Detection coordinates 4
Detection coordinates 5
Detection coordinates 6
Detection coordinates 7
Detection coordinates 8
Detection coordinates 9
-------------------
Robot coordinates
Measuring point coordinates 1
Measuring point coordinates 2
Measuring point coordinates 3
Measuring point coordinates 4
Measuring point coordinates 5
Measuring point coordinates 6
Measuring point coordinates 7
Measuring point coordinates 8
Measuring point coordinates 9
Measuring point coordinates10
Measuring point coordinates11
Measuring point coordinates12
Measuring point coordinates13
Measuring point coordinates14
Measuring point coordinates15
Measuring point coordinates16
Measuring point coordinates17
Measuring point coordinates18
U axis
0 degree
180
degrees
443
VxCalib Statement
3) CamOrient = 3 (Fixed Upward), TwoRefPoints = True
Note: When the tool is exactly defined, TwoRefPoints is not necessary and should be set to False.
By setting TwoRefPoints to True, two detection points are used, which makes the calibration more
accurate. For only the pixel coordinates, 18 points of U axis: 0 degree / 180 degrees are required.
After setting 1 to 9 detection coordinates at the each measuring point coordinates at 0 degrees, set
the detection coordinates for points 10 to 18 at 180 degrees.
Data order
Position
Pixel coordinates
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Top left
Top center
Top right
Center right
Center
Center left
Bottom left
Bottom center
Bottom right
Top left
Top center
Top right
Center right
Center
Center left
Bottom left
Bottom center
Bottom right
Detection coordinates 1
Detection coordinates 2
Detection coordinates 3
Detection coordinates 4
Detection coordinates 5
Detection coordinates 6
Detection coordinates 7
Detection coordinates 8
Detection coordinates 9
Detection coordinates 10
Detection coordinates 11
Detection coordinates 12
Detection coordinates 13
Detection coordinates 14
Detection coordinates 15
Detection coordinates 16
Detection coordinates 17
Detection coordinates 18
Robot coordinates
Measuring point coordinates 1
Measuring point coordinates 2
Measuring point coordinates 3
Measuring point coordinates 4
Measuring point coordinates 5
Measuring point coordinates 6
Measuring point coordinates 7
Measuring point coordinates 8
Measuring point coordinates 9
-------------------
U axis
0 degree
180
degrees
4) CamOrient = 4 to 7
Data order
Position
1
2
3
4
5
6
7
8
9
Top left
Top center
Top right
Center right
Center
Center left
Bottom left
Bottom center
Bottom right
Pixel coordinates
Detection coordinates 1
Detection coordinates 2
Detection coordinates 3
Detection coordinates 4
Detection coordinates 5
Detection coordinates 6
Detection coordinates 7
Detection coordinates 8
Detection coordinates 9
Robot coordinates
Measuring point coordinates 1
Measuring point coordinates 2
Measuring point coordinates 3
Measuring point coordinates 4
Measuring point coordinates 5
Measuring point coordinates 6
Measuring point coordinates 7
Measuring point coordinates 8
Measuring point coordinates 9
Notes
In addition to the tables above, specify the robot coordinates of the reference points.
Using the two reference points makes the calibration more accurate. In this case, it needs two points
of U axis: 0 degree / 180 degrees.
After setting the first reference points coordinates, turn the U axis by 180 degrees and set the second
reference points coordinates where the hand (such as the rod) is positioned at the calibration target
position. When the tool is exactly defined, the two reference points are not necessary.
See Also
VxTrans Function, VxCalInfo Function, VxCalDelete, VxCalSave, VxCalLoad
444
VxCalib Statement
VxCalib Statement Example
Function MobileJ2
Integer i
Double d(8)
Robot 1
LoadPoints "MobileJ2.pts"
VxCalib 0, 4, P(21:29), P(1:9), P(0)
If (VxCalInfo(0, 1) = True) Then
For i = 0 To 7
d(i) = VxCalInfo(0, i + 2)
Next i
Print "Calibration result:"
Print d(0), d(1), d(2), d(3), d(4), d(5), d(6), d(7)
P52 = VxTrans(0, P51, P50)
Print "Coordinates conversion result:"
Print P52
SavePoints "MobileJ2.pts"
VxCalSave "MobileJ2.caa"
Else
Print "Calibration failed"
EndIf
Fend
445
VxCalDelete Statement
VxCalDelete Statement
Note: This command is only for use with external vision systems and cannot be used with Vision Guide.
Deletes the calibration data for an external vision system calibration.
Syntax
VxCalDelete CalNo
Parameters
CalNo
Integer expression that specifies the calibration data number. The range is from 0 to
15; up to 16 calibrations may be defined.
Description
Deletes the calibration data defined by the specified calibration number.
See Also
VxCalib, VxTrans Function, VxCalInfo Function, VxCalSave, VxCalLoad
VxCalDelete Statement Example
VxCalDelete "MobileJ2.caa"
446
VxCalLoad Statement
VxCalLoad Statement
Note: This command is only for use with external vision systems and cannot be used with Vision Guide.
Loads the calibration data for an external vision system calibration from a file.
Syntax
VxCalLoad FileName
Parameters
FileName
Specifies the file name from which the calibration data is loaded using a string
expression.
The file extension is .CAA. If omitted, .CAA is automatically added.
For extensions other than .CAA, they are automatically changed to .CAA.
Description
Loads the calibration data from the specified file in the current project.
See Also
VxCalib, VxTrans Function, VxCalInfo Function, VxCalDelete, VxCalSave
VxCalLoad Statement Example
VxCalLoad "MobileJ2.caa"
447
VxCalInfo Function
VxCalInfo Function
Note: This command is only for use with external vision systems and cannot be used with Vision Guide.
Returns the calibration completion status and the calibration data.
Syntax
VxCalInfo (CalNo,CalData)
Parameters
CalNo
CalData
Integer expression that specifies the calibration data number. The range is from 0 to
15; up to 16 calibrations may be defined.
Specifies the calibration data type to acquire using the integer values in the table below.
CalData
1
2
3
4
5
6
7
8
9
Return Value
Returns the specified calibration data. For CalData = 1, the data type is Boolean. For all other data,
the data type is Double.
Description
You can check which calibration has defined calibration data.
Also, you can retrieve the calibration data values.
See Also
VxCalib, VxTrans Function, VxCalDelete, VxCalSave, VxCalLoad
VxCalInfo Function Example
Print VxCalInfo(0, 1)
448
VxCalSave Statement
VxCalSave Statement
Note: This command is only for use with external vision systems and cannot be used with Vision Guide.
Saves the calibration data for an external vision system calibration to a file.
Syntax
VxCalSave FileName
Parameters
FileName
Specifies the file name from which the calibration data is loaded using a string
expression.
The extension is .CAA. If omitted, .CAA is automatically added.
For extensions other than .CAA, they are automatically changed to .CAA.
Description
Saves the calibration data with the specified file name. The file is saved in the current project. If the
file name is already existed, the calibration data is overwritten.
See Also
VxCalib, VxTrans Function, VxCalInfo Function, VxCalDelete, VxCalLoad
VxCalSave Statement Example
VxCalSave "MobileJ2.caa"
449
VxTrans Function
VxTrans Function
Note: This command is only for use with external vision systems and cannot be used with Vision Guide.
Converts pixel coordinates to robot coordinates and returns the converted point data.
Syntax
VxTrans (CalNo, P(pixel) [, P(camRobot)] ) As Point
Parameters
CalNo
P(pixel)
Integer expression that specifies the calibration data number. The range is from 0 to
15; up to 16 calibrations may be defined.
Specifies the vision pixel coordinates (X,Y,U only) using point data.
P(camRobot) Optional. For a mobile camera, this is the position where the robot was located when
the image was acquired. If not specified, then the current robot position is used.
The point should be in BASE: 0, TOOL: 0, ARM: 0.
Return Value
Returns the calculated robot coordinates using the point data.
Description
This command converts pixel coordinates to robot coordinates using the calibration data of the
specified calibration number.
When using a mobile camera, specify P(camRobot) if the robot has been moved from the position
where the image was acquired. Ensure that P(camRobot) is in BASE: 0, TOOL: 0, ARM: 0. The Joint
#4 and Joint #6 angles of the set robot coordinates are used for the calculation.
See Also
VxCalib, VxCalInfo Function, VxCalDelete, VxCalSave, VxCalLoad
VxTrans Statement Example
P52 = VxTrans(0, P51, P50)
450
Wait Statement
Wait Statement
Causes the program to Wait for a specified amount of time or until the specified input
condition (using MemSw or Sw) is met. (Oport may also be used in the place of Sw
to check hardware outputs.)
>
Syntax
(1) Wait time
(2) Wait inputCondition
(3) Wait inputCondition, time
Parameters
time
inputCondition
Real expression between 0 and 2,147,483 which represents the amount of time
to wait when using the Wait instruction to wait based on time. Time is specified in
seconds. The smallest increment is .01 seconds.
The following functions and operators may be used in the inputCondition:
Functions : Sw, In, InW, Oport, Out, OutW, MemSw, MemIn, MemW, Ctr,
Motor, LOF,
ErrorOn, SaftyOn, EstopOn, InsideBox,
InsidePlane, AtHome
Operators : And, Or, Xor, Mask
Description
(1) Wait with Time Interval
When used as a timer, the Wait instruction causes the program to pause for the amount of time
specified and then continues program execution.
(2) Wait for Input Conditions without Time Interval
When used as a conditional Wait interlock, the Wait instruction causes the program to wait until
specified conditions are satisfied. If after TMOut time interval has elapsed and the Wait conditions
have not yet been satisfied, an error occurs. The user can check multiple conditions with a single
Wait instruction by using the And, Mask, Or, or Xor instructions. (Please review the example
section for Wait.)
(3) Wait with Input Condition and Time Interval
Specifies Wait condition and time interval. After either Wait condition is satisfied, or the time
interval has elapsed, program control transfers to the next command. Use Tw to verify if the Wait
condition was satisfied or if the time interval elapsed.
Notes
Specifying a Timeout for Use with Wait
When the Wait instruction is used without a time interval, a timeout can be specified which sets a time
limit to wait for the specified condition. This timeout is set through using the TMOut instruction. Please
refer to this instruction for more information. (The default setting for TMOut is 0 which means no
timeout.)
Wait the change of a variable using Wait
The following program does not wait for the global variable i changing to 3.
Global Integer i
Wait i=3
When variables are included in the Waitcondition, their values are computed when setting the
Waitcondition. No use of variable is recommended. Otherwise, the condition may be an unintended
condition.
451
Wait Statement
Using Wait with Lof function
When Wait is used with Lof function, the port number for Lof function is 1 to 8 and 201 to 216.
Standard COM port (1001, 1002) is not available. If specified these ports, error occurs during the
operation.
See Also
AtHome, Ctr, ErrorOn, EstopOn, In, InsideBox, InsidePlane, InW, LOF, Mask, MemIn, MemSw,
MemW, Motor, Oport, Out, OutW, SaftyOn, Sw, TMOut, Tw
Wait Example
The example shown below shows 2 tasks each with the ability to initiate motion instructions. However,
a locking mechanism is used between the 2 tasks to ensure that each task gains control of the robot
motion instructions only after the other task is finished using them. This allows 2 tasks to each execute
motion statements as required and in an orderly predictable fashion. MemSw is used in combination
with the Wait instruction to wait until the memory I/O #1 is the proper value before it is safe to move
again.
Function main
Integer I
MemOff 1
Xqt !2, task2
For i = 1 to 100
Wait MemSw(1) = Off
Go P(i)
MemOn 1
Next I
Fend
Function task2
Integer i
For i = 101 to 200
Wait MemSw(1) = On
Go P(i)
MemOff 1
Next i
Fend
' Wait until input 0 turns on
Wait Sw(0) = On
' Wait 60.5 secs and then continue execution
Wait 60.5
' Wait until input 0 is off and input 1 is on
Wait Sw(0) = Off And Sw(1) = On
' Wait until memory bit 0 is on or memory bit 1 is on
Wait MemSw(0) = On Or MemSw(1) = On
'Wait one second, then turn output 1 on
Wait 1; On 1
' Wait for the lower 3 bits of input port 0 to equal 1
Wait In(0) Mask 7 = 1
452
WaitNet Statement
WaitNet Statement
Wait for TCP/IP port connection to be established.
Syntax
WaitNet #portNumber [, timeOut]
Parameters
portNumber
timeOut
See Also
OpenNet, CloseNet
WaitNet Statement Example
For this example, two controllers have their TCP/IP settings configured as follows:
Controller #1:
Port: #201
Host Name: 192.168.0.2
TCP/IP Port: 1000
Function tcpip
OpenNet #201 As Server
WaitNet #201
Print #201, "Data from host 1"
Fend
Controller #2:
Port: #201
Host Name: 192.168.0.1
TCP/IP Port: 1000
Function tcpip
String data$
OpenNet #201 As Client
WaitNet #201
Input #201, data$
Print "received '", data$, "' from host 1"
Fend
453
WaitPos Statement
WaitPos Statement
Waits for robot to decelerate and stop at position before executing the next statement
while path motion is active.
Syntax
WaitPos
Description
Normally, when path motion is active (CP On or CP parameter specified), the motion command starts
the next statement as deceleration starts.
Use the WaitPos command right before the motion to complete the deceleration motion and go on to
the next motion.
See Also
Wait, WaitSig, CP
WaitPos Statement Example
Off 1
CP On
Move P1
Move P2
WaitPos
On 1
CP Off
454
WaitSig Statement
WaitSig Statement
Waits for a signal from another task.
Syntax
WaitSig signalNumber [, timeOut]
Parameters
signalNumber
timeOut
Description
Use WaitSig to wait for a signal from another task. The signal will only be received after WaitSig has
started. Previous signals are ignored.
See Also
Wait, WaitPos, Signal
WaitSig Example
Function Main
Xqt SubTask
Wait 1
Signal 1
.
.
Fend
Function SubTask
WaitSig 1
Print "signal received"
.
Fend
455
Weight Statement
Weight Statement
Specifies or displays the inertia of the robot arm.
>
Syntax
Weight payloadWeight [ , distance ]
Weight
Parameters
payloadWeight
distance
Return Values
Displays the current Weight settings when parameters are omitted.
Description
Specifies parameters for calculating Point to Point motion maximum acceleration. The Weight
instruction specifies the weight of the end effector and the parts to be carried.
The Arm length (distance) specification is necessary only for SCARA robots (including RS series). It is
the distance from the second arm rotation joint centerline to the hand/work piece combined center of
gravity.
If the equivalent value work piece weight calculated from specified parameters exceeds the maximum
allowable payload, an error occurs.
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
Potential Errors
Weight Exceeds Maximum
When the equivalent load weight calculated from the value entered exceeds the maximum load weight,
an error will occur.
Potential Damage to the Manipulator Arm
Take note that specifying a Weight hand weight significantly less than the actual work piece weight
can result in excessive acceleration and deceleration. These, in turn, may cause severe damage to
the manipulator.
Note
Weight Values Are Not Changed by Turning Main Power Off
The Weight values are not changed by turning power off.
See Also
Accel, Inertia
Weight Statement Example
This Weight instruction on the Command window displays the current setting.
> weight
2.000, 200.000
>
456
Weight Function
Weight Function
Returns a Weight parameter.
Syntax
Weight(paramNumber)
Parameters
paramNumber
Return Values
Real number containing the parameter value.
See Also
Inertia, Weight Statement
Weight Function Example
Print "The current Weight parameters are: ", Weight(1)
457
Where Statement
Where Statement
>
See Also
Joint, PList, Pulse
Where Statement Example
>where
WORLD:
JOINT:
PULSE:
X:
1:
1:
350.000 mm Y:
0.000 deg 2:
0 pls 2:
0.000 mm Z:
0.000 deg 3:
0 pls 3:
0.000 mm U:
0.000 mm 4:
0 pls 4:
0.000 deg
0.000 deg
0 pls
250.000 mm Y: -100.000 mm Z:
0.000 deg 2:
0.000 deg 3:
0 pls 2:
0 pls 3:
0.000 mm U:
0.000 mm 4:
0 pls 4:
0.000 deg
0.000 deg
0 pls
458
1
X:
1:
1:
Wrist Statement
Wrist Statement
>
Syntax
(1) Wrist point, [Flip | NoFlip]
(2) Wrist
Parameters
point
459
Wrist Function
Wrist Function
Returns the wrist orientation of a point.
Syntax
Wrist [(point)]
Parameters
point
Optional. Pnumber or P(expr) or point label or point expression. If point is omitted, then
the wrist orientation of the current robot position is returned.
Return Values
1
NoFlip (/NF)
2
Flip (/F)
See Also
Elbow, Hand, J4Flag, J6Flag, Wrist Statement
Wrist Function Example
Print
Print
Print
Print
460
Wrist(pick)
Wrist(P1)
Wrist
Wrist(P1 + P2)
Write Statement
Write Statement
Writes characters to a communication port without end of line terminator.
Syntax
Write #portNumber, string
Parameters
portNumber
string
Description
Write is different from Print in that it does not add an end of line terminator.
See Also
Print, Read
Write Example
OpenCom #1
For i = 1 to 10
Write #1, data$(i)
Next i
CloseCom #1
461
WriteBin Statement
WriteBin Statement
Writes binary data to a communications port.
Syntax
WriteBin #portNumber, data
WriteBin #portNumber, array(), count
Parameters
portNumber
data
array()
Name of a byte, integer, or long array variable that contains the data bytes to be written.
Specify a one dimension array variable.
count
Specifies the number of bytes to be written and must be less than or equal to the
number of array elements.
Parameters
portNumber
data
See Also
ReadBin, Write
462
Xor Operator
Xor Operator
Performs the bitwise Xor operation (exclusive OR) on two expressions.
Syntax
result = expr1 Xor expr2
Parameters
expr1, expr2
result
Description
The Xor operator performs the bitwise Xor operation on the values of the operands. Each bit of the
result is the Xored value of the corresponding bits of the two operands.
If bit in expr1 is
0
0
1
1
The result is
0
1
1
0
See Also
And, LShift, Not, Or, Rshift
Xor Operator Example
>print 2 Xor 6
4
>
463
Xqt Statement
Xqt Statement
Initiates execution of a task from within another task.
Syntax
Xqt [taskNumber,] funcName [(argList)] [,Normal | NoPause | NoEmgAbort ]
Parameters
taskNumber
Optional. The task number for the task to be executed. The range of the task
number is 1 to 16.
funcName
argList
Optional. List of arguments that are passed to the function procedure when it is
called. Multiple arguments are separated by commas.
taskType
Normal
NoPause
Executes a task that does not pause at Pause statement or Pause input signal
occurance or Safety Door Open.
NoEmgAbort
Description
Xqt starts the specified function and returns immediately.
Normally, the taskNumber parameter is not required. When taskNumber is omitted, SPEL+
automatically assigns a task number to the function, so you don't have to keep track of which task
numbers are in use.
Notes
Task Type
Speciify NoPause or NoEmgAbort as a task type to execute a task that monitors the whole controller.
However, be sure to use these special tasks based on the understanding of the task motion using
SPEL+ or restriction of special tasks.
For details of special tasks, refer to the section Special Tasks in the EPSON RC+ 5.0 Users Guide.
Unavailable Commands in NoEmgAbort Task
The following commands cannot be executed in NoEmgAbort task.
A Accel
E ECP
M Motor
T TGo
AccelR
ECPClr
Move
Till
AccelS
ECPSet
O OLAccel
TLSet
Arc
F Fine
P Pass
TLClr
Arc3
Find
Plane
TMove
Arch
G Go
PlaneClr
Tool
Arm
H Home
Power
Trap
ArmSet
HomeClr
PTPBoost
V VGet
ArmClr
HomeSet
Pulse
VRun
B Base
Hordr
Q QP
VSet
BGo
I Inertia
R Range
W WaitPos
BMove
J JTran
Reset
Weight
Box
Jump
S Sense
X XYLim
BoxClr
Jump3
SFree
Xqt
Brake
Jump3CP
SLock
C CP
JRange
Speed
Curve
L LimZ
SpeedR
SpeedS
CVMove
Local
LocalClr
464
Xqt Statement
See Also
Function...Fend, Halt, Resume, Quit
Xqt Example
Function main
Xqt flash
Xqt Cycle(5)
Do
Wait 3
Halt flash
Wait 3
Resume flash
Loop
Fend
465
XY Function
XY Function
Returns a point from individual coordinates that can be used in a point expression.
Syntax
XY(x, y, z, u, [v, w])
Parameters
x
Real expression representing the X coordinate.
y
Real expression representing the Y coordinate.
z
Real expression representing the Z coordinate.
u
Real expression representing the U coordinate.
v
Optional for 6-Axis robots. Real expression representing the V coordinate.
w Optional for 6-Axis robots. Real expression representing the W coordinate.
Return Values
A point constructed from the specified coordinates.
See Also
JA, Point Expression
XY Function Example
P10 = XY(60, 30, -50, 45) + P20
466
XYLim Statement
XYLim Statement
Sets or displays the permissible XY motion range limits for the robot.
>
Syntax
XYLim minX, maxX, minY, maxY, [minZ], [maxZ]
XYLim
Parameters
minX
The minimum X coordinate position to which the manipulator may travel. (The
manipulator may not move to a position with the X Coordinate less than minX.)
maxX
The maximum X coordinate position to which the manipulator may travel. (The
manipulator may not move to a position with the X Coordinate greater than maxX.)
minY
The minimum Y coordinate position to which the manipulator may travel. (The
manipulator may not move to a position with the Y Coordinate less than minY.)
maxY
The maximum Y coordinate position to which the manipulator may travel. (The
manipulator may not move to a position with the Y Coordinate greater than maxY.)
minZ
Optional. The minimum Z coordinate position to which the manipulator may travel. (The
manipulator may not move to a position with the Z Coordinate less than minZ.)
maxZ
Optional. The maximum Z coordinate position to which the manipulator may travel. (The
manipulator may not move to a position with the Z Coordinate greater than maxZ.)
Return Values
Displays current XYLim values when used without parameters
Description
XYLim is used to define XY motion range limits. Many robot systems allow users to define joint limits
but the SPEL+ language allows both joint limits and motion limits to be defined. In effect this allows
users to create a work envelope for their application. (Keep in mind that joint range limits are also
definable with SPEL.)
The motion range established with XYLim values applies to motion command target positions only,
and not to motion paths from starting position to target position. Therefore, the arm may move outside
the XYLim range during motion. (i.e. The XYLim range does not affect Pulse.)
Notes
Turning Off Motion Range Checking
There are many applications which don't require Motion Range limit checking and for that reason
there is a simple method to turn this limit checking off. To turn motion range limit checking off, define
the Motion Range Limit values for minX, maxX, minY, and maxY to be 0. For example XYLim 0, 0, 0, 0.
Default Motion Range Limit Values
The default values for the XYLim instruction are "0, 0, 0, 0". (Motion Range Limit Checking is turned
off.)
Tip
Point & Click Setup for XYLim
EPSON RC+ 5.0 has a point and click dialog box for defining the motion range limits. The simplest
method to set the XYLim values is by using the XYZ Limits page on the Robot Manager .
467
XYLim Statement
See Also
Range
XYLim Statement Example
This simple example from the command window sets and then displays the current XYLim setting:
> xylim -200, 300, 0, 500
> XYLim
-200.000, 300.000, 0.000, 500.000
468
XYLim Function
XYLim Function
Returns point data for either upper or lower limit of XYLim region.
Syntax
XYLim(limit)
Parameters
limit
Return Values
Point containing the specified limit coordinates.
Description
Point data is stored to the Compact Flash inside the Controller. When you execute this command, the
data is written to the Compact Flash. If a data is written to the Compact Flash frequently, it may
shorten the Compact Flash life. Using this command only when saving the point data is
recommended.
See Also
XYLim Statement
XYLim Function Example
P1 = XYLim(1)
P2 = XYLim(2)
469
XYLimClr Statement
XYLimClr Statement
>
Syntax
XYLimClr
See Also
XYLim, XYLimDef
XYLimClr Function Example
This example uses the XYLimClr function in a program:
Function ClearXYLim
If XYLimDef = True Then
XYLimClr
EndIf
Fend
470
XYLimDef Function
XYLimDef Function
Returns whether XYLim has been defined or not.
Syntax
XYLimDef
Return Values
True if XYLim has been defined, otherwise False.
See Also
XYLim, XYLimClr
XYLimDef Function Example
This example uses the XYLimDef function in a program:
Function ClearXYLim
If XYLimDef = True Then
XYLimClr
EndIf
Fend
471
XYLimDef Function
472
Events
No.
1
2
3
4
5
Events
Warnings
Controller Main
Operator Panel
Teach Pendant
PC
Interpreter
Parser
Motor control
Servo
Points
Fieldbus
Message
12
13
14
15
16
17
18
100
Note 1
Note 2
11
Remedy
10
Vision
Simulator
GUI Builder
Hardware
EPSON RC+
J1 value
after change
J1 value
before
change
J2 value
after change
J2 value
before
change
J3 value
after change
J3 value
before
change
J4 value
after change
J4 value
before
change
J5 value
after change
J5 value
before
change
J6 value
after change
J6 value
before
change
473
Message
Remedy
101
102
103
110
111
120
121
122
123
124
125
126
127
128
129
130
131
132
474
Note 1
Note 2
21:PC
22:Remote
23:OP1
1:Setup
2:Initialize
3:Upgrade
4:Recover
LogoutStatus
0:Nomal
1:Abnormal
(Timeout)
Warnings
No.
501
Message
Trace history is active.
Memory has been initialized.
502
511
512
513
514
515
516
517
700
736
737
752
Remedy
Effects system performance if trace
history is active.
When this error occurs, the value of the
Global Preserve variable will be
initialized.
Replace the CPU board battery.
Replace the CPU board.
Replace the CPU board battery
immediately. Keep the power to the
controller ON as far as possible until
you replace the battery.
If normal voltage is not generated by a
5V power supply alone, replace the
power supply.
If normal voltage is not generated by a
24V power supply alone, replace the
power supply.
Stop the controller as soon as possible
and check whether the ambient
temperature of the controller is not
high.
Check whether the filter is not clogged
up.
Check whether the filter is not clogged
up. If the warning is not cleared after
the controller is rebooted, replace the
fan.
Check whether the filter is not clogged
up. If the warning is not cleared after
the controller is rebooted, replace the
fan.
Note 1
Note 2
Current
Boundary
value
value
Current
Boundary
value
value
Current
Boundary
value
value
Current
Boundary
value
value
Current
Boundary
value
value
Current
Boundary
value
value
Servo alarm D.
475
Controller Main
No.
1001
Message
Remedy
1005
1006
1003
1004
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1040
1041
476
Note 2
Operation Failure.
Command parameter is invalid.
Requested data cannot be
accessed. The data is not set up or
the range is invalid.
The password is invalid
Cannot execute with unsupported
version.
Cannot execute with invalid serial
number.
1002
Note 1
Message
Cannot execute while the
safeguard is open.
Cannot execute during error
condition.
Cannot execute when the remote
pause input is ON.
Input waiting condition is the only
available condition to input.
Cannot execute during file transfer.
Cannot cancel the command
executed from other devices.
1050
1051
1052
1100
1102
1048
1049
1103
1104
1105
1106
1107
1108
1109
1110
Remedy
1121
1122
1123
1125
1126
1127
1128
1130
Note 2
1120
1124
Note 1
477
Message
Remedy
1132
1133
1141
1142
1143
1144
1150
1151
1152
1153
1155
1156
1157
1158
1160
1161
1162
1163
1165
1166
1167
1168
1170
1171
1172
478
Note 2
1131
1140
Note 1
Message
1185
1186
1187
1188
1173
1175
1176
1177
1178
1180
1181
1189
1200
1201
1190
1191
1500
1501
Communication error.
Command did not complete in
time.
1550
Communication disconnection
between PC and Controller. Reestablish communication.
Disconnection while executing a
task.
Out of IP Address range.
Communication failure. Ethernet
initialization error.
1551
1552
1553
1502
1503
1510
Remedy
Note 1
Note 2
479
480
Message
Ethernet transmission error.
Ethernet reception error.
USB transmission error.
USB reception error.
Remedy
Note 1
Note 2
Unsupported. Unsupported
command was attempted.
Unsupported. Unsupported
parameter was specified.
System error.
Operator Panel
No.
Message
1603
1604
1605
1606
1607
1608
1600
1609
OP cannot be connected.
Remedy
Note 1
Note 2
Note 1
Note 2
Teach Pendant
No.
Message
1703
1704
1706
1708
1709
1710
1700
1701
1702
Remedy
481
PC
No.
1800
1802
1803
1804
Message
Remedy
1806
1807
1805
1808
482
Note 1
Note 2
Interpreter
No.
Message
Remedy
2000
Unsupported. Unsupported
command was attempted.
2001
Unsupported. Unsupported
conveyer command was
attempted.
Unsupported. Unsupported
Function argument was specified.
2005
Unsupported. Unsupported
Function return value was
specified.
Unsupported. Unsupported
condition was specified.
2006
2007
2008
Unsupported.
Unknown error number.
2009
Unsupported.
Invalid Task number.
2010
2011
2012
2013
2002
2003
2004
2014
2015
2016
2017
2018
2019
2020
Note 1
Note 2
483
Message
Remedy
2022
2023
2030
2031
2032
2021
2033
2040
2042
2043
2044
2045
2046
2047
2050
2051
2052
2053
2054
2055
2056
2057
484
Note 2
2041
Note 1
Message
2058
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2114
2115
2116
2059
2070
2071
2072
2073
2074
2113
Remedy
Note 1
Note 2
attempted to
use
485
Message
Remedy
2120
2121
2122
2123
Initialization failure.
Failed to create event.
2119
2130
2131
2132
2133
2134
2135
2136
2137
2150
2154
2155
2156
2157
2158
2151
2152
2153
2159
2160
486
Note 2
2118
Note 1
Message
2161
2162
2164
2165
2163
2166
2167
2168
2169
2170
2171
2172
2176
2177
2178
2179
2180
2190
2192
Note 2
2175
2174
Note 1
2173
Remedy
487
Message
2193
2194
2195
2196
2200
2203
2204
Note 1
Note 2
2201
2202
Remedy
The Arm
number you
attempted to
clear
2205
2206
The Tool
number you
attempted to
clear
2207
2208
2209
The ECP
number you
attempted to
clear
2210
2216
2217
2218
2219
2220
2221
2222
488
The specified
Local number
Message
Local number is out of range.
Unsupported. MCOFS is not
defined
CalPls is not defined.
Arm number is out of range.
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2240
Remedy
Available Local number is from 1 to
15. Review the program.
Note 1
Note 2
The specified
Local number
The specified
Arm number
The specified
Arm number
The specified
Tool number
The specified
Tool number
The specified
ECP number
The specified
ECP number
The
dimensions
The specified
exceeding the
subscript
definition
2245
2246
2247
2241
2242
2243
2244
The specified
value
The specified
value
489
Message
Remedy
2248
2249
2250
2251
2252
2253
2254
Note 1
The number
of array
subscripts
2256
2260
2261
2262
The specified
The specified
The specified
The specified
2255
2263
2264
2265
2266
The number
of data to be
referred or
updated
The specified
task number
The specified
task number
robot number
output
number
The specified
What number
value
argument?
joint number
wait time
2267
The specified
2268
The specified
2269
The specified
490
Note 2
timer number
trap number
language ID
2271
Message
Specified D parameter value at the
parallel process is out of available
range.
Arch number is out of available
range.
2272
2273
Remedy
Note 1
Note 2
The specified
D parameter
value
The specified
arch number
The specified
device
number
What number
Output data
byte data is
out of range?
2274
2275
2276
2277
2278
2280
2281
2282
2283
2290
2291
2292
2293
2294
2295
Timeout
period
Signal
Timeout
number
period
Port number
Timeout
period
491
Message
One or more source files are
updated. Please build the project.
Cannot execute an I/O command in
TEACH mode without the Forced
parameter.
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
Remedy
2317
2312
2313
2314
492
the robot
2316
2311
that is using
2315
2310
Task number
2309
Note 2
Note 1
Message
Remedy
2320
2321
2322
Function failure.
ByRef type does not match.
2323
2324
2325
2326
2327
2328
2329
2318
2319
2331
2332
2333
2334
2335
2336
2337
2340
2341
Note 2
2330
Note 1
Tens digit
Units digit
The specified
value
493
2343
2344
2345
2346
Message
Remedy
Check the remote I/O setting.
I/O number
2361
2362
2363
2364
2365
2349
2350
2351
2352
2370
2371
2372
2373
2374
494
3: word
time
2360
2348
1: bit, 2: byte,
The specified
2347
Note 2
Note 1
Bit number
Byte number
Word number
Bit number
Byte number
Word number
Combined
string length
The specified
length
Message
Remedy
Check the Step value.
2401
2402
2380
2381
2382
2383
2384
2385
2386
2400
2407
2408
2409
2404
2405
2406
2410
2411
2412
2413
2414
2415
Note 2
2403
Note 1
Start point
End point
495
Message
Remedy
2430
Curve failure.
Curve file path is too long.
Curve file name is invalid.
Error message failure. Error
message file does not exist.
2431
2435
2440
File Error.
File number is used.
2441
File Error.
Failed to open the file.
2442
File Error.
The file is not open.
2443
2444
2445
2446
File Error.
All file numbers are being used.
2447
File Error.
No read permision.
2448
File Error.
No write permision.
2449
File Error.
No binary permision.
2450
File Error.
Failed to access the file.
2451
2420
2432
2433
2434
2452
2453
File Error.
Cannot execute the commnad for
current disk.
2454
496
Note 2
2418
2419
Note 1
Message
2455
2456
2460
2461
2470
2471
2472
2477
2478
2473
2474
2475
2476
2500
2501
2502
2507
2508
2509
2503
2504
2505
2506
Note 1
Note 2
Database Error.
The database number is already
being used.
Database Error.
The database is not open.
Database Error.
The database number is being
used by another task.
Windows Communication Error.
Invalid status.
2462
Remedy
The specified
bit number
The specified
task number
497
2511
2512
2513
2514
2515
2516
2517
2518
2519
Message
Remedy
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2539
498
Note 2
Signal
number
Signal
number
Start point
End point
2520
2521
Note 1
No wait terms.
Too many variables used for global
valiable wait.
The variables cannot use global
valiable wait.
Cannot use Byref if the variables
used for global variable wait.
Too many point files.
The point file is used by another
robot.
Cannot calculate the point position
because there is undefined data.
Error on INP or OUTP.
No main function to start on Restart
statement.
Password is invalid.
Message
2900
2901
2902
2904
2905
2906
2907
2908
2909
2910
2911
2912
2915
Note 1
Note 2
2913
2914
Remedy
Port number
Port number
Port number
Port number
Timeout value
Port number
Port number
Port number
The number
of bytes in a
received line
2921
2926
Port number
Port number
Port number
2920
2927
2928
2929
2930
2931
2932
2933
Port number
Timeout value
Port number
Port number
499
Message
Remedy
2935
2937
2934
Note 1
Note 2
The number
of bytes in a
received line
2950
2951
2952
2953
2954
2955
Temperature of regeneration
resistor was higher than the
specified temperature.
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2998
2999
500
Parser
No.
3000
3050
3051
3052
3100
Message
OBJ file size is large. TP1 may not
be able to build this project.
Main function is not defined.
Function does not exist.
Variable does not exist.
Syntax error.
Parameter count error.
3101
3102
3103
3104
3105
3106
3107
3108
3109
3115
3116
3117
3110
3111
3112
3114
Remedy
3121
3123
3119
3120
Note 2
3118
Note 1
501
Message
Remedy
Corresponding Do cannot be
found.
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3141
3142
3140
3143
3144
3145
3146
3147
3148
3149
3150
502
Note 2
3125
3126
Note 1
Message
Cannot use a function parameter.
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3172
3173
3175
3176
3177
3178
3179
3180
3181
3182
3187
3200
3201
3202
3203
Remedy
Note 1
Note 2
503
Message
3207
Identifier is missing.
Point is not specified.
Event condition expression is
missing.
Formula is missing.
3208
3209
3210
3211
3206
3213
3214
3215
3216
3217
3218
3219
3220
3212
3221
3222
3223
3226
3227
3228
3225
3230
3231
3232
3233
3234
3229
3239
3240
3241
3242
3235
3236
3237
3238
504
Note 1
Note 2
3224
Remedy
Message
3243
3244
3245
3246
3247
3248
3249
3250
3252
3253
3254
3256
3260
3261
Expected '.'.
3257
3258
3259
3262
3263
3264
3265
3266
3267
Note 2
3255
3301
3302
3303
3304
3300
Note 1
3251
Remedy
505
Message
3305
3306
Duplicate function.
3307
3308
3309
3310
3311
3312
3313
3314
Remedy
3319
3320
3316
3317
3318
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
506
Note 2
3315
Note 1
Message
Variable '%s' is redefined.
3332
3500
3501
3502
3503
3504
3505
3506
3507
3510
3550
3800
3801
3509
3802
3803
3804
3805
3806
3811
3900
Note 2
3810
3850
Note 1
3508
Remedy
507
Message
3911
3912
3913
3914
Invalid ICode.
3915
Invalid ICode.
3916
Invalid ICode.
3917
Invalid ICode.
3918
Invalid ICode.
3919
Invalid ICode.
3920
Invalid ICode.
3921
Invalid ICode.
3910
508
Remedy
Note 1
Note 2
Motor Control
No.
Message
Remedy
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4013
4016
4018
4021
4022
4023
4024
4025
Note 2
The
parameter
causing the
error
Note 1
Local
number
509
4028
4030
4031
4032
4034
4035
4036
4037
4038
4039
4041
4042
4043
4044
4045
4046
4047
510
Message
Remedy
Note 1
Note 2
4049
4050
4051
4052
4053
Message
Curve failure. Parallel process was
specified before the point
designation.
Curve failure. Number of parallel
processes is out of the allowable
range.
Curve failure. Number of points is
out of the allowable range.
4054
Remedy
4056
4059
4060
4061
4062
4063
Note 2
4055
Note 1
511
4068
4069
4070
4071
4072
4074
4075
4076
4077
4080
4099
4100
4101
4103
Message
Motion command was attempted in
the prohibited area depended on
joint combination.
ROT modifier parameter was
specified for the CP motion
command without orientation
rotation.
Specified ECP without selecting
ECP in CP statement.
Specified ECP number does not
match the ECP number used in
curve file creation.
Attempted motion command during
electronic brake lock condition.
Initialization failure. Hardware
monitor was not initialized.
Motor type does not match the
current robot setting.
ECP Option is not active.
4150
512
4106
Note 2
EMERGENCY connector
connection failure.
Note 1
4105
4151
Remedy
Message
Relay welding error of the main
circuit.
4154
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4191
4192
4210
4211
Remedy
Note 1
Note 2
Temperature of regeneration
resistor was higher than the
specified temperature.
Manipulator initialization failure.
Specified manipulator was is not
found.
Manipulator initialization failure.
Specified manipulator was in use
by another task.
Manipulator initialization failure.
Manipulator name is too long.
Manipulator initialization failure.
Manipulator data version error.
Manipulator initialization failure.
Duplication of single axis joint is
assigned.
Manipulator initialization failure.
Specified axis is in use by the other
manipulator.
Manipulator initialization failure.
Necessary hardware resource is
not defined.
Manipulator initialization failure.
Communication error with the
module : VSRCMNPK.
Manipulator initialization failure.
Joint angle interference matrix is
invalid.
Manipulator initialization failure.
Communication error with the
module : VSRCMC.
Manipulator initialization failure.
Physical-logical pulse
transformation matrix is invalid.
Manipulator initialization failure.
Communication error with the
servo module.
RAS circuit detected the servo
system malfunction. Reboot the
controller. Measure the noise.
Replace the controller.
Servo CPU internal RAM failure.
Reboot the controller. Measure the
noise. Replace the DMB.
513
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4230
514
Message
Remedy
Note 1
Note 2
Message
Remedy
4232
4233
4241
4243
Note 1
Note 2
515
4252
Message
Arm reached the limit of motion
range during the operation.
4267
516
Remedy
Note 1
Note 2
Servo
No.
Message
Servo control gate array failure.
Check the DMB.
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
Remedy
Note 2
Note 1
517
5012
5013
5015
5016
5017
5018
5019
5020
Message
Serial encoder communication
failure. Reboot the controller.
Check the motor, the DMB, or the
encoder IF board.
Servo CPU watchdog timer failure.
Reboot the controller. Check the
motor or the DMB.
Current control circuit WDT failure.
Reboot the controller. Check the
controller.
518
Note 2
Servo alarm A.
Motor torque output failure in high
power state. Check the power
cable connection, the robot, the
driver or the motor.
5040
Note 1
5021
5032
Remedy
Message
Motor torque output failure in low
power state. Check the power
cable connection, robot, brake,
driver, or motor.
5041
5042
5043
Remedy
Note 1
Note 2
519
Message
Remedy
5044
5045
5046
520
Note 1
Note 2
Message
Remedy
5047
5048
5049
5050
5051
5054
5072
Note 1
Note 2
Servo alarm B.
521
Message
Motor is overloaded. Decrease the
duty and the Accel.
5080
5098
5099
5112
522
Remedy
Note 1
Note 2
Servo alarm C.
Points
No.
7003
7004
7006
7007
Message
Remedy
7010
7011
7015
7016
7013
7014
7018
7019
7017
7023
7024
7026
7021
7022
7027
7028
Note 2
7012
Note 1
523
7030
7031
7032
7033
Message
Specified point file name is not
correct. Specify a valid point file
name.
Specified point label is beyond the
maximum length. Specify a valid
point label.
Description for the specified point
is beyond the maximum length.
Specify a valid description.
Point file is corrupted. Check sum
error.
Specified point file cannot be
found. Specify a valid point file
name.
7034
7035
7036
7037
7038
7039
7040
7041
524
Remedy
Note 1
Note 2
Fieldbus
No.
Message
Remedy
7101
7103
Note 1
Note 2
525
Vision
No.
7300
7302
7303
7304
7305
7306
7307
7308
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7341
7342
7343
7344
7345
7346
7500
7501
526
Message
Remedy
Note 1
Note 2
Message
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
No vision calibration.
7517
7502
7503
7504
7518
7819
Remedy
Note 1
Note 2
527
Simulator
No.
Message
Remedy
7750
Initialization failure.
Reboot RC+.
7751
7752
7753
Reboot RC+.
Reboot RC+.
Reboot RC+.
Name of the virtual controller may be
duplicated. Check the virtual
controller name.
7754
7755
7756
7757
7758
7759
7760
7761
7762
7763
7764
7765
7766
7767
7768
7769
7770
528
Note 1
Note 2
Reboot RC+.
Check the virtual controller name.
Name of the virtual controller may be
duplicated. Check the virtual
controller name.
Reboot RC+.
Reboot RC+.
Reboot RC+.
Check the virtual controller name.
Check the virtual controller name.
Check the virtual controller name.
Reboot RC+.
Check whether the definition file
exists.
Reboot RC+
Reboot RC+
Reboot RC+
Reboot RC+
Update RC+ to the latest version
GUI Builder
No.
7600
7602
7603
7604
7610
7611
7612
7613
7650
7651
7652
7653
7654
Message
Cannot execute a GUI Builder
statement from the command
window.
GSet parameter is too long.
Too many parameters for GGet.
Not enough data for GGet
statement variable assignment.
The event task cannot be
executed. System in pause state
and EventTaskType is Normal.
The event task cannot be
executed. Safeguard is open and
EventTaskType is Normal.
The event task cannot be
executed. Estop is active and
EventTaskType is not
NoEmgAbort.
The event task cannot be
executed. System in error state
and EventTaskType is not
NoEmgAbort.
Invalid property.
Invalid form.
Invalid control.
The specified form is already open.
Event function does not exist.
Remedy
Note 1
Note 2
529
Hardware
No.
9001
9002
9011
9012
9013
9014
Message
Remedy
9015
9016
9017
9100
9101
9233
9234
9610
9611
9612
9613
9614
530
Note 1
Note 2
Current
Boundary
value
value
Current
Boundary
value
value
Current
Boundary
value
value
9616
9617
9618
9619
9620
9621
Message
Initialization communication of the main
and servo CPU failure. Reboot the
controller. Check for noise. Replace the
DMB.
Communication of the main and servo
CPU failure. Reboot the controller.
Check for noise. Replace the DMB.
Communication of the main and servo
CPU failure. Reboot the controller.
Check for noise. Replace the DMB.
Servo long time command overrun.
Servo long time command check sum
error.
System watchdog timer detected a
failure. Reboot the controller. Check for
noise. Replace the DMB.
Drive unit check failure.
9630
9632
9633
9622
9623
9624
9625
9640
9700
Remedy
Note 1
Note 2
531
Message
Remedy
9701
9702
9703
9704
9705
9706
9707
9708
9709
9710
9711
9712
9713
9715
9716
532
Note 1
Note 2
Message
Backup data failure of the absolute
encoder. Reset the encoder.
Absolute encoder battery alarm.
Position failure of the absolute encoder.
Reset the encoder. Replace the motor.
Speed is too high at controller power
ON. Stop the robot and reboot the
controller.
Absolute encoder over heat.
9721
9732
Remedy
Note 1
Note 2
Servo alarm A.
533
EPSON RC+
No.
Message
10000
10001
Command timeout.
10002
10003
Remedy
10004
10005
10006
10007
10008
No project specified.
10009
10010
10011
10012
10013
10014
10016
10017
Invalid IP address
10018
Invalid IP mask
10020
10021
10022
534
Note 2
10015
10019
Note 1
Invalid IP gateway
IP address or gateway cannot be the
subnet address
IP address or gateway cannot be the
broadcast address
Invalid DNS address
535
General Differences
General differences of EPSON RC+ Ver.4.* and EPSON RC+ 5.0 are as follows.
Item
Number of task
Type of task
Special TRAP
such as TRAP ERROR
Task starts by TRAP number
Number of significant figure for
Real type
Number of significant figure for
Double type
Array elements number
Line number
Device number
Timer number range
Signal No range
for SyncLock, SyncUnlock
Signal No range
for WaitSig, Signal
Port No of Ethernet
Port No of
RS-232C communication
OpenCom execution of
RS-232C communication port
Input/output to files
Fieldbus I/O
Group in the project
Error number
536
14 digits
No specification
String variable
Local variable
Global variable
Module variable
Global Preserve variable
Not supported
21:PC
22:REMOTE
23:OP
0 to 15
0 to 15
Supported
100
1000
1000
100
Supported
1:Controller
2:REMOTE
3:OP
0 to 63
1 to 32
0 to 5
0 to 127
201 to 208
1 to 8
128 to 147
1 to 16
Mandatory
Optional
Not supported
Use normal I/O commands
Not supported
New error numbers
Supported
Use special commands
Supported
!
!!
Function expansion / function changes have been made with upper compatibility.
No changes.
Pay attention. Function changes or syntax changes have been made.
Pay attention. Significant changes have been made.
Deleted.
Command
Abs Function
Compatibility
Accel Statement
Accel Function
+
+
AccelR Statement
AccelR Function
AccelS Statement
AccelS Function
Acos Function
Agl Function
AglToPls Function
And Operator
AOpen Statement
Arc Statement
Arc3 Statement
Arch Statement
Arch Function
Arm Statement
Arm Function
ArmClr Statement
ArmSet Statement
ArmSet Function
Asc Function
Asin Function
Atan Function
Atan2 Function
ATCLR Statement
ATRQ Statement
ATRQ Function
B
Base Statement
BClr Function
Beep Statement
BGo Statement
BMove Statement
Boolean Statement
BOpen Statement
Brake Statement
BSet Function
BTst Function
Byte Statement
Note
537
Command
Calib Statement
CloseNet Statement
ClrScr Statement
Cnv_**
Cont
Cont Statement
!
!!
Call Statement
CalPls Statement
CalPls Function
Chain Statement
ChDir Statement
ChDrive Statement
ChkCom Function
ChkNet Function
Chr$ Function
Clear Statement
Close Statement
CloseCom Statement
Copy Statement
Cos Function
CP Statement
CP Function
Ctr Function
CTReset Statement
CtrlDev Statement
CtrlDev Function
CtrlInfo Function
CurDir$ Function
CurDrive$ Function
CurPos Function
Curve Statement
CVMove Statement
CX to CW Statement
CX to CW Function
D
Date Statement
Date$ Function
Declare Statement
DegToRad Function
Del Statement
Dir Statement
Dist Function
Do...Loop Statement
Double Statement
EClr Statement
ECP Statement
538
Compatibility
Note
Renamed to ClearPoints
Changed device ID
Changed the obtaining contents
FbusIO_****
FileDateTime$ Function
FileExists Function
FileLen Function
Find Statement
FindPos Function
Fine Statement
Fine Function
Fix Function
FmtStr$ Statement
FoldrExist Function
For...Next
FreeFile Function
Function...Fend
GetCurrentUser$ Function
Global Statement
Go Statement
Gosub...Return
Goto Statement
Halt Statement
Hand Statement
Hand Function
Here Statement
Here Function
Compatibility
+
+
!
+
!!
Note
539
If...EndIf
ImportPoints Statement
In Function
In($n) Statement
InBCD Function
Inertia Statement
Inertia Function
InPos Function
Input Statement
Input# Statement
InputBox Statement
InStr Function
Int Function
Integer Statement
InW Function
InW($n) Statement
IONumber Function
J4Flag Statement
J4Flag Function
J6Flag Statement
J6Flag Function
JA Function
JRange Statement
JRange Function
JS Function
JT Function
JTran Statement
Jump Statement
Jump3 Statement
Jump3CP Statement
Kill Statement
LCase$ Function
Left$ Function
Len Function
540
Compatibility
Note
Replaced to MemIn
Replaced to MemInW
Returns True/False
Not Operator
Off Statement
Off$ Statement
OLRate Statement
OLRate Function
On Statement
On$ Statement
OnErr
Compatibility
+
!
!
!
Note
Replaced to MemOff
Replaced to MemOn
541
PLabel Statement
PList
PLocal Statement
PPls Function
Print Statement
Print# Statement
PTCLR Statement
Returns True/False
OpenCom Statement
OpenNet Statement
Oport Function
Or Operator
Out Statement
Out Function
Out$ Statement
OutW Statement
OutW Function
OutW$ Statement
PAgl Function
Pallet Statement
Pallet Function
ParsStr Statement
ParsStr Function
Pass Statement
Pause Statement
PauseOn Function
PDef Function
PDel
PLabel$ Function
PLocal Function
Pls Function
PNumber Function
Point Assignment
Point Expression
POrient Statement
POrient Function
PosFound Function
Power Statement
Power Function
PTPBoost Statement
PTPBoost Function
PTPBoostOK Function
542
Note
OpBCD Statement
Compatibility
OpenCom is mandatory
Replaced to MemOut
Replaced to MemOutW
Returns True/False
Recover Statement
+
!
Redim Statement
Rename Statement
Sense
+
!
SetCom Statement
SetNet Statement
PTran Statement
PTRQ Statement
PTRQ Function
Pulse Statement
Pulse Function
Q
QP Statement
Quit Statement
RadToDeg Function
Randmize Statement
Range Statement
Read Statement
ReadBin Statement
Real Statement
RenDir Statement
Reset Statement
Resume Statement
Restart Statement
Reset Statement
Return Statement
Right$ Function
RmDir Statement
Rnd Function
Robot Statement
Robot Function
RobotModel$ Function
RobotType Function
ROpen Statement
RSet$ Function
RShift Function
RTrim$ Function
S
Compatibility
RunDialog Statement
SafetyOn Function
SavePoints Statement
Seek Statement
Select...Send
SFree Statement
SFree Function
Sgn Function
Note
543
SyncUnlock Statement
TaskDone Function
TaskState Function
TaskWait Statement
Sw Function
Tab$ Function
Tan Function
TargetOK Function
TGo Statement
TillOn Function
Time Command
Time Function
Time$ Function
TLClr Statement
TLSet Statement
TLSet Function
TMOut Statement
TMove Statement
Tmr Function
TmReset Statement
Tool Statement
Tool Function
Argument optional
SyncLock Statement
String Statement
Note
Sw($) Function
Str$ Function
544
Stat Function
Compatibility
Replaced to MemSw
Error occurs by executing SyncLock
repeatedly
Returns True/False
6 specified tasks do not return while Wait
statement execution
Trap Statement
!!
Trim$ Function
Write Statement
WriteBin Statement
Xor Operator
Xqt Statement
XY Function
Tw Function
Type Statement
U
UBound Function
UCase$ Function
UOpen Statement
Val Function
Ver Statement
Verinit Statement
W Wait Statement
WaitNet Statement
WaitPos Statement
WaitSig Statement
Weight Statement
Weight Function
Where Statement
While..Wend
WOpen Statement
Wrist Statement
Wrist Function
XYLim Statement
XYLim Function
Z
Compatibility
ZeroFlg Function
Note
Compatibility with Trap Goto
Trap Gosub abolished and replaced to Trap
Call
Trap Call is renamed to Trap Xqt
Trap Emergency, Trap Error, Trap Abort,
Trap Pause, Trap SGOpen, Trap SGClose
have been deleted
Returns True/False
Replaced to SysConfig
545
546
Joint
LJM Function
LocalDef Function
OLAccel
OLAccel Function
OutReal
OutReal Function
Plane
Plane Function
PlaneClr
PlaneDef Function
QPDecelR Statement
QPDecelR Function
QPDecelS Statement
QPDecelS Function
RealPls Function
RealPos Function
RobotInfo$ Function
RobotInfo Function
RobotName$ Function
RobotSerial$ Function
SetInReal
SysErr Function
SoftCP
SoftCP Function
TaskInfo$ Function
TaskInfo Function
TaskState
TC
TCLim
TCLim Function
TCSpeed
TCSpeed Function
TlDef Function
Toff
Ton
VxCalib statement
VxCalDelete Statement
VxCalLoad Statement
VxCalInfo Function
VxCalSave Statement
VxTrans Function
XYLimClr
XYLimDef Function