RobotStudio
56
RAPID Programming Basic General RAPID Syntax Rules:
Semicolon( ; )
The general rule is that each statement ends with
a semicolon ( ; ).
eg: Variable declaration:
VAR
num
length;
Assigning values:
area := length * width;
Most instruction calls:
MoveL
p10,v1000,fi ne,tool0;
Exceptions
Some special instructions do not end with a
semicolon. Instead there are special keywords to
indicate where they end.
Example of instructions that do not end with
semicolon:
Instruction Keyword Terminating Keyword
IF ENDIF
FOR ENDFOR
WHILE ENDWHILE
PROC ENDPROC
MODULE ENDMODULE
Comments ( ! )
A line starting with ! will not be interpreted by the
robot controller. Use this to write comments about
the code.
Fig. 67 - Example of a Basic RAPID Program
MODULE Module1
CONST robtarget pHome:=[[369.934835843,300.012,621.40403256],[0.49999989,0,0.866025467,0],[0,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]];
CONST robtarget pStart:=[[230.000213825,299.99979157,447.292792199],[0.000000153,0,1,0],[-1,0,-1,0],[9E9,9E9,9E9,9E9,9E9,9E9]];
CONST robtarget pApproach:=[[230.000085874,299.999791573,82.490119405],[0.000000157,0,1,0],[-1,0,-1,0],[9E9,9E9,9E9,9E9,9E9,9E9]];
CONST robtarget Target_10:=[[181.121273138,300,0],[0,0.011744259,0.999931034,0],[0,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]];
CONST robtarget Target_20:=...;
...
PROC pathApproach()
MoveJ pHome,v50,fi ne,pen\WObj:=WobjPad;
MoveL pStart,v50,fi ne,pen\WObj:=WobjPad;
MoveL pApproach,v50,fi ne,pen\WObj:=WobjPad;
ENDPROC
PROC pathExit()
MoveL pApproach,v50,fi ne,pen\WObj:=WobjPad;
MoveL pStart,v50,fi ne,pen\WObj:=WobjPad;
MoveJ pHome,v50,fi ne,pen\WObj:=WobjPad;
ENDPROC
PROC Path_10()
MoveL Target_10,v50,fi ne,pen\WObj:=WobjPad;
MoveC Target_20,Target_30,v50,fi ne,pen\WObj:=WobjPad;
MoveC Target_40,Target_50,v50,fi ne,pen\WObj:=WobjPad;
...
ENDPROC
PROC main()
pathApproach;
Path_10;
pathExit;
ENDPROC
ENDMODULE