RAPID Instructions, Functions and Data types | Technical reference manual | ABB Robotics

1324
ABB Robotics Technical reference manual RAPID Instructions, Functions and Data types

description

This manual is intended for the RAPID programmer. The RAPID base instructions, functions and data types are detailed in this manual.Document ID: 3HAC16581-en

Transcript of RAPID Instructions, Functions and Data types | Technical reference manual | ABB Robotics

ABB Robotics

Technical reference manual RAPID Instructions, Functions and Data types

Trace back information: Workspace R12-2 version a10 Checked in 2012-10-11 Skribenta version 1184

Technical reference manual RAPID Instructions, Functions and Data typesRobotWare 5.15 Document ID: 3HAC16581-1 Revision: N

Copyright 2004-2012 ABB. All rights reserved.

The information in this manual is subject to change without notice and should not be construed as a commitment by ABB. ABB assumes no responsibility for any errors that may appear in this manual. Except as may be expressly stated anywhere in this manual, nothing herein shall be construed as any kind of guarantee or warranty by ABB for losses, damages to persons or property, fitness for a specific purpose or the like. In no event shall ABB be liable for incidental or consequential damages arising from use of this manual and products described herein. This manual and parts thereof must not be reproduced or copied without ABB's written permission. Additional copies of this manual may be obtained from ABB. The original language for this publication is English. Any other languages that are supplied have been translated from English.

Copyright 2004-2012 ABB. All rights reserved. ABB AB Robotics Products SE-721 68 Vsters Sweden

Table of contents

Table of contentsOverview of this manual ................................................................................................................... 15 1 Instructions 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 1.10 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.18 1.19 1.20 1.21 1.22 1.23 1.24 1.25 1.26 1.27 1.28 1.29 1.30 1.31 1.32 1.33 1.34 1.35 1.36 1.37 1.38 1.39 1.40 1.41 1.42 1.43 1.44 1.45 1.46 1.47 1.48 1.49 1.50 1.51 1.52 1.53 AccSet - Reduces the acceleration ....................................................................... ActEventBuffer - Activation of event buffer ............................................................. ActUnit - Activates a mechanical unit .................................................................... Add - Adds a numeric value ................................................................................ AliasIO - Define I/O signal with alias name ............................................................. ":=" - Assigns a value ......................................................................................... BitClear - Clear a specified bit in a byte or dnum data .............................................. BitSet - Set a specified bit in a byte or dnum data .................................................... BookErrNo - Book a RAPID system error number .................................................... Break - Break program execution ......................................................................... CallByVar - Call a procedure by a variable ............................................................. CancelLoad - Cancel loading of a module .............................................................. CheckProgRef - Check program references ........................................................... CirPathMode - Tool reorientation during circle path ................................................. Clear - Clears the value ...................................................................................... ClearIOBuff - Clear input buffer of a serial channel .................................................. ClearPath - Clear current path ............................................................................. ClearRawBytes - Clear the contents of rawbytes data .............................................. ClkReset - Resets a clock used for timing .............................................................. ClkStart - Starts a clock used for timing ................................................................. ClkStop - Stops a clock used for timing ................................................................. Close - Closes a file or serial channel .................................................................... CloseDir - Close a directory ................................................................................. Comment - Comment ......................................................................................... Compact IF - If a condition is met, then... (one instruction) ........................................ ConfJ - Controls the configuration during joint movement ......................................... ConfL - Monitors the configuration during linear movement ....................................... CONNECT - Connects an interrupt to a trap routine ................................................ CopyFile - Copy a file ......................................................................................... CopyRawBytes - Copy the contents of rawbytes data ............................................... CorrClear - Removes all correction generators ....................................................... CorrCon - Connects to a correction generator ......................................................... CorrDiscon - Disconnects from a correction generator ............................................. CorrWrite - Writes to a correction generator ........................................................... DeactEventBuffer - Deactivation of event buffer ...................................................... DeactUnit - Deactivates a mechanical unit ............................................................. Decr - Decrements by 1 ...................................................................................... DitherAct - Enables dither for soft servo ................................................................ DitherDeact - Disables dither for soft servo ............................................................ DropWObj - Drop work object on conveyor ............................................................. EOffsOff - Deactivates an offset for external axes .................................................... EOffsOn - Activates an offset for external axes ...................................................... EOffsSet - Activates an offset for external axes using known values ........................... EraseModule - Erase a module ............................................................................ ErrLog - Write an error message .......................................................................... ErrRaise - Writes a warning and calls an error handler ............................................. ErrWrite - Write an error message ........................................................................ EXIT - Terminates program execution .................................................................. ExitCycle - Break current cycle and start next ......................................................... FOR - Repeats a given number of times ................................................................ GetDataVal - Get the value of a data object ............................................................ GetSysData - Get system data ............................................................................. GetTrapData - Get interrupt data for current TRAP .................................................. 17 17 19 21 23 25 28 30 33 36 38 39 41 43 44 50 51 53 57 59 60 62 63 64 65 66 67 69 71 73 75 77 78 83 84 86 88 90 92 94 95 96 97 99 101 103 107 111 113 114 116 118 121 124

3HAC16581-1 Revision: N Copyright 2004-2012 ABB. All rights reserved.

5

Table of contents

1.54 1.55 1.56 1.57 1.58 1.59 1.60 1.61 1.62 1.63 1.64 1.65 1.66 1.67 1.68 1.69 1.70 1.71 1.72 1.73 1.74 1.75 1.76 1.77 1.78 1.79 1.80 1.81 1.82 1.83 1.84 1.85 1.86 1.87 1.88 1.89 1.90 1.91 1.92 1.93 1.94 1.95 1.96 1.97 1.98 1.99 1.100 1.101 1.102 1.103 1.104 1.105 1.106 1.107 1.108 1.109 1.110 1.111 1.112

GOTO - Goes to a new instruction ........................................................................ GripLoad - Defines the payload for a robot ............................................................. HollowWristReset - Reset hollow wrist for IRB5402 and IRB5403 ............................... IDelete - Cancels an interrupt .............................................................................. IDisable - Disables interrupts ............................................................................... IEnable - Enables interrupts ................................................................................ IError - Orders an interrupt on errors ..................................................................... IF - If a condition is met, then ...; otherwise ... ......................................................... Incr - Increments by 1 ........................................................................................ IndAMove - Independent absolute position movement ............................................. IndCMove - Independent continuous movement ...................................................... IndDMove - Independent delta position movement .................................................. IndReset - Independent reset .............................................................................. IndRMove - Independent relative position movement ............................................... InvertDO - Inverts the value of a digital output signal ............................................... IOBusStart - Start of I/O bus ................................................................................ IOBusState - Get current state of I/O bus ............................................................... IODisable - Disable I/O unit ................................................................................. IOEnable - Enable I/O unit ................................................................................... IPers - Interrupt at value change of a persistent variable ........................................... IRMQMessage - Orders RMQ interrupts for a data type ............................................ ISignalAI - Interrupts from analog input signal ........................................................ ISignalAO - Interrupts from analog output signal ..................................................... ISignalDI - Orders interrupts from a digital input signal ............................................. ISignalDO - Interrupts from a digital output signal .................................................... ISignalGI - Orders interrupts from a group of digital input signals ............................... ISignalGO - Orders interrupts from a group of digital output signals ............................ ISleep - Deactivates an interrupt .......................................................................... ITimer - Orders a timed interrupt .......................................................................... IVarValue - orders a variable value interrupt ........................................................... IWatch - Activates an interrupt ............................................................................. Label - Line name .............................................................................................. Load - Load a program module during execution ..................................................... LoadId - Load identification of tool or payload ......................................................... MakeDir - Create a new directory ......................................................................... ManLoadIdProc - Load identification of IRBP manipulators ....................................... MechUnitLoad - Defines a payload for a mechanical unit .......................................... MotionSup - Deactivates/Activates motion supervision ............................................. MoveAbsJ - Moves the robot to an absolute joint position ......................................... MoveC - Moves the robot circularly ....................................................................... MoveCDO - Moves the robot circularly and sets digital output in the corner .................. MoveCSync - Moves the robot circularly and executes a RAPID procedure .................. MoveExtJ - Move one or several mechanical units without TCP ................................. MoveJ - Moves the robot by joint movement ........................................................... MoveJDO - Moves the robot by joint movement and sets digital output in the corner ...... MoveJSync - Moves the robot by joint movement and executes a RAPID procedure ...... MoveL - Moves the robot linearly .......................................................................... MoveLDO - Moves the robot linearly and sets digital output in the corner ..................... MoveLSync - Moves the robot linearly and executes a RAPID procedure ..................... MToolRotCalib - Calibration of rotation for moving tool ............................................. MToolTCPCalib - Calibration of TCP for moving tool ................................................ Open - Opens a file or serial channel .................................................................... OpenDir - Open a directory ................................................................................. PackDNHeader - Pack DeviceNet Header into rawbytes data ..................................... PackRawBytes - Pack data into rawbytes data ........................................................ PathAccLim - Reduce TCP acceleration along the path ............................................ PathRecMoveBwd - Move path recorder backwards ................................................ PathRecMoveFwd - Move path recorder forward ..................................................... PathRecStart - Start the path recorder ...................................................................

126 128 130 132 133 134 135 138 140 142 146 150 153 158 162 164 165 168 171 173 175 179 189 193 196 199 202 205 207 209 212 214 215 219 224 225 229 233 235 241 249 253 258 261 266 270 275 281 285 290 293 296 301 303 306 310 314 320 323

6 Copyright 2004-2012 ABB. All rights reserved.

3HAC16581-1 Revision: N

Table of contents

1.113 1.114 1.115 1.116 1.117 1.118 1.119 1.120 1.121 1.122 1.123 1.124 1.125 1.126 1.127 1.128 1.129 1.130 1.131 1.132 1.133 1.134 1.135 1.136 1.137 1.138 1.139 1.140 1.141 1.142 1.143 1.144 1.145 1.146 1.147 1.148 1.149 1.150 1.151 1.152 1.153 1.154 1.155 1.156 1.157 1.158 1.159 1.160 1.161 1.162 1.163 1.164 1.165 1.166 1.167 1.168 1.169 1.170 1.171

PathRecStop - Stop the path recorder ................................................................... PathResol - Override path resolution .................................................................... PDispOff - Deactivates program displacement ....................................................... PDispOn - Activates program displacement ........................................................... PDispSet - Activates program displacement using known frame ................................ ProcCall - Calls a new procedure ......................................................................... ProcerrRecovery - Generate and recover from process-move error ............................ PulseDO - Generates a pulse on a digital output signal ............................................ RAISE - Calls an error handler ............................................................................. RaiseToUser - Propagates an error to user level ..................................................... ReadAnyBin - Read data from a binary serial channel or file ...................................... ReadBlock - read a block of data from device ......................................................... ReadCfgData - Reads attribute of a system parameter ............................................. ReadErrData - Gets information about an error ....................................................... ReadRawBytes - Read rawbytes data .................................................................... RemoveDir - Delete a directory ............................................................................ RemoveFile - Delete a file ................................................................................... RenameFile - Rename a file ................................................................................ Reset - Resets a digital output signal .................................................................... ResetPPMoved - Reset state for the program pointer moved in manual mode .............. ResetRetryCount - Reset the number of retries ....................................................... RestoPath - Restores the path after an interrupt ...................................................... RETRY - Resume execution after an error .............................................................. RETURN - Finishes execution of a routine ............................................................. Rewind - Rewind file position ............................................................................... RMQEmptyQueue - Empty RAPID Message Queue ................................................. RMQFindSlot - Find a slot identity from the slot name .............................................. RMQGetMessage - Get an RMQ message ............................................................. RMQGetMsgData - Get the data part from an RMQ message ..................................... RMQGetMsgHeader - Get header information from an RMQ message ......................... RMQReadWait - Returns message from RMQ ......................................................... RMQSendMessage - Send an RMQ data message .................................................. RMQSendWait - Send an RMQ data message and wait for a response ........................ Save - Save a program module ............................................................................ SCWrite - Send variable data to a client application ................................................. SearchC - Searches circularly using the robot ........................................................ SearchExtJ - Search with one or several mechanical units without TCP ....................... SearchL - Searches linearly using the robot ........................................................... SenDevice - connect to a sensor device ................................................................ Set - Sets a digital output signal ........................................................................... SetAllDataVal - Set a value to all data objects in a defined set ................................... SetAO - Changes the value of an analog output signal ............................................. SetDataSearch - Define the symbol set in a search sequence .................................... SetDataVal - Set the value of a data object ............................................................. SetDO - Changes the value of a digital output signal ................................................ SetGO - Changes the value of a group of digital output signals .................................. SetSysData - Set system data .............................................................................. SingArea - Defines interpolation around singular points ............................................ SkipWarn - Skip the latest warning ....................................................................... SocketAccept - Accept an incoming connection ...................................................... SocketBind - Bind a socket to my IP-address and port ............................................. SocketClose - Close a socket .............................................................................. SocketConnect - Connect to a remote computer ..................................................... SocketCreate - Create a new socket ..................................................................... SocketListen - Listen for incoming connections ...................................................... SocketReceive - Receive data from remote computer .............................................. SocketSend - Send data to remote computer .......................................................... SoftAct - Activating the soft servo ......................................................................... SoftDeact - Deactivating the soft servo ..................................................................

326 329 331 332 336 338 340 346 349 352 355 358 360 364 367 370 372 373 375 376 377 378 380 381 383 385 387 389 392 395 398 401 405 410 413 416 425 432 442 444 446 448 450 454 457 459 462 464 466 467 470 472 474 477 479 481 486 490 492

3HAC16581-1 Revision: N Copyright 2004-2012 ABB. All rights reserved.

7

Table of contents

1.172 1.173 1.174 1.175 1.176 1.177 1.178 1.179 1.180 1.181 1.182 1.183 1.184 1.185 1.186 1.187 1.188 1.189 1.190 1.191 1.192 1.193 1.194 1.195 1.196 1.197 1.198 1.199 1.200 1.201 1.202 1.203 1.204 1.205 1.206 1.207 1.208 1.209 1.210 1.211 1.212 1.213 1.214 1.215 1.216 1.217 1.218 1.219 1.220 1.221 1.222 1.223 1.224 1.225 1.226 1.227 1.228 1.229

SpeedLimAxis - Set speed limitation for an axis ...................................................... 493 SpeedLimCheckPoint - Set speed limitation for check points ..................................... 497 SpeedRefresh - Update speed override for ongoing movement .................................. 502 SpyStart - Start recording of execution time data ..................................................... 505 SpyStop - Stop recording of time execution data ..................................................... 508 StartLoad - Load a program module during execution .............................................. 509 StartMove - Restarts robot movement ................................................................... 513 StartMoveRetry - Restarts robot movement and execution ........................................ 516 STCalib - Calibrate a Servo Tool .......................................................................... 519 STClose - Close a Servo Tool .............................................................................. 523 StepBwdPath - Move backwards one step on path .................................................. 526 STIndGun - Sets the gun in independent mode ....................................................... 528 STIndGunReset - Resets the gun from independent mode ........................................ 530 SToolRotCalib - Calibration of TCP and rotation for stationary tool ............................. 531 SToolTCPCalib - Calibration of TCP for stationary tool ............................................. 534 Stop - Stops program execution ........................................................................... 537 STOpen - Open a Servo Tool ............................................................................... 540 StopMove - Stops robot movement ....................................................................... 542 StopMoveReset - Reset the system stop move state ................................................ 546 StorePath - Stores the path when an interrupt occurs ............................................... 548 STTune - Tuning Servo Tool ................................................................................ 550 STTuneReset - Resetting Servo tool tuning ............................................................ 554 SyncMoveOff - End coordinated synchronized movements ....................................... 555 SyncMoveOn - Start coordinated synchronized movements ...................................... 561 SyncMoveResume - Set synchronized coordinated movements ................................. 567 SyncMoveSuspend - Set independent-semicoordinated movements ........................... 569 SyncMoveUndo - Set independent movements ....................................................... 571 SystemStopAction - Stop the robot system ............................................................ 573 TEST - Depending on the value of an expression ... ................................................. 575 TestSignDefine - Define test signal ....................................................................... 577 TestSignReset - Reset all test signal definitions ...................................................... 579 TextTabInstall - Installing a text table .................................................................... 580 TPErase - Erases text printed on the FlexPendant ................................................... 582 TPReadDnum - Reads a number from the FlexPendant ............................................ 583 TPReadFK - Reads function keys ......................................................................... 586 TPReadNum - Reads a number from the FlexPendant ............................................. 590 TPShow - Switch window on the FlexPendant ......................................................... 593 TPWrite - Writes on the FlexPendant ..................................................................... 594 TriggC - Circular robot movement with events ........................................................ 596 TriggCheckIO - Defines IO check at a fixed position ................................................. 604 TriggEquip - Define a fixed position and time I/O event on the path ............................. 609 TriggInt - Defines a position related interrupt .......................................................... 615 TriggIO - Define a fixed position or time I/O event near a stop point ............................ 619 TriggJ - Axis-wise robot movements with events ..................................................... 624 TriggL - Linear robot movements with events ......................................................... 631 TriggLIOs - Linear robot movements with I/O events ................................................ 638 TriggRampAO - Define a fixed position ramp AO event on the path ............................ 645 TriggSpeed - Defines TCP speed proportional analog output with fixed position-time scale event .............................................................................................................. 651 TriggStopProc - Generate restart data for trigg signals at stop ................................... 659 TryInt - Test if data object is a valid integer ............................................................ 664 TRYNEXT - Jumps over an instruction which has caused an error .............................. 666 TuneReset - Resetting servo tuning ...................................................................... 667 TuneServo - Tuning servos ................................................................................. 668 UIMsgBox - User Message Dialog Box type basic .................................................... 674 UIShow - User Interface show .............................................................................. 682 UnLoad - UnLoad a program module during execution ............................................. 686 UnpackRawBytes - Unpack data from rawbytes data ............................................... 689 VelSet - Changes the programmed velocity ............................................................ 693

8 Copyright 2004-2012 ABB. All rights reserved.

3HAC16581-1 Revision: N

Table of contents

1.230 1.231 1.232 1.233 1.234 1.235 1.236 1.237 1.238 1.239 1.240 1.241 1.242 1.243 1.244 1.245 1.246 1.247 1.248 1.249 1.250 1.251 1.252 1.253 1.254 1.255 1.256 1.257 1.258 1.259 1.260 1.261 1.262 1.263 2

WaitAI - Waits until an analog input signal value is set ............................................. WaitAO - Waits until an analog output signal value is set .......................................... WaitDI - Waits until a digital input signal is set ........................................................ WaitDO - Waits until a digital output signal is set ..................................................... WaitGI - Waits until a group of digital input signals are set ........................................ WaitGO - Waits until a group of digital output signals are set ..................................... WaitLoad - Connect the loaded module to the task .................................................. WaitRob - Wait until stop point or zero speed ......................................................... WaitSyncTask - Wait at synchronization point for other program tasks ........................ WaitTestAndSet - Wait until variable unset - then set ............................................... WaitTime - Waits a given amount of time ............................................................... WaitUntil - Waits until a condition is met ................................................................ WaitWObj - Wait for work object on conveyor ......................................................... WarmStart - Restart the controller ........................................................................ WHILE - Repeats as long as ... ............................................................................. WorldAccLim - Control acceleration in world coordinate system ................................. Write - Writes to a character-based file or serial channel ........................................... WriteAnyBin - Writes data to a binary serial channel or file ........................................ WriteBin - Writes to a binary serial channel ............................................................ WriteBlock - write block of data to device ............................................................... WriteCfgData - Writes attribute of a system parameter ............................................. WriteRawBytes - Write rawbytes data .................................................................... WriteStrBin - Writes a string to a binary serial channel ............................................. WriteVar - write variable ..................................................................................... WZBoxDef - Define a box-shaped world zone ......................................................... WZCylDef - Define a cylinder-shaped world zone .................................................... WZDisable - Deactivate temporary world zone supervision ....................................... WZDOSet - Activate world zone to set digital output ................................................ WZEnable - Activate temporary world zone supervision ............................................ WZFree - Erase temporary world zone supervision .................................................. WZHomeJointDef - Define a world zone for home joints ........................................... WZLimJointDef - Define a world zone for limitation in joints ....................................... WZLimSup - Activate world zone limit supervision ................................................... WZSphDef - Define a sphere-shaped world zone .....................................................

695 698 701 703 705 709 713 717 719 723 726 728 731 734 735 737 739 742 745 747 749 753 755 757 759 761 764 766 770 772 774 777 781 784 787 787 789 791 792 794 797 798 799 800 802 804 806 808 810 813 815 817 819 821 823 825 827 829

Functions 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 2.10 2.11 2.12 2.13 2.14 2.15 2.16 2.17 2.18 2.19 2.20 2.21 2.22 2.23 Abs - Gets the absolute value .............................................................................. AbsDnum - Gets the absolute value of a dnum ....................................................... ACos - Calculates the arc cosine value .................................................................. AOutput - Reads the value of an analog output signal .............................................. ArgName - Gets argument name ......................................................................... ASin - Calculates the arc sine value ...................................................................... ATan - Calculates the arc tangent value ................................................................. ATan2 - Calculates the arc tangent2 value ............................................................. BitAnd - Logical bitwise AND - operation on byte data .............................................. BitAndDnum - Logical bitwise AND - operation on dnum data .................................... BitCheck - Check if a specified bit in a byte data is set ............................................. BitCheckDnum - Check if a specified bit in a dnum data is set ................................... BitLSh - Logical bitwise LEFT SHIFT - operation on byte .......................................... BitLShDnum - Logical bitwise LEFT SHIFT - operation on dnum ................................ BitNeg - Logical bitwise NEGATION - operation on byte data ..................................... BitNegDnum - Logical bitwise NEGATION - operation on dnum data ........................... BitOr - Logical bitwise OR - operation on byte data .................................................. BitOrDnum - Logical bitwise OR - operation on dnum data ........................................ BitRSh - Logical bitwise RIGHT SHIFT - operation on byte ........................................ BitRShDnum - Logical bitwise RIGHT SHIFT - operation on dnum .............................. BitXOr - Logical bitwise XOR - operation on byte data .............................................. BitXOrDnum - Logical bitwise XOR - operation on dnum data .................................... ByteToStr - Converts a byte to a string data ...........................................................

3HAC16581-1 Revision: N Copyright 2004-2012 ABB. All rights reserved.

9

Table of contents

2.24 2.25 2.26 2.27 2.28 2.29 2.30 2.31 2.32 2.33 2.34 2.35 2.36 2.37 2.38 2.39 2.40 2.41 2.42 2.43 2.44 2.45 2.46 2.47 2.48 2.49 2.50 2.51 2.52 2.53 2.54 2.55 2.56 2.57 2.58 2.59 2.60 2.61 2.62 2.63 2.64 2.65 2.66 2.67 2.68 2.69 2.70 2.71 2.72 2.73 2.74 2.75 2.76 2.77 2.78 2.79 2.80 2.81 2.82

CalcJointT - Calculates joint angles from robtarget .................................................. CalcRobT - Calculates robtarget from jointtarget ..................................................... CalcRotAxFrameZ - Calculate a rotational axis frame ............................................... CalcRotAxisFrame - Calculate a rotational axis frame .............................................. CDate - Reads the current date as a string ............................................................. CJointT - Reads the current joint angles ................................................................ ClkRead - Reads a clock used for timing ................................................................ CorrRead - Reads the current total offsets ............................................................. Cos - Calculates the cosine value ......................................................................... CPos - Reads the current position (pos) data .......................................................... CRobT - Reads the current position (robtarget) data ................................................ CSpeedOverride - Reads the current override speed ............................................... CTime - Reads the current time as a string ............................................................. CTool - Reads the current tool data ...................................................................... CWObj - Reads the current work object data .......................................................... DecToHex - Convert from decimal to hexadecimal ................................................... DefAccFrame - Define an accurate frame ............................................................... DefDFrame - Define a displacement frame ............................................................. DefFrame - Define a frame .................................................................................. Dim - Obtains the size of an array ......................................................................... Distance - Distance between two points ................................................................ DnumToNum - Converts dnum to num .................................................................. DnumToStr - Converts numeric value to string ........................................................ DotProd - Dot product of two pos vectors ............................................................... DOutput - Reads the value of a digital output signal ................................................. EulerZYX - Gets euler angles from orient ............................................................... EventType - Get current event type inside any event routine ..................................... ExecHandler - Get type of execution handler .......................................................... ExecLevel - Get execution level ........................................................................... Exp - Calculates the exponential value .................................................................. FileSize - Retrieve the size of a file ....................................................................... FileTime - Retrieve time information about a file ...................................................... FSSize - Retrieve the size of a file system .............................................................. GetMecUnitName - Get the name of the mechanical unit .......................................... GetModalPayLoadMode - Get the ModalPayLoadMode value .................................... GetNextMechUnit - Get name and data for mechanical units ..................................... GetNextSym - Get next matching symbol ............................................................... GetServiceInfo - Get service information from the system ......................................... GetSysInfo - Get information about the system ....................................................... GetTaskName - Gets the name and number of current task ....................................... GetTime - Reads the current time as a numeric value ............................................... GInputDnum - Read value of group input signal ...................................................... GOutput - Reads the value of a group of digital output signals ................................... GOutputDnum - Read value of group output signal .................................................. HexToDec - Convert from hexadecimal to decimal ................................................... IndInpos - Independent axis in position status ........................................................ IndSpeed - Independent speed status ................................................................... IOUnitState - Get current state of I/O unit ............................................................... IsFile - Check the type of a file ............................................................................. IsMechUnitActive - Is mechanical unit active .......................................................... IsPers - Is persistent .......................................................................................... IsStopMoveAct - Is stop move flags active ............................................................. IsStopStateEvent - Test whether moved program pointer .......................................... IsSyncMoveOn - Test if in synchronized movement mode ......................................... IsSysId - Test system identity .............................................................................. IsVar - Is variable .............................................................................................. MaxRobSpeed - Maximum robot speed ................................................................. MirPos - Mirroring of a position ............................................................................ ModExist - Check if program module exist .............................................................

831 835 837 841 845 846 848 850 851 852 854 857 859 860 862 864 865 868 871 874 876 878 880 882 884 886 888 890 891 892 893 896 899 902 903 904 907 909 911 914 916 918 920 922 925 926 928 930 933 937 938 939 941 943 945 946 947 948 950

10 Copyright 2004-2012 ABB. All rights reserved.

3HAC16581-1 Revision: N

Table of contents

2.83 2.84 2.85 2.86 2.87 2.88 2.89 2.90 2.91 2.92 2.93 2.94 2.95 2.96 2.97 2.98 2.99 2.100 2.101 2.102 2.103 2.104 2.105 2.106 2.107 2.108 2.109 2.110 2.111 2.112 2.113 2.114 2.115 2.116 2.117 2.118 2.119 2.120 2.121 2.122 2.123 2.124 2.125 2.126 2.127 2.128 2.129 2.130 2.131 2.132 2.133 2.134 2.135 2.136 2.137 2.138 2.139 2.140 2.141

ModTime - Get file modify time for the loaded module .............................................. 951 MotionPlannerNo - Get connected motion planner number ....................................... 953 NonMotionMode - Read the Non-Motion execution mode .......................................... 955 NOrient - Normalize orientation ............................................................................ 957 NumToDnum - Converts num to dnum .................................................................. 959 NumToStr - Converts numeric value to string ......................................................... 960 Offs - Displaces a robot position .......................................................................... 962 OpMode - Read the operating mode ..................................................................... 964 OrientZYX - Builds an orient from euler angles ........................................................ 965 ORobT - Removes the program displacement from a position .................................... 967 ParIdPosValid - Valid robot position for parameter identification ................................ 969 ParIdRobValid - Valid robot type for parameter identification ..................................... 972 PathLevel - Get current path level ......................................................................... 975 PathRecValidBwd - Is there a valid backward path recorded ...................................... 977 PathRecValidFwd - Is there a valid forward path recorded ......................................... 980 PFRestart - Check interrupted path after power failure ............................................. 984 PoseInv - Inverts pose data ................................................................................. 985 PoseMult - Multiplies pose data ........................................................................... 987 PoseVect - Applies a transformation to a vector ...................................................... 989 Pow - Calculates the power of a value ................................................................... 991 PowDnum - Calculates the power of a value ........................................................... 992 PPMovedInManMode - Test whether the program pointer is moved in manual mode ..... 993 Present - Tests if an optional parameter is used ...................................................... 994 ProgMemFree - Get the size of free program memory .............................................. 996 RawBytesLen - Get the length of rawbytes data ...................................................... 997 ReadBin - Reads a byte from a file or serial channel ................................................ 999 ReadDir - Read next entry in a directory ................................................................ 1001 ReadMotor - Reads the current motor angles .......................................................... 1004 ReadNum - Reads a number from a file or serial channel .......................................... 1006 ReadStr - Reads a string from a file or serial channel ............................................... 1009 ReadStrBin - Reads a string from a binary serial channel or file ................................. 1013 ReadVar - Read variable from a device .................................................................. 1015 RelTool - Make a displacement relative to the tool ................................................... 1017 RemainingRetries - Remaining retries left to do ...................................................... 1019 RMQGetSlotName - Get the name of an RMQ client ................................................. 1020 RobName - Get the TCP robot name ..................................................................... 1022 RobOS - Check if execution is on RC or VC ............................................................ 1024 Round - Round a numeric value ........................................................................... 1025 RoundDnum - Round a numeric value ................................................................... 1027 RunMode - Read the running mode ...................................................................... 1029 Sin - Calculates the sine value ............................................................................. 1030 SocketGetStatus - Get current socket state ............................................................ 1031 Sqrt - Calculates the square root value .................................................................. 1033 SqrtDnum - Calculates the square root value .......................................................... 1034 STCalcForce - Calculate the tip force for a Servo Tool .............................................. 1035 STCalcTorque - Calc. the motor torque for a servo tool ............................................ 1036 STIsCalib - Tests if a servo tool is calibrated .......................................................... 1037 STIsClosed - Tests if a servo tool is closed ............................................................ 1039 STIsIndGun - Tests if a servo tool is in independent mode ........................................ 1041 STIsOpen - Tests if a servo tool is open ................................................................ 1042 StrDigCalc - Arithmetic operations with datatype stringdig ........................................ 1044 StrDigCmp - Compare two strings with only digits ................................................... 1047 StrFind - Searches for a character in a string .......................................................... 1050 StrLen - Gets the string length ............................................................................. 1052 StrMap - Maps a string ....................................................................................... 1053 StrMatch - Search for pattern in string ................................................................... 1055 StrMemb - Checks if a character belongs to a set .................................................... 1057 StrOrder - Checks if strings are ordered ................................................................ 1059 StrPart - Finds a part of a string ........................................................................... 1062

3HAC16581-1 Revision: N Copyright 2004-2012 ABB. All rights reserved.

11

Table of contents

2.142 2.143 2.144 2.145 2.146 2.147 2.148 2.149 2.150 2.151 2.152 2.153 2.154 2.155 2.156 2.157 2.158 2.159 2.160 2.161 2.162 2.163 2.164 2.165 2.166 2.167 3

StrToByte - Converts a string to a byte data ........................................................... 1064 StrToVal - Converts a string to a value .................................................................. 1066 Tan - Calculates the tangent value ........................................................................ 1068 TaskRunMec - Check if task controls any mechanical unit ........................................ 1069 TaskRunRob - Check if task controls some robot .................................................... 1070 TasksInSync - Returns the number of synchronized tasks ........................................ 1071 TestAndSet - Test variable and set if unset ............................................................ 1073 TestDI - Tests if a digital input is set ..................................................................... 1076 TestSignRead - Read test signal value .................................................................. 1077 TextGet - Get text from system text tables ............................................................. 1079 TextTabFreeToUse - Test whether text table is free ................................................. 1081 TextTabGet - Get text table number ...................................................................... 1083 Trunc - Truncates a numeric value ....................................................................... 1085 TruncDnum - Truncates a numeric value ............................................................... 1087 Type - Get the data type name for a variable .......................................................... 1089 UIAlphaEntry - User Alpha Entry .......................................................................... 1091 UIClientExist - Exist User Client ........................................................................... 1097 UIDnumEntry - User Number Entry ....................................................................... 1098 UIDnumTune - User Number Tune ........................................................................ 1104 UIListView - User List View ................................................................................. 1110 UIMessageBox - User Message Box type advanced ................................................. 1117 UINumEntry - User Number Entry ......................................................................... 1124 UINumTune - User Number Tune ......................................................................... 1130 ValidIO - Valid I/O signal to access ....................................................................... 1136 ValToStr - Converts a value to a string .................................................................. 1138 VectMagn - Magnitude of a pos vector .................................................................. 1140 1143

Data types 3.1 3.2 3.3 3.4 3.5 3.6 3.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.15 3.16 3.17 3.18 3.19 3.20 3.21 3.22 3.23 3.24 3.25 3.26 3.27 3.28 3.29 3.30 3.31

aiotrigg - Analog I/O trigger condition .................................................................... 1143 bool - Logical values .......................................................................................... 1145 btnres - Push button result data ........................................................................... 1146 busstate - State of I/O bus ................................................................................... 1148 buttondata - Push button data .............................................................................. 1149 byte - Integer values 0 - 255 ................................................................................ 1151 clock - Time measurement .................................................................................. 1152 confdata - Robot configuration data ...................................................................... 1153 corrdescr - Correction generator descriptor ............................................................ 1159 datapos - Enclosing block for a data object ............................................................ 1161 dionum - Digital values (0 - 1) .............................................................................. 1162 dir - File directory structure ................................................................................. 1163 dnum - Double numeric values ............................................................................ 1164 errdomain - Error domain .................................................................................... 1166 errnum - Error number ....................................................................................... 1168 errstr - Error string ............................................................................................. 1174 errtype - Error type ............................................................................................ 1175 event_type - Event routine type ............................................................................ 1176 exec_level - Execution level ................................................................................ 1177 extjoint - Position of external joints ....................................................................... 1178 handler_type - Type of execution handler .............................................................. 1180 icondata - Icon display data ................................................................................. 1181 identno - Identity for move instructions .................................................................. 1183 intnum - Interrupt identity .................................................................................... 1185 iodev - Serial channels and files ........................................................................... 1187 iounit_state - State of I/O unit .............................................................................. 1188 jointtarget - Joint position data ............................................................................. 1189 listitem - List item data structure .......................................................................... 1191 loaddata - Load data .......................................................................................... 1192 loadidnum - Type of load identification .................................................................. 1198 loadsession - Program load session ..................................................................... 1199

12 Copyright 2004-2012 ABB. All rights reserved.

3HAC16581-1 Revision: N

Table of contents

3.32 3.33 3.34 3.35 3.36 3.37 3.38 3.39 3.40 3.41 3.42 3.43 3.44 3.45 3.46 3.47 3.48 3.49 3.50 3.51 3.52 3.53 3.54 3.55 3.56 3.57 3.58 3.59 3.60 3.61 3.62 3.63 3.64 3.65 3.66 3.67 3.68 3.69 3.70 3.71 3.72 3.73 3.74 3.75 3.76 3.77 3.78 4

mecunit - Mechanical unit ................................................................................... 1200 motsetdata - Motion settings data ......................................................................... 1202 num - Numeric values ........................................................................................ 1207 opcalc - Arithmetic Operator ................................................................................ 1209 opnum - Comparison operator ............................................................................. 1210 orient - Orientation ............................................................................................ 1211 paridnum - Type of parameter identification ........................................................... 1216 paridvalidnum - Result of ParIdRobValid ................................................................ 1218 pathrecid - Path recorder identifier ....................................................................... 1220 pos - Positions (only X, Y and Z) .......................................................................... 1222 pose - Coordinate transformations ........................................................................ 1224 progdisp - Program displacement ......................................................................... 1225 rawbytes - Raw data .......................................................................................... 1227 restartdata - Restart data for trigg signals .............................................................. 1229 rmqheader - RAPID Message Queue Message header ............................................. 1233 rmqmessage - RAPID Message Queue message ..................................................... 1235 rmqslot - Identity number of an RMQ client ............................................................ 1237 robjoint - Joint position of robot axes .................................................................... 1238 robtarget - Position data ..................................................................................... 1239 shapedata - World zone shape data ...................................................................... 1242 signalxx - Digital and analog signals ..................................................................... 1244 socketdev - Socket device .................................................................................. 1246 socketstatus - Socket communication status .......................................................... 1247 speeddata - Speed data ...................................................................................... 1248 stoppointdata - Stop point data ............................................................................ 1252 string - Strings .................................................................................................. 1258 stringdig - String with only digits .......................................................................... 1260 switch - Optional parameters .............................................................................. 1261 symnum - Symbolic number ................................................................................ 1262 syncident - Identity for synchronization point .......................................................... 1263 System data - Current RAPID system data settings ................................................. 1264 taskid - Task identification .................................................................................. 1266 tasks - RAPID program tasks ............................................................................... 1267 testsignal - Test signal ....................................................................................... 1269 tooldata - Tool data ............................................................................................ 1270 tpnum - FlexPendant window number ................................................................... 1276 trapdata - Interrupt data for current TRAP .............................................................. 1277 triggdata - Positioning events, trigg ...................................................................... 1279 triggios - Positioning events, trigg ........................................................................ 1280 triggiosdnum - Positioning events, trigg ................................................................. 1283 triggstrgo - Positioning events, trigg ..................................................................... 1285 tunetype - Servo tune type .................................................................................. 1288 uishownum - Instance ID for UIShow .................................................................... 1289 wobjdata - Work object data ................................................................................ 1290 wzstationary - Stationary world zone data .............................................................. 1294 wztemporary - Temporary world zone data ............................................................. 1296 zonedata - Zone data ......................................................................................... 1298 1305

Programming type examples 4.1 4.2 4.3 4.4

ERROR handler with movements ......................................................................... 1305 Service routines with or without movements ........................................................... 1308 System I/O interrupts with or without movements .................................................... 1311 TRAP routines with movements ........................................................................... 1314 1317

Index

3HAC16581-1 Revision: N Copyright 2004-2012 ABB. All rights reserved.

13

This page is intentionally left blank

Overview of this manual

Overview of this manualAbout this manual This is a technical reference manual intended for the RAPID programmer. The RAPID base instructions, functions and data types are detailed in this manual. Usage This manual should be read during programming and when you need specific information about a RAPID instruction, function or data type. Who should read this manual? This manual is intended for someone with some previous experience in programming, for example, a robot programmer. Prerequisites The reader should have some programming experience and have studied Operating manual - Introduction to RAPID Technical reference manual - RAPID overview

Organization of chapters The manual is organized in the following chapters:Chapter 1 Instructions 2 Functions 3 Data types 4 Programming type examples Contents Detailed descriptions of all RAPID base instructions, including examples of how to use them. Detailed descriptions of all RAPID base functions, including examples of how to use them. Detailed descriptions of all RAPID base data types, including examples of how to use them. A general view of how to write program code that contains different instructions/functions/data types. The chapter contains also programming tips and explanations.

ReferencesReference Document ID

Operating manual - Introduction to RAPID 3HAC029364-001 Technical reference manual - RAPID over- 3HAC16580-1 view Technical reference manual - RAPID kernel 3HAC16585-1

RevisionsRevision F Description 7th edition. RobotWare 5.10. New chapter added, 4 Programming type examples.

Continues on next page3HAC16581-1 Revision: N Copyright 2004-2012 ABB. All rights reserved. 15

Overview of this manualContinued

Revision G

Description 8th edition. RobotWare 5.11. New instructions, functions and data types are added. Also a new programming type example is added. 9th edition. RobotWare 5.12. New instructions, functions and data types are added. 10th edition. RobotWare 5.13. The following new instructions, functions and data types are added: TPReadNum - Reads a number from the FlexPendant on page 590 Type - Get the data type name for a variable on page 1089 UIDnumEntry - User Number Entry on page 1098 UIDnumTune - User Number Tune on page 1104 triggiosdnum - Positioning events, trigg on page 1283 Updated safety signal graphics for the levels Danger and Warning. 11th edition. RobotWare 5.14. The following new functions are added: AbsDnum - Gets the absolute value of a dnum on page 789 DnumToStr - Converts numeric value to string on page 880 GetServiceInfo - Get service information from the system on page 909 PowDnum - Calculates the power of a value on page 992 RoundDnum - Round a numeric value on page 1027 SqrtDnum - Calculates the square root value on page 1034 TruncDnum - Truncates a numeric value on page 1087 12th edition. RobotWare 5.14.02. Updates related to the stationary case and the relation of the different coordinate systems in the following data types: loaddata - Load data on page 1192 tooldata - Tool data on page 1270 Miscellaneous updates in the following instructions: GripLoad - Defines the payload for a robot on page 128 MechUnitLoad - Defines a payload for a mechanical unit on page 229 13th edition. RobotWare 5.14.03. Bit functions are added for dnum: BitAndDnum, BitCheckDnum, BitLshDnum, BitNegDnum, BitOrDnum, BitRshDnum, and BitXorDnum. Instructions BitClear and BitSet are updated to support dnum data. Total Load (TLoad) argument added to all movement instructions: MoveAbsJ, MoveC, MoveCDO, MoveCSync, MoveJ, MoveJDO, MoveJSync, MoveL, MoveLDO, MoveL, SyncSearchC, SearchL, TriggC, TriggJ, TriggL, TriggLIOs. A new error handler, ERR_SIG_NOT_VALID, is added to following I/O instructions: AOutput, DOutput, GInputDnum, GOutput, GOutputDnum, InvertDO, ProcErrRecovery, PulseDO, Reset, Set, SetDO, SetGO, WaitAI, WaitAO, WaitDI, WaitDO, WaitGI, WaitGO. GetSysData and SetSysData modified for new total load concept. 14th edition. RobotWare 5.15. Minor corrections Instructions SpeedLimAxis and SpeedLimCheckPoint are added

H J

K

L

M

N

16 Copyright 2004-2012 ABB. All rights reserved.

3HAC16581-1 Revision: N

1 Instructions1.1 AccSet - Reduces the acceleration

1 Instructions1.1 AccSet - Reduces the accelerationUsage AccSet is used when handling fragile loads. It allows slower acceleration and deceleration, which results in smoother robot movements. This instruction can only be used in the main task T_ROB1 or, if in a MultiMove system, in Motion tasks. Basic examples Basic examples of the instruction AccSet are illustrated below. Example 1AccSet 50, 100;

The acceleration is limited to 50% of the normal value. Example 2AccSet 100, 50;

The acceleration ramp is limited to 50% of the normal value. ArgumentsAccSet Acc Ramp

Acc Data type: num Acceleration and deceleration as a percentage of the normal values. 100% corresponds to maximum acceleration. Maximum value: 100%. Input value < 20% gives 20% of maximum acceleration. Ramp Data type: num The rate at which acceleration and deceleration increases as a percentage of the normal values. Jerking can be restricted by reducing this value. 100% corresponds to maximum rate. Maximum value: 100%. Input value < 10% gives 10% of maximum rate.

Continues on next page3HAC16581-1 Revision: N Copyright 2004-2012 ABB. All rights reserved. 17

1 Instructions1.1 AccSet - Reduces the acceleration Continued The figures show that reducing the acceleration results in smoother movements.

Ti

xx0500002146

Program execution The acceleration applies to both the robot and external axes until a new AccSet instruction is executed. The default values (100%) are automatically set SyntaxAccSet [ Acc ':=' ] < expression (IN) of num > ',' [ Ramp ':=' ] < expression (IN) of num > ';'

at a cold start. when a new program is loaded. when starting program execution from the beginning.

Related informationFor information about See

Control acceleration in world coordinate WorldAccLim - Control acceleration in world cosystem ordinate system on page 737 Reduce TCP acceleration along the path PathAccLim - Reduce TCP acceleration along the path on page 310 Positioning instructions Motion settings data Technical reference manual - RAPID overview motsetdata - Motion settings data on page 1202

18 Copyright 2004-2012 ABB. All rights reserved.

3HAC16581-1 Revision: N

1 Instructions1.2 ActEventBuffer - Activation of event buffer

1.2 ActEventBuffer - Activation of event bufferDescription ActEventBuffer is used to activate the use of the event buffer in current motion program task. The instructions ActEventBuffer and DeactEventBuffer should be used when combining an application using finepoints and a continuous application where signals needs to be set in advance due to slow process equipment. This instruction can only be used in the main task T_ROB1 or, if in a MultiMove system, in Motion tasks. Basic examples A basic example of the instruction ActEventBuffer is illustrated below. Example 1.. DeactEventBuffer; ! Use an application that uses finepoints, such as SpotWelding .. ! Activate the event buffer again ActEventBuffer; ! Now it is possible to use an application that needs ! to set signals in advance, such as Dispense ..

The DeactEventBuffer deactivates the configured event buffer. When using an application with finepoints, the start of the robot from the finepoint will be faster. When activating the event buffer with ActEventBuffer, it is possible to set signals in advance for an application with slow process equipment. Program execution The use of an event buffer applies for the next executed robot movement of any type, and is valid until a DeactEventBuffer instruction is executed. The instruction will wait until the robot and external axes has reached the stop point (ToPoint of current move instruction) before the activation of the event buffer. Therefore it is recommended to program the movement instruction preceding ActEventBuffer with a fine point. The default value (use event buffer = TRUE) is automatically set Limitations ActEventBuffer cannot be executed in a RAPID routine connected to any of the following special system events: PowerOn, Stop, QStop, Restart or Step. at a cold start-up. when a new program is loaded. when starting program execution from the beginning.

Continues on next page3HAC16581-1 Revision: N Copyright 2004-2012 ABB. All rights reserved. 19

1 Instructions1.2 ActEventBuffer - Activation of event buffer Continued SyntaxActEventBuffer ;

Related informationFor information about Deactivation of event buffer Configuration of Event preset time Motion settings data See DeactEventBuffer - Deactivation of event buffer on page 86 Technical reference manual - System parameters motsetdata - Motion settings data on page 1202

20 Copyright 2004-2012 ABB. All rights reserved.

3HAC16581-1 Revision: N

1 Instructions1.3 ActUnit - Activates a mechanical unit

1.3 ActUnit - Activates a mechanical unitUsage ActUnit is used to activate a mechanical unit. It can be used to determine which unit is to be active when, for example, common drive units are used. This instruction can only be used in the main task T_ROB1 or, if in a MultiMove system, in Motion tasks. Basic examples A basic example of the instruction ActUnit is illustrated below. Example 1ActUnit orbit_a;

Activation of the orbit_a mechanical unit. ArgumentsActUnit MechUnit

MechUnit Mechanical Unit Data type: mecunit The name of the mechanical unit that is to be activated. Program execution When the robots and external axes actual path is ready, the path on current path level is cleared and the specified mechanical unit is activated. This means that it is controlled and monitored by the robot. If several mechanical units share a common drive unit, activation of one of these mechanical units will also connect that unit to the common drive unit. Limitations If this instruction is preceded by a move instruction, that move instruction must be programmed with a stop point (zonedata fine), not a fly-by point, otherwise restart after power failure will not be possible. ActUnit cannot be executed in a RAPID routine connected to any of the following special system events: PowerOn, Stop, QStop, Restart, Reset or Step. It is possible to use ActUnit - DeactUnit on StorePath level, but the same mechanical units must be active when doing RestoPath as when StorePath was done. Such operation on the Path Recorder and the path on the base level will be intact, but the path on the StorePath level will be cleared. SyntaxActUnit [MechUnit ':=' ] < variable (VAR) of mecunit> ';'

Continues on next page3HAC16581-1 Revision: N Copyright 2004-2012 ABB. All rights reserved. 21

1 Instructions1.3 ActUnit - Activates a mechanical unit Continued Related informationFor information about Deactivating mechanical units Mechanical units More examples Path Recorder See DeactUnit - Deactivates a mechanical unit on page 88 mecunit - Mechanical unit on page 1200 DeactUnit - Deactivates a mechanical unit on page 88 PathRecMoveBwd - Move path recorder backwards on page 314

22 Copyright 2004-2012 ABB. All rights reserved.

3HAC16581-1 Revision: N

1 Instructions1.4 Add - Adds a numeric value

1.4 Add - Adds a numeric valueUsage Add is used to add or subtract a value to or from a numeric variable or persistent. Basic examples Basic examples of the instruction Add are illustrated below. Example 1Add reg1, 3;

3 is added to reg1, i.e. reg1:=reg1+3. Example 2Add reg1, -reg2;

The value of reg2 is subtracted from reg1, i.e. reg1:=reg1-reg2. Example 3VAR dnum mydnum:=5; Add mydnum, 500000000;

500000000 is added to mydnum, i.e. mynum:=mynum+500000000. Example 4VAR dnum mydnum:=5000; VAR num mynum:=6000; Add mynum, DnumToNum(mydnum \Integer);

5000 is added to mynum, i.e. mynum:=mynum+5000. You have to use DnumToNum to get a num numeric value that you can use together with the num variable mynum. ArgumentsAdd Name | Dname AddValue | AddDvalue

Name Data type: num The name of the variable or persistent to be changed. Dname Data type: dnum The name of the variable or persistent to be changed. AddValue Data type: num The value to be added. AddDvalue Data type: dnum The value to be added.

Continues on next page3HAC16581-1 Revision: N Copyright 2004-2012 ABB. All rights reserved. 23

1 Instructions1.4 Add - Adds a numeric value Continued Limitations If the value to be added is of the type dnum, and the variable/persistent that should be changed is a num, a runtime error will be generated. The combination of arguments is not possible (see Example 4 above how to solve this). SyntaxAdd [ | [ | Name ':=' ] < var or pers (INOUT) of [ Dname := ] < var or pers (INOUT) AddValue ':=' ] < expression (IN) of [ AddDvalue := ] < expression (IN) num > of dnum > , num > of dnum > ;

Related informationFor information about Incrementing a variable by 1 Decrementing a variable by 1 See Incr - Increments by 1 on page 140 Decr - Decrements by 1 on page 90

Changing data using an arbitrary expres- ":=" - Assigns a value on page 28 sion, e.g. multiplication

24 Copyright 2004-2012 ABB. All rights reserved.

3HAC16581-1 Revision: N

1 Instructions1.5 AliasIO - Define I/O signal with alias name

1.5 AliasIO - Define I/O signal with alias nameUsage AliasIO is used to define a signal of any type with an alias name or to use signals in built-in task modules. Signals with alias names can be used for predefined generic programs, without any modification of the program before running in different robot installations. The instruction AliasIO must be run before any use of the actual signal. See Basic examples on page 25 for loaded modules, and More examples on page 26 for installed modules. Basic examples A basic example of the instruction AliasIO is illustrated below. See also More examples on page 26. Example 1VAR signaldo alias_do; PROC prog_start() AliasIO config_do, alias_do; ENDPROC

The routine prog_start is connected to the START event in system parameters. The program defining digital output signal alias_do is connected to the configured digital output signal config_do at program start. ArgumentsAliasIO FromSignal ToSignal

FromSignal Data type: signalxx or string Loaded modules: The signal identifier named according to the configuration (data type signalxx) from which the signal descriptor is copied. The signal must be defined in the I/O configuration. Installed modules or loaded modules: A reference (CONST, VAR or parameter of these) containing the name of the signal (data type string) from which the signal descriptor after search in the system is copied. The signal must be defined in the I/O configuration. ToSignal Data type: signalxx The signal identifier according to the program (data type signalxx) to which the signal descriptor is copied. The signal must be declared in the RAPID program. The same data type must be used (or found) for the arguments FromSignal and ToSignal and must be one of type signalxx (signalai, signalao, signaldi, signaldo, signalgi, or signalgo).

Continues on next page3HAC16581-1 Revision: N Copyright 2004-2012 ABB. All rights reserved. 25

1 Instructions1.5 AliasIO - Define I/O signal with alias name Continued Program execution The signal descriptor value is copied from the signal given in argument FromSignal to the signal given in argument ToSignal. Error handling Following recoverable errors can be generated. The errors can be handled in an error handler. The system variable ERRNO will be set to:ERR_ALIASIO_DEF The FromSignal is not defined in the IO configuration or the ToSignal is not declared in the RAPID program or the ToSignal is defined in the IO configuration. The data types for the arguments FromSignal and ToSignal is not the same type.

ERR_ALIASIO_TYPE

More examples More examples of the instruction AliasIO are illustrated below. Example 1VAR signaldi alias_di; PROC prog_start() CONST string config_string := "config_di"; AliasIO config_string, alias_di; ENDPROC

The routine prog_start is connected to the START event in system parameters. The program defined digital input signal alias_di is connected to the configured digital input signal config_di (via constant config_string) at program start. Limitation When starting the program, the alias signal cannot be used until the AliasIO instruction is executed. Instruction AliasIOmust be placed either in the event routine executed at program start (event START) or in the program part executed after every program start (before use of the signal)

In order to prevent mistakes it is not recommended to use dynamic reconnection of an AliasIO signal to different physical signals. SyntaxAliasIO [ FromSignal ':=' ] < reference (REF) of anytype> ',' [ ToSignal ':=' ] < variable (VAR) of anytype> ';'

Related informationFor information about Input/Output instructions See Technical reference manual - RAPID overview

Input/Output functionality in general Technical reference manual - RAPID overview Configuration of I/O Technical reference manual - System parameters

Continues on next page26 Copyright 2004-2012 ABB. All rights reserved. 3HAC16581-1 Revision: N

1 Instructions1.5 AliasIO - Define I/O signal with alias name ContinuedFor information about Defining event routines Loaded/Installed task modules See Technical reference manual - System parameters Technical reference manual - System parameters

3HAC16581-1 Revision: N Copyright 2004-2012 ABB. All rights reserved.

27

1 Instructions1.6 ":=" - Assigns a value

1.6 ":=" - Assigns a valueUsage The := instruction is used to assign a new value to data. This value can be anything from a constant value to an arithmetic expression, e.g. reg1+5*reg3. Basic examples Basic examples of the instruction := are illustrated below. See also More examples on page 28. Example 1reg1 := 5;

reg1 is assigned the value 5. Example 2reg1 := reg2 - reg3;

reg1 is assigned the value that the reg2-reg3 calculation returns. Example 3counter := counter + 1;

counter is incremented by one. ArgumentsData := Value

Data Data type: All The data that is to be assigned a new value. Value Data type: Same as Data The desired value. More examples More examples of the instruction := are illustrated below. Example 1tool1.tframe.trans.x := tool1.tframe.trans.x + 20;

The TCP for tool1 is shifted 20 mm in the X-direction. Example 2pallet{5,8} := Abs(value);

An element in the pallet matrix is assigned a value equal to the absolute value of the value variable. Limitations The data (whose value is to be changed) must not be Continues on next page28 Copyright 2004-2012 ABB. All rights reserved. 3HAC16581-1 Revision: N

a constant a non-value data type.

1 Instructions1.6 ":=" - Assigns a value Continued The data and value must have similar (the same or alias) data types. Syntax(EBNF) ':=' ';' ::= | | |

Related informationFor information about Expressions Non-value data types Assigning an initial value to data See Technical reference manual - RAPID overview Technical reference manual - RAPID overview Operating manual - IRC5 with FlexPendant

3HAC16581-1 Revision: N Copyright 2004-2012 ABB. All rights reserved.

29

1 Instructions1.7 BitClear - Clear a specified bit in a byte or dnum data

1.7 BitClear - Clear a specified bit in a byte or dnum dataUsage BitClear is used to clear (set to 0) a specified bit in a defined byte data or dnum data. Basic examples Basic examples of the instruction BitClear are illustrated below. Example 1CONST num parity_bit := 8; VAR byte data1 := 130; BitClear data1, parity_bit;

Bit number 8 (parity_bit) in the variable data1 will be set to 0, e.g. the content of the variable data1 will be changed from 130 to 2 (integer representation). Bit manipulation of data type byte when using BitClear is illustrated in the figure below.

xx0500002147

Example 2CONST num parity_bit := 52; VAR dnum data2 := 2251799813685378; BitClear data2, parity_bit;

Bit number 52 (parity_bit) in the variable data2 will be set to 0, e.g. the content of the variable data2 will be changed from 2251799813685378 to 130 (integer

Continues on next page30 Copyright 2004-2012 ABB. All rights reserved. 3HAC16581-1 Revision: N

1 Instructions1.7 BitClear - Clear a specified bit in a byte or dnum data Continued representation). Bit manipulation of data type dnum when using BitClear is illustrated in the figure below.

BitPos 52

BitPos 1 data2 : 2251799813685378

Clear bit 52

data2 : 130

xx1200000014

ArgumentsBitClear BitData | DnumData BitPos

BitData Data type: byte The bit data, in integer representation, to be changed. DnumData Data type: dnum The dnum bit data, in integer representation, to be changed. BitPos Bit Position Data type: num The bit position (1-8) in the BitData, or bit position (1-52) in the DnumData, to be set to 0. Limitations The range for a data type byte is 0 - 255 decimal. The bit position is valid from 1 - 8 for data type byte. The range for a data type dnum is 0 - 4503599627370495 decimal. The bit position is valid from 1 - 52 for data type dnum. SyntaxBitClear [ BitData ':=' ] < var or pers (INOUT) of byte > | [ DnumData ':=' ] < var or pers (INOUT) of dnum > ',' [ BitPos ':=' ] < expression (IN) of num > ';'

Continues on next page3HAC16581-1 Revision: N Copyright 2004-2012 ABB. All rights reserved. 31

1 Instructions1.7 BitClear - Clear a specified bit in a byte or dnum data Continued Related informationFor information about See

Set a specified bit in a byte or dnum data BitSet - Set a specified bit in a byte or dnum data on page 33 Check if a specified bit in a byte data is set BitCheck - Check if a specified bit in a byte data is set on page 804

Check if a specified bit in a dnum data is BitCheckDnum - Check if a specified bit in a set dnum data is set on page 806 Other bit functions Technical reference manual - RAPID overview

32 Copyright 2004-2012 ABB. All rights reserved.

3HAC16581-1 Revision: N

1 Instructions1.8 BitSet - Set a specified bit in a byte or dnum data

1.8 BitSet - Set a specified bit in a byte or dnum dataUsage BitSet is used to set a specified bit to 1 in a defined byte data or dnum data. Basic examples Basic examples of the instruction BitSet are illustrated below. Example 1CONST num parity_bit := 8; VAR byte data1 := 2; BitSet data1, parity_bit;

Bit number 8 (parity_bit) in the variable data1 will be set to 1, e.g. the content of the variable data1 will be changed from 2 to 130 (integer representation). Bit manipulation of data type byte when using BitSet is illustrated in the figure below.

xx0500002148

Example 2CONST num parity_bit := 52; VAR dnum data2 := 130; BitSet data2, parity_bit;

Bit number 52 (parity_bit) in the variable data2 will be set to 1, e.g. the content of the variable data2 will be changed from 130 to 2251799813685378 (integer

Continues on next page3HAC16581-1 Revision: N Copyright 2004-2012 ABB. All rights reserved. 33

1 Instructions1.8 BitSet - Set a specified bit in a byte or dnum data Continued representation). Bit manipulation of data type dnum when using BitSet is illustrated in the figure below.

BitPos 52

BitPos 1 data2 : 130

Set bit 52

data2 : 2251799813685378

xx1200000015

ArgumentsBitSet BitData | DnumData BitPos

BitData Data type: byte The bit data, in integer representation, to be changed. DnumData Data type: dnum The bit data, in integer representation, to be changed. BitPos Bit Position Data type: num The bit position (1-8) in the BitData, or bit position (1-52) in the DnumData, to be set to 1. Limitations The range for a data type byte is integer 0 - 255. The bit position is valid from 1 - 8 for data type byte. The range for a data type dnum is integer 0 - 4503599627370495. The bit position is valid from 1 - 52 for data type dnum. SyntaxBitSet [ BitData':=' ] < var or pers (INOUT) of byte > | [ DnumData':=' ] < var or pers (INOUT) of dnum > ',' [ BitPos':=' ] < expression (IN) of num > ';'

Continues on next page34 Copyright 2004-2012 ABB. All rights reserved. 3HAC16581-1 Revision: N

1 Instructions1.8 BitSet - Set a specified bit in a byte or dnum data Continued Related informationFor information about Clear a specified bit in a byte or dnum data Check if a specified bit in a byte data is set See BitClear - Clear a specified bit in a byte or dnum data on page 30 BitCheck - Check if a specified bit in a byte data is set on page 804

Check if a specified bit in a dnum data is set BitCheckDnum - Check if a specified bit in a dnum data is set on page 806 Other bit functions Technical reference manual - RAPID overview

3HAC16581-1 Revision: N Copyright 2004-2012 ABB. All rights reserved.

35

1 Instructions1.9 BookErrNo - Book a RAPID system error number

1.9 BookErrNo - Book a RAPID system error numberUsage BookErrNois used to book a new RAPID system error number. Basic examples A basic example of the instruction BookErrNo is illustrated below. Example 1! Introduce a new error number in a glue system ! Note: The new error variable must be declared with the initial value -1 VAR errnum ERR_GLUEFLOW := -1; ! Book the new RAPID system error number BookErrNo ERR_GLUEFLOW;

The variable ERR_GLUEFLOW will be assigned to a free system error number for use in the RAPID code.! Use the new error number IF di1 = 0 THEN RAISE ERR_GLUEFLOW; ELSE ... ENDIF ! Error handling ERROR IF ERRNO = ERR_GLUEFLOW THEN ... ELSE ... ENDIF

If the digital input di1 is 0, the new booked error number will be raised and the system error variable ERRNO will be set to the new booked error number. The error handling of those user generated errors can then be handled in the error handler as usual. ArgumentsBookErrNo ErrorName

ErrorName Data type: errnum The new RAPID system error variable name. Limitations The new error variable must not be declared as a routine variable. The new error variable must be declared with an initial value of -1, that gives the information that this error should be a RAPID system error. Continues on next page36 Copyright 2004-2012 ABB. All rights reserved. 3HAC16581-1 Revision: N

1 Instructions1.9 BookErrNo - Book a RAPID system error number Continued SyntaxBookErrNo [ ErrorName ':='] < variable (VAR) of errnum > ';'

Related informationFor information about Error handling Error number Call an error handler See Technical reference manual - RAPID overview errnum - Error number on page 1168 RAISE - Calls an error handler on page 349

3HAC16581-1 Revision: N Copyright 2004-2012 ABB. All rights reserved.

37

1 Instructions1.10 Break - Break program execution

1.10 Break - Break program executionUsage Break is used to make an immediate break in program execution for RAPID program code debugging purposes. The robot movement is stopped at once. Basic examples A basic example of the instruction Break is illustrated below. Example 1... Break; ...

Program execution stops and it is possible to analyze variables, values etc. for debugging purposes. Program execution The instruction stops program execution at once, without waiting for the robot and external axes to reach their programmed destination points for the movement being performed at the time. Program execution can then be restarted from the next instruction. If there is a Break instruction in some routine event, the execution of the routine will be interrupted and no STOP routine event will be executed. The routine event will be executed from the beginning the next time the same event occurs. SyntaxBreak';'

Related informationFor information about Stopping for program actions Stopping after a fatal error Terminating program execution Only stopping robot movements See Stop - Stops program execution on page 537 EXIT - Terminates program execution on page 113 EXIT - Terminates program execution on page 113 StopMove - Stops robot movement on page 542

38 Copyright 2004-2012 ABB. All rights reserved.

3HAC16581-1 Revision: N

1 Instructions1.11 CallByVar - Call a procedure by a variable

1.11 CallByVar - Call a procedure by a variableUsage CallByVar (Call By Variable) can be used to call procedures with specific names, e.g. proc_name1, proc_name2, proc_name3 ... proc_namex via a variable. Basic examples A basic example of the instruction CallByVar is illustrated below. See also More examples on page 39. Example 1reg1 := 2; CallByVar "proc", reg1;

The procedure proc2 is called. ArgumentsCallByVar Name Number

Name Data type: string