Uploaded by mikako4666

STEP Robotics User Programming Manual-V1.7.3.20200917.C

advertisement
STEP Robot User Programming Manual
STEP Robot User Programming Manual
Applicable models: All series
Publication status: Standard
Product version: C
All Copyright© reserved by Shanghai STEP Robotics Co., Ltd.,
China.
Shanghai STEP Robotics Co., Ltd. authorizes in the documenting, printing
to this robot control manual.
All rights reserved.
The information in this document is subject to change None prior notice.
No
part
of
this
document
may
in
any
form
or
by
any
means(electronic,mechanical,micro-coping,photocopying,recording
or
otherwise)be reproduced, stored in a retrial system or transmitted None
prior written permission from Shanghai STEP Robotics Co., Ltd.
STEP Robot User Programming Manual
PREFACE
Executive summary
This operating manual provides a comprehensive and systematic explanation of STEP
robot programming, and can be used as a reference material for STEP robot programming.
In order to ensure the correct use of STEP robot software functions, please read this
manual carefully before use.
Reading object
Operator
Robot programmer
Engineering maintenance staff
User technical support staff
Content description
The contents of this manual will be supplemented and modified, please pay attention to our
company website and update the manual frequently. My company website:www.steprobots.com.
Main feature
The STEP robot teach pendant interface adopts a hierarchical classification management
form. The user can control the robot through the physical keys on the teach pendant and the
virtual hot keys on the touch screen. The operation interface is concise and clear, and the usage
method is in line with human perception and understanding, and is simple and easy to
understand.
Security mark
In this manual, the following notations are used for safety-related content. The description
and content with safety marks are important, so please be sure to follow them.
When used incorrectly, it may cause a dangerous situation, possibly resulting in
personal injury or death.
When used incorrectly, it will cause danger, which may result in slight or severe
personal injury and equipment damage.
The part that users need to observe and pay attention to.
I
SPD-12-01-C
STEP Robot User Programming Manual
Chapter 1 Preface
Chapter 2 Data Type
Chapter 3 Instructions and Writing Examples
II
SPD-12-01-C
STEP Robot User Programming Manual
CONTENT
CHAPTER 1 PREFACE ............................................................................................................................. 1
1.1 Purpose ................................................................................................................................................ 1
1.2 Programming prerequisites ................................................................................................................. 1
1.3 File structure ........................................................................................................................................1
CHAPTER 2 DATA TYPE ......................................................................................................................... 2
2.1 Basic data types ...................................................................................................................................2
2.1.1 BOOL .............................................................................................................................................................2
2.1.2 INT ................................................................................................................................................................. 2
2.1.3 UINT .............................................................................................................................................................. 2
2.1.4 LINT ...............................................................................................................................................................2
2.1.5 ULINT ............................................................................................................................................................2
2.1.6 REAL ............................................................................................................................................................. 3
2.1.7 LREAL ...........................................................................................................................................................3
2.1.8 PERCENT ......................................................................................................................................................3
2.1.9 BOOLEXT ..................................................................................................................................................... 3
2.1.10 DINTEXT .................................................................................................................................................... 3
2.1.11 REALEXT ....................................................................................................................................................3
2.1.12 DWORDEXT ...............................................................................................................................................3
2.1.13 CLOCK ........................................................................................................................................................ 4
2.1.14 ARRAY........................................................................................................................................................ 4
2.1.15 STRING ....................................................................................................................................................... 4
2.1.16 LINE .............................................................................................................................................................4
2.1.17 PLANE .........................................................................................................................................................4
2.2 Position data type ................................................................................................................................ 5
2.2.1 AXISPOS ....................................................................................................................................................... 5
2.2.2 CARTPOS ......................................................................................................................................................5
2.2.3 AXISPOSEXT ............................................................................................................................................... 6
2.2.4 CARTPOSEXT .............................................................................................................................................. 6
2.2.5 ROBOTAXISPOS..........................................................................................................................................6
2.2.6 AUXAXISPOS...............................................................................................................................................6
2.2.7 ROBOTCARTPOS ........................................................................................................................................ 6
2.2.8 ROBOTAXISPOSEXT .................................................................................................................................. 6
2.2.9 ROBOTCARTPOSEXT .................................................................................................................................6
2.2.10 AXISDIST ....................................................................................................................................................7
2.2.11 CARTDIST...................................................................................................................................................7
2.2.12 POSOFFSET ................................................................................................................................................ 7
2.3 Coordinate system and tool data type ................................................................................................. 7
2.3.1 CARTREF ......................................................................................................................................................7
2.3.2 CARTREFEXT .............................................................................................................................................. 7
2.3.3 CARTREFVAR .............................................................................................................................................. 8
2.3.4 TOOL ............................................................................................................................................................. 8
III
SPD-12-01-C
STEP Robot User Programming Manual
2.3.5 TOOLEXT ..................................................................................................................................................... 8
2.3.6 INTNUM ........................................................................................................................................................8
2.4 Dynamic characteristics and Ovl type .................................................................................................8
2.4.1 DYNAMIC .....................................................................................................................................................9
2.4.2 OVLREL ........................................................................................................................................................ 9
2.4.3 RAMPTYPE .................................................................................................................................................. 9
2.5 Operators ............................................................................................................................................. 9
2.5.1 Mathematical operators ..................................................................................................................................9
2.5.2 Relational operators ..................................................................................................................................... 10
2.5.3 Logical operators ..........................................................................................................................................10
2.5.4 Delimiters and other symbols ...................................................................................................................... 10
2.6 Polishing variables ............................................................................................................................ 10
CHAPTER III INSTRUCTIONS AND WRITING EXAMPLES ........................................................ 11
3.1 Robot motion instructions ................................................................................................................. 11
3.1.1 PTP ............................................................................................................................................................... 11
3.1.2 Lin ................................................................................................................................................................ 11
3.1.2 LineSearch ................................................................................................................................................... 12
3.1.3 Circ ...............................................................................................................................................................13
3.1.4 CircleAngle .................................................................................................................................................. 13
3.1.5 PTPRel ......................................................................................................................................................... 14
3.1.6 LinRel ...........................................................................................................................................................14
3.1.7 WaitTime ...................................................................................................................................................... 15
3.1.8 LinISR ..........................................................................................................................................................15
3.1.9 CLin ............................................................................................................................................................. 16
3.1.10 WaitIsFinished ............................................................................................................................................17
3.2 Robot setting instructions ..................................................................................................................18
3.2.1 Dyn ...............................................................................................................................................................18
3.2.2 Ovl ................................................................................................................................................................18
3.2.3 Ramp ............................................................................................................................................................ 19
3.2.4 RefSys .......................................................................................................................................................... 19
3.2.5 Tool .............................................................................................................................................................. 19
3.2.6 OriMode ....................................................................................................................................................... 20
3.2.7 CartSpaceActivate ........................................................................................................................................20
3.2.8 AxisSpaceActivate ....................................................................................................................................... 20
3.2.9 SetCartSpaceMode .......................................................................................................................................21
3.2.10 SetAxisSpaceMode .................................................................................................................................... 21
3.2.11 ReadCartSpaceState ................................................................................................................................... 22
3.2.12 ReadAxisSpaceState .................................................................................................................................. 22
3.2.13 Override ..................................................................................................................................................... 23
3.2.14 IndReset ..................................................................................................................................................... 23
3.3 System function instructions ............................................................................................................. 24
3.3.1 :=(Assignment instruction) .......................................................................................................................... 24
3.3.2 //(Comment instruction) ............................................................................................................................... 24
3.3.3 SaveData ...................................................................................................................................................... 24
IV
SPD-12-01-C
STEP Robot User Programming Manual
3.3.4 RecordList ....................................................................................................................................................25
3.3.5 Message ........................................................................................................................................................26
3.3.6 MessageErase ...............................................................................................................................................27
3.3.6 Pause ............................................................................................................................................................ 28
3.3.7 GetCurrentRobotPos .................................................................................................................................... 28
3.3.8 ReturnMainProgram .....................................................................................................................................29
3.4 Mathematical function instructions ...................................................................................................30
3.4.1 SIN ............................................................................................................................................................... 30
3.4.2 COS ..............................................................................................................................................................31
3.4.3 TAN ..............................................................................................................................................................31
3.4.4 LN ................................................................................................................................................................ 31
3.4.5 PosReset ....................................................................................................................................................... 32
3.4.6 SHL .............................................................................................................................................................. 32
3.4.7 SHR ..............................................................................................................................................................32
3.4.8 SetBit ............................................................................................................................................................33
3.4.9 GetPointBy2Lines ........................................................................................................................................33
3.4.10 GetPointBy2Planes .................................................................................................................................... 34
3.4.11 GetPointByLinePlane .................................................................................................................................34
3.4.12 GetPointBy3Points .....................................................................................................................................35
3.4.13 GetPointBy4Points .....................................................................................................................................36
3.4.14 GetVPointByPlanePoint .............................................................................................................................36
3.4.15 GetVPointByLinePoint .............................................................................................................................. 37
3.4.16 GetCenterByPoints .....................................................................................................................................38
3.4.17 GetOffsetPointByLine ................................................................................................................................39
3.4.18 GetLineBy2Points ......................................................................................................................................40
3.4.19 GetLineByPointLine .................................................................................................................................. 40
3.4.20 GetVLineByPointLine ............................................................................................................................... 41
3.4.21 GetVLineByPointPlane ..............................................................................................................................41
3.4.22 GetLineBy2Planes ..................................................................................................................................... 42
3.4.23 GetPlaneByPointLine .................................................................................................................................42
3.4.24 GetPlaneBy2Lines ..................................................................................................................................... 43
3.4.25 FittingPlaneByPoints ................................................................................................................................. 43
3.5 Program flow control instructions .....................................................................................................44
3.5.1 IF ()THEN... END_IF .................................................................................................................................. 44
3.5.2 IF() THEN …ELSE… END_IF ...................................................................................................................45
3.5.3 WHILE ()DO... END_WHILE .................................................................................................................... 45
3.5.4 LOOP ()DO... END_LOOP ......................................................................................................................... 46
3.5.5 LP ................................................................................................................................................................. 46
3.5.6 GOTO ...........................................................................................................................................................46
3.5.7 SWITCH...CASE ......................................................................................................................................... 47
3.5.8 ElSIF ............................................................................................................................................................ 48
3.5.9 ProgCall ....................................................................................................................................................... 49
3.6 Input and output IO instructions ........................................................................................................49
3.6.1 DIRead ......................................................................................................................................................... 49
3.6.2 DIWAIT ....................................................................................................................................................... 50
V
SPD-12-01-C
STEP Robot User Programming Manual
3.6.3 DIWaitSimple ...............................................................................................................................................51
3.6.4 DIWaitPath ...................................................................................................................................................52
3.6.5 DIWaitSyncPath ...........................................................................................................................................53
3.6.6 DOSet ...........................................................................................................................................................54
3.6.7 AIRead ......................................................................................................................................................... 55
3.6.8 AIWaitGreater .............................................................................................................................................. 56
3.6.9 AIWaitLess ...................................................................................................................................................57
3.6.10 AOSet ......................................................................................................................................................... 59
3.6.11 AOSyncOn ................................................................................................................................................. 60
3.6.12 AOSyncOff .................................................................................................................................................60
3.6.13 GDIRead .................................................................................................................................................... 61
3.6.14 GDOSet ......................................................................................................................................................62
3.6.15 DOPulse ..................................................................................................................................................... 63
3.6.16 DOSetSyncTime ........................................................................................................................................ 64
3.6.17 DOSetSyncPath ..........................................................................................................................................65
3.6.18 DOPulseSyncTime ..................................................................................................................................... 66
3.6.19 DOPulseSyncPath ...................................................................................................................................... 67
3.6.20 BOOLEXTRead .........................................................................................................................................68
3.6.21 BOOLEXTSet ............................................................................................................................................69
3.6.22 DINTEXTRead .......................................................................................................................................... 69
3.6.23 DINTEXTSet ............................................................................................................................................. 69
3.6.24 REALEXTRead ......................................................................................................................................... 70
3.6.25 REALEXTSet ............................................................................................................................................ 70
3.6.26 DWORDEXTRead .....................................................................................................................................71
3.6.27 DWORDEXTSet ........................................................................................................................................71
3.6.28 AXISPOSEXTSet ...................................................................................................................................... 71
3.6.29 CARTPOSEXTSet ..................................................................................................................................... 72
3.6.30 ROBOTAXISPOSEXTSet .........................................................................................................................72
3.6.31 ROBOTCARTPOSEXTSet ....................................................................................................................... 73
3.6.32 AXISPOSEXTRead ................................................................................................................................... 73
3.6.33 CARTPOSEXTRead ..................................................................................................................................73
3.6.34 ROBOTAXISPOSEXTRead ......................................................................................................................74
3.6.35 ROBOTCARTPOSEXTRead .................................................................................................................... 74
3.7 Clock instruction ............................................................................................................................... 75
3.7.1 ClkStart ........................................................................................................................................................ 75
3.7.2 ClkStop .........................................................................................................................................................75
3.7.3 ClkReset ....................................................................................................................................................... 76
3.7.4 ClkRead ........................................................................................................................................................76
3.8 Interrupt instruction ...........................................................................................................................77
3.8.1 Connect ........................................................................................................................................................ 77
3.8.2 ISignal .......................................................................................................................................................... 77
3.8.3 StorePath ...................................................................................................................................................... 78
3.8.4 RestorePath .................................................................................................................................................. 78
3.8.5 IDelete ..........................................................................................................................................................78
3.8.6 ISleep ........................................................................................................................................................... 79
VI
SPD-12-01-C
STEP Robot User Programming Manual
3.8.7 IWatch .......................................................................................................................................................... 79
3.8.8 IDisable ........................................................................................................................................................ 80
3.8.9 IEnable ......................................................................................................................................................... 80
3.9 Palletizing instructions ...................................................................................................................... 81
3.9.1 PALLETENTRYPOINT .............................................................................................................................. 81
3.9.2 UPDATEPALLETIZING ............................................................................................................................. 81
3.9.3 SETPALLETIZING ..................................................................................................................................... 82
3.9.4 READPALLETIZING ................................................................................................................................. 82
3.9.5 PLIN .............................................................................................................................................................83
3.9.6 PPTP .............................................................................................................................................................83
TECHNICAL SUPPORT ..........................................................................................................................84
VII
SPD-12-01-C
STEP Robot User Programming Manual
Chapter 1 Preface
1.1 Purpose
This document describes how the user writes programs on STEP robot. We assume that the
user already has a certain understanding of the robot.
1.2 Programming prerequisites

Electrical technology related experience

PLC programming experience

Object-oriented programming experience

Have an understanding of robot language and robot applications
1.3 File structure
1) Project file
The project file is a directory folder with the suffix: ".sr". When the project file is created, a
project variable data file named _project.srd will be automatically generated.
2) User program file
The user program file contains the user instruction file, and the file suffix is "srp".
3) User data file
The data file contains the variables and corresponding values in the user program file, and
the file suffix is "srd".
1
SPD-12-01-C
STEP Robot User Programming Manual
Chapter 2 Data Type
2.1 Basic data types
Range
Corresponding to
C++ type
Type
Meaning
BOOL
Boolean type
TRUE / FALSE (1/0)
Bool
INT
Integer
-2^15 ~ 2^15-1
Short
UINT
Unsigned integer
0 ~ 2^16-1
Unsigned short
LINT
Long integer
-2^31 ~ 2^31-1
Long int
ULINT
Unsigned long
0 ~ 2^32-1
Unsigned long int
REAL
Single precision
floating point
Float
LREAL
Double-precision
floating point
Double
PERCENT
percentage
Integer from 0-100
BOOLEXT
External BOOL
variable
TRUE / FALSE (1/0)
The port number is
0-31
DINTEXT
External INT
variable
-2^15 ~ 2^15-1
The port number is
0-31
REALEXT
External REAL
variable
The port number is
0-31
DWORDEXT
External DWORD
variable
-2^31 ~ 2^31-1
The port number is
0-31
2.1.1 BOOL
Example: BOOL bool0 := TRUE
2.1.2 INT
Example: INT int1 := -10
2.1.3 UINT
Example: UINT uint1 := 100
2.1.4 LINT
Example: LINT lint1 := -1000
2.1.5 ULINT
Example: ULINT ulint1 := 1000
2
SPD-12-01-C
STEP Robot User Programming Manual
2.1.6 REAL
Example: REAL real0 := 1.1
2.1.7 LREAL
Example: LREAL lreal0 := 1.11
2.1.8 PERCENT
Percentage variable, the range is an integer in the range of 0-100.
Example: PERCENT per0:=70
2.1.9 BOOLEXT
External (PLC) variable type. When you need to interact with an external BOOL variable,
create a new variable of this type and use it as a parameter. This type of variable is composed of
Port and Value, Port is a number (0-31), and Value is a bool (BOOL mentioned above) type. The
defined data is in the following format:
Example: BOOLEXT ext1 := {0, TRUE}
2.1.10 DINTEXT
External (PLC) variable type. When you need to interact with an external DINT variable,
create a new variable of this type and use it as a parameter. This type of variable is composed of
Port and Value. Port is a number (0-31), and Value is a DINT (LINT mentioned above) type.
The defined data is in the following format:
Example: DINTEXT ext1 := {0, 12}
2.1.11 REALEXT
External (PLC) variable type. When you need to interact with an external REAL variables,
create new and use variables of this type as parameters. This type of variable is composed of
Port and Value. Port is a number (0-31), and Value is REAL (FLOAT mentioned above). The
defined data is in the following format:
Example: REALEXT ext1 := {0, 1.1}
2.1.12 DWORDEXT
External (PLC) variable type. When you need to interact with an external DWORD
variable, create a new variable and use this type of variable as a parameter. This type of variable
is composed of Port and Value. Port is a number (0-31), and Value is a DWORD (ULINT
mentioned above) type. The defined data is in the following format:
3
SPD-12-01-C
STEP Robot User Programming Manual
Example: DWORDEXT ext1 := {0, 222}.
2.1.13 CLOCK
The clock variable, essentially an unsigned long integer, is used to store the length of time,
in milliseconds. The maximum time interval is 49 days (49*24*3600 seconds).
E.g:
CLOCK ck := 0;
2.1.14 ARRAY
Array variable contains two parameters: type and array length. The type includes
BOOL/INT/UINT/LINT/ULINT/REAL/LREAL/AXISPOS/CARTPOS/ROBOTAXISPOS/RO
BOTCARTPOS, and the array length is 1-100.
E.g:
ARRAY array0 := {BOOL,10};
2.1.15 STRING
String variable, the length is 255.
E.g:
STRING string0 =sr;
2.1.16 LINE
Line equation variable.
E.g:
LINE line0 ={0.0,0.0,0.0,1.0,1.0,1.0};
The 6 REAL type variables are:
Line point X; line point Y; line point Z; line direction vector X; line direction vector Y; line
direction vector Z.
2.1.17 PLANE
Plane equation variables.
E.g:
PLANE plane0 ={0.0,0.0,0.0,1.0,1.0,1.0};
The 6 REAL type variables are:
Point X on the plane; Point Y on the plane; Point Z on the plane; Plane normal vector X;
Plane normal vector Y; Plane normal vector Z.
4
SPD-12-01-C
STEP Robot User Programming Manual
2.2 Position data type
The definition of the composite data type refers to the structure in the defined ROBOT data
structure type. When user creates variables, they are provided to the user as options, and the
user is not allowed to customize the data type.
Type of data
Meaning
AXISPOS
Joint position (with additional axis)
CARTPOS
Cartesian position (with additional axis)
AXISPOSEXT
External joint position (with additional axis)
CARTPOSEXT
External Cartesian position (with additional axis)
ROBOTAXISPOS
Robot joint position (None additional axis)
AUXAXISPOS
Additional axis joint position (None robot axis)
ROBOTCARTPOS
Robot Cartesian position (None additional axis)
ROBOTAXISPOSEXT
External robot joint position (None additional axis)
ROBOTCARTPOSEXT
Cartesian position of external robot (None additional axis)
AXISDIST
Relative distance of joint type (with additional axis)
CARTDIST
Cartesian type relative distance (with additional axis)
CARTPOSEE
Cartesian position with XYZ offset (with additional axis)
POSOFFSET
Position deviation (None additional axis)
POSITION_:
The
type
ROBOTAXISPOS,
can
be:
AXISPOS,
AUXAXISPOS,
CARTPOS,
AXISPOSEXT,
ROBOTCARTPOS,
CARTPOSEXT,
ROBOTAXISPOSEXT,
ROBOTCARTPOSEXT, CARTPOSEE .
2.2.1 AXISPOS
Joint positions with additional axes, up to 6 robot axes + 6 additional axes, the type of each
data is REAL, and the unit is degree (°).
Example: AXISPOS ap1 := {10.1, 10.1, 10.1, 10.1, 10.1, 10.1, 10.1, 10.1, 10.1, 10.1, 10.1,
10.1}
2.2.2 CARTPOS
The spatial position in the Cartesian coordinate system, including the position data for the
additional axes, up to 6 additional axes. Variables are composed of X, Y, Z, A, B, C, Aux1~6,
Mode. X~Aux6 is REAL type, Mode is UINT type, and the range is [0, 31].
Example: CARTPOS cp1 := {800, 10.1 ,1027, 0, 90, -180, 10.1, 10.1, 10.1, 10.1, 10.1, 10.1,
0}
5
SPD-12-01-C
STEP Robot User Programming Manual
2.2.3 AXISPOSEXT
The external joint position, including the position data for the additional axes, the port
number is UINT type, and the range is [0, 31].
Example: AXISPOSEXT ape0:= 5
2.2.4 CARTPOSEXT
External Cartesian position, including the position data for the additional axes, the port
number is UINT type, and the range is [0,127].
Example: CARTPOSEXT cpe1:= 5
2.2.5 ROBOTAXISPOS
The joint position of the robot, up to 6 joints, the type of each data is REAL, and the unit is
degree (°).
Example: ROBOTAXISPOS rap1 := {10.1, 10.1, 10.1, 10.1, 10.1, 10.1}
2.2.6 AUXAXISPOS
Additional axis joint position value, up to 6 additional axes, the type of each data is REAL,
and the unit is degree (°).
Example: AUXAXISPOS raxp1 := {10.1, 10.1, 10.1, 10.1, 10.1, 10.1}
2.2.7 ROBOTCARTPOS
The spatial position in the Cartesian coordinate system does not include the data for the
additional axes. The variable is composed of X, Y, Z, A, B, C, and Mode. X~C is REAL type,
Mode is UINT type, and the range is [0 ,31].
Example: ROBOTCARTPOS rcp1 := {10.1, 10.1, 10.1, 10.1, 10.1, 10.1, 1}
2.2.8 ROBOTAXISPOSEXT
The position of the external robot axis, the port number is UINT type, and the range is
[0,31].
Example: ROBOTAXISPOSEXT rape1 := 5
2.2.9 ROBOTCARTPOSEXT
External Spatial position in Cartesian coordinate system, the port number is UINT type, the
range is [0,127].
Example: ROBOTCARTPOSEXT rcpe1 := 5
6
SPD-12-01-C
STEP Robot User Programming Manual
2.2.10 AXISDIST
The relative distance of joint type, including additional axes, up to 6 robot axes + 6
additional axes, the type of each data is REAL, and the unit is degree (°).
Example: AXISDIST ad1 := {10.1, 10.1, 10.1, 10.1, 10.1, 10.1, 10.1, 10.1, 10.1, 10.1, 10.1,
10.1}
2.2.11 CARTDIST
The relative distance of the Cartesian type, including additional axes, up to 6 robot axes +
6 additional axes, and the variables are composed of X, Y, Z, A, B, C, Aux1~6, all of which are
REAL types.
Example: CARTDIST cd1 := {800, 10.1 ,1027, 0, 90, -180, 10.1, 10.1, 10.1, 10.1, 10.1,
10.1}
2.2.12 POSOFFSET
Position deviation, None additional axes data, variables are composed of VAR1, VAR2,
VAR3, VAR4, VAR5, VAR6, all of which are of REAL type.
2.3 Coordinate system and tool data type
Type
Meaning
CARTREF
Reference coordinate system
CARTREFEXT
External fixed reference coordinate system
CARTREFVAR
External tracking coordinate system
TOOL
Tool
TOOLEXT
External tools
2.3.1 CARTREF
The position of the coordinate system relative to its reference coordinate system. The
variables are composed of X, Y, Z, A, B, C, and the reference coordinate system. X~C are all
REAL types.
Example: CARTREF ref1 := {1.1, 1.2, 1.3, 1.4, 1.5, 1.6, ref0}
2.3.2 CARTREFEXT
The external fixed coordinate system includes a port number and a reference coordinate
system. The range of the port number is [0,31]. According to the port number, set the data of the
external fixed coordinate system relative to the reference coordinate system on the PLC side.
The referenced coordinate system can only be a fixed coordinate system type.
7
SPD-12-01-C
STEP Robot User Programming Manual
Example: CARTREFEXT refe0:= {5, ref0}
2.3.3 CARTREFVAR
The external tracking coordinate system includes a port number and a reference coordinate
system. The range of the port number is [0,31]. According to the port number, set the data of the
external fixed coordinate system relative to the reference coordinate system on the PLC side.
The data is changing. The referenced coordinate system can only be a fixed coordinate system
type.
Example: CARTREFVAR refv1 := {1, ref0}
2.3.4 TOOL
Represents the coordinate system of the tool, i.e. the data of the tool end relative to the
flange coordinate system. It is composed of X, Y, Z, A, B, and C, all of which are REAL types.
Example: TOOL tool0:= {1.1, 1.2, 1.3,1.4,1.5,1.6}
2.3.5 TOOLEXT
The external tool coordinate system, that is, the data of the tool set on the PLC side, is
transmitted to the teach pendant through the port number, and the data range of the port number
is [0,31].
Example: TOOLEXT toolext0:= 3
2.3.6 INTNUM
The interrupt type variable can only be a global variable, and the interrupt function is
realized by binding the interrupt program and the DI signal. If the data of this variable is not
used, the default is 0.
Example: INTNUM intnum0 := 0
2.4 Dynamic characteristics and Ovl type
Type
8
Meaning
DYNAMIC
Dynamic characteristics
OVLREL
Percentage of smothness
OVLABS
Absolute amount of smothness
ORITYPE
Posture type
RAMPTYPE
Acceleration type
SPD-12-01-C
STEP Robot User Programming Manual
2.4.1 DYNAMIC
It consists of position, rotation and joint speed, acceleration, deceleration and jerk, a total
of 12 quantities. Actually, different quantities are used according to the type of path executed
(for Cartesian or joint). The 12 quantities are:
PathVel
REAL
Position speed (mm/s)
PathAcc
REAL
Position acceleration (mm/s^2)
PathDec
REAL
Position deceleration (mm/s^2)
PathJerk
REAL
Position jerk (mm/s^3)
OriVel
REAL
Rotation speed (deg/s)
OriAcc
REAL
Rotation acceleration (deg/s^2)
OriDec
REAL
Rotation deceleration (deg/s^2)
OriJerk
REAL
Rotational jerk (deg/s^3)
JointVel
REAL
Joint speed (%)
JointAcc
REAL
Joint acceleration (%)
JointDed
REAL
Joint deceleration (%)
JointJerk
REAL
Joint acceleration (%)
Example: DYNAMIC dyn1 := {1000, 2000, 2000, 5000, 100, 200, 200, 500, 80, 80, 80,
80}
2.4.2 OVLREL
Indicates the percentage of smoothness, INT type, represents percent.
Example: OVERLAPREL olr0 := 50
2.4.3 RAMPTYPE
Composed of two types: Sshape and Ssine;
2.5 Operators
2.5.1 Mathematical operators
9
+
Addition operation
-
Subtraction operation
*
Multiplication operation
/
Division operation
SPD-12-01-C
STEP Robot User Programming Manual
Usage: The left and right sides can be numeric or basic data type variables
2.5.2 Relational operators
<
Less than
<= Less than or equal to
>
more than the
>= greater or equal to
== equal
!= not equal to
Usage: The left and right sides can be numeric or basic data type variables
2.5.3 Logical operators
&& and
||
or
!
not
2.5.4 Delimiters and other symbols
: Colon
Usage: used in assignment instruction
,
Comma
Usage: used between multiple parameters
()
Brackets (applicable to parameters, initialization lists, arithmetic expressions)
Usage: used after instructions that require parameters
2.6 Polishing variables
Polishing variables are used in the CLin instruction. The variables are composed of the
polishing type (String), the number of polishing (Integer), the radius of the circle (REAL), the
semi-major axis of the ellipse (REAL), the semi-minor axis of the ellipse (REAL), and the
ellipse tilt Angle (REAL), amplitude (REAL).
Example: POLISHDATA polishdata1 := {eCircle, 1, 0.0, 0.0, 0.0, 0.0,0.0}
When the eCircle type is selected, the parameters related to the ellipse do not need to be
added, and the default values are Transfern by the system.
10
SPD-12-01-C
STEP Robot User Programming Manual
Chapter III Instructions and Writing Examples
3.1 Robot motion instructions
3.1.1 PTP
1. Use format:
PTP (pos, dyn, ovl, tool, refsys)
2. Parameters:
pos: POSITION_ //Target position, required
OPTIONAL dyn: DYNAMIC_ //Dynamic characteristics, optional
OPTIONAL ovl: OVERLAP_ //Smooth data, optional
OPTIONAL tool: TOOL_ //Tool data, optional
OPTIONAL refsys: REFSYS_ //Coordinate system data, optional
3. Function description:
To achieve point-to-point movement, that is, the robot moves from the current position to
the target position pos in the fastest way. The dynamic parameters and smoothness parameters
during the running process are determined by dyn and ovl, and the tool and coordinate system
parameters are determined by tool and refsys.
4. Writing examples:
PTP(ap1);
The robot moves from the current position to the ap1 point in the fastest way, dynamic and
smooth, and the tool and coordinate system parameters are the default value.
3.1.2 Lin
1. Use format:
Lin (pos, dyn, ovl, ori, Tool, refsys)
2. Parameters:
pos: POSITION_ //Target position, required
OPTIONAL dyn: DYNAMIC_ //Dynamic characteristics, optional
OPTIONAL ovl: OVERLAP_ //Smooth data, optional
OPTIONAL ori: ORITYPE
//Posture parameters, optional
OPTIONAL tool: TOOL_ //Tool data, optional
11
SPD-12-01-C
STEP Robot User Programming Manual
OPTIONAL refsys: REFSYS_ //Coordinate system data, optional
3. Function description:
The TCP of the robot will move from the initial position to the target position in a linear
motion. The dynamic parameters, smoothness data and posture during the running process are
determined by dyn, ovl and ori, and the tool and coordinate system parameters are determined
by tool and refsys.
4. Writing examples:
Lin (ap1,dyn1,ovl1,ori1);
The robot moves from the current position to ap1 in a straight line. The dynamic
parameters during operation are determined by dyn1, the smothness data is determined by ovl1,
the posture changes according to ori1, and the tool and coordinate system parameters are default
values.
3.1.2 LineSearch
1. Use format:
LineSearch(Pos, di, pat, outPlane, outPos, tool, refsys)
2. Parameters:
pos: POSITION_ // Target position, required
di: DI// System signal// Find position feedback signal, required
pat: PAT // Positioning process parameters, required
outPlane: PLANE //Output searched position, PLANE type, required
outPos: POSITION //Output searched position, POSITION type, required
OPTIONAL tool: TOOL_ //Tool data, optional
OPTIONAL refsys: REFSYS_ //Coordinate system data, optional
3. Function description:
The TCP of the robot will move from the initial position to the target position in a linear
motion. If the positioning signal is triggered during the operation, the robot will stop and record
the relevant information. The path dynamic parameters and positioning process during the
operation will be determined by pat, tool and coordinate system parameters are determined by
tool and refsys.
4. Writing examples:
12
SPD-12-01-C
STEP Robot User Programming Manual
Lin (ap1, di1, pat1, outPlane1, outPos1, tool1, refsys1);
3.1.3 Circ
1. Use format:
Circ (hlpPos, pos, dyn, ovl, ori, Tool, refsys)
2. Parameters:
hlpPos: POSITION_ //Auxiliary position on the arc, the middle point is required
pos: POSITION_ //Target position, required
OPTIONAL dyn: DYNAMIC_ //Dynamic characteristics, optional
OPTIONAL ovl: OVERLAP_ //Smooth data, optional
OPTIONAL ori: ORITYPE
//Posture parameters, optional
OPTIONAL tool: TOOL_ //Tool data, optional
OPTIONAL refsys: REFSYS_ //Coordinate system data, optional
3. Function description:
The TCP is controlled to perform a circular arc movement, and the dynamic parameters
and smothness data are determined by dyn and ovl, the posture is changed according to the
options of ori, and the tool and coordinate system parameters are determined by tool and refsys.
4. Writing examples:
Circ(ap0,ap1);
A unique arc is determined by the current position point, ap0 and ap1, and the robot moves
along this arc from the current position to the ap1 point.
3.1.4 CircleAngle
1. Use format:
CircAngle(hlpPos, pos, angle, dyn, ovl, ori, Tool, refsys)
2. Parameters:
hlpPos: POSITION_ //Auxiliary position on the arc, required
pos: POSITION_ //Target position, required
angle: REAL/ /User-specified angle, required
OPTIONAL dyn: DYNAMIC_ //Dynamic characteristics, optional
OPTIONAL ovl: OVERLAP_ //Smooth data, optional
OPTIONAL ori: ORITYPE
13
//Posture parameters, optional
SPD-12-01-C
STEP Robot User Programming Manual
OPTIONAL tool: TOOL_ //Tool data, optional
OPTIONAL refsys: REFSYS_ //Coordinate system data, optional
3. Function description:
Control TCP to perform a circular arc movement. The angle of the arc is specified by the
user. The dynamic, smooth, and Posture parameters are specified by dyn, ovl, and ori. The tool
and coordinate system parameters are determined by tool and refsys.
4. Writing examples:
CircleAngle(ap0,ap1,angle0);
A unique arc is determined by the current position point, ap0 and ap1, the smooth angle of
this segment is determined by angle0. The robot moves angle0 degrees along this arc from its
current position.
3.1.5 PTPRel
1. Use format:
PTPRel(pos, Dyn, ovl, Tool, refsys)
2. Parameters:
pos: DISTANCE_ //The distance moved, required
OPTIONAL dyn: DYNAMIC_ //Dynamic data, optional
OPTIONAL ovl: OVERLAP_ //Smooth data, optional
OPTIONAL tool: TOOL_ //Tool data, optional
OPTIONAL refsys: REFSYS_ //Coordinate system data, optional
3. Function description:
PTPRel is a point-to-point relative motion instruction, and the moving distance is relative
to the initial position of the robot (this position depends on the previous motion instruction).
4. Writing examples:
PTPRel(apd0);
The robot moves the distance of apd0 from the current position in a point-to-point way.
3.1.6 LinRel
1. Use format:
LinRel (dist, dyn, ovl, ori, Tool, refsys)
2. Parameters:
14
SPD-12-01-C
STEP Robot User Programming Manual
dist: DISTANCE_ //The distance moved, required
OPTIONAL dyn: DYNAMIC_ //Dynamic data, optional
OPTIONAL ovl: OVERLAP_ //Smooth data, optional
OPTIONAL ori: ORITYPE
//Posture parameters, optional
OPTIONAL tool: TOOL_ //Tool data, optional
OPTIONAL refsys: REFSYS_ //Coordinate system data, optional
3. Function description:
LinRel is a relative linear motion instruction, and the moving distance is relative to the
initial position of the robot (this position depends on the previous motion instruction).
4. Writing examples:
LinRel(cpd0);
The robot moves the distance of cpd0 in a straight line from the current position.
3.1.7 WaitTime
1. Use format:
WaitTime (timeMs);
2. Parameters:
timeMs: UINT//Time (unit: milliseconds ms)
3. Function description:
This instruction pauses the robot timeMs time.
4. Writing examples:
WaitTime(unit0);
The robot pauses for unit0 ms.
3.1.8 LinISR
1. Use format:
BOOLVAR: =LinISR(Pos, dyn, ovl, ori, Di, respondpos, stoppos, tool, refsys)
2. Parameters:
pos: POSITION_ //Target position, required
OPTIONAL dyn: DYNAMIC_ //Dynamic characteristics, optional
OPTIONAL ovl: OVERLAP_ //Smooth data, optional
OPTIONAL ori: ORITYPE
15
//Posture parameters, optional
SPD-12-01-C
STEP Robot User Programming Manual
di: DI //Digital input port number
respondpos: POSITION_ //The position where the signal is received
stoppos: POSITION_ //The position where the robot stops after receiving the signal
OPTIONAL tool: TOOL_ //Tool data, optional
OPTIONAL refsys: REFSYS_ //Coordinate system data, optional
3. Function description:
When the TCP of the robot moves from the initial position to the target position in a linear
motion, if the di signal is received, it will immediately slow down and stop, the position
information of the received signal is stored in respondpos, and the position information of the
robot stop is stored in stoppos. The dynamic parameters, smooth data and Posture are
determined by dyn, ovl and ori. In addition, if the di signal is received during this straight line,
the left data is assigned to TRUE, otherwise, it is assigned to FALSE.
Note: The stored response position and stop position information of respondpos and
stoppos cannot be seen on the interface, and the initial data is always displayed on the interface.
4. Writing examples:
PTP(ap0);
bool0:=LinISR (ap1,dyn1,ovl1,ori1,di0,cp0,cp1);
Lin(cp0);
When the robot runs in a straight line from ap0 to ap1, if it receives the signal of di0, the
robot will immediately slow down and stop, and store the received position information in cp0,
and store the stop position information of the robot in cp1. Set bool0 to TRUE. The dynamic
parameters during the straight line motion are determined by dyn1, the smothness data is
determined by ovl1, and the posture changes according to ori1. Then run the third instruction,
you can move the robot to the position of receiving the signal.
If no di0 signal is received during the straight-line motion from ap0 to ap1, it will run
directly to ap1, and the data of bool0 is FALSE. When running the third line, the robot will run
to the initial data position of cp0, which is the position data displayed by the variable cp0.
3.1.9 CLin
1. Use format:
CLin (pos,polishdata, press,dyn, ovl, ori, Tool, refsys)
16
SPD-12-01-C
STEP Robot User Programming Manual
2. Parameters:
pos: POSITION_ //Target position, required
Polishdata// polishing variables, required
press// press amount, optional
OPTIONAL dyn: DYNAMIC_ //Dynamic characteristics, optional
OPTIONAL ovl: OVERLAP_ //Smoothness data, optional
OPTIONAL ori: ORITYPE
//Posture parameters, optional
OPTIONAL tool: TOOL_ //Tool data, optional
OPTIONAL refsys: REFSYS_ //Coordinate system data, optional
3. Function description:
The TCP of the robot will move according to the type of trajectory set in the polishing
variable, which may be circle, ellipse, or sin shape. If the pressing amount is not empty, an
overall offset will be made on the above trajectory, and the offset direction is along the Z-axis of
the tool.
4. Writing examples:
CLin (ap1,polishdata, press, dyn1,ovl1,ori1,tool,ref);
If the type in polishdata is circle, the robot will move to ap1 while drawing a circle from
the current position. The dynamic parameters during operation are determined by dyn1, the
smoothness data is determined by ovl1, the posture changes according to ori1, the tool is tool,
and the coordinate system parameter is ref.
3.1.10 WaitIsFinished
1. Use format:
WaitIsFinished ();
2. Parameters:
Noneq;
3. Function description:
This instruction is used to interrupt pre-reading and smoothing.
4. Writing examples:
WaitIsFinished ();
17
SPD-12-01-C
STEP Robot User Programming Manual
3.2 Robot setting instructions
Setting instructions are used to modify parameter settings and apply to subsequent motion
instructions.
3.2.1 Dyn
1. Use format:
Dyn( dyn);
2. Parameters:
dyn: DYNAMIC_//Specify dynamic characteristic parameters, required
3. Function:
Speed, acceleration, deceleration and jerk are the default data of the dynamic parameters of
the following motion instructions. In PTP, the dynamic uses the percentage form, and the
dynamic characteristics of the Cartesian movement use the absolute numerical form.
4. Writing examples:
Dyn(dynamic0);
The default data of the dynamic parameter of the following motion instruction is
dynamic0.
3.2.2 Ovl
1. Use format:
Ovl ( ovl );
2. Parameters:
ovl: OVERLAP_//Smoothness data, required
3. Function description:
Set the smoothness characteristic during the movement and apply it to the subsequent
movement.
4. Writing examples:
Ovl(ovearlap0);
The default data of the smooth data of the following motion instructions is overlap0.
Note: When you do not use the smooth instruction, the smooth parameters used in the
program are the smooth parameters configured in the robot configuration file.
18
SPD-12-01-C
STEP Robot User Programming Manual
3.2.3 Ramp
1.Use format:
Ramp( type );
2. Parameters:
type: RAMPTYPE //Rate type, required
3. Function description:
Set the speed type, Sshape and Ssine are optional.
4. Writing examples:
Ramp(type0);
The speed type of the following movement instruction is type0.
3.2.4 RefSys
1. Use format:
RefSys ( refSys );
2. Parameters:
refSys: REFSYS_ //Reference system, required
3. Function description:
Set the coordinate system and apply it to the following motion instructions.
4. Writing examples:
RefSys(ref0);
The reference coordinate system of the following robot position is ref0.
3.2.5 Tool
1. Use format:
Tool( tool );
2. Parameters:
tool: TOOL_ //Tool data, required
3. Function description:
Specify the position and direction of the end of the tool relative to the flange, and apply it
to the following motion instructions.
4. Writing examples:
Tool(tool0);
19
SPD-12-01-C
STEP Robot User Programming Manual
The following instructions are all moved under tool0.
3.2.6 OriMode
1.Use format
OriMode ( ori );
2. Parameters:
ori: ORITYPE_
//Posture mode, enumeration type
3. Function description:
Set the posture change mode of the continuous motion instruction and apply it to the
subsequent continuous motion instruction.
4. Writing examples:
OriMode(eVar);
The default posture mode of the subsequent continuous motion instructions is eVar.
3.2.7 CartSpaceActivate
1. Use format:
CartSpaceActivate(space,val);
2. Parameters:
Space: SPACE //The serial number of the working space, the data is 1-8, which is required
val: BOOL //Activation status of the workspace, TRUE means active, FALSE means
inactive, required.
3. Function description:
Activate a Cartesian workspace or close a Cartesian workspace.
4. Writing examples:
CartSpaceActivate(1,TRUE);
Activate Cartesian workspace 1.
3.2.8 AxisSpaceActivate
1. Use format:
AxisSpaceActivate(space,val);
2. Parameters:
space: SPACE //The serial number of the workspace, the data is 1-8, required
20
SPD-12-01-C
STEP Robot User Programming Manual
val: BOOL //Activation status of the workspace, TRUE means active, FALSE means
inactive, required
3. Function description:
Activate or close a joint workspace.
4. Writing examples:
AxisSpaceActivate(1,TRUE);
Activate the joint workspace 1.
3.2.9 SetCartSpaceMode
1. Use format:
SetCartSpaceMode(space,val);
2. Parameters:
space: SPACE //The serial number of the workspace, the data is 1-8, required
val: //Enumerated type, 5 modes of workspace, required
eAreaInside---Entering the workspace will trigger the signal of the workspace
eAreaOutside---Movement to the outside of the workspace will trigger the signal of the
workspace
eAreaInside_Stop---When entering the workspace, the robot will report an error to stop and
trigger a signal
eAreaOutside_Stop---The robot will report an error to stop when it moves outside the
space, and trigger the signal
eAreaOFF---Off mode, the workspace will not be triggered in this mode
3. Function description:
Set the mode of Cartesian workspace in the program.
4. Writing examples:
SetCartSpaceMode(1,eAreaInside);
Set the mode of Cartesian workspace 1 to inside mode.
3.2.10 SetAxisSpaceMode
1. Use format:
SetAxisSpaceMode(space,val);
2. Parameters:
21
SPD-12-01-C
STEP Robot User Programming Manual
space: SPACE //The serial number of the workspace, the data is 1-8, required
val: //Enumerated type, 5 modes of workspace, required
eAreaInside---Entering the workspace will trigger the signal of the workspace
eAreaOutside---Movement to the outside of the workspace will trigger the signal of the
workspace
eAreaInside_Stop---When entering the workspace, the robot will report an error to stop and
trigger a signal
eAreaOutside_Stop---The robot will report an error to stop when it moves outside the
space, and trigger the signal
eAreaOFF---Off mode, the workspace will not be triggered in this mode
3. Function description:
Set the mode of joint workspace in the program.
4. Writing examples:
SetAxisSpaceMode(1,eAreaInside);
Set the mode of joint workspace 1 to inside mode.
3.2.11 ReadCartSpaceState
1. Use format:
bool:=ReadCartSpaceState(space);
2. Parameters:
space: SPACE //The serial number of the workspace, the data is 1-8, required
val: BOOL //Boolean type variable, required
3. Function description:
Read the data of the Cartesian workspace state. If the workspace is triggered, the read
data is 1, otherwise it is 0, and the data is assigned to the left variable.
4. Writing examples:
bool0:=ReadCartSpaceState(1);
Read the state of Cartesian workspace 1 and assign its data to bool0.
3.2.12 ReadAxisSpaceState
1. Use format:
bool:=ReadAxisSpaceState(space);
22
SPD-12-01-C
STEP Robot User Programming Manual
2. Parameters:
space: SPACE //The serial number of the workspace, the data is 1-8, required
val: BOOL //Boolean type variable, required
3. Function description:
Read the data of the joint workspace state. If the workspace is triggered, the read data is 1,
otherwise it is 0, and the data is assigned to the left variable.
4. Writing examples:
bool0:=ReadAxisSpaceState(1);
Read the state of joint workspace 1 and assign its data to bool0.
3.2.13 Override
1. Use format
Override ( percent);
2. Parameters:
percent: PERCENT //Percent
3. Function description:
Dynamically set the movement speed percentage.
4. Writing examples:
Override (percent);
Change the speed percentage of the current program to the data of percent.
3.2.14 IndReset
1. Use format:
IndReset();
2. Parameters:
None.
3. Function description:
The function of this instruction is to reset the current six-axis angle after the independent
axis function is currently turned on (calculation method: divide 360 to remove the remainder). If
the independent axis is not turned on, the execution of this instruction will report an error "The
independent axis can only be used after it is turned on" . If the independent axis is turned on and
23
SPD-12-01-C
STEP Robot User Programming Manual
the current six-axis angle is 370°, after executing IndReset, the current six-axis angle displayed
on the position interface is 10°
3.3 System function instructions
3.3.1 :=(Assignment instruction)
1. Use format:
Left:= right;
2. Parameters:
None
3. Function description:
Assign a data to the variable, the variable is on the left side of the symbol, and the data
(expression) is on the right.
4. Writing examples:
int0:=1;
Assign 1 to the integer variable int0;
3.3.2 //(Comment instruction)
1. Use format:
//comment;
2. Parameters:
None
3. Function description:
The instruction is followed by a comment (same line).
4. Writing
//PTP(ap0);
The motion instruction is no longer executed.
3.3.3 SaveData
1. Use format:
SaveData(localvar);
2. Parameters:
localvar: local variable, unlimited type
24
SPD-12-01-C
STEP Robot User Programming Manual
3. Function description:
SaveData is only used for saving important data before power off after get off work. It is
used to save the current data of the variable to the .srd file of the controller. It is recommended
that this function be used at the end of the program and executed once before the power-off
operation.
If it is used continuously in the program, the variable data in the .srd file will be written
continuously. If the frequency is too high, the life of the disk will be affected.
4. Writing examples:
IF(int1= =1)THEN //The initial data of int1 is 0
PTP(ap1); //ap1:=10,20,10,0,0,30
PTP(ap0); //ap0:=0,0,0,0,0,0
END_IF
int1:=1; //This instruction changes the data of int1 to 1
SaveData(int1); //Save the process data of int1, the variable data of the variable monitoring
interface will be updated to 1 synchronously
After running the program, even if the power is turned off and restarted, the data of int1 is
still 1, and will not change to the initial data of 0.
3.3.4 RecordList
1. Use format:
RecordList(Var1, Var2, Var3, Var4, Var5, Var6, Var7, Var8, Var9, Var10);
2. Parameters:
Var: local variables, the type is all local variables
3. Function description:
The function of this instruction is similar to the function of the SaveData instruction. It is
used to save the process data of the variable, but the usage is different. The variable name to
record the process data is used as the parameter of the RecordList, and the process data of up to
10 variables can be recorded, and then the RecordList The instruction is placed on the first line
of the program. When the program is running, as long as the data of the variable to be recorded
changes, it will be recorded. Even if the power is turned off and restarted, the data before the
power off will be saved.
25
SPD-12-01-C
STEP Robot User Programming Manual
RecordList is only used in special circumstances, that is, for variables that need to save
process datas, otherwise the file is read and written too frequently, which will affect the life of
the disk.
4. Writing examples:
RecordList(int1,int2)
While(int1) DO //The initial data of int1 is 100
int1:=int1-1;
PTP(ap0);
PTP(ap1);
PTP(ap2);
int2:=int2+1; //The initial data of int2 is 0
WaitTime(unit3); //unit3 is 1000
END_WHILE
After the program runs twice in a loop, the data of int1 will change to 98, and the data of
int2 will change to 2. At this time, whether it is uninstalling the program or restarting after a
power failure, the data of int1 will remain at 98 and the data of int2 will remain at 2. .
3.3.5 Message
1. Use format:
Message(message,type,var1,var2);
2. Parameters:
message: STRING //Customized message, string type
type: enumerated type, eInfo/eWarining/eError //Type of custom information
var1: any variable type//replace "%1" in message
var2: any variable type//replace "%2" in message
3. Function description:
The user can use the Message instruction to customize the information, and the customized
information type can be Information, Error or Warning.
If it is Error, an error will stop when the instruction is run, and an error message box will
pop up. The message data is displayed in the error message box, and the "%1" in the message is
replaced by the variable name or data of var1, "% 2" is replaced by the variable name or data of
26
SPD-12-01-C
STEP Robot User Programming Manual
var2. If there is only one parameter for var1 and var2, the "%1" and "%2" in the message will be
replaced by the data of the variable; if there are two parameters for var1, var2 And above, the
"%1" and "%2" in the message will be replaced by the variable name. In addition, by clicking
the confirm button in the error pop-up box, all errors in the information interface will be cleared.
If it is Warning or Information, when the message instruction is running, the message will
be displayed in the error status bar on the teach pendant, but it will not affect the running status
of the robot.
4. Writing examples:
int1:=3;
PTP(ap0);
PTP(ap1);
Message(“outint %1 outpos %2 ”,eError,int1,ap0);
PTP(ap2);
When the program runs to the message instruction, it will report an error and stop, and an
error message box will pop up. The error description is "outint 3 outpos ap1". Click the confirm
button in the error pop-up box to clear all error messages.
3.3.6 MessageErase
1. Use format:
MessageErase();
2. Parameters:
No parameters
3. Function description:
This instruction is used to clear all the information in the information bar, including
Warning and Information.
4. Writing examples:
int1:=3;
PTP(ap0);
PTP(ap1);
Message(“outint %1 outpos %2 ”,eWarning,int1,ap0);
WaitTime(unit0);
27
SPD-12-01-C
STEP Robot User Programming Manual
MessageErase();
When running to the last instruction, the warning message generated by the Message
instruction will be cleared.
3.3.6 Pause
1. Use format:
Pause();
2. Parameters:
No parameters.
3. Function description:
This instruction has the same function as the Stop button. It is used to pause the program.
During the program running, when the instruction is reached, the robot stops and the program is
in a paused state. When the start button is pressed again, the program continues to run.
Notice:
This instruction will interrupt the pre-reading, that is, the program instructions after the
instruction will not be pre-read;
If there is no movement instruction after the pause instruction, and the synchronous IO
instruction is directly connected, the synchronous IO instruction will be invalid;
When running the program continuously in manual mode, if you encounter a pause
instruction, you need to release the start key to run it, otherwise it will stay in the pause
instruction.
4. Writing examples:
PTP(ap0);
PTP(ap1);
Pause();
PTP(ap2);
When running to the 3rd line, the robot will slow down and stop, and the program running
status will change to pause status. When you press the start key again, the program will continue
to run the PTP (ap2) instruction.
3.3.7 GetCurrentRobotPos
1. Use format:
28
SPD-12-01-C
STEP Robot User Programming Manual
GetCurrentRobotPos (Pos,Tool,Ref);
2. Parameters:
Pos: "AXISPOS", "CARTPOS", "ROBOTAXISPOS", "ROBOTCARTPOS" type.
Tool: Tool variable (optional, the most recently set tool is used by default).
Ref: Coordinate system variable (optional, the most recently set coordinate system is used
by default).
3. Function description:
Get the current position and posture of the robot, and convert them into the coordinate
system and the data of the tool set in the instruction.
Notice:
This instruction will interrupt the pre-reading, that is, the program instructions after the
instruction will not be pre-read;
4. Writing examples:
Example 1:
GetCurrentRobotPos(pos);//Get Default, the position under WORLD is stored in pos
Example 2:
Tool(too10);
Refsys(ref0);
Lin(ap1,tool2);
GetCurrentRobotPos(pos);//Get tool0, store the position under ref0 to pos
Example 3:
Tool(too10);
Refsys(ref0);
Lin(ap1,tool2);
GetCurrentRobotPos(pos,tool3,ref3);//Get the position under too13, ref3 and store it in
pos
3.3.8 ReturnMainProgram
1. Use format:
ReturnMainProgram (int);
2. Parameters:
29
SPD-12-01-C
STEP Robot User Programming Manual
int: program line number, a required parameter, the range is 0-10000.
3. Function description:
The ReturnMainProgram instruction is used to return to the main program from an
interrupt program or subprogram, and can specify to return to a certain line of the main program
Notice:
This instruction reloads the program, and the program variables will become initial data.
4. Writing examples:
Main program:
Connect(intnum0,program0);
ISignal(jia_close,TRUE,intnum0);
PTP(ap0);
PTP(ap1);
Interrupt program program0:
PTP(cp1);
ReturnMainProgram(3);
PTP(cp2);
When the ReturnMainProgram(3) instruction of the interrupt program program0 is run,
the program will no longer execute the PTP(cp2) , but will directly jump to the third line of the
main program to execute PTP(ap0), and at this time, the interrupt signal will not respond to the
interrupt.
3.4 Mathematical function instructions
3.4.1 SIN
1. Use format:
real:= SIN(deg);
2. Parameters:
The parameter deg can be of INT, FLOAT, or DOUBLE type (in °).
3. Function description:
Assign the sine of one real number to another real number.
4. Writing examples:
a:=SIN(b);
30
SPD-12-01-C
STEP Robot User Programming Manual
Assign the sine of the real number b to the real number a.
3.4.2 COS
1. Use format:
real:= COS(deg);
2. Parameters:
The parameter deg can be of INT, FLOAT, or DOUBLE type (in °).
3. Function description:
Assign the cosine data of one real number to another real number.
4. Writing examples:
a:=COS(b);
Assign the cospin data of the real number b to the real number a.
3.4.3 TAN
1. Use format:
real:= TAN(deg);
2. Parameters:
The parameter deg can be of INT, FLOAT, or DOUBLE type (in °).
3. Function description:
Assign the tangent of one real number to another real number.
4. Writing examples:
a:=TAN(b);
Assign the tangent data of the real number b to the real number a.
3.4.4 LN
1. Use format:
real:= LN(deg);
2. Parameters:
The parameter deg can be of INT, FLOAT, or DOUBLE type (in °).
3. Function description:
Assign the logarithmic data of one real number to another real number.
4. Writing examples:
a:=LN(b);
31
SPD-12-01-C
STEP Robot User Programming Manual
Assign the logarithm of the real number b to the real number a.
3.4.5 PosReset
1. Use format:
PosReset(pos,distance,outpos);
2. Parameters:
pos: POSITION_ //The initial position of the instruction, required
diatance: OFFSET //position offset, required
outpos: POSITION_ //The output position of the instruction, required
3. Function description:
The PosReset instruction can implement the addition operation of the position point, that is,
after adding the data of pos to the deviation of distance, assign it to outpos. This instruction is
not a running instruction. When running this instruction, the robot will not move.
4. Writing examples:
PosReset(ap0,posoffset0,ap1); //ap0=0,0,0,0,0,0 posoffset0=10,10,10,10,10,10
PosReset(cp0,posoffset0,cp1); //cp0=872,0,920,0,70,-80
After running the instruction in line 1, the data of ap1 becomes: 10,10,10,10,10,10
After running the instruction in line 2, the data of cp0 becomes: 882,10,930,10,80,-70
3.4.6 SHL
1. Use format:
int:=SHL (Expr, digit);
2. Parameters:
Expr: the data to be moved
digits: the number of digits to be moved in the data
3. Function description:
Shift Expr to the left by digit and assign it to int.
4. Writing an example:
c:=SHL(a,b);
Shift a bit by bit to the left by b bit and assign it to c.
3.4.7 SHR
1. Use format:
32
SPD-12-01-C
STEP Robot User Programming Manual
int:=SHR(Expr, digit);
2. Parameters:
Expr: the data to be moved
digits: the number of digits to be moved in the data
3. Function description:
Shift Expr to the right by digit and assign it to int.
4. Writing an example:
c:=SHR(a,b);
Shift a bit by bit to the right by b bit and assign it to c.
3.4.8 SetBit
1. Use format:
int:=SetBit(val,bitNr);
2. Parameters:
val: will be used to set the data
bitNr: the bit to be set
3. Function description:
Set the value of the bitNr bit of val to 1, and then assign it to int.
4. Writing examples:
C:=SetBit(a,b);
Set the bth position of a to 1, and assign it to c.
3.4.9 GetPointBy2Lines
1. Use format:
pos := GetPointBy2Lines (line1,line2);
2. Parameters:
pos: CARTPOS/ROBOTCARTPOS //The intersection point of two straight lines or the
midpoint of the common perpendicular, required
line1: LINE //Line equation or XAxis/YAxis/ZAxis, required
line2: LINE //Line equation or XAxis/YAxis/ZAxis, required
3. Function description:
33
SPD-12-01-C
STEP Robot User Programming Manual
The GetPointBy2Lines instruction obtains the intersection of two straight lines. If two
straight lines intersect, return to the position XYZ of the intersection point; if the two straight
lines are different planes, return to the position XYZ of the midpoint of the common vertical
line; if the two straight lines are parallel, an error will be reported.
4. Writing examples:
cp0 := GetPointBy2Lines(line0, line1)
Return the intersection position of line0 and line1 and assign it to the XYZ of cp0.
3.4.10 GetPointBy2Planes
1. Use format:
pos := GetPointBy2Planes (plane1, plane2);
2. Parameters:
pos: CARTPOS/ROBOTCARTPOS //The intersection point of two straight lines or the
midpoint of the common perpendicular, required
plane1: PLANE //Plane equation or XOY/YOZ/ZOX, required
plane2: PLANE //Plane equation or XOY/YOZ/ZOX, required
3. Function description:
GetPointBy2Lines instruction gets the intersection of two planes. If the two planes are
parallel, an error will be reported.
4. Writing examples:
cp0 := GetPointBy2Planes (plane1, plane2)
Return the intersection position of plane1 and plane2 and assign it to the XYZ of cp0.
3.4.11 GetPointByLinePlane
1. Use format:
pos := GetPointByLinePlane (line,plane);
2. Parameters:
pos: CARTPOS/ROBOTCARTPOS //Intersection point of straight line and plane, required
line: LINE //Line equation or XAxis/YAxis/ZAxis, required
plane: PLANE //Plane equation or XOY/YOZ/ZOX, required
3. Function description:
34
SPD-12-01-C
STEP Robot User Programming Manual
The GetPointByLinePlane instruction obtains the intersection point of a straight line and a
plane. If the straight line is parallel to the plane, an error will be reported.
4. Writing examples:
cp0 := GetPointByLinePlane(line0, plane0)
Return the intersection position of line0 and plane0, and assign it to the XYZ of cp0.
3.4.12 GetPointBy3Points
1. Use format:
posA :=GetPointBy3Points (P1, P2, P3);
2. Parameters:
posA: CARTPOS/ROBOTCARTPOS // point of intersection of perpendiculars, required
P1: CARTPOS/ROBOTCARTPOS //Point 1 on the straight line, required
P2: CARTPOS/ROBOTCARTPOS //Point 2 on the straight line, required
P3: CARTPOS/ROBOTCARTPOS //Point 3 outside the straight line, required
3. Function description:
The GetPointBy3Points instruction is used to obtain the intersection of the vertical lines of
three points on the known plane. As shown in the figure above, the three parameters of the
instruction are P1, P2, P3, and then return the vertical foot that passes through P3 and is
perpendicular to the line P1P2.
4. Writing examples:
cp0 := GetPointBy3Points (cp1,cp2,cp3)
Return the foot that passes point cp3 and is perpendicular to the line passing points cp1 and
cp2, and assign the XYZ of the foot to the XYZ of cp0.
35
SPD-12-01-C
STEP Robot User Programming Manual
3.4.13 GetPointBy4Points
1. Use format:
posA := GetPointBy4Points (P1, P2, P3, P4);
2. Parameters:
posA: CARTPOS/ROBOTCARTPOS // point of intersection of straight lines, required
P1: CARTPOS/ROBOTCARTPOS //point 1 on line 1, required
P2: CARTPOS/ROBOTCARTPOS //point 2 on line 1, required
P3: CARTPOS/ROBOTCARTPOS //point 1 on line 2, required
P4: CARTPOS/ROBOTCARTPOS //point 2 on line 2, required
3. Function description:
The GetPointBy4Points instruction is used to obtain the intersection of two straight lines
determined by the four points on the plane. As shown in the figure above, the three parameters
of the instruction are P1, P2, P3, P4, and then return the intersection of the straight line P1P2
and the straight line P3P4. If the two straight lines formed are not in the same plane, return to
the midpoint of the common perpendicular. If the two straight lines are parallel, an error will be
reported.
4. Writing examples:
cp0 := GetPointBy4Points (cp1,cp2,cp3,cp4)
Return the intersection point of two straight lines passing through cp1 and cp2 and passing
through cp3 and cp4, and assign the XYZ of the intersection point to the XYZ of cp0.
3.4.14 GetVPointByPlanePoint
1. Use format:
posA := GetVPointByPlanePoint (Pos,plane);
36
SPD-12-01-C
STEP Robot User Programming Manual
2. Parameters:
posA: CARTPOS/ROBOTCARTPOS // point of intersection of straight lines, required
Pos: CARTPOS/ROBOTCARTPOS //Point in space, required
plane: PLANE //Plane equation or XOY/YOZ/ZOX, required
3. Function description:
The GetVPointByPlanePoint instruction is used to obtain the XYZ of the projection point
of a point on the plane. If the point is on a Transfern plane, the XYZ of the point is directly
returned.
4. Writing examples:
cp0 := GetVPointByPlanePoint (cp1,plane1)
Return the projection point of cp1 to plane1, and assign the XYZ of the projection point to
the XYZ of cp0.
3.4.15 GetVPointByLinePoint
1. Use format:
posA := GetVPointByLinePoint (Pos,line);
2. Parameters:
posA: CARTPOS/ROBOTCARTPOS // point of intersection of straight lines, required
Pos: CARTPOS/ROBOTCARTPOS //Point in space, required
line: LINE //Line equation or XAxis/YAxis/ZAxis, required
37
SPD-12-01-C
STEP Robot User Programming Manual
3. Function description:
The GetVPointByLinePoint instruction is used to obtain the XYZ of the projection point of
a point on a straight line. If the point is on a Transfern straight line, the XYZ of the point is
directly returned.
4. Writing examples:
cp0 := GetVPointByLinePoint (cp1,line1)
Return the projection point of cp1 to line1, and assign the XYZ of the projection point to
the XYZ of cp0.
3.4.16 GetCenterByPoints
1. Use format:
posA := GetCenterByPoints (P1, P2, P3…P10);
2. Parameters:
posA: CARTPOS/ROBOTCARTPOS //Center of circle, required
P1: CARTPOS/ROBOTCARTPOS //Point 1 on the plane
…
P10: CARTPOS/ROBOTCARTPOS //point 10 on the plane
38
SPD-12-01-C
STEP Robot User Programming Manual
3. Function description:
The GetCenterByPoints instruction is used to obtain the center of the circle fitted by
multiple points on the plane and the position points on the plane. At least 3 and at most 10 are
required. If the error of the fitted circle exceeds 10mm, an error will be reported.
4. Writing examples:
cp0 := GetCenterByPoints (cp1,cp2,cp3,cp4)
Return the center of the circle fitted by cp1/cp2/cp3/cp4, and assign the XYZ of the
projection point to the XYZ of cp0.
3.4.17 GetOffsetPointByLine
1. Use format:
posA := GetOffsetPointByLine (Pos, line, offset);
2. Parameters:
posA: CARTPOS/ROBOTCARTPOS //Offset point, required
Pos: CARTPOS/ROBOTCARTPOS //Point in space, required
line: LINE //Line equation or XAxis/YAxis/ZAxis, required
offset:REAL//offset distance, required
39
SPD-12-01-C
STEP Robot User Programming Manual
3. Function description:
The GetOffsetPointByLine instruction is used to obtain the position of a point offset by an
offset distance on a straight line (along the direction of the straight line).
4. Writing examples:
cp0 := GetOffsetPointByLine (cp1,line1,real0)
Return the position of cp1 offset from real0 along the line line1, and assign its XYZ to the
XYZ of cp0.
3.4.18 GetLineBy2Points
1. Use format:
line := GetLineBy2Points (pos1,pos2);
2. Parameters:
line: LINE //Line equation, required
pos1: CARTPOS/ROBOTCARTPOS //Any point in space, required
pos2: CARTPOS/ROBOTCARTPOS //Any point in space, required
3. Function description:
The GetLineBy2Points instruction obtains a straight line passing through two Transfern
position points. If the two position points are the same, an error is reported. In addition, the
vector of the obtained line equation is a normalized data.
4. Writing examples:
Line0 := GetLineBy2Points (cp1, cp2)
Return the linear equation passing through cp1 and cp2 and assign it to Line0.
3.4.19 GetLineByPointLine
1. Use format:
line2 := GetLineByPointLine (Pos,line1);
2. Parameters:
40
SPD-12-01-C
STEP Robot User Programming Manual
Pos: CARTPOS/ROBOTCARTPOS //Any point in space, required
line1: LINE //Line equation of known straight line, required
line2: LINE //Returned line equation, required
3. Function description:
The GetLineByPointLine instruction obtains a straight line that passes through a Transfern
point and is parallel to a known straight line. In addition, the obtained vector of the straight line
equation is a normalized data.
4. Writing examples:
line2 := GetLineByPointLine (cp1, line1)
Return the equation of a straight line that passes through cp1 and is parallel to the line line1,
and assigns it to line2.
3.4.20 GetVLineByPointLine
1. Use format:
line2 :=GetVLineByPointLine (Pos,line1);
2. Parameters:
Pos: CARTPOS/ROBOTCARTPOS //Any point in space, required
line1: LINE //Line equation of known straight line, required
line2: LINE //Returned line equation, required
3. Function description:
The GetVLineByPointLine instruction obtains the equation of a straight line that passes
through a Transfern point and is perpendicular to a known straight line. If the point is on a
straight line, an error is reported. In addition, the obtained vector of the linear equation is a
normalized data.
4. Writing examples:
line2 := GetVLineByPointLine (cp1, line1)
Return the equation of a straight line passing through cp1 and perpendicular to the line
line1, and assign it to line2.
3.4.21 GetVLineByPointPlane
1. Use format:
line := GetVLineByPointPlane (Pos,plane);
41
SPD-12-01-C
STEP Robot User Programming Manual
2. Parameters:
line: LINE //Returned line equation, required
Pos: CARTPOS/ROBOTCARTPOS //Any point in space, required
plane: PLANE //Plane equation or XOY/YOZ/ZOX, required
3. Function description:
The GetVLineByPointPlane instruction obtains a straight line that passes through a
Transfern point and is perpendicular to a known plane. In addition, the obtained vector of the
straight line equation is a normalized data.
4. Writing examples:
line := GetVLineByPointPlane (cp1, plane)
Return the equation of a straight line passing through cp1 and perpendicular to the plane
plane, and assign it to line.
3.4.22 GetLineBy2Planes
1. Use format:
line := GetLineBy2Planes (plane1, plane2);
2. Parameters:
line: LINE //Returned line equation, required
plane1: PLANE //Plane equation or XOY/YOZ/ZOX, required
plane2: PLANE //Plane equation or XOY/YOZ/ZOX, required
3. Function description:
The GetLineBy2Planes instruction obtains the straight line equation of the intersection of
the two planes. If the two planes are parallel, an error is reported. In addition, the obtained
vector of the straight line equation is the normalized data.
4. Writing examples:
line0 := GetLineBy2Planes (plane1, plane2)
Return the line equation of the intersection of plane1 and plane2 and assign it to line0.
3.4.23 GetPlaneByPointLine
1. Use format:
plane:= GetPlaneByPointLine (Pos,line);
2. Parameters:
42
SPD-12-01-C
STEP Robot User Programming Manual
Pos: CARTPOS/ROBOTCARTPOS //Any point in space, required
line: LINE //Line equation of known straight line, required
plane: PLANE //The returned plane equation, required
3. Function description:
The GetPlaneByPointLine instruction obtains the plane equation of the plane determined
by the point and the line. If the point is on the line, an error will be reported. In addition, the
obtained vector of the plane equation is a normalized data.
4. Writing examples:
plane0:= GetPlaneByPointLine (cp0, line0)
Return the plane equation of the plane determined by the point cp0 and the line line0, and
assign it to plane0.
3.4.24 GetPlaneBy2Lines
1. Use format:
plane:= GetPlaneBy2Lines (line1,line2);
2. Parameters:
line1: LINE //Line equation of known straight line, required
line2: LINE //Line equation of known straight line, required
plane: PLANE //The returned plane equation, required
3. Function description:
The GetPlaneBy2Lines instruction obtains the plane equation of the plane passing through
the two straight lines. If the two straight lines are collinear, an error will be reported. If the two
straight lines are of different planes, the plane passing through the midpoint of the common
perpendicular and parallel to the two straight lines will be returned. In addition, the obtained
vector of the plane equation is a normalized data.
4. Writing examples:
plane0:= GetPlaneBy2Lines (line0, line1)
Return the plane equation of the plane determined by line0 and line1 and assign it to
plane0.
3.4.25 FittingPlaneByPoints
1. Use format:
43
SPD-12-01-C
STEP Robot User Programming Manual
plane:= FittingPlaneByPoints (P1, P2, P3…P10);
2. Parameters:
P1: CARTPOS/ROBOTCARTPOS //Point 1 on the plane
…
P10: CARTPOS/ROBOTCARTPOS //point 10 on the plane
plane: PLANE //The returned plane equation, required
Note: At least 3 locations need to be filled in.
3. Function description:
The FittingPlaneByPoints instruction obtains the plane equation of the plane fitted by
multiple points on the plane. If the fitting error is too large, that is, it exceeds 10mm, an error
will be reported. In addition, the obtained vector of the plane equation is a normalized data.
4. Writing examples:
plane0:= FittingPlaneByPoints (cp0, cp1,cp2,cp3)
Return the plane equation of the plane fitted by the four points cp0/cp1/cp2/cp3 and assign
it to plane0.
3.5 Program flow control instructions
3.5.1 IF ()THEN... END_IF
1. Use format:
IF(…)THEN
…
END_IF
2. Parameters:
None
3. Function description:
This instruction controls the program flow to enter a conditional branch.
4. Writing examples:
IF(bool1==0)THEN
PTP(ap1);
END_IF
PTP(ap2);
44
SPD-12-01-C
STEP Robot User Programming Manual
When bool1 is 0, the robot moves to ap1, otherwise it runs the PTP(ap2) instruction
directly.
3.5.2 IF() THEN …ELSE… END_IF
1. Use format:
IF(…)THEN
…
ELSE
…
END_IF
2. Parameters:
None
3. Function description:
This instruction controls the program flow to enter a conditional branch.
4. Writing examples:
IF(bool1==0)THEN
PTP(ap1);
ELSE
PTP(ap2);
END_IF
When bool1 is 0, the robot moves to ap1, otherwise the robot moves to ap2.
3.5.3 WHILE ()DO... END_WHILE
1. Use format:
WHILE(...)DO
…
END_WHILE
2. Parameters:
None
3. Function description:
This instruction is used to execute a sequence of instructions when the conditions are met.
4. Writing examples:
WHILE (bool0)DO
PTP(ap0);
45
SPD-12-01-C
STEP Robot User Programming Manual
PTP(ap1);
END_WHILE
When bool0 is TRUE, the robot executes two PTP instructions, otherwise it does not
execute them.
3.5.4 LOOP ()DO... END_LOOP
1. Use format:
LOOP(...)DO
…
END_LOOP
2. Parameters:
None
3. Function description:
This instruction is used to execute the instruction sequence a Transfern number of times.
4. Writing examples:
LOOP(int0)DO
PTP(ap0);
PTP(ap1);
END_LOOP
Execute two PTP instructions int0 times in a loop.
3.5.5 LP
1. Use format:
LP: variable
2. Parameters:
Any variable name
3. Function description:
This instruction is used to define the jump label point and is used in conjunction with the
GOTO instruction.
3.5.6 GOTO
1. Use format:
GOTO (variable);
2. Parameters:
46
SPD-12-01-C
STEP Robot User Programming Manual
Any variable name
3. Function description:
Used to jump to different parts of the program
4. Writing examples:
LP:int0
PTP(ap1);
PTP(ap2);
PTP(ap3);
GOTO (int0);
When running to the GOTO line, it jumps to the LP and continues to execute the
instruction sequence between LP and GOTO. The program will run 3 PTP instructions in a loop.
3.5.7 SWITCH...CASE
1. Use format:
SWITCH(uint)
CASE 1:
…
CASE 2:
…
CASE 3,4,5:
…
END_SWITCH
2. Parameters:
The parameter of SWITCH can only be unsigned integer, namely Uint type variable.
The parameters of the CASE instruction can only be non-negative integers or strings of
non-negative integers concatenated by commas.
3. Function description:
Select the instruction to be executed according to the data of unit, that is, select the CASE
branch to be executed according to the data of unit.
4. Writing examples:
SWITCH(uint0)
CASE 0:
PTP(ap0);
47
SPD-12-01-C
STEP Robot User Programming Manual
CASE 1:
PTP(ap1);
CASE 4:
PTP(ap2);
CASE 2,5,8:
PTP(ap3);
END_SWITCH
When unit0 is 0, the robot runs to ap0; when unit0 is 1, the robot runs to ap1; when unit0 is
4, the robot runs to ap2; when unit0 is 2 or 5 or 8, the robot runs to ap3 point.
3.5.8 ElSIF
1. Use format:
IF()
…
ELSIF()
…
ELSEIF()
…
ELSE
…
END_IF
2. How to use:
This instruction is used as a whole on the teach pendant, the number of ELSIF is not
limited, and the input character format in ELSIF is the same as that in IF.
3. Programming use cases:
IF(int0>100)THEN
PTP(ap1);
ELSEIF(int0>50)
PTP(ap2);
ELSE
PTP(ap3);
END_IF
48
SPD-12-01-C
STEP Robot User Programming Manual
When int0 is greater than 100, the robot runs to ap1; when 50<int0<=100, the robot runs to
ap2; otherwise, the robot runs to ap3.
3.5.9 ProgCall
1. Use format:
ProgCall(var)
2. Parameters:
var: label //The program name under the same project or the program name under the
global project
3. Function description:
Call the program under the same project (or global) as a subprogram.
4. Writing examples:
ProgCall(test);
ProgCall(_global.sr\test);
Call the program named test under the same project (or global) as a subroutine.
3.6 Input and output IO instructions
3.6.1 DIRead
1. Use format:
BOOLVAR=DIRead(di,CONT);
2. Parameters:
di: DI / /digital input signal port number;
CONT: enumeration//optional parameters
3. Function description:
This instruction is used to read the digital input from the external data port and return the
data to the left variable BOOLVAR. None the CONT parameter, DIRead will interrupt the
pre-reading, and read the data of the di port when the instruction is run, and assign it to
BOOLVAR;
If the CONT parameter is taken, the data of the di port will be directly read when the
instruction is read ahead, and the read ahead will continue, but the data will be assigned to the
left variable BOOLVAR when the instruction is run.
4. Writing examples:
49
SPD-12-01-C
STEP Robot User Programming Manual
PTP(ap0);
bool0:=DIRead(di0);
When the DIRead instruction is run, the data of di0 will be read and the data of the di0 port
will be assigned to bool0;
PTP(ap0);
bool0:=DIRead(di0,CONT);
In continuous mode, when running PTP, the data of di0 will be read, and when it reaches
the DIRead instruction, the data of di0 will be assigned to bool0;
3.6.2 DIWAIT
1. Use format:
BOOLVAR=DIWAIT(di,val,time,CONT);
2. Parameters:
BOOLVAR: BOOL
di: DI
val: BOOL
time: UINT (milliseconds) optional
CONT: enumerated type, optional
3. Function description:
This instruction is used to wait for the trigger signal and assign a data within the specified
waiting time, and the return data is bool type.
If there is no CONT parameter, it will start to judge whether the data of di is equal to the
data of val when the DIWAIT instruction is run. If they are equal, the left BOOLVAR will be
assigned the data TRUE. If not, the time will be waited. During this time Within, when the val
signal is reached, the left BOOLVAR is also assigned TRUE. If the val signal is not waited, the
left BOOLVAR is assigned FALSE and runs down. If the time parameter is not set, it will wait
until the val signal is reached.
If the CONT parameter is provided, it will be judged whether the data of di is equal to the
data of val during the pre-reading. If it is equal, the pre-reading will continue. When the
DIWAIT instruction is run, BOOLVAR will be assigned the data TRUE. If not, the pre-reading
will be interrupted. Read, and read the data of di when running to the DIWAIT instruction,
50
SPD-12-01-C
STEP Robot User Programming Manual
judge the data of di and the data of val, if they are equal, assign TRUE to the left BOOLVAR, if
not, wait for time, within this period of time if the val signal is reached, the left BOOLVAR is
also assigned TRUE. If the val signal is not waited, the left BOOLVAR is assigned FALSE and
runs down. If the time parameter is not set, it will wait until the val signal is reached.
4. Writing examples:
PTP(ap0);
bool0=DIWAIT(di0,val0,time0);
When running to the DIWAIT instruction, within time0, if the val signal is received from
the di0 digital input, set bool0 to true, if not, set bool0 to false after waiting for time0;
PTP(ap0);
bool0=DIWAIT(di0,val0);
When running to the DIWAIT instruction, judge the data of the digital input of di0 and the
data of val, if they are equal, set TRUE to bool0, if not, wait until the data of the digital input of
di0 is equal to val;
PTP(ap0);
bool0=DIWAIT(di0,val0,time0,CONT);
When running the PTP instruction, judge whether the data of di0 is equal to the data of
val0, if they are equal, continue to read ahead, set bool0 to TRUE when it runs to DIWAIT,
otherwise, when the program runs to DIWAIT, start the judgment again, at time0 Within time, if
the val signal is obtained from the di0 digital input terminal, set bool0 to true, if not, set bool0 to
false after waiting for time0;
PTP(ap0);
bool0=DIWAIT(di0,val0, NULL,CONT);
When running a PTP instruction, judge whether the data of di0 is equal to the data of val0,
if they are equal, continue to read ahead, set bool0 to TRUE when it runs to DIWAIT, if not,
wait until the program runs to the DIWAIT instruction, then proceed Judge, wait until the di0
digital input terminal gets the val signal;
3.6.3 DIWaitSimple
1. Use format:
DIWaitSimple(di,val);
51
SPD-12-01-C
STEP Robot User Programming Manual
2. Parameters:
di: DI
val: BOOL
3. Function description:
This instruction is used to wait for the signal. If it waits for the corresponding signal, it will
continue to execute. If it cannot wait, it will wait forever. But this instruction does not interrupt
the pre-reading, if the signal is triggered in advance, the beat can be improved.
4. Writing examples:
PTP(ap0);
DIWaitSimple(di0,val0);
PTP(ap1);
When running to the DIWaitSimple instruction, if the val signal is received from the di0
digital input, it will execute PTP(ap1), if not, it will wait forever;
Note: If you don't need the return data, it is recommended to use DIWaitSimple instead of
DIWait, the beat will be improved a lot.
3.6.4 DIWaitPath
1. Use format:
BOOLVAR=DIWaitPath(di,val,time);
2. Parameters:
BOOLVAR: BOOL
di: DI
val: BOOL
time: UINT (milliseconds) optional
3. Function description:
Start to judge di when the last motion instruction of DIWaitPath is running. If the data of di
is equal to val, continue the pre-reading of subsequent instructions, and set BOOLVAR to TRUE
when it reaches DIWaitPath. Otherwise, continue to judge. After the last motion instruction is
executed, continue to wait for time (if there is no time parameter, it will wait indefinitely). If the
data of di is equal to val, then BOOLVAR is equal to TRUE; otherwise, BOOLVAR is equal to
FALSE.
52
SPD-12-01-C
STEP Robot User Programming Manual
4. Writing examples:
PTP(ap0);
PTP(ap1);
bool0=DIWaitPath(di0,val0,time0);
PTP(ap2);
When you start to run the PTP(ap1) instruction, you start to read the data of di0 and
determine whether the data of di0 is equal to val0. If it is equal, then directly read ahead, and
wait until the DIWaitPath instruction is run to set bool0 to TRUE, if If they are not equal,
continue to judge until the PTP(ap1) instruction is executed. If the data of di0 is always different
from val0 during the process of running PTP(ap1), then judge when running DIWaitPath, judge
whether to wait until di0 is equal to val0 within time0. If it waits, set bool0 to TRUE and run it
down. If it can't wait, set bool0 to FALSE and run it down.
PTP(ap0);
PTP(ap1);
bool0=DIWaitPath(di0,val0);
PTP(ap2);
When starting to run the PTP(ap1) instruction, start to read the data of di0, and determine
whether the data of di0 is equal to val0, if it is equal, directly read ahead, and wait until the
DIWaitPath instruction is run, set bool0 to TRUE, if they are not equal, the judgment continues
until the PTP(ap1) instruction is finished. If the data of di0 is always different from val0 during
the process of running PTP(ap1), then the judgment will be made when running DIWaitPath
until the data of di0 is equal to the data of val0. Until the data is equal.
3.6.5 DIWaitSyncPath
1. Use format:
BOOLVAR=DIWaitPath(di,val,time,START,10);
2. Parameters:
BOOLVAR: BOOL
di: DI
val: BOOL
time: UINT (milliseconds) optional
53
SPD-12-01-C
STEP Robot User Programming Manual
Reference point: enumeration (START, END).
distance:
3. Function description:
Similar to the function of DIWaitPath, the difference is that DIWaitPath starts the DI
waiting judgment from the beginning of the upper path, and DIWaitSyncPath can control the DI
waiting to judge the path position; the reference point enumeration is selected as START, which
means that the judgment starts from the specified distance after the beginning of the upper path,
if the set distance is greater than the path length, the DI logic judgment will be started after the
path is executed. On the contrary, END means to start the judgment from the specified distance
before the end point of the upper path. If the set distance is greater than the length of the path,
the DI logic judgment will start synchronously when the path is executed.
4. Writing examples:
PTP(ap0);
Lin(ap1);
bool0=DIWaitSyncPath(di0,val0,time0,START,10);
PTP(ap2);
Start to run the Lin (ap1) instruction. When the path reaches 10mm, start to read the data of
di0 and determine whether the data of di0 is equal to val0. If it is equal, read ahead directly, and
wait until the DIWaitSyncPath instruction is run to set bool0 If it is not equal, the judgment will
continue until the Lin (ap1) instruction is finished. If the data of di0 is always different from
val0 during the process of running PTP(ap1), then the judgment will be made when DIWaitPath
is running, and judge whether to wait until di0 and val0 are equal within time0, if so, directly set
bool0 to TRUE and run down, if not, directly set bool0 to FALSE and run down.
3.6.6 DOSet
1. Use format:
DOSet(do,val,CONT);
2. Parameters:
do: DO
val: BOOL
CONT: enumeration, optional parameters
54
SPD-12-01-C
STEP Robot User Programming Manual
3. Function description:
This instruction is used to set the data of the external DO port;
None the CONT parameter, the DO port will be set when the instruction is run, but the
pre-reading of the instruction will not be interrupted;
If the CONT parameter is provided, the data of the DO port will be directly set during the
pre-reading, that is, the DO may be output directly before the instruction is executed;
4. Writing examples:
PTP(ap0);
DOSet(do0,val0);
When running to the DOSet instruction, output val0 to do0;
PTP(ap0);
DOSet(do0,val0,CONT);
In continuous mode, val0 will be output directly to do0 when running PTP;
3.6.7 AIRead
1. Use format:
int:= AIRead(ai,CONT);
2. Parameters:
int: INT type variable
ai: AI port number
CONT: enumerated type, optional parameters
3. Function description:
Read the analog data of the corresponding port from the designated port and assign it to the
left data.
Without the CONT parameter, the pre-reading will be interrupted, and the data of the
corresponding analog port will be read when the AIRead instruction is running, and the data will
be assigned to the left variable int;
If the CONT parameter is included, the data of the corresponding analog port will be read
when the AIRead instruction is pre-read, and the pre-reading will continue. When the instruction
is reached, the data will be assigned to the left variable int;
4. Writing examples:
55
SPD-12-01-C
STEP Robot User Programming Manual
PTP(ap0);
int0:=AIRead(ai0);
When running to the AIRead instruction, read the data of the ai0 port and assign the data to
int0;
PTP(ap0);
int0:=AIRead(ai0,CONT);
In continuous mode, the data of ai0 will be read directly when running PTP, and then the
data will be assigned to int0 when running to the AIRead instruction;
3.6.8 AIWaitGreater
1. Use format:
bool:= AIWaitGreater (ai, val, time,CONT);
2. Parameters:
bool: BOOL
ai: AI
val: INT
time: UINT (milliseconds) optional
CONT: enumerated type, optional parameters
3. Function description:
Monitor the analog quantity of the designated port until the data of the port is greater than
or equal to the set val data;
If there is no CONT parameter, the AIWaitGreater instruction will start to read the data of
ai and determine whether the data of ai is greater than or equal to val within the time period. If
the condition is met, the data of bool is assigned TRUE, otherwise the data of FALSE is
assigned ;
If the CONT parameter is taken, it will directly judge whether the data of ai is greater than
or equal to the data of val during pre-reading. If the condition is met, it will directly pre-read
down and assign bool to TRUE when it runs to AIWaitGreater, otherwise it runs to the
AIWaitGreater instruction Then, judge whether the data of ai is greater than or equal to val
within the time period. If the condition is met, assign a data of TRUE to bool, otherwise assign a
data of FALSE;
56
SPD-12-01-C
STEP Robot User Programming Manual
4. Writing examples:
PTP(ap0);
bool0:= AIWaitGreater (ai0, val0, time0);
When running to the AIWaitGreater instruction, within time0, judge whether the data of ai0
is greater than or equal to the data of val0. If the condition is met, assign TRUE to bool0 and run
directly, otherwise, after waiting for time0, assign FALSE to bool0, and then Run down
PTP(ap0);
bool0:= AIWaitGreater (ai0, val0);
When running to the AIWaitGreater instruction, start to judge whether the data of ai0 is
greater than or equal to the data of val0, if the condition is met, assign TRUE to bool0, and run
down, if not, wait until it is met;
PTP(ap0);
bool0:= AIWaitGreater (ai0, val0, time0,CONT);
In continuous mode, when running PTP, it will directly read the data of ai0 and determine
whether ai0 is greater than or equal to val0. If the condition is met, continue to read ahead, wait
until AIWaitGreater is running, and assign bool0 the data true. If it is not met, wait When the
program runs to the AIWaitGreater instruction, judge whether the data of ai0 is greater than or
equal to the data of val0 within time0. If the condition is met, assign a data of TRUE to bool0
and run directly, otherwise wait for time0 and Transfer bool0 Assign the data FALSE, and then
run down;
PTP(ap0);
bool0:= AIWaitGreater (ai0, val0, NULL,CONT);
In continuous mode, when running PTP, it will directly read the data of ai0 and determine
whether ai0 is greater than or equal to val0. If the condition is met, continue to read ahead, wait
until AIWaitGreater is running, and assign bool0 the data true. If it is not met, wait The program
will judge when it reaches the AIWaitGreater instruction and wait until the condition is met;
3.6.9 AIWaitLess
1. Use format:
bool:= AIWaitLess (ai, val, time,CONT);
2. Parameters:
57
SPD-12-01-C
STEP Robot User Programming Manual
bool: BOOL
ai: AI
val: INT
time: UINT (milliseconds) optional
CONT: enumerated type, optional parameters
3. Function description:
Monitor the analog quantity of the designated port until the data of the port is less than or
equal to the set val data;
If there is no CONT parameter, it will start to read the data of ai when it runs to the
AIWaitLess instruction, and judge whether the data of ai is less than or equal to val within the
time period. If the condition is met, assign a data of TRUE to bool, otherwise assign a data of
FALSE ;
If the CONT parameter is taken, it will directly judge whether the data of ai is less than or
equal to the data of val during pre-reading. If the condition is met, continue to pre-read, and
assign TRUE to bool when the instruction is run, otherwise run to the AIWaitLess instruction
Then, judge whether the data of ai is less than or equal to val within time. If the condition is met,
assign TRUE to bool, otherwise assign FALSE;
4. Writing examples:
PTP(ap0);
bool0:= AIWaitLess (ai0, val0, time0);
When running to the AIWaitLess instruction, within time0, judge whether the data of ai0 is
less than or equal to the data of val0. If the condition is met, assign TRUE to bool0 and run
directly, otherwise, after waiting for time0, assign FALSE to bool0, and then Run down
PTP(ap0);
bool0:= AIWaitLess (ai0, val0);
When running to the AIWaitLess instruction, start to judge whether the data of ai0 is less
than or equal to the data of val0, if the condition is met, assign TRUE to bool0, and run down, if
not, wait until it is met;
PTP(ap0);
bool0:= AIWaitLess (ai0, val0, time0,CONT);
58
SPD-12-01-C
STEP Robot User Programming Manual
In continuous mode, when running PTP, it will directly read the data of ai0 and determine
whether ai0 is less than or equal to val0. If the condition is met, continue to read ahead, and
assign true to bool0 when running to the AIWaitLess instruction. If it is not met, Then wait for
the program to run to the AIWaitLess instruction before judging to determine whether the data
of ai0 is less than or equal to the data of val0 within time0. If the condition is met, assign a data
of TRUE to bool0 and run directly, otherwise, after waiting for time0, Assign FALSE to bool0,
and then run down;
PTP(ap0);
bool0:= AIWaitLess (ai0, val0, NULL,CONT);
In continuous mode, when running PTP, it will directly read the data of ai0 and determine
whether ai0 is less than or equal to val0. If the condition is met, continue to read ahead, and wait
until the AIWaitLess instruction is executed to assign the data of true to bool0, if not satisfied ,
Wait for the program to run to the AIWaitLess instruction before making judgments, and wait
until the conditions are met;
3.6.10 AOSet
1. Use format:
AOSet(ao,int,CONT);
2. Parameters:
ao: AO
int: INT
CONT: enumerated type, optional parameters
3. Function description:
Set the data for the ao port, that is, set the data of the ao corresponding port to int.
If there is no CONT parameter, when the instruction is run, the data of the port
corresponding to ao is set to int, but the pre-reading of the program instruction is not
interrupted;
If with CONT, directly set the data of the corresponding port of ao to int during
pre-reading;
4. Writing examples:
PTP(ap0);
59
SPD-12-01-C
STEP Robot User Programming Manual
AOSet (ao0,int0);
When running to the AOSet instruction, set the data of the ao0 port to int0;
PTP(ap0);
AOSet (ao0,int0,CONT);
In continuous mode, the data of the ao0 port will be set to int0 when the PTP instruction is
exercised;
3.6.11 AOSyncOn
1. Use format:
AOSyncOn(ao,vel0,vel1,int0,int1);
2. Parameters:
ao: AO
vel0: REAL
vel1: REAL
int0: INT
int1: INT
3. Function description:
The data of ao changes with the running speed of the robot, that is, the data of ao has a
linear relationship with the current speed of the robot. (vel0, int0) and (vel1, int1) are the two
corresponding points on the linear relationship. That is to say ao0=(int1-int0)/(vel1-vel0)*v,
where v is the current moving speed of the robot end.
4. Writing examples:
AOSyncOn (ao0,vel0,vel1,int0,int1);
PTP(ap0);
PTP(ap1);
During PTP operation, the data of ao0 will change linearly with the speed of the robot. The
linear relationship is determined by two points (vel0, int0) and (vel1,int1), namely
ao0=(int1-int0)/(vel1-vel0) )*v, where v is the current moving speed of the robot end.
3.6.12 AOSyncOff
1. Use format:
AOSyncOff(ao);
60
SPD-12-01-C
STEP Robot User Programming Manual
2. Parameters:
ao: AO
3. Function description:
Turn off the linear relationship between ao and speed and use it in conjunction with
AOSyncOn.
4. Writing examples:
AOSyncOn (ao0,vel0,vel1,int0,int1);
PTP(ap0);
PTP(ap1);
AOSyncOff(ao0);
PTP(ap2);
During running PTP(ap0) and PTP(ap1), the data of ao0 will change with the current speed
of the robot, but during running PTP(ap2), the data of ao0 has nothing to do with the speed of
the robot.
3.6.13 GDIRead
1. Use format:
uint:= GDIRead(gdi,CONT);
2. Parameters:
uint: UINT
gdi: GDI // port group
CONT: enumerated type, optional parameters
3. Function description:
Read the corresponding digital data from the specified port group, and combine the datas
of these ports and assign them to the left data. For example, gdi sets ports 3-7, that is, reads
the di datas
of ports 3, 4, 5, 6, and 7, and port 7 is the highest bit; then, if ports 3, 6, and 7
are 1, the others are 0, then the left data at this time is 25=24+23+0+0+1 and the binary
representation is 11001.
The port
number
Correspon
ding data
61
7
6
5
4
3
1
1
0
0
1
.
SPD-12-01-C
STEP Robot User Programming Manual
The port number of group IO needs to be continuous, but the number can be changed, from
2 to 16; the corresponding data range is 0 to 3; 0 to 65535.
If there is no CONT parameter, the data of gdi will be read when the instruction is run, and
the read data will be assigned to the left variable; if there is a CONT parameter, the data of gdi
will be read during pre-reading, and the Assign to the left variable when running to the
instruction.
4. Writing examples:
PTP(ap0);
uint0:= GDIRead(gdi0); //The port number of gdi0 is 1-3
When running to the GDIRead instruction, if the read port numbers 1 and 2 are true and
port 3 is false, the data of uint0 is 3;
PTP(ap0);
uint0:= GDIRead(gdi0,CONT); //The port number of gdi0 is 1-3
In continuous mode, when the PTP instruction is in motion, the datas
of port numbers
1-3 are read. If the port numbers 1 and 2 are true and port 3 is false, the data of unit0 is set to
when the GDIRead instruction is run. 3;
3.6.14 GDOSet
1. Use format:
GDOSet(gdo,uint,CONT);
2. Parameters:
gdo: GDO // port group
uint: UINT
CONT: enumerated type, optional parameters
3. Function description:
Set the specified data to a port group. For example, gdo sets ports 3-7, the second
parameter data is 6, and the corresponding binary is 00110. Then set port 3 to 0; port 4 to 1, port
5 to 1; port 6, 7 to 0.
The port
number
Correspondi
ng data
62
7
6
5
4
3
0
0
1
1
0
.
SPD-12-01-C
STEP Robot User Programming Manual
If there is no CONT parameter, the port number in GDO will be set when the GDOSet
instruction is run;
If the CONT parameter is provided, the port number in GDO will be set when the GDOSet
instruction is pre-read;
4. Writing examples:
PTP(ap0);
GDOSet (gdo0,uint0); //gdo0 port number is 1-3, unit0 is 3
When running to the GDOSet instruction, set DO port numbers 1 and 2 to true, and port 3
to false;
PTP(ap0);
GDOSet (gdo0,uint0,CONT); //gdo0 port number is 1-3, unit0 is 3
In continuous mode, when moving PTP instructions, set DO1 and DO2 to TRUE, and DO3
to FALSE;
3.6.15 DOPulse
1. Use format:
DOPulse(do,bool,pulsetime,CONT);
2. Parameters:
do: DO
bool: BOOL
pulsetime: INT
CONT: enumerated type, optional parameters
3. Function description:
Output a pulse lasting pulsetime to do, and the data of the pulse signal is determined by the
bool parameter. If bool is true, output a high-level pulse with a duration of pulsetime to do; if it
is false, output a low-level pulse with a duration of pulsetime to do.
If there is no CONT parameter, DO will be output only when the DOPulse instruction is
run;
If the CONT parameter is included, it will output a pulse to DO when pre-reading the
DOPulse instruction;
4. Writing examples:
63
SPD-12-01-C
STEP Robot User Programming Manual
PTP(ap0);
DOPulse (do0,bool0,time0); //bool0 is TRUE, time0 is 1000
When running to the DOPulse instruction, output a high-level pulse to do0, and the
high-level duration is 1s;
PTP(ap0);
DOPulse (do0,bool0,time0,CONT); //bool0 is TRUE, time0 is 1000
In continuous mode, when the PTP instruction is exercised, a high-level pulse is output to
do0, and the high-level duration is 1s;
3.6.16 DOSetSyncTime
1. Use format:
DOSetSyncTime(do, boolval, start/end, offsettime);
2. Parameters:
do: DO
boolvar: BOOL
start/end:
enumerated type
offsettime: INT
3. Function description:
Output DO synchronously with the previous motion instruction, and output boolval to do at
the time of offset time from the start/end point. If the start mode is selected, the offsettime set
time is greater than 0 hours, and do is output at the start of operation. When the offsettime set
time is longer than the running time of the above motion instruction, do is output at the end of
the motion instruction; if the end mode is selected, offsettime is set If the data of is too small, it
will output at the beginning of the run when it exceeds the starting point. When the offset time is
greater than 0, it will output do at the end of the previous motion instruction.
Note: In single-step mode, if there is a motion instruction before the instruction, do will be
output directly when the instruction is run.
4. Writing examples:
PTP(ap0);
PTP(ap1);
DOSetSyncTime(do0, bool0, start, time0);//bool0 is TRUE, time0 is 1000
64
SPD-12-01-C
STEP Robot User Programming Manual
When running in continuous mode, set the data of do0 to TRUE after PTP(ap1) runs for 1s;
PTP(ap0);
PTP(ap1);
DOSetSyncTime(do0, bool0, end, time0);//bool0 is TRUE, time0 is -1000
When running in continuous mode, set the data of do0 to TRUE one second before the end
of the PTP(ap1) instruction;
3.6.17 DOSetSyncPath
1. Use format:
DOSetSyncPath(do, boolval, start/end, length,A1/X);
2. Parameters:
do: DO
boolvar: BOOL
start/end:
enumerated type
length: REAL
A1/X: Enumeration type
3. Function description:
Output DO synchronously with the previous motion instruction, and output boolval to do
when the distance from the start/end point is length. If the start mode is selected, when the path
length set by lenght is less than 0, do is output when the last motion instruction starts to run.
When the length set by lenght is longer than the trajectory of the last motion instruction, do is
output at the end of the motion instruction; if the end mode is selected , The setting of lenght is
too small, which leads to exceeding the starting point of the motion instruction, and do is output
at the beginning of the operation. When the setting of lenght is greater than 0, do is output at the
end of the previous motion instruction.
The meaning of START/END and length data is related to the last reference parameter. The
last parameter is NULL to indicate the entire path. If the last parameter is set to a certain axis,
the reference information will be converted to a specific axis.
Note: In single-step mode, if there is a motion instruction before the instruction, do will be
output directly when the instruction is run. And when the previous motion instruction is PTP, the
unit of length is degree, which is calculated according to the longest axis that runs. When the
65
SPD-12-01-C
STEP Robot User Programming Manual
previous motion instruction is LIN or CIRC, the unit of length is mm, which is calculated
according to the movement distance of the TCP end.
4. Writing examples:
PTP(ap0); //ap0=0,0,0,0,0,0
PTP(ap1); //ap1=100,20,10,0,0,0
DOSetSyncPath(do0, bool0, start, lenght0);//bool0 is TRUE, lenght0 is 10°
When running in continuous mode, the data of do0 is set to TRUE after one axis of the
robot runs for 10°;
PTP(ap0); //ap0=0,0,0,0,0,0
PTP(ap1); //ap1=100,20,10,0,0,0
DOSetSyncPath(do0, bool0, end, lenght0);//bool0 is TRUE, lenght0 is -10°
When running in continuous mode, the data of do0 is set to TRUE when the 1 axis of the
robot runs to 90 degrees;
3.6.18 DOPulseSyncTime
1. Use format:
DOPulseSyncTime(do, boolval, pulsetime, start/end, offsettime);
2. Parameters:
do: DO
boolvar: BOOL
pulsetime: INT
start/end:
enumerated type
offsettime: INT
3. Function description:
The pulse is output synchronously with the previous motion instruction. At the time of
offsettime from the start/end point, a pulse with a width of pulsetime and a data of boolval is
output to do. If the start mode is selected, the offsettime set time is greater than 0 hours, and the
pulse will be output at the beginning of the run. When the offsettime set time is longer than the
run time of the previous motion instruction, the pulse will be output at the end of the motion
instruction; if the end mode is selected, the offsettime set If the data of is too small, the pulse
will be output at the start of running when it exceeds the starting point. When the offset time is
66
SPD-12-01-C
STEP Robot User Programming Manual
set to greater than 0, the pulse will be output at the end of the previous motion instruction.
Note: In single-step mode, if there is a motion instruction before the instruction, do will be
output directly when the instruction is run.
4. Writing examples:
PTP(ap0);
PTP(ap1);
DOPulseSyncTime (do0, bool0,pulsetime0, start, time0);
//bool0 is TRUE, pulsetime0 is 500, time0 is 1000
When running in continuous mode, after PTP(ap1) runs for 1s, output a high-level pulse
with a width of 500ms to do0;
PTP(ap0);
PTP(ap1);
DOPulseSyncTime (do0, bool0, pulsetime0, end, time0);
//bool0 is TRUE, pulsetime0 is 500, time0 is -1000
When running in continuous mode, 1 second before the end of the PTP(ap1) instruction,
output a high-level pulse with a width of 500ms to do0;
3.6.19 DOPulseSyncPath
1. Use format:
DOPulseSyncPath (do, boolvar, pulsetime, start/end, length);
2. Parameters:
do: DO
boolvar: BOOL
pulsetime: INT
start/end:
enumerated type
length: REAL
3. Function description:
The pulse is output synchronously with the previous motion instruction. When the distance
is length from the start/end point, a pulse with a width of pulsetime and a data of boolval will be
output to do. If the start mode is selected, when the path length set by lenght is less than 0, the
pulse will be output at the beginning of the last motion instruction. When the length set by
67
SPD-12-01-C
STEP Robot User Programming Manual
lenght is longer than the track of the last motion instruction, the pulse will be output at the end
of the motion instruction; if the end mode is selected , The setting of lenght is too small, which
will exceed the starting point of the operation, and the pulse will be output at the beginning of
the operation. When the setting of lenght is greater than 0, the pulse will be output at the end of
the previous motion instruction.
Note: In single-step mode, if there is a motion instruction before the instruction, do will be
output directly when the instruction is run. And when the previous motion instruction is PTP, the
unit of length is degree, which is calculated according to the longest axis that runs. When the
previous motion instruction is LIN or CIRC, the unit of length is mm, which is calculated
according to the movement distance of the TCP end.
4. Writing examples:
PTP(ap0); //ap0=0,0,0,0,0,0
PTP(ap1); //ap1=100,20,10,0,0,0
DOPulseSyncPath(do0, bool0, pulsetime0,start, lenght0);
//bool0 is TRUE, pulsetime0 is 800, and lenght0 is 10°
When running in continuous mode, after one axis of the robot runs for 10°, it outputs a
high-level pulse with a width of 800ms;
PTP(ap0); //ap0=0,0,0,0,0,0
PTP(ap1); //ap1=100,20,10,0,0,0
DOPulseSyncPath (do0, bool0, pulsetime0,end, lenght0);
//bool0 is TRUE, pulsetime0 is 800, and lenght0 is -10°
When running in continuous mode, when one axis of the robot runs to 90 degrees, it
outputs a high-level pulse with a width of 800ms;
3.6.20 BOOLEXTRead
1. Use format:
BOOLVAR= BOOLEXTRead(ext);
2. Parameters:
ext: BOOLEXT // structure, including the port number and data of the digital input signal;
3. Function description:
68
SPD-12-01-C
STEP Robot User Programming Manual
This instruction is used to read the variables that have been defined in the PLC, and the
return data is bool type;
4. Writing examples:
bool0 = BOOLEXTRead(ext0);
Assign the data in the external data structure ext0 to the variable bool0.
3.6.21 BOOLEXTSet
1. Use format:
BOOLEXTSet(ext, val);
2. Parameters:
ext: BOOLEXT // structure, including digital input signal port number and data
val: BOOL
3. Function description:
The instruction is set in the variable that has been defined in the PLC.
4. Writing examples:
BOOLEXTSet(ext0, val0);
Assign the data of val0 to the external data structure ext0.
3.6.22 DINTEXTRead
1. Use format:
DINTVAR = DINTEXTRead(ext);
2. Parameters:
ext: BOOLEXT // structure, including digital input signal port number and data
3. Function description:
This instruction is used to read the defined variable from the PLC, and the return data is
DINT type.
4. Writing examples:
int0=DINTEXTRead(ext0);
Assign the data in ext0 to the variable int0.
3.6.23 DINTEXTSet
1. Use format
DINTEXTSet(ext, val);
69
SPD-12-01-C
STEP Robot User Programming Manual
2. Parameters:
ext: BOOLEXT //Structure, including digital input signal port number and data
val: DINT(LINT)
3. Function description:
This instruction sets the data of a variable that has been defined in the PLC.
4. Writing examples:
DINTEXTSet(ext0, val0);
Assign the data of val0 to ext0.
3.6.24 REALEXTRead
1. Use format:
REALVAR = REALEXTRead(ext);
2. Parameters:
ext: BOOLEXT // structure, including the port number and data of the digital input signal;
3. Function description:
This instruction is used to read the variables that have been defined in the PLC, and the
return data is REAL type;
4. Writing examples:
real0 = REALEXTRead(ext0);
Assign the data read from ext0 to real0.
3.6.25 REALEXTSet
1. Use format:
REALEXTSet(ext, val);
2. Parameters:
ext: BOOLEXT // structure, including digital input signal port number and data
val: REAL
3. Function description:
This instruction sets the data of the variable that has been defined in the PLC.
4. Writing examples:
REALEXTSet(ext0, val0);
Assign the data of val0 to ext0.
70
SPD-12-01-C
STEP Robot User Programming Manual
3.6.26 DWORDEXTRead
1. Use format:
DWORDVAR = DWORDEXTRead(ext);
2. Parameters:
ext: BOOLEXT // structure, including the port number and data of the digital input signal;
3. Function description:
This instruction is used to read the variables that have been defined in the PLC, and the
return data type is DWORD.
4. Writing examples:
int0 = DWORDEXTRead(ext0);
Read the data of ext0 and assign it to the variable int0.
3.6.27 DWORDEXTSet
1. Use format:
DWORDEXTSet(ext, val);
2. Parameters:
ext: BOOLEXT // structure, including digital input signal port number and data
val: DWORD (ULINT)
3. Function description:
This instruction is used to set variables that have been defined in the PLC.
4. Writing examples:
DWORDEXTSet(ext0, val0);
Assign the data of the variable val0 to ext0.
3.6.28 AXISPOSEXTSet
1. Use format:
AXISPOSEXTSet(port, axispos);
2. Parameters:
port: enumerated type, 0-31 //port number
axispos:AXISPOS //Joint position point
3. Function description:
71
SPD-12-01-C
STEP Robot User Programming Manual
This instruction is used in conjunction with Step_Robot_GetAxisPosFromHMI in codesys
to read the joint position points of the teach pendant to codesys.
4. Writing examples:
AXISPOSEXTSet(1,ap0);
Transfer the position data of ap0 to the codesys end through port 1.
3.6.29 CARTPOSEXTSet
1. Use format:
CARTPOSEXTSet(port, cartpos);
2. Parameters:
port: enumerated type, 0-127 //port number
cartpos: CARTPOS //Cartesian position point
3. Function description:
This instruction is used in conjunction with Step_Robot_GetCartPosFromHMI in codesys
to read the Cartesian position point of the teach pendant to codesys.
4. Writing examples:
CARTPOSEXTSet (2,cp0);
Transfer the position data of cp0 to the codesys end through port 2.
3.6.30 ROBOTAXISPOSEXTSet
1. Use format:
ROBOTAXISPOSEXTSet(port, robotaxispos);
2. Parameters:
port: enumerated type, 0-31 //port number
robotaxispos: ROBOTAXISPOS //Robot joint position
3. Function description:
This instruction works with Step_Robot_GetRobotAxisPosFromHMI in codesys. It is used
to read the robot position on the teach pendant into codesys.
4. Writing examples:
ROBOTAXISPOSEXTSet(3,rap1);
Transfer the position data of rap1 to the codesys terminal through port 3.
72
SPD-12-01-C
STEP Robot User Programming Manual
3.6.31 ROBOTCARTPOSEXTSet
1. Use format:
ROBOTCARTPOSEXTSet(port, robotcartpos);
2. Parameters:
port: enumerated type, 0-127 //port number
robotcartpos: ROBOTCARTPOS //Robot Cartesian position point
3. Function description:
This instruction works with Step_Robot_GetRobotCartPosFromHMI in codesys. It is used
to read the Cartesian position of the robot on the teach pendant into codesys.
4. Writing examples:
ROBOTCARTPOSEXTSet(4,rcp1);
Transfer the position data of rcp1 to the codesys terminal through port 4.
3.6.32 AXISPOSEXTRead
1. Use format:
axispos:=AXISPOSEXTRead (port);
2. Parameters:
axispos:AXISPOS //Joint position point
port: enumerated type, 0-31 //port number
3. Function description:
This instruction works with Step_Robot_SetAxisPos in codesys. It is used to read the joint
position point of the codesys side to the position variable of the teach pendant.
4. Writing examples:
ap0:=AXISPOSEXTRead (1);
Transfer the joint position of port 1 in codesys to the teach pendant variable ap0.
3.6.33 CARTPOSEXTRead
1. Use format:
cartpos:=CARTPOSEXTRead (port);
2. Parameters:
port: enumerated type, 0-127 //port number
cartpos: CARTPOS //Cartesian position point
73
SPD-12-01-C
STEP Robot User Programming Manual
3. Function description:
This instruction works with Step_Robot_SetCartPos in codesys. It is used to transfer the
Cartesian position point in codesys to the position variable on the teach pendant.
4. Writing examples:
cp0:=CARTPOSEXTRead (2);
Transfer the cartesian position of port 2 in codesys to the cp0 variable on the teach pendant.
3.6.34 ROBOTAXISPOSEXTRead
1. Use format:
robotaxispos:=ROBOTAXISPOSEXTRead (port);
2. Parameters:
port: enumerated type, 0-31 //port number
robotaxispos: ROBOTAXISPOS //Robot joint position
3. Function description:
This instruction works with Step_Robot_SetRobotAxisPos in codesys. It is used to read the
robot joint position of the codesys side to the position variable of the teach pendant.
4. Writing examples:
rap1: =ROBOTAXISPOSEXTRead (3);
Transfer the robot joint position of port 3 in codesys to the teach pendant variable rap1.
3.6.35 ROBOTCARTPOSEXTRead
1. Use format:
robotcartpos:=ROBOTCARTPOSEXTRead (port);
2. Parameters:
port: enumerated type, 0-127 //port number
robotcartpos: ROBOTCARTPOS //Robot Cartesian position point
3. Function description:
This instruction works with Step_Robot_SetRobotCartPos in codesys. It is used to transfer
the robot cartesian position point in codesys to the position variable on the teach pendant.
4. Writing examples:
rcp1: =ROBOTCARTPOSEXTRead (4);
74
SPD-12-01-C
STEP Robot User Programming Manual
Transfer the robot Cartesian position of port 4 in codesys to the teach pendant position
variable rcp1.
3.7 Clock instruction
3.7.1 ClkStart
1. Use format:
ClkStart(clock);
2. Parameters:
Clock: clock variable, no data
3. Function description:
ClkStart is used to start a timer.
4. Writing an example:
First define a Clock type variable ck1. Ck1 is essentially a basic type of variable whose
data will not be used.
ClkStart(ck1);
The timing will be started when running to the ClkStart(ck1) instruction.
3.7.2 ClkStop
1. Use format:
ClkStop (clock);
2. Parameters:
clock: clock variable, no data
3. Function description:
ClkStop is used to stop the timer.
4. Writing an example:
First define a Clock type variable ck1. Ck1 is essentially a basic type of variable whose
data will not be used.
ClkStart(ck1);
...
ClkStop(ck1);
The timing will stop when running to the ClkStop instruction.
75
SPD-12-01-C
STEP Robot User Programming Manual
3.7.3 ClkReset
1. Use format:
ClkReset (clock);
2. Parameters:
clock: clock variable, no data
3. Function description:
ClkReset is used to reset a timer, that is, set the data of the timer to 0.
4. Writing an example:
First define a Clock type variable ck1. Ck1 is essentially a basic type of variable whose
data will not be used.
ClkStart(ck1);
...
ClkStop(ck1);
ClkReset(ck1);
Ck1 will be reset when running to the ClkReset instruction.
3.7.4 ClkRead
1. Use format:
luint:=ClkRead (clock);
2. Parameters:
clock: clock variable, no data
3. Function description:
ClkRead is used to read all the time intervals counted by the clock variable, which can be
one segment or multiple segments.
4. Writing an example:
First define a Clock type variable ck1. Ck1 is essentially a basic type of variable whose
data will not be used.
ClkStart(ck1);
...
ClkStop(ck1);
ulint0:=ClkRead(ck1);
76
SPD-12-01-C
STEP Robot User Programming Manual
When running to the ClkRead instruction, ulint0 records the time interval between ClkStart
and ClkStop.
3.8 Interrupt instruction
3.8.1 Connect
1. Use format:
Connect(intnum0,program1);
2. Parameters:
intnum0: INTNUM (interrupt type variable)
program1: program name;
3. Function description:
Used to connect the interrupt variable and the interrupt program.
4. Writing examples:
Connect(Intnum0,programName);
ISignal(move_open,1,Intnum0);
Establish the mapping relationship between the interrupt variable Intnum0 and the program
programName.
3.8.2 ISignal
1. Use format:
ISignal(move_open,1,Intnum0);
2. Parameters:
move_open: DI //input signal to be monitored
TRUE(FALSE): bool type//used to determine whether it is a rising edge (TRUE means
monitoring rising edge, FALSE monitoring falling edge)
Intnum0: INTNUM (interrupt type variable)//used to find the associated interrupt program
Type: Enumeration (single, cycle, safe) //This parameter is optional, if not selected, the
cycle interrupt type is used by default.
3. Function description:
Bind interrupt variables and DI signals (digital input signals).
4. Writing examples:
Connect(Intnum0,programName);
77
SPD-12-01-C
STEP Robot User Programming Manual
ISignal(move_open,1,Intnum0);
Establish the mapping relationship between the interrupt variable Intnum0 and the program
programName. When the move_open signal becomes a rising edge, the interrupt program
programName is executed.
3.8.3 StorePath
1. Use format:
StorePath();
2. Parameters:
None
3. Function description:
Store the internal path information of the robot before the interruption.
4. Writing examples:
StorePath();//Store the current internal information of the robot (tool, coordinate system)
GetCurrentRobotPos(pos,tool,ref);//Get the end position of the robot;
3.8.4 RestorePath
1. Use format:
RestorePath();
2. Parameters:
None
3. Function description:
Restore the path information stored in StorePath, and it is not allowed to be used alone.
4. Writing examples:
StorePath();//Store the current internal information of the robot (tool, coordinate system)
GetCurrentRobotPos(pos,tool,ref);//Get the end position of the robot;
3.8.5 IDelete
1. Use format:
IDelete(intnum);
2. Parameters:
intnum: INTNUM (interrupt variable name)
3. Function description:
78
SPD-12-01-C
STEP Robot User Programming Manual
After IDelete is executed, the corresponding interrupt in the parameter will no longer
respond. If the deleted interrupt is already in the pending execution queue, it will not be
deleted synchronously.
4. Writing examples:
IDelete(intnum);
3.8.6 ISleep
1. Use format:
ISleep(intnum);
2. Parameters:
intnum: INTNUM (interrupt variable name)
3. Function description:
After ISleep is executed, the corresponding interrupt in the parameter will not respond
again until the IWatch instruction releases the dormancy. Interrupts that are already in the queue
to be executed are not affected by ISleep. ISleep will not delete existing interrupts.
4. Writing examples:
ISleep(intnum);
...
IWatch(intnum);
3.8.7 IWatch
1. Use format:
IWatch(intnum);
2. Parameters:
intnum: INTNUM (interrupt variable name)
3. Function description:
After IWatch is executed, the corresponding interrupt in the parameter will be awakened.
The interrupt will be placed in the background again for monitoring.
4. Writing examples:
ISleep(intnum);
...
IWatch(intnum);
79
SPD-12-01-C
STEP Robot User Programming Manual
3.8.8 IDisable
1. Use format:
IDisable();
2. Parameters:
None
3. Function description:
This instruction is used to disable the execution of all interrupts. This instruction will list
the interrupts that occur during the effective period of the IDisable instruction into the waiting
queue. When the interrupt is enabled again (executing IEnable), the interrupt will be responded
to immediately, and the execution will be executed in the order of "first in first out" in the
queue.
4. Writing examples:
IDisable();
...
IEnable();
3.8.9 IEnable
1. Use format:
IEnable();
2. Parameters:
None
3. Function description:
This instruction is used to enable all disabled interrupts and the interrupts that come
afterwards. This instruction will turn the interrupt status that occurs during the IDisable
instruction's effective period into executable and execute it in a "first in, first out" order. The
interrupts after the execution of the IEnable instruction are also inserted into the queue and
executed in sequence.
4. Writing examples:
IDisable();
...
IEnable();
80
SPD-12-01-C
STEP Robot User Programming Manual
3.9 Palletizing instructions
3.9.1 PalletEntryPoint
1. Use format:
PalletEntryPoint (pallet0,cp0,dyn0,olr0,tool0,ref0);
2. Parameters:
Pallet: PALLETDATA (palletizing variable)
cp0: CARTPOS (Cartesian position point)
dyn0: DYNAMIC (dynamic characteristics)
olr0: OVERLAPREL (percentage of smothness)
tool0: TOOL (tool)
ref0: CARTREF (reference coordinate system)
3. Function description:
It is used to set the palletizing entry point, which will increase or decrease with the height
of the stacking layer.
4. Writing examples:
PalletEntryPoint (pallet0,cp0,dyn0,olr0);
Set the palletizing entry point, the PalletEntryPoint instruction should be placed before
calling the generated palletizing program. When teaching the entry point, you need to select the
tool and coordinate system. This tool and coordinate system must be consistent with the tool and
coordinate system used by the pallet, otherwise the first entry point will be deviated.
3.9.2 UpdatePalletizing
1. Use format:
UpdatePalletizing (pallet0);
2. Parameters:
Pallet: PALLETDATA (palletizing variable)
3. Function description:
Update the status of the specified palletizing.
4. Writing examples:
UpdatePalletizing (pallet0);
ReadPalletizing(pallet0);
81
SPD-12-01-C
STEP Robot User Programming Manual
The UpdatePalletizing instruction is a instruction to update the palletizing. After palletizing
a product, it needs to be updated, that is, it needs to be placed after the palletizing sub-function
call instruction, and a ReadPalletizing instruction must be added immediately after the
UpdatePalletizing instruction.
3.9.3 SetPalletizing
1. Use format:
SetPalletizing (pallet0,uint0,uint1,uint2);
2. Parameters:
Pallet: PALLETDATA (palletizing variable)
uint0: UINT (Set the current layer number)
uint1: UINT (set the number of products in the current layer)
uint2: UINT (set task amount)
3. Function description:
It is used to set the palletizing layer count, the count in the layer and the number of cycles,
and the palletizing variable can be initialized at the same time. Before calling the palletizing
subroutine, this instruction must be used to initialize the palletizing variables.
4. Writing examples:
SetPalletizing (pallet0,uint0,uint1,uint2);
Before using the palletizing variable, that is, at the beginning of the palletizing program,
you need to use the SetPalletizing instruction to initialize the palletizing variable.
3.9.4 ReadPalletizing
1. Use format:
ReadPalletizing (pallet0,uint0,uint1,uint2,bool0,bool1);
2. Parameters:
Pallet: PALLETDATA (palletizing variable)
uint0: UINT (number of layers)
uint1: UINT (number of products)
uint2: UINT (task amount)
bool0: BOOL (whether full)
bool1: BOOL (completed or not)
82
SPD-12-01-C
STEP Robot User Programming Manual
3. Function description:
Used to read the stacking count and status, including which layer the current stack has
reached, which one, how many times it has cycled, whether it is full, and whether it is
completed.
4. Writing examples:
ReadPalletizing (pallet0,uint0,uint1,uint2,bool0,bool1);
3.9.5 PLin
1. Use format:
PLin(pcp0,dyn0,olr0);
2. Parameters:
pcp0: PCARTPOS (special type position point for palletizing)
dyn0: DYNAMIC (dynamic characteristics)
olr0: OVERLAPREL (percentage of smothness)
3. Function description:
Special point-to-point motion instruction for palletizing.
4. Writing examples:
PLin(pcp0,dyn0,olr0);
3.9.6 PPTP
1. Use format:
PPTP(pcp0,dyn0,olr0);
2. Parameters:
pcp0: PCARTPOS (special type position point for palletizing)
dyn0: DYNAMIC (dynamic characteristics)
olr0: OVERLAPREL (percentage of smothness)
3. Function description:
Dedicated linear motion instruction for palletizing.
4. Writing examples:
PPTP(pcp0,dyn0,olr0);
83
SPD-12-01-C
STEP Robot User Programming Manual
Technical Support
 Technical Services
Shanghai STEP Robotics Co., Ltd. is happy to provide information about the operation and
operation of the machine, and can help you troubleshoot and provide detailed consultation. If
your robot fails during the production process, you can immediately contact our service
organization and provide the following information:

Robot model and serial number

Control system model and serial number

Control system version number

Additional software function package (optional)

Existing application

Other additional devices (positioner, guide rail, etc., optional)

Problem description, failure duration and frequency, etc.
 Contact information
Shanghai STEP Robotics Co., Ltd.
Address: No.599, Meiyu Road, Jiading District, Shanghai, P.R.China, 201802
Phone: 021-69926073
Fax: 021-69926046
Mail:robot@steprobots.com
Post Code: 201802
http://www.steprobots.com
84
SPD-12-01-C
Download