Navigation

  • Page 1

    FANUC Robotics SYSTEMR-30iA Controller KARELReference ManualMARRCRLRF04071E REV BApplies to Version 7.30© 2007FANUC Robotics America, Inc.

  • Page 2

  • Page 3

    About This ManualThis manual can be used with controllers labeled R-30iAorR-J3iC. If you have a controller labeledR-J3iC, youshouldreadR-30iAasR-J3iC throughout this manual.Copyrights and TrademarksThis new publication contains proprietary information of FANUC Robotics America, Inc. furnishedfor ...

  • Page 4

    About This ManualMARRCRLRF04071E REV BWarningThis equipment generates, uses, and can radiate radio frequency energyand if not installed and used in accordance with the instruction manual,may cause interference to radio communications. As temporarilypermitted by regulation, it has not been tested ...

  • Page 5

    MARRCRLRF04071E REV BAbout This ManualPaintPro™, PaintTool 100™, PAINTWorks™, PAINTWorks II™, PAINTWorks III™, PalletMate™,PalletMate PC™, PalletTool PC™, PayloadID™, RecipTool™, RemovalTool™, Robo Chop™, RoboSpray™, S-420i™, S-430i™, ShapeGen™, SoftFloat™, SOFT ...

  • Page 6

    About This ManualMARRCRLRF04071E REV B6,970,802 7,038,165 7,069,808 7,08,4900 7,092,791 7,131,848 7,133,747 7,143,100 7,149,6027,161,321 7,171,041 7,174,234 7,173,213 7,177,722 7,177,439 7,181,294 7,181,313VersaBell, ServoBell and SpeedDock Patents Pending.ConventionsThis manual includes informat...

  • Page 7

    Contents 3,About 3,This 3,Manual................................................................................................................................ 3,i 29,Safety............................................................................................................................

  • Page 8

    ContentsMARRCRLRF04071E REV B 76,3.1 76,EXPRESSIONS 76,AND 76,ASSIGNMENTS................................................................................ 76,3–2 76,3.1.1 76,Rule 76,for 76,Expressions 76,and 76,Assignments......................................................................

  • Page 9

    MARRCRLRF04071E REV BContents 138,7.3 138,OPEN 138,FILE 138,STATEMENT................................................................................................. 138,7–4 139,7.3.1 139,Setting 139,File 139,and 139,Port 139,Attributes......................................................

  • Page 10

    ContentsMARRCRLRF04071E REV B 223,9.2 223,FILE 223,SPECIFICATION...................................................................................................... 223,9–3 223,9.2.1 223,Device 223,Name 223,......................................................................................

  • Page 11

    MARRCRLRF04071E REV BContents 295,Chapter 295,11 295,SYSTEM 295,VARIABLES............................................................................................... 295,11–1 296,11.1 296,ACCESS 296,RIGHTS......................................................................................

  • Page 12

    ContentsMARRCRLRF04071E REV B 345,Appendix 345,A 345,KAREL 345,LANGUAGE 345,ALPHABETICAL 345,DESCRIPTION............................................... 345,A–1 353,A.1 353,OVERVIEW 353,............................................................................................................

  • Page 13

    MARRCRLRF04071E REV BContents 403,A.4.18 403,%CMOSVARS 403,Translator 403,Directive................................................................................... 403,A–59 404,A.4.19 404,%CMOS2SHADOW 404,Translator 404,Directive.............................................................

  • Page 14

    ContentsMARRCRLRF04071E REV B 453,A.5.16 453,DET_WINDOW 453,Built-In 453,Procedure................................................................................. 453,A–109 453,A.5.17 453,DISABLE 453,CONDITION 453,Action........................................................................

  • Page 15

    MARRCRLRF04071E REV BContents 513,A.8.25 513,GET_VAR 513,Built-In 513,Procedure......................................................................................... 513,A–169 517,A.8.26 517,GO 517,TO 517,Statement............................................................................

  • Page 16

    ContentsMARRCRLRF04071E REV B 576,A.14.13 576,MSG_CONNECT 576,Built-In 576,Procedure............................................................................... 576,A–232 578,A.14.14 578,MSG_DISCO 578,Built-In 578,Procedure...................................................................

  • Page 17

    MARRCRLRF04071E REV BContents 626,A.19.2 626,READ_DICT 626,Built-In 626,Procedure...................................................................................... 626,A–282 627,A.19.3 627,READ_DICT_V 627,Built-In-Procedure...................................................................

  • Page 18

    ContentsMARRCRLRF04071E REV B 679,A.20.36 679,SET_VAR 679,Built-In 679,Procedure.......................................................................................... 679,A–335 682,A.20.37 682,%SHADOWVARS 682,Translator 682,Directive........................................................

  • Page 19

    MARRCRLRF04071E REV BContents 726,A.25.2 726,XML_GETDATA 726,Built-In 726,Procedure................................................................................ 726,A–382 727,A.25.3 727,XML_REMTAG 727,Built-In 727,Procedure...................................................................

  • Page 20

    ContentsMARRCRLRF04071E REV B 839,C.17 839,DELETE 839,NODE 839,command................................................................................................ 839,C–13 839,C.18 839,DELETE 839,VARIABLE 839,command.......................................................................

  • Page 21

    MARRCRLRF04071E REV BContents 858,C.58 858,SAVE 858,VARS 858,command.................................................................................................... 858,C–32 859,C.59 859,SET 859,BREAK 859,CONDITION 859,command..............................................................

  • Page 22

    ContentsMARRCRLRF04071E REV B 876,C.99 876,STEP 876,ON 876,command........................................................................................................ 876,C–50 876,C.100 876,TRANSLATE 876,command...............................................................................

  • Page 23

    51,List 51,of 51,Figures 51,Figure 51,1–1. 51,Controller 51,Memory............................................................................................................ 51,1–9 53,Figure 53,1–2. 53,R-30iA 53,Controller.................................................................

  • Page 24

    ContentsMARRCRLRF04071E REV B 281,Figure 281,10–3. 281,CRT/KB 281,Form 281,Screen..................................................................................................... 281,10–31 283,Figure 283,10–4. 283,Dictionary 283,Compressor 283,and 283,Form 283,Dictionary 283,Fil...

  • Page 25

    56,List 56,of 56,Tables 56,Table 56,2–1. 56,ASCII 56,Character 56,Set.......................................................................................................... 56,2–2 57,Table 57,2–2. 57,Multinational 57,Character 57,Set..................................................

  • Page 26

    ContentsMARRCRLRF04071E REV B 137,Table 137,7–1. 137,Predefined 137,File 137,Variables.................................................................................................... 137,7–3 139,Table 139,7–2. 139,Predefined 139,Attribute 139,Types.....................................

  • Page 27

    MARRCRLRF04071E REV BContents 327,Table 327,13–6. 327,Ports 327,P1 327,- 327,P4 327,................................................................................................................. 327,13–23 327,Table 327,13–7. 327,Default 327,Communications 327,Settings 327,for 327...

  • Page 28

  • Page 29

    SafetyFANUC Robotics is not and does not represent itself as an expert in safety systems, safety equipment, orthe specific safety aspects of your company and/or its work force. It is the responsibility of the owner,employer, or user to take all necessary steps to guarantee the safety of all perso...

  • Page 30

    SafetyMARRCRLRF04071E REV B• People• External devices• Robot(s)• Tooling• WorkpieceUsing Safety Enhancing DevicesAlways give appropriate attention to the work area that surrounds the robot. The safety of the workarea can be enhanced by the installation of some or all of the following de...

  • Page 31

    MARRCRLRF04071E REV BSafety• Clearly identify the work envelope of each robot in the system with floor markings, signs, andspecial barriers. The work envelope is the area defined by the maximum motion range of therobot, including any tooling attached to the wrist flange that extend this range....

  • Page 32

    SafetyMARRCRLRF04071E REV BStaying Safe While Teaching or Manually Operating the RobotAdvise all personnel who must teach the robot or otherwise manually operate the robot to observe thefollowing rules:• Never wear watches, rings, neckties, scarves, or loose clothing that could get caught in mo...

  • Page 33

    MARRCRLRF04071E REV BSafetyStaying Safe During Automatic OperationAdvise all personnel who operate the robot during production to observe the following rules:• Make sure all safety provisions are present and active.• Know the entire workcell area. The workcell includes the robot and its work ...

  • Page 34

    SafetyMARRCRLRF04071E REV BStaying Safe During MaintenanceWhen performing maintenance on your robot system, observe the following rules:• Never enter the work envelope while the robot or a program is in operation.• Before entering the work envelope, visually inspect the workcell to make sure ...

  • Page 35

    MARRCRLRF04071E REV BSafety• Make sure personnel cannot get trapped between the moving robot and other equipment. Knowthe path that can be used to escape from a moving robot. Make sure the escape route is neverblocked.• Use blocks, mechanical stops, and pins to prevent hazardous movement by t...

  • Page 36

    SafetyMARRCRLRF04071E REV BMechanical Safety PrecautionsImplement the following mechanical safety measures to prevent damage to machine tools and otherexternal devices.• Make sure the workcell is clean and free of oil, water, and debris.• Use software limits, limit switches, and mechanical ha...

  • Page 37

    MARRCRLRF04071E REV BSafetyADDITIONAL SAFETY CONSIDERATIONS FOR PAINT ROBOTINSTALLATIONSProcess technicians are sometimes required to enter the paint booth, for example, during daily orroutine calibration or while teaching new paths to a robot. Maintenance personal also must workinside the paint ...

  • Page 38

    SafetyMARRCRLRF04071E REV BThis section provides information about the safety features that are included in the paint system andalso explains the way the robot interacts with other equipment in the system.The paint system includes the following safety features:• Most paint booths have red warni...

  • Page 39

    MARRCRLRF04071E REV BSafetyWarningNever bypass, strap, or otherwise deactivate a safety device, such as alimit switch, for any operational convenience. Deactivating a safety deviceis known to have resulted in serious injury and death.WarningEnclosures shall not be opened unless the area is know t...

  • Page 40

    SafetyMARRCRLRF04071E REV BSpecial Precautions for Combustible Dusts (powder paint)When the robot is used in a location where combustible dusts are found, such as the application ofpowder paint, the following special precautions are required to insure that there are no combustibledusts inside the...

  • Page 41

    MARRCRLRF04071E REV BSafety• High Voltage : High voltage should only be on during actual spray operations. Voltage should beoff when the painting process is completed. Never leave high voltage on during a cap cleaningprocess.• Avoid any accumulation of combustible vapors or coating matter.•...

  • Page 42

    SafetyMARRCRLRF04071E REV B— Follow the Original Equipment Manufacturer’s Material Safety Data Sheets.• When using paint remover observe the following:— Eye protection, protective rubber gloves, boots, and apron are required during booth cleaning.— Adequate ventilation is required. Over...

  • Page 43

    Chapter 1KAREL LANGUAGE OVERVIEWContents 43,Chapter 43,1 43,KAREL 43,LANGUAGE 43,OVERVIEW............................................................ 43,1–1 44,1.1 44,OVERVIEW 44,................................................................................................ 44,1–2 44,1.2 ...

  • Page 44

    1. KAREL LANGUAGE OVERVIEWMARRCRLRF04071E REV B1.1 OVERVIEWFANUC Robotics’ KAREL system consists of a robot, a controller, and system software. Itaccomplishes industrial tasks using programs written in the KAREL programming language. KARELcan direct robot motion, control and communicate with re...

  • Page 45

    MARRCRLRF04071E REV B1. KAREL LANGUAGE OVERVIEWp-code program can be loaded onto the controller using the KAREL Command Language (KCL),orthe FILE menu.During loading, the system will create any required variables that are not in RAM and set themuninitialized. When you run the program, the KAREL i...

  • Page 46

    1. KAREL LANGUAGE OVERVIEWMARRCRLRF04071E REV B1.2.2 Creating a ProgramYou can create a KAREL program using an off-line editor such as OLPC PRO or any text editor suchas WordPad. The resulting file is called the source file or source code.1.2.3 Translating a ProgramKAREL source files must be tran...

  • Page 47

    MARRCRLRF04071E REV B1. KAREL LANGUAGE OVERVIEWThe following limits apply to the number and size of KAREL programs that can be loaded:• Number of programs is limited to 2704 or available RAM.• Number of variables per program is limited to 2704 or available RAM.1.2.5 Executing a ProgramAfter y...

  • Page 48

    1. KAREL LANGUAGE OVERVIEWMARRCRLRF04071E REV Bdeclaration sections of the program. BEGIN and END mark the executable section. Reserved wordsare described in 59,Section 59,2.1.3 .The PROGRAM statement, which identifies the program, must be the first statement in any KARELprogram. The PROGRAM st...

  • Page 49

    MARRCRLRF04071E REV B1. KAREL LANGUAGE OVERVIEWThis section provides an overview of the supported system software and robot models.Hardware topics are covered in greater detail in the Maintenance Manual specific for your robotand controller model.1.3.1 Software ComponentsR-30iA system software is...

  • Page 50

    1. KAREL LANGUAGE OVERVIEWMARRCRLRF04071E REV BController electronics includes a central processing unit (CPU), several types of memory, aninput/output (I/O) system, and user interface devices. A cabinet houses the controller electronics andthe ports to which remote user interface devices and oth...

  • Page 51

    MARRCRLRF04071E REV B1. KAREL LANGUAGE OVERVIEWThe TPP memory pool (used for teach pendant programs) is allocated from PERM. KAREL programscan designate variables to be stored in CMOS. A portion of SRAM memory can be defined as auser storage device called RAM Disk (RD:).Flash memory (FROM)FROM me...

  • Page 52

    1. KAREL LANGUAGE OVERVIEWMARRCRLRF04071E REV B• Memory card• Ethernet via FTP• USB Memory Stick1.4.2 Input/Output SystemThe controller can support a modular I/O structure, allowing you to add I/O boards as required byyour application. Both digital and analog input and output modules are su...

  • Page 53

    MARRCRLRF04071E REV B1. KAREL LANGUAGE OVERVIEWFigure 1–2.R-30iA ControllerTeach pendantOperator panelMode switchRS-232 Serial ConnectionThe CRT/KB is a software option on the controller that allows an external terminal such as a PCrunning TelNet to display a Menu System that lookssimilartothe ...

  • Page 54

  • Page 55

    Chapter 2LANGUAGE ELEMENTSContents 55,Chapter 55,2 55,LANGUAGE 55,ELEMENTS........................................................................ 55,2–1 56,2.1 56,LANGUAGE 56,COMPONENTS...................................................................... 56,2–2 56,2.1.1 56,Character 56,...

  • Page 56

    2. LANGUAGE ELEMENTSMARRCRLRF04071E REV BThe KAREL language provides the elements necessary for programming effective roboticsapplications. This chapter lists and describes each of the components of the KAREL language, theavailable translator directives and the available data types.2.1 LANGUAGE C...

  • Page 57

    MARRCRLRF04071E REV B2. LANGUAGE ELEMENTSTable 2–1.ASCII Character Set (Cont’d)Symbols@ <>= /*+-_,; : . # $ ’ []()&%{}Special Charactersblank or spaceform feed (treated as new line)tab (treated as a blank space)The following rules are applicable for the ASCII character set:• Bla...

  • Page 58

    2. LANGUAGE ELEMENTSMARRCRLRF04071E REV BTable 2–2.Multinational Character Set (Cont’d)ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÑÒÓÔÕÖŒØÙÚÛÜYßàáâãäåæçèéêëìíîïñòóôõöœSpecial CharactersøùúûüÿTable 2–3.Graphics Character SetLettersAB CD EFGH IJKLMN OPQRS T UV W...

  • Page 59

    MARRCRLRF04071E REV B2. LANGUAGE ELEMENTS2.1.2 OperatorsKAREL provides operators for standard arithmetic operations, relational operations, and Boolean(logical) operations. KAREL also includes special operators that can be used with positional andVECTOR data types as operands. 59,Table 59,2–4 ...

  • Page 60

    2. LANGUAGE ELEMENTSMARRCRLRF04071E REV BTable 2–6.Reserved Word ListABORTCONSTGET_VARNOPAUSESTOPABOUTCONTINUEGONOTSTRINGABSCOORDINATEDGOTONOWAITSTRUCTUREAFTERCRGROUPOFTHENALONGDELAYGROUP_ASSOCOPENTIMEALSODISABLEHANDORTIMERANDDISCONNECTHOLDPATHTOARRAYDIVIFPATHHEADERTPENABLEARRAY_LENDOINPAUSETYP...

  • Page 61

    MARRCRLRF04071E REV B2. LANGUAGE ELEMENTS2.1.4 User-Defined IdentifiersUser-defined identifiers represent constants, data types, statement labels, variables, routine names,and program names. Identifiers• Start with a letter• Can include letters, digits, and underscores• Can have a maximum o...

  • Page 62

    2. LANGUAGE ELEMENTSMARRCRLRF04071E REV B2.1.6 Predefined IdentifiersPredefined identifiers within the KAREL language have a predefined meaning. These can beconstants, types, variables, or built-in routine names. 62,Table 62,2–7 and 62,Table 62,2–8 list the predefinedidentifiers along wit...

  • Page 63

    MARRCRLRF04071E REV B2. LANGUAGE ELEMENTSTable 2–8.Port and File Predefined Identifier Summary (Cont’d)Predefined IdentifierTypeTPIN (Teach pendant input)TPOUT (Teach pendant output)RDI (Robot digital input)RDO (Robot digital output)OPIN (Operator panel input)OPOUT (Operator panel output)WDI ...

  • Page 64

    2. LANGUAGE ELEMENTSMARRCRLRF04071E REV Bcomments from 65,%INCLUDE 65,Directive 65,in 65,a 65,KAREL 65,Program 65,and 66,Include 66,File 66,mover_decs fora KAREL Program .Comments From Within a Program--This program, called mover, picks up 10 objects--from an original POSITION and puts ...

  • Page 65

    MARRCRLRF04071E REV B2. LANGUAGE ELEMENTSTable 2–9.Translator Directives (Cont’d)DirectiveDescription%CRTDEVICESpecifies that the CRT/KB user window will be the default in the READand WRITE statements instead of the TPDISPLAY window.%DEFGROUP = nSpecifies the default motion group to be used b...

  • Page 66

    2. LANGUAGE ELEMENTSMARRCRLRF04071E REV B-- called mover_decs containing declarationsBEGIN$SPEED = 200.0$MOTYPE = LINEAROPEN HAND gripper-- Loop to move total number of objectsFOR count=1TO num_of_parts DOMOVE TO originalCLOSE HAND gripperMOVE TO destinationOPEN HAND gripperENDFOR-- End of loopEN...

  • Page 67

    MARRCRLRF04071E REV B2. LANGUAGE ELEMENTS— Cannot include itself 67,Table 67,2–10 lists the simple and structured data types available in KAREL. User-defined data typesare described in 67,Section 67,2.4 .Table 2–10.Simple and Structured Data TypesSimpleStructuredBOOLEANARRAY OF BYTEJOINT...

  • Page 68

    2. LANGUAGE ELEMENTSMARRCRLRF04071E REV BUser-defined data types can be defined as structures, consisting of several KAREL variable data types.The continuation character, "&", can be used to continue a declaration on a new line. 68,User-Defined 68,Data 68,Type 68,Example 68,show...

  • Page 69

    MARRCRLRF04071E REV B2. LANGUAGE ELEMENTSRestrictionsA user-defined data type cannot• Include itself• Include any type that includes it, either directly or indirectly• Be declared within a routine2.4.2 User-Defined Data StructuresA structure is used to store a collection of information that...

  • Page 70

    2. LANGUAGE ELEMENTSMARRCRLRF04071E REV B• Access elements of a data type defined as a structure from the CRT/KB and at the teach pendant.• Define a range of executable statements in which fields of a STRUCTURE type variable canbe accessed without repeating the name of the variable. See 70,D...

  • Page 71

    MARRCRLRF04071E REV B2. LANGUAGE ELEMENTSbigs_field_2:STRUCTUREsubs_field_1:INTEGERsubs_field_2:BOOLEANENDSTRUCTUREENDSTRUCTURE—PATH types— FILE types— VISION types— Variable length arrays— The data structure itself, or any type that includes it, either directly or indirectly— Any str...

  • Page 72

    2. LANGUAGE ELEMENTSMARRCRLRF04071E REV BYou can access elements of these arrays in a KAREL program, from the CRT/KB, and from theteach pendant.In addition, you can define two types of arrays:• Multi-dimensional arrays• Variable-sized arrays2.5.1 Multi-Dimensional ArraysMulti-dimensional arra...

  • Page 73

    MARRCRLRF04071E REV B2. LANGUAGE ELEMENTSROUTINE array_user (array_param:ARRAY [*,*] OF INTEGER)The following are equivalent:ROUTINE rtn_name(array_param:ARRAY[*] OF INTEGER)andROUTINE rtn_name(array_param:ARRAY OF INTEGER)• Access elements with KCL commands and the teach pendant.• Save and l...

  • Page 74

    2. LANGUAGE ELEMENTSMARRCRLRF04071E REV B2.5.2 Variable-Sized ArraysVariable-sized arrays are arrays whose actual size is not known, and that differ from one use of theprogram to another. Variable-sized arrays allow you to write KAREL programs without establishingdimensions of the array variables...

  • Page 75

    Chapter 3USE OF OPERATORSContents 75,Chapter 75,3 75,USE 75,OF 75,OPERATORS............................................................................ 75,3–1 76,3.1 76,EXPRESSIONS 76,AND 76,ASSIGNMENTS........................................................ 76,3–2 76,3.1.1 76,Rule 76,f...

  • Page 76

    3. USE OF OPERATORSMARRCRLRF04071E REV BThis chapter describes how operators are used with other language elements to perform operationswithin a KAREL application program. Expressions and assignments, which are program statementsthat include operators and operands, are explained first. Next, the ...

  • Page 77

    MARRCRLRF04071E REV B3. USE OF OPERATORSTable 3–1.Summary of Operation Result TypesOperator+-*/DIVMOD<>,>=<=,<, >, =>=<AND ORNOT#@:Types of OperatorsINTEGERIIIRIB−I−−−REALRRRR−B−−−−−Mixed**INTEGER-REALRRRR−B−−−−−BOOLEAN−−−−−B−B...

  • Page 78

    3. USE OF OPERATORSMARRCRLRF04071E REV B3.1.3 Variables and ExpressionsAssignment statements contain variables and expressions. The variables can be any user-definedvariable, a system variable with write access, or an output port array with write access. The expressioncan be any valid KAREL expre...

  • Page 79

    MARRCRLRF04071E REV B3. USE OF OPERATORSTable 3–2.KAREL OperatorsOperationOperatorArithmetic+-*/DIVMODRelational<<==<>>=>BooleanANDORNOTSpecial>= <:#@3.2.1 Arithmetic OperationsThe addition (+), subtraction (-), and multiplication (*) operators, along with the DIV and MO...

  • Page 80

    3. USE OF OPERATORSMARRCRLRF04071E REV BTable 3–5.Arithmetic Operations Using Bitwise OperandsEXPRESSIONBINARY EQUIVALENTRESULT5AND 85OR80101 AND 10000101 OR 10000000 = 01101 = 13-4 AND 8-4 OR 81100 AND 10001100 OR 10001000 = 81100 = -4NOT 5NOT -15NOT 0101NOT 1100011010 = -6*1110 = 14**Because ...

  • Page 81

    MARRCRLRF04071E REV B3. USE OF OPERATORSThe relational operators function with INTEGER and REAL operands to evaluate standardmathematical equations. Refer to 81,Table 81,3–7 .NotePerforming equality (=) or inequality (<>) tests between REAL values might not yield theresults you expect. ...

  • Page 82

    3. USE OF OPERATORSMARRCRLRF04071E REV BTable 3–8.BOOLEAN Operation SummaryOPERATOROPERAND 1OPERAND 2RESULTTRUE−FALSENOTFALSE−TRUETRUETRUEFALSETRUETRUEORFALSEFALSEFALSETRUETRUETRUEFALSETRUEANDFALSEFALSEFALSETable 3–9.BOOLEAN Operations Using AND, OR, and NOT OperatorsEXPRESSIONRESULTDIN[1...

  • Page 83

    MARRCRLRF04071E REV B3. USE OF OPERATORS• The relational operator (>=<) is allowed only in normal program use and cannot be used as acondition in a condition handler statement.In the following example the relational operator (>=<) is used to determine if the current robotposition (d...

  • Page 84

    3. USE OF OPERATORSMARRCRLRF04071E REV BFigure 3–1.Determining w_handle Relative to WORLD Framew_handle = bolt : b_handle(world (world (bumper frame) frame) frame)bolt is the position of the BUMPER frame origin referenced in the WORLD frame.w_handle is the handle position referenced i...

  • Page 85

    MARRCRLRF04071E REV B3. USE OF OPERATORSFigure 3–2.Determining b_handle Relative to BUMPER Frameb_handle = INV(bolt) : w_handle(bumper (bumper (world frame) frame) frame)INV(bolt) is the position of the WORLD frame origin referenced in the BUMPER frame.w_handle is the handle pos...

  • Page 86

    3. USE OF OPERATORSMARRCRLRF04071E REV B• The multiplication (*) and division (/) operators can be used with either— A VECTOR and an INTEGER operand— A VECTOR and a REAL operandThe product of a VECTOR and an INTEGER or a VECTOR and a REAL is a scaled versionof the VECTOR. Each component of ...

  • Page 87

    MARRCRLRF04071E REV B3. USE OF OPERATORSTable 3–10.Examples of Vector OperationsEXPRESSIONRESULTVEC(3.0,7.0,6.0) + VEC(12.6,3.2,7.5)(15.6,10.2,13.5)VEC(7.6,9.0,7.0) - VEC(14.0,3.5,17.0)(-6.4,5.5,-10)4.5 * VEC(3.2,7.6,4.0)(14.4,34.2,18.0)VEC(12.7,2.0,8.3) * 7.6(96.52,15.2,63.08)VEC(17.3,1.5,0.23...

  • Page 88

    3. USE OF OPERATORSMARRCRLRF04071E REV B• During STRING assignment, the string will be truncated if the target string is not large enough tohold the same string.• You can compare or extract a character from a string. For example if string_1 = ‘ABCDE’ . Youroutput would be ‘D’ .See 88...

  • Page 89

    Chapter 4MOTION AND PROGRAM CONTROLContents 89,Chapter 89,4 89,MOTION 89,AND 89,PROGRAM 89,CONTROL..................................................... 89,4–1 90,4.1 90,OVERVIEW 90,................................................................................................ 90,4–2 90,4...

  • Page 90

    4. MOTION AND PROGRAM CONTROLMARRCRLRF04071E REV B4.1 OVERVIEWThe KAREL language provides several motion control statements that direct the movement of thetool center point or the auxiliary axes. Optional clauses used in conjunction with the motion controlstatements specify motion characteristics...

  • Page 91

    MARRCRLRF04071E REV B4. MOTION AND PROGRAM CONTROL• MOVE AWAY - allows you to specify a destination that is AWAY from the current position ofthe group of axes, using a REAL value for the offset distance. The specified offset is measured inmillimeters along the negative z-axis of the tool coordi...

  • Page 92

    4. MOTION AND PROGRAM CONTROLMARRCRLRF04071E REV B• HOLD - causes all robot and auxiliary axes to decelerate to a stop. HOLD also prevents motionfrom being started or resumed by any KAREL motion statement or condition handler actionother than UNHOLD.See Also: 345,Appendix 345,A for more detai...

  • Page 93

    MARRCRLRF04071E REV B4. MOTION AND PROGRAM CONTROL• Agroup is kinematic if there is a correspondence between the position in Cartesian space andthe joint angles.CautionIf you add a second motion group to a system, and there are KARELprograms currently loaded that reference the $xxx_GRP system v...

  • Page 94

    4. MOTION AND PROGRAM CONTROLMARRCRLRF04071E REV B4.3.2 Looping Control StatementsA looping control structure allows you to specify that a set of statements be repeated an arbitrarynumber of times, based on the value of data items in the program. KAREL supports three loopingcontrol structures:•...

  • Page 95

    MARRCRLRF04071E REV B4. MOTION AND PROGRAM CONTROL• PAUSE - causes execution to be suspended until a CONTINUE operation is executed.• WAIT FOR - causes execution to be suspended until a specified condition or list of conditions issatisfied.See Also: ABORT Statement, DELAY Statement, PAUSE Sta...

  • Page 96

  • Page 97

    Chapter 5ROUTINESContents 97,Chapter 97,5 97,ROUTINES 97,............................................................................................. 97,5–1 98,5.1 98,ROUTINE 98,EXECUTION.............................................................................. 98,5–2 98,5.1.1 98,Decla...

  • Page 98

    5. ROUTINESMARRCRLRF04071E REV BRoutines, similar in structure to a program, provide a method of modularizing KAREL programs.Routines can include VAR and/or CONST declarations and executable statements. Unlike programs,however, a routine must be declared within an upper case program, and cannot i...

  • Page 99

    MARRCRLRF04071E REV B5. ROUTINES• Routines that are local to the program are completely defined in the program. Declarationsof local routines include:— The ROUTINE statement— Any VAR and/or CONST declarations for the routine— The executable statements of the routine• While the VAR and C...

  • Page 100

    5. ROUTINESMARRCRLRF04071E REV BLocal and External Procedure DeclarationsPROGRAM procs_libROUTINE wait_a_bit--local procedure, no parametersBEGINDELAY 20END wait_a_bitROUTINE move_there(p: POSITION)--local procedure, one parameterBEGINMOVE TO p--reference to parameter pEND move_thereROUTINE calc_...

  • Page 101

    MARRCRLRF04071E REV B5. ROUTINES5.1.2 Invoking RoutinesRoutines that are declared in a program can be called within the executable section of the program, orwithin the executable section of any routine contained in the program. Calling a routine causes theroutine to be invoked. A routine is invok...

  • Page 102

    5. ROUTINESMARRCRLRF04071E REV BFunction CallsROUTINE error_check : BOOLEAN FROM error_prog--external function with no parameters returns a BOOLEAN valueROUTINE distance(p1, p2: POSITION) : REAL &FROM funct_lib--external function with two parameters returns a REAL valueBEGIN--Main program--th...

  • Page 103

    MARRCRLRF04071E REV B5. ROUTINES5.1.3 Returning from RoutinesThe RETURN statement is used in a routine to restore execution control from a routine to thecalling routine or program.The following rules apply when returning from a routine:• In a procedure, the RETURN statement cannot include a val...

  • Page 104

    5. ROUTINESMARRCRLRF04071E REV Bbe used only in a direct assignment statement. ARRAY valued functions cannot be used asparameters to other routines. Refer to 108,Correct 108,Passage 108,of 108,an 108,ARRAY 108,, for an example of anARRAY passed between two function routines.• If no value ...

  • Page 105

    MARRCRLRF04071E REV B5. ROUTINES• LocalGlobal Declarations and DefinitionsThe following rules apply to global declarations and definitions:• Global declarations are recognized throughout a program.• Global declarations are referred to as static because they are given a memory location that ...

  • Page 106

    5. ROUTINESMARRCRLRF04071E REV B• As part of the routine call, you must supply a data item, referred to as an argument, for eachparameter in the routine declaration.• An argument can be a variable, constant, or expression. There must be one argumentcorresponding to each parameter.• Argument...

  • Page 107

    MARRCRLRF04071E REV B5. ROUTINESIf an argument is passed by reference, the corresponding parameter shares the same memorylocation as the argument. Therefore, changing the value of the parameter changes the valueof the corresponding argument.— Passing Arguments By ValueIf an argument is passed b...

  • Page 108

    5. ROUTINESMARRCRLRF04071E REV Bvalue of arg: 5value of param: 15value of arg: 15If the routine calls from 107,Passing 107,Variable 107,Arguments were made in reverse order, first passing argby reference using "test(arg)" and then passing it by value using "test ((arg))," t...

  • Page 109

    MARRCRLRF04071E REV B5. ROUTINESEND correct 109,Incorrect 109,Passage 109,of 109,an 109,ARRAY shows the incorrect use of an ARRAY passed between two functionroutines.Incorrect Passage of an ARRAYPROGRAM wrongROUTINE rtn_ary : ARRAY of INTEGERFROM util_progROUTINE print_ary(arg : ARRAY of INTE...

  • Page 110

    5. ROUTINESMARRCRLRF04071E REV BTable 5–1.Stack Usage (Cont’d)TypeParameter Passedby ReferenceParameter Passedby ValueLocal VariableCAM_SETUPARRAY OF CAM_SETUP1not allowednot allowednot allowednot allowedCOMMON_ASSOCARRAY OF COMMON_ASSOC12not allowed11 + array sizeCONFIGARRAY OF CONFIG12not a...

  • Page 111

    MARRCRLRF04071E REV B5. ROUTINESTable 5–1.Stack Usage (Cont’d)TypeParameter Passedby ReferenceParameter Passedby ValueLocal VariablePATH2not allowednot allowedPOSITIONARRAY OF POSITION2116not allowed141 + 14 * array sizeREALARRAY OF REAL112not allowed11 + array sizeARRAY OF SHORT1not allowed1...

  • Page 112

    5. ROUTINESMARRCRLRF04071E REV BTable 5–2.KAREL Built—In Routine SummaryCategoryIdentifierBynameCALL_PROGCALL_PROGLINCURR_PROGFILE_LISTPROG_LISTVAR_INFOVAR_LISTData AcquisitionDAQ_CHECKPDAQ_REGPIPEDAQ_STARTDAQ_STOPDAQ_UNREGDAQ_WRITEError Code HandlingERR_DATAPOST_ERRFile and DeviceOperationCH...

  • Page 113

    MARRCRLRF04071E REV B5. ROUTINESTable 5–2.KAREL Built—In Routine Summary (Cont’d)CategoryIdentifierPersonal ComputerCommunicationsADD_BYNAMEPCADD_INTPCADD_REALPCADD_STRINGPCSEND_DATAPCSEND_EVENTPCPositionCHECK_EPOSCNV_JPOS_RELCNV_REL_JPOSCURPOSCURJPOSFRAMEIN_RANGEJ_IN_RANGEJOINT2POSPOSPOS2J...

  • Page 114

    5. ROUTINESMARRCRLRF04071E REV BTable 5–2.KAREL Built—In Routine Summary (Cont’d)CategoryIdentifierUser InterfaceACT_SCREENADD_DICTATT_WINDOW_DATT_WINDOW_SCHECK_DICTCNC_DYN_DISBCNC_DYN_DISECNC_DYN_DISICNC_DYN_DISPCNC_DYN_DISRCNC_DYN_DISSDEF_SCREENDEF_WINDOWDET_WINDOWDISCTRL_ALPHDISCTRL_FORM...

  • Page 115

    Chapter 6CONDITION HANDLERSContents 115,Chapter 115,6 115,CONDITION 115,HANDLERS........................................................................ 115,6–1 117,6.1 117,CONDITION 117,HANDLER 117,OPERATIONS....................................................... 117,6–3 117,6.1.1 117,Gl...

  • Page 116

    6. CONDITION HANDLERSMARRCRLRF04071E REV BThe condition handler feature of the KAREL language allows a program to respond to externalconditions more efficiently than conventional program control structures allow. Two kinds ofcondition handlers are available in KAREL:• Global - used to monitor a...

  • Page 117

    MARRCRLRF04071E REV B6. CONDITION HANDLERSTable 6–2.Actions (Cont’d)HOLDPULSE DOUT[n] FOR tUNHOLDUNPAUSEroutine_nameABORTSIGNAL EVENT[n]CONTINUEPAUSESIGNAL SEMAPHORE[n]6.1 CONDITION HANDLER OPERATIONSGlobal condition handler operations differ from those of local condition handlers. 117,Table...

  • Page 118

    6. CONDITION HANDLERSMARRCRLRF04071E REV B• Each global condition handler is referenced throughout the program by a specified number, from1 to 1000. If a condition handler with the specified number was previously defined, it must bepurged before it is replaced by the new one.• The conditions/...

  • Page 119

    MARRCRLRF04071E REV B6. CONDITION HANDLERSGlobal Condition Handler DefinitionsCONDITION[1]:--defines condition handler number1WHEN DIN[1] DO DOUT[1] = TRUE--triggered if any oneWHEN DIN[2] DO DOUT[2] = TRUE--of the WHEN clausesWHEN DIN[3] DO DOUT[3] = TRUE--is satisfiedENDCONDITIONCONDITION[2]:--...

  • Page 120

    6. CONDITION HANDLERSMARRCRLRF04071E REV BWHEN line_go = TRUE DODOUT[1] = TRUE, ENABLECONDITION [1]ENDCONDITIONENABLE CONDITION[2]--condition handler 2 is enabled...IF ready THEN line_go = TRUE; ENDIF--If ready is TRUE condition handler 2 is triggered (and--disabled) and condition handler 1 is en...

  • Page 121

    MARRCRLRF04071E REV B6. CONDITION HANDLERSThe optional THEN portion of the UNTIL clause an be used to specify other actions (inaddition to canceling the motion) to be taken when the conditions are satisfied.• The condition list represents a list of conditions to be monitored when the conditionh...

  • Page 122

    6. CONDITION HANDLERSMARRCRLRF04071E REV BWHEN PAUSE DOtmp_clean_up --call interrupt routineWHEN TIME 100 BEFORE NODE[last_node] DOclean_up --call interrupt routineENDMOVE6.2 CONDITIONSOne or more conditions are specified in the condition list of a WHEN or UNTIL clause, defining theconditions por...

  • Page 123

    MARRCRLRF04071E REV B6. CONDITION HANDLERS6.2.1 Port_Id ConditionsPort_id conditions are used to monitor digital port signals. Port_id must be one of the predefinedBOOLEAN port array identifiers (DIN, DOUT, OPIN, OPOUT, TPIN, TPOUT, RDI, RDO, WDI, orWDO). The value of n specifies the port array s...

  • Page 124

    6. CONDITION HANDLERSMARRCRLRF04071E REV BTable 6–6.Relational ConditionsCONDITIONSATISFIED (TRUE) WHENoperand = operandoperand < > operandoperand < operandoperand < = operandoperand > operandoperand > = operandRelationship specified is TRUE. Operands on the left can be a port...

  • Page 125

    MARRCRLRF04071E REV B6. CONDITION HANDLERSEnabled condition handlers containing ERROR, EVENT, PAUSE, ABORT, POWERUP, orCONTINUE conditions are scanned only if the specified type of event occurs. For example, anenabled condition handler containing an ERROR condition will be scanned only when an er...

  • Page 126

    6. CONDITION HANDLERSMARRCRLRF04071E REV B• The ERROR condition is satisfied only for the scan performed when the error was detected. Theerror is not remembered in subsequent scans.EVENT Condition• The EVENT condition monitors the occurrence of the specified program event. The SIGNALstatement...

  • Page 127

    MARRCRLRF04071E REV B6. CONDITION HANDLERSERROR ConditionEVENT ConditionPAUSE ConditionPOWERUP ConditionSEMAPHORE Conditionapplication-specific FANUC Robotics Setup and Operations Manual for error codes. FANUC RoboticsError Code Manual.6.2.4 Local ConditionsThe conditions that can be monitored on...

  • Page 128

    6. CONDITION HANDLERSMARRCRLRF04071E REV B• The TIME t BEFORE condition will not be satisfied before NODE[0]. The TIME t AFTERcondition will not be satisfied after the last node.6.2.5 Synchronization of Local Condition HandlersThe triggering of local conditions depends on the motion segment ter...

  • Page 129

    MARRCRLRF04071E REV B6. CONDITION HANDLERS(1) WHEN AT NODE[0] DO DOUT[1] = TRUE(2) WHEN TIME 100 AFTER NODE[0] DO DOUT[2] = TRUE(3) WHEN TIME 100 BEFORE NODE[1] DO DOUT[3] = TRUE(4) WHEN AT NODE[1] DO DOUT[4] = TRUE(5) WHEN TIME 100 AFTER NODE[1] DO DOUT[5] = TRUE(6) WHEN AT NODE[2] DO DOUT[6] = ...

  • Page 130

    6. CONDITION HANDLERSMARRCRLRF04071E REV B6.3 ACTIONSActions are specified in the action list of a WHEN or UNTIL clause. Actions can be• Specially defined KAREL actions that are executed in parallel with the program• A routine call, which will interrupt program executionWhen the conditions of...

  • Page 131

    MARRCRLRF04071E REV B6. CONDITION HANDLERS• If a variable is on the left side of the assignment, theexpression canalsobeaportarrayelement.However, you cannot assign a port array element to a port array element directly. For example,the first assignment shown is invalid, but the next two are val...

  • Page 132

    6. CONDITION HANDLERSMARRCRLRF04071E REV BNoteThe CANCEL action in a local condition handler differs from the same action in a globalcondition handler and the CANCEL statement. In a local condition handler, a CANCEL actioncancels only the motion in progress, permitting any queued behind it to sta...

  • Page 133

    MARRCRLRF04071E REV B6. CONDITION HANDLERSbe executed only when the higher priority routine has completed. If $PRIORITY is not specified,the routine’s priority will default to the current value of the $PRIORITY system variable.See Also: WITH Clause, Appendix A, ‘‘KAREL Language Alphabetical...

  • Page 134

  • Page 135

    Chapter 7FILE INPUT/OUTPUT OPERATIONSContents 135,Chapter 135,7 135,FILE 135,INPUT/OUTPUT 135,OPERATIONS....................................................... 135,7–1 137,7.1 137,OVERVIEW 137,................................................................................................ 13...

  • Page 136

    7. FILE INPUT/OUTPUT OPERATIONSMARRCRLRF04071E REV B 172,7.10 172,USER 172,INTERFACE 172,TIPS........................................................................... 172,7–38 172,7.10.1 172,USER 172,Menu 172,on 172,the 172,Teach 172,Pendant...............................................

  • Page 137

    MARRCRLRF04071E REV B7. FILE INPUT/OUTPUT OPERATIONS7.1 OVERVIEWThe KAREL language facilities allow you to perform the following serial input/output (I/O)operations:• Open data files and serial communication ports using the OPEN FILE Statement• Close data files and serial communication ports ...

  • Page 138

    7. FILE INPUT/OUTPUT OPERATIONSMARRCRLRF04071E REV BTable 7–1.Predefined File Variables (Cont’d)CRTFUNC*CRT/KB function key lineBothINPUTCRT/KB keyboardReadOUTPUT*CRT/KB KAREL screenWriteCRTPROMPT*CRT/KB prompt lineBothCRTERRORCRT/KB message lineWriteCRTSTATUS*CRT/KB status lineWrite* Only di...

  • Page 139

    MARRCRLRF04071E REV B7. FILE INPUT/OUTPUT OPERATIONS7.3.1 Setting File and Port AttributesAttributes specify the details of operation of a serial port, or KAREL FILE variable. TheSET_PORT_ATR and SET_FILE_ATR built-ins are used to set these attributes. SET_FILE_ATRmust be called before the FILE i...

  • Page 140

    7. FILE INPUT/OUTPUT OPERATIONSMARRCRLRF04071E REV BTable 7–2.Predefined Attribute Types (Cont’d)ATTRIBUTE TYPEFUNCTIONSET_PORT_ATR ORSET_FILE_ATRTP/ CRTSERIALPORTSDATAFILESPIPESSOCKETMESSAGINGATR_XONOFFXON/XOFFSET_PORT_ATRnot usedvalidnotusednotusednot usedATR_PIPOVADVPipeOverflowSET_FILE_AT...

  • Page 141

    MARRCRLRF04071E REV B7. FILE INPUT/OUTPUT OPERATIONSTable 7–3.Attribute Values (Cont’d)Attribute TypeDescriptionValid DeviceUsage ModeValid ValuesDefault ValueATR_IAInteractively writeIf specified, the contentsof the buffer are outputwhen each write operationto the buffer is complete.(Interac...

  • Page 142

    7. FILE INPUT/OUTPUT OPERATIONSMARRCRLRF04071E REV BTable 7–3.Attribute Values (Cont’d)Attribute TypeDescriptionValid DeviceUsage ModeValid ValuesDefault ValueATR_PIPWAITThereadoperationwaitsfor data to arrive in thepipe.PIPEReadWAIT_USED orWAIT_NOTUSEDThe default issnapshot whichmeans that t...

  • Page 143

    MARRCRLRF04071E REV B7. FILE INPUT/OUTPUT OPERATIONSModem lineValid device : PORTUsage mode : Read/WriteDefault value : MD_NOT_USED: DSR, DTR, and RTS not usedValid attribute values : MD_NOT_USED: DSR, DTR, and RTS not usedMD_USE_DSR: DSR usedMD_NOUSE_DSR: DSR not usedMD_USE_DTR: DTR usedMD_NOUSE...

  • Page 144

    7. FILE INPUT/OUTPUT OPERATIONSMARRCRLRF04071E REV Bwrite (’DTR is in use’,cr)ENDIF— To determine if DTR is not used (LOW/OFF)IF (atr_value AND MD_USE_DTR) = MD_NOUSE_DTR) THENwrite (’DTR is not in use’, cr)ENDIFFor more information on GET_PORT_ATR Built-in, refer to 345,Appendix 345,...

  • Page 145

    MARRCRLRF04071E REV B7. FILE INPUT/OUTPUT OPERATIONSSee Also: 221,Chapter 221,9 221,FILE 221,SYSTEM 221,, for a description of file names and file types.7.3.3 Usage StringThe usage string in an OPEN FILE statement indicates how the file is to be used.• It is composed of one usage specifier...

  • Page 146

    7. FILE INPUT/OUTPUT OPERATIONSMARRCRLRF04071E REV BTable 7–4.Usage Specifiers (Cont’d)RW— Rewrites over existingdata in a file, deletingexisting data— Permits read andwrite operations— Sets file position tobeginning of file— File will be created if itdoes not existvalidvalidvalidNo u...

  • Page 147

    MARRCRLRF04071E REV B7. FILE INPUT/OUTPUT OPERATIONS* AP and UD specifiers can only be used with uncompressed files on the RAM disk. Refer to 221,Chapter9 221,FILE 221,SYSTEM 221,, for more information on the RAM disk and Pipe devices. 147,File 147,String 147,Examples shows a program that i...

  • Page 148

    7. FILE INPUT/OUTPUT OPERATIONSMARRCRLRF04071E REV B7.4 CLOSE FILE STATEMENTThe CLOSE FILE statement is used to break the association between a specified file variable and itsdata file or communication port. It accomplishes two objectives:• Any buffered data is written to the file or port.• T...

  • Page 149

    MARRCRLRF04071E REV B7. FILE INPUT/OUTPUT OPERATIONS• The OPEN FILE statement must be used to associate the file variable with the file opened inthe statement before any read operations can be performed unless one of the predefined files isused (refer to 137,Table 137,7–1 ).• If the file ...

  • Page 150

    7. FILE INPUT/OUTPUT OPERATIONSMARRCRLRF04071E REV B• PATH data must be read in binary (unformatted) form. 150,READ 150,Statement 150,Examples shows several examples of the READ statement using a variety of filevariables and data lists.READ Statement ExamplesREAD (next_part_no)--uses default ...

  • Page 151

    MARRCRLRF04071E REV B7. FILE INPUT/OUTPUT OPERATIONS• Format specifiers can be used to control the format of data that is written for each data_item. Theeffect of format specifiers depends on the data type of the item being written and on whether thedata is in text (ASCII) or binary (unformatte...

  • Page 152

    7. FILE INPUT/OUTPUT OPERATIONSMARRCRLRF04071E REV BBuffers are used by the READ and WRITE statements as follows:• During the execution of a READ statement, if more data was read from the file than required bythe READ statement, the remaining data is kept in a buffer for subsequent read operati...

  • Page 153

    MARRCRLRF04071E REV B7. FILE INPUT/OUTPUT OPERATIONSTable 7–5.Text (ASCII) Input Format Specifiers (Cont’d)DATA TYPE1ST FORMAT SPECIFIER2ND FORMAT SPECIFIERBOOLEANTotal number of characters readIgnoredSTRINGTotal number of characters read0 - unquoted STRING2 - quoted STRING 153,Table 153,7...

  • Page 154

    7. FILE INPUT/OUTPUT OPERATIONSMARRCRLRF04071E REV BFirst Format Specifier: Indicates the total number of characters to be read. The input field must beentirely on the current input line and can include leading, but not trailing, blanks.Second Format Specifier: Indicates the number base used for ...

  • Page 155

    MARRCRLRF04071E REV B7. FILE INPUT/OUTPUT OPERATIONS 155,Table 155,7–8 lists examples of INTEGER output data items and their format specifiers. The outputvalues of the INTEGER data items are also included in the table. Double quotes are used in the tableas delimiters to show leading blanks; ho...

  • Page 156

    7. FILE INPUT/OUTPUT OPERATIONSMARRCRLRF04071E REV BTable 7–8.Examples of INTEGER Output Data Items (Cont’d)DATA ITEMOUTPUTCOMMENT5::6::2"00101"Binary output (leading zeros)-1::9::16"FFFFFFFF"Hexadecimal output7.8.2 Formatting REAL Data ItemsREAL data items in a READ state...

  • Page 157

    MARRCRLRF04071E REV B7. FILE INPUT/OUTPUT OPERATIONSTable 7–9.Examples of REAL Input Data ItemsDATA ITEMINPUT DATARESULTreal_var1[eol]1.0real_var1.000[eol]1.0real_var2.5 XX2.50real_var1E5 XX100000.0real_var::72.5 XXformat error (trailing blank)real_var1Eformat error (no exponent)real_var::41E 2...

  • Page 158

    7. FILE INPUT/OUTPUT OPERATIONSMARRCRLRF04071E REV B 158,Table 158,7–10 lists examples of REAL output data items and their format specifiers. The output values ofthe REAL data items are also included in the table. Double quotes are used in the table as delimitersto show leading blanks; however...

  • Page 159

    MARRCRLRF04071E REV B7. FILE INPUT/OUTPUT OPERATIONSTable 7–10.Examples of REAL Output Data Items (Cont’d)DATA ITEMOUTPUTCOMMENT123.456::9::2"123.46"Right justified and rounded123.::12::-3"1.230E+02"Scientific notation7.8.3 Formatting BOOLEAN Data ItemsBOOLEAN data items i...

  • Page 160

    7. FILE INPUT/OUTPUT OPERATIONSMARRCRLRF04071E REV BTable 7–11.Examples of BOOLEAN Input Data ItemsDATA ITEMINPUT DATARESULTbool_varFALSE[eol]FALSEbool_varFAL 3...FALSEbool_varT[eol]TRUEbool_var::1FXXFALSE (only reads ‘‘ F’’)bool_varO[eol]format error (ambiguous)bool_var1.2[eol]format e...

  • Page 161

    MARRCRLRF04071E REV B7. FILE INPUT/OUTPUT OPERATIONSTable 7–12.Examples of BOOLEAN Output Data ItemsDATA ITEMOUTPUTCOMMENTFALSE"FALSE"Default includes a leading blankTRUE"TRUE"TRUE is shorter than FALSEFALSE::8"FALSE"Left justified (default)FALSE::8::1"FALSE&q...

  • Page 162

    7. FILE INPUT/OUTPUT OPERATIONSMARRCRLRF04071E REV BFirst Format Specifier: Indicates the total field length of the input data. If the field length is longerthan the declared length of the STRING, the input data is truncated on the right. If it is shorter, thecurrent length of the STRING is set t...

  • Page 163

    MARRCRLRF04071E REV B7. FILE INPUT/OUTPUT OPERATIONSTable 7–13.Examples of STRING Input Data Items (Cont’d)DATA ITEMINPUT DATARESULTstr_var"’ABC’XX""’AB"(blanks and quote are read as data)str_var::0::2"’ABC’XX""’ABC’"(read ends with second...

  • Page 164

    7. FILE INPUT/OUTPUT OPERATIONSMARRCRLRF04071E REV B 164,Table 164,7–14 lists examples of STRING output data items and their format specifiers. The output valuesof the STRING data items are also included in the table. Double quotes are used in the table asdelimiters to show leading blanks; how...

  • Page 165

    MARRCRLRF04071E REV B7. FILE INPUT/OUTPUT OPERATIONSTable 7–14.Examples of STRING Output Data Items (Cont’d)DATA ITEMOUTPUTCOMMENT’ABC’::8::3"’ABC’"Right justified’ABC’::4::2"’A’"TruncatedFormat specifiers for STRING data items can cause the truncation of t...

  • Page 166

    7. FILE INPUT/OUTPUT OPERATIONSMARRCRLRF04071E REV Bthe table. Double quotes are used in the table as delimiters to show leading blanks; however, doublequotes are not written by KAREL programs.See Also: 156,Section 156,7.8.2 , ‘‘Formatting REAL Data Items,’’ for information on the defau...

  • Page 167

    MARRCRLRF04071E REV B7. FILE INPUT/OUTPUT OPERATIONS 167,Table 167,7–16 lists examples of POSITION output data items and their format specifiers, where p =POS(2.0,-4.0,8.0,0.0,90.0,0.0,config_var). The output values of the POSITION data items are alsoincluded in the table. Double quotes are us...

  • Page 168

    7. FILE INPUT/OUTPUT OPERATIONSMARRCRLRF04071E REV BPOS Built-In Function, 345,Appendix 345,A .7.9 FORMATTING BINARY INPUT/OUTPUTThis section explains the format specifier used in READ and WRITE statements to read and writebinary (unformatted) data for each data item. Binary input/output operat...

  • Page 169

    MARRCRLRF04071E REV B7. FILE INPUT/OUTPUT OPERATIONSHowever, if large numbers of INTEGER values are to be written and their values are known to besmall, writing these with format specifiers reduces both storage space and I/O time.For example, INTEGER values in the range of -128 to +127 require on...

  • Page 170

    7. FILE INPUT/OUTPUT OPERATIONSMARRCRLRF04071E REV BFirst Format Specifier: Indicates the number of least significant bytes of the INTEGER to read orwrite, with the most significant of these read or written first. The sign of the most significant byte readis extended to unread bytes. The format s...

  • Page 171

    MARRCRLRF04071E REV B7. FILE INPUT/OUTPUT OPERATIONSLikewise, if a STRING is read without a format specifier, the length is expected in the data, while if aSTRING is read with a format specifier, the length is not expected.This means that, if you write and then read STRING data, you must make sur...

  • Page 172

    7. FILE INPUT/OUTPUT OPERATIONSMARRCRLRF04071E REV B7.9.8 Formatting XYZWPREXT Data ItemsXYZWPREXT data items in a READ or WRITE statement are formatted as follows:Default: Read or written in the internal format of the controller, which is 44 bytes long.7.9.9 Formatting JOINTPOS Data ItemsJOINTPO...

  • Page 173

    MARRCRLRF04071E REV B7. FILE INPUT/OUTPUT OPERATIONSBy default, the USER menu will attach the "err", "stat", "full", "motn", "t_fu", "t_pr", and "t_fk"windows to the "t_sc" screen. See 173,Figure 173,7–1 .Figure 7...

  • Page 174

    7. FILE INPUT/OUTPUT OPERATIONSMARRCRLRF04071E REV B7.10.2 USER Menu on the CRT/KBThe screen that is activated when the USER menu is selected from the CRT is named "c_sc". Thewindows listed in 174,Table 174,7–19 are defined for "c_sc".Table 7–19.Defined Windows for c_sc&...

  • Page 175

    MARRCRLRF04071E REV B7. FILE INPUT/OUTPUT OPERATIONS• $CRT_LCKUSER: BOOLEAN - This variable locks the CRT in the USER menu while$CRT_DEFPROG is running and $CRT_LCKUSER is TRUE.• $CRT_USERSTAT: BOOLEAN - This variable causes the user status window "c_st"(CRTSTATUS) to be attached to...

  • Page 176

  • Page 177

    Chapter 8MOTIONContents 177,Chapter 177,8 177,MOTION 177,................................................................................................. 177,8–1 178,8.1 178,OVERVIEW 178,................................................................................................ 178,8–2...

  • Page 178

    8. MOTIONMARRCRLRF04071E REV B8.1 OVERVIEWIn robotic applications, single segment motion is the movement of the tool center point (TCP) froman initial position to a desired destination position. The KAREL system represents positional datain terms of location (x, y, z), orientation (w, p, r), and ...

  • Page 179

    MARRCRLRF04071E REV B8. MOTION— ‘N’ or ‘F’ (wrist no-flip or flip)— ‘T’ or ‘B’ (config front or back)A turn number is the number of complete turns a multiple turn joint makes beyond therequired rotation to reach a position. 179,Table 179,8–1 lists the valid turn number def...

  • Page 180

    8. MOTIONMARRCRLRF04071E REV BFigure 8–1.Referencing Positions in KARELFACEPLATE$UTOOLTCPUSERFRAMEWORLDCOORDINATESYSTEMROBOT$UFRAMEROBOT = $UFRAME:POSITION:INV($UTOOL)POSITIONThree frames of reference exist:• WORLD - predefined• UFRAME -determinedbythe user• UTOOL - defined by the toolUsi...

  • Page 181

    MARRCRLRF04071E REV B8. MOTION8.3.2 User Frame (UFRAME)The programmer defines user frame relative to the world frame by assigning a value to the systemvariable $UFRAME.WarningBe sure $UFRAME is set to the same value whether you are teachingpositional data or running a program with that data, or d...

  • Page 182

    8. MOTIONMARRCRLRF04071E REV BWarningDo not run a KAREL program that performs motion if more than onemotion group is defined on your controller. If your controller is set upfor more than one motion group, all motion must be initiated from ateach pendant program. Otherwise, the robot could move un...

  • Page 183

    MARRCRLRF04071E REV B8. MOTION• JOGFRAME - a Cartesian coordinate system in which the TCP moves parallel to, or rotatesaround, the x, y, and z-axes of the coordinate system defined by the $JOG_GROUP[group_no].$jogframe system variable. The motion is linearly interpolated.• USER FRAME - a Cart...

  • Page 184

    8. MOTIONMARRCRLRF04071E REV B• When the interpreter encounters a motion statement, it passes the information to the motionenvironment, which carries out the motion.• The motion environment runs in parallel with the interpreter so that, when necessary, motion canbe carried out simultaneously ...

  • Page 185

    MARRCRLRF04071E REV B8. MOTION• Trajectory The path of the TCP as the robot moves from its initial to final position. Thetrajectory includes orientation as well as location of the TCP.• Acceleration/Deceleration Acceleration is the initial phase of a motion during which the speedof the robot ...

  • Page 186

    8. MOTIONMARRCRLRF04071E REV B• During joint interpolation , the joint angles of the robot are linearly interpolated from theirinitial to final values.• Cartesian interpolation is categorized into linear and circular interpolation of the location of theTCP and, for each of these, there are se...

  • Page 187

    MARRCRLRF04071E REV B8. MOTIONFigure 8–5.Location Interpolation of the TCPEach axis is linearly interpolatedTCP movesin a straight lineTCP movesin a circular fashionbased on the valueof the via positionJOINTLINEARCIRCULARABABAB• JOINT Interpolated MotionThe following rules apply to joint inte...

  • Page 188

    8. MOTIONMARRCRLRF04071E REV BSee Also: ‘‘Orientation Interpolation’’ for more information on these methods• CIRCULAR Interpolated MotionThe following rules apply to circular interpolated motion.— The TCP follows a circular arc from the initial position to the destination.— An addit...

  • Page 189

    MARRCRLRF04071E REV B8. MOTION• Two-Angle Method (RSWORLD)• Three-Angle Method (AESWORLD)• Wrist-Joint Method (WRISTJOINT)The system variable $ORIENT_TYPE uses the predefined constants RSWORLD, AESWORLD, andWRISTJOINT to indicate the type of interpolation used to move from one orientation t...

  • Page 190

    8. MOTIONMARRCRLRF04071E REV BFor LINEAR motions, elevation and azimuth are defined with respect to the world coordinatehorizontal plane. That is, elevation is the elevation angle of the tool approach vector above thehorizontal, and azimuth is the angle of the projected approach vector in the hor...

  • Page 191

    MARRCRLRF04071E REV B8. MOTIONFor example, during a move in which the azimuth of the tool approach vector is 0° at the initialposition and 50° at the destination position and the TCP moves along a straight line, azimuth canchange in a negative direction by 310° or in a positive direction by 50...

  • Page 192

    8. MOTIONMARRCRLRF04071E REV Bwill go through the VIA position as it is taught or programmed. This allows the usermore control over the tool orientation throughout a circular motion.It is important to maintain uniform speed along the location trajectory. Circularinterpolation maintains a uniform ...

  • Page 193

    MARRCRLRF04071E REV B8. MOTION• The physical requirements of executing a Cartesian path also limit the joint motions to±180° fromthe starting position of that joint. This makes it necessary to ignore the destination turn numbersspecified in the taught data. Multiple turn joints, however, alwa...

  • Page 194

    8. MOTIONMARRCRLRF04071E REV B8.5.3 Acceleration and DecelerationDuring a single segment motion, the robot accelerates from rest at the initial position and deceleratesto rest at the destination position.For motions long enough to reach the programmed speed before deceleration must begin, theacce...

  • Page 195

    MARRCRLRF04071E REV B8. MOTIONSee Also: ‘‘Short Motions’’In 195,Figure 195,8–9 both stages are the same length, producing a second order profile over the entireacceleration profile. In 195,Figure 195,8–10 , the second stage is zero length, producing a first order profileover the e...

  • Page 196

    8. MOTIONMARRCRLRF04071E REV B 196,Figure 196,8–11 shows a desirable compromise between the profiles shown in 195,Figure 195,8–9 and 195,Figure 195,8–10. The first stage is two times the length of the second stage, reducing the peak acceleration, while stillmaintaining a second order p...

  • Page 197

    MARRCRLRF04071E REV B8. MOTIONPeak Acceleration TimesThe example in 195,Figure 195,8–10 , where Stage_2 = 0, is referred to as the constant acceleration case. Thisalso represents the average acceleration of the general case.The value of the average acceleration is calculated by dividing progr...

  • Page 198

    8. MOTIONMARRCRLRF04071E REV BThe system variables $MCR[],$genoverride (general override) and $MCR[],$prgoverride (programoverride) are both speed overrides. $MCR[],$genoverride can be altered from the teach pendant andfrom the CRT/KB, but affects both programmed and manual motion. $MCR[],$prgove...

  • Page 199

    MARRCRLRF04071E REV B8. MOTION• For Cartesian interpolation, the value of $GROUP[].$speed is the speed of the TCP in millimetersper second. The system variable $PARAM_GROUP[].$speedlim determines the maximum valuethat can be used for $GROUP[].$speed for Cartesian motions.• For a single segmen...

  • Page 200

    8. MOTIONMARRCRLRF04071E REV B100$MCR.$GENOVERRIDE$PARAM_GROUP.$SPEEDLIMJNT*$MCR.$PRGOVERRIDE100*$GROUP.$SPEEDPARAM_GROUP.$JNTVELLIM[i]*Cartesian Translational Speed (in mm/sec) equals: (11)100$MCR.$GENOVERRIDE*$MCR.$PRGOVERRIDE100*$GROUP.$SPEEDRotational SpeedNormally you are interested in the t...

  • Page 201

    MARRCRLRF04071E REV B8. MOTIONExtended Axis Speed ControlIn KAREL extended axes and robot axes move simultaneously, meaning they both start and end at thesame time for each motion segment.The system variable $GROUP[].$ext_speed controls extended axis motion speed control.• A non-zero value indi...

  • Page 202

    8. MOTIONMARRCRLRF04071E REV B• If a motor speed limit is encountered, cycle time is not changed. The motion will be sloweddown and the warning message, ‘‘MOTOR SPEED LIMIT USED,’’ will be issued. However,after the motor rate slows to below its limit, the motion speeds up faster than pr...

  • Page 203

    MARRCRLRF04071E REV B8. MOTION• In some cases, however, a signal from outside the motion environment will cause early orabnormal interval termination. In these cases termination of the interval causes the motion to beterminated. The termination in these cases is referred to as ‘‘abnormal te...

  • Page 204

    8. MOTIONMARRCRLRF04071E REV BNODECEL is used to permit continuous motion near taught positions. In this case motioninterval termination is signaled to the interpreter as soon as the axes begin to decelerate.— VARDECELVARDECEL is used to permit variable deceleration. When VARDECEL is specified,...

  • Page 205

    MARRCRLRF04071E REV B8. MOTION8.5.6 Multiple Segment MotionMultiple segment motion occurs when the robot continues moving as it passes near or through taughtpositions, thus extending a motion through multiple segments.For example, continuous path operations such as sealing, arc welding, and paint...

  • Page 206

    8. MOTIONMARRCRLRF04071E REV B• If you use NOWAIT, the interpreter can continue program execution beyond the current motionstatement while the motion environment carries out the motion. The interpreter is permittedto continue at the beginning of the interval instead of at the end of the interva...

  • Page 207

    MARRCRLRF04071E REV B8. MOTION• The following is a section of a test program in which the termination type is set and twoconsecutive LINEAR moves are made. The motion segments, from the initial position to B andfrom B to C, are at 90 degrees to each other.$TERMTYPE = ?-- (FINE | COARSE | NOSETT...

  • Page 208

    8. MOTIONMARRCRLRF04071E REV B• In the case of NODECEL, the interpreter can process the MOVE TO C as soon as deceleration toB starts. There will be a slight delay (from 30 ms to 100 ms depending on robot model) for thenext statement to be processed and the interval to begin, but this is small c...

  • Page 209

    MARRCRLRF04071E REV B8. MOTIONFigure 8–15.NODECEL ExampleGUN ONCORNERDESTINATION$TERMTYPE = NODECELMOVE TO cornerDOUT[gun] = ONMOVE TO destination• If VARDECEL is used, the digital output turns on as soon as the deceleration tolerance specifiedin $DECELTOL is satisfied-somewhere between the N...

  • Page 210

    8. MOTIONMARRCRLRF04071E REV BFigure 8–17.COARSE ExampleGUN ONCORNERDESTINATION$TERMTYPE = COARSEMOVE TO cornerDOUT[gun] = ONMOVE TO destination• For the FINE case, all axes are within the FINE tolerance of being in position before the digitaloutput turns on (the closest possible control). 21...

  • Page 211

    MARRCRLRF04071E REV B8. MOTIONFigure 8–19.Effect of Speed on PathABCabcdefghija – Bb – Bc – Bd – Be – BB – fB – gB – hB – iB – jDecelerationdistanceAccelerationdistanceHIGH SPEEDLOW SPEED• It is sometimes difficult to teach continuous path positions, because the path gener...

  • Page 212

    8. MOTIONMARRCRLRF04071E REV B8.5.7 Path MotionA PATH variable is a varying-length list of elements called path nodes. A path node consists of aposition, called NODEPOS, and any associated data.There are two primary uses of PATH variables:• As a bookkeeping aid in programming• For improved pe...

  • Page 213

    MARRCRLRF04071E REV B8. MOTIONThis improvement is possible because the interpreter does not have to execute intermediatemotion statements and the motion environment can plan further ahead.However, the same continuous path anomalies also exist. Changing program speed will changethe path near the t...

  • Page 214

    8. MOTIONMARRCRLRF04071E REV B— SEGRELSPEED allows you to override the SPEED, both higher or lower.The SEGRELSPEED field is an INTEGER field, representing percentage, with a range of 0to 4000 (400.0%) that permits a relative multiplier to be applied to the programmed speedfor each segment.For e...

  • Page 215

    MARRCRLRF04071E REV B8. MOTIONWarningDo not run a KAREL program that performs motion if more thanone motion group is defined on your controller. If your controller isset up for more than one motion group, all motion must be initiatedfrom a teach pendant program. Otherwise, the robot could moveune...

  • Page 216

    8. MOTIONMARRCRLRF04071E REV Bthe motion, plus any settling time. (You can think of the time to accelerate at the beginning of amotion as being part of the computed segment time.)• The formulas assume that there is no deceleration between segments in multiple segment motionsand that FINE or COA...

  • Page 217

    MARRCRLRF04071E REV B8. MOTIONFormula 13 indicates that regardless of the distance of a motion, the time to execute that motion is atleast Taccdec (not 2 * Taccdec which you might expect), which is normally determined by the times setin the system variables $PARAM_GROUP[].$accel_time1 and $PARAM_...

  • Page 218

    8. MOTIONMARRCRLRF04071E REV BFor this reason, a minimum motion time is imposed. That is, acceleration times get shorter withshorter moves, as the diagram indicates, but only down to a limit. This limit is represented as aminimum acceleration time, kept in the system variable $PARAM_GROUP[ ].$min...

  • Page 219

    MARRCRLRF04071E REV B8. MOTIONTable 8–3. Correspondence between $GROUP System Variables and Teach Pendant Motion InstructionsKAREL System VariableTeach Pendant Motion Instruction$GROUP.$motypeMotion type$GROUP.$speedSpeed - mm/sec, cm/min, inch/min$GROUP.$rotspeedSpeed - deg/sec$GROUP.$seg_time...

  • Page 220

  • Page 221

    Chapter 9FILE SYSTEMContents 221,Chapter 221,9 221,FILE 221,SYSTEM........................................................................................ 221,9–1 222,9.1 222,OVERVIEW 222,................................................................................................ 222,9–...

  • Page 222

    9. FILE SYSTEMMARRCRLRF04071E REV B9.1 OVERVIEWThe file system provides a means of storing data on CMOS RAM, FROM, or external storagedevices. The data is grouped into units, with each unit representing a file. For example, a file cancontain the following:• Source code statements for a KAREL pr...

  • Page 223

    MARRCRLRF04071E REV B9. FILE SYSTEMUSB Memory Stick Device supports a USB 1.1 interface. The USB Organization specifies standardsfor USB 1.1 and 2.0. Most memory stick devices conform to the USB 2.0 specification for operationand electrical standards. USB 2.0 devices as defined by the USB Specifi...

  • Page 224

    9. FILE SYSTEMMARRCRLRF04071E REV B• UD1: (USB Memory Stick Device)The USB memory stick can be formatted and used as an MS-DOS file system. It can be read fromand written to on the controller and an IBM PC equipped with the proper hardware and software.If the USB memory stick is used as an MS-D...

  • Page 225

    MARRCRLRF04071E REV B9. FILE SYSTEM• File names are limited to eight characters.• Files should be named according to the rules defined in 61,Section 61,2.1.4 .9.2.3 File TypeA file type consists of two characters that indicate what type of data a file contains. A file type alwaysbegins with...

  • Page 226

    9. FILE SYSTEMMARRCRLRF04071E REV BTable 9–1.File Type Descriptions (Cont’d)File TypeDescription.SVSystem filesare binary files that contain data fortool and user frames (SYSFRAME.SV), systemvariables (SYSVARS.SV), mastering (SYSMAST.SV),servo parameters (SYSSERVO.SV), and macros(SYSMACRO.SV)...

  • Page 227

    MARRCRLRF04071E REV B9. FILE SYSTEM9.3.1 OverviewThe following kinds of storage devices can be used to store programs and files:• Memory Card (MC:)• USB Memory Stick Device (UD1:)• Flash File Storage disk (FR:)• RAM Disk (RD:) (Not for SpotTool+)• Ethernet Device (optional)• Memory De...

  • Page 228

    9. FILE SYSTEMMARRCRLRF04071E REV BWarningThe memory card interface is located on the Main CPU on the controllercabinet. When the power disconnect circuit breaker is OFF, power isstill present inside the controller. Turn off the power disconnect circuitbreaker before you insert a memory card into...

  • Page 229

    MARRCRLRF04071E REV B9. FILE SYSTEMNoteGenerally the larger the size of the device such as a USB memory stick, the slower the accessspeed and device performance.TheUSB Memory StickDevicerequiresa USBinterface which is standard on the controller.The USB memory stick device can be formatted on the ...

  • Page 230

    9. FILE SYSTEMMARRCRLRF04071E REV BSRAM is battery-backed volatile memory. This means that all information in SRAM, includingprograms, requires battery backup for information to be retained when the controller is turnedoff and then on again. Teach pendant programs are automatically stored in the ...

  • Page 231

    MARRCRLRF04071E REV B9. FILE SYSTEMMemory Device (MD:)The memory device (MD:) treats the controller’s program memory as if it were a file device. You canaccess all teach pendant programs, KAREL programs, and KAREL variables loaded in the controller.The Memory Device is a group of devices (MD:, ...

  • Page 232

    9. FILE SYSTEMMARRCRLRF04071E REV Bservice in your remote FTP client. At a command line using the cd command where in this examplefmd: is the device being used, this might look like :D:\temp>ftp pderob029Connected to pderob029.frc.com220 R-J3 FTP server ready.[PaintTool V6.22–1L]User <pde...

  • Page 233

    MARRCRLRF04071E REV B9. FILE SYSTEM9.3.2 Memory File DevicesThe RAM and F-ROM disks allocate files using blocks. Each block is 512 bytes.The system variable $FILE_MAXSEC specifies the number of blocks to allocate for the RAM disk. Ifthe specified number is less than zero, the RAM disk is allocate...

  • Page 234

    9. FILE SYSTEMMARRCRLRF04071E REV BAfter some use, the F-ROM disk will have used up all blocks. At that time, a purge is required toerase the F-ROM blocks which are no longer needed. For more information on purging, refer tothe PURGE_DEV Built-in in 345,Appendix 345,A , "KAREL Language Alp...

  • Page 235

    MARRCRLRF04071E REV B9. FILE SYSTEMDRAM and $FILE_MAXSEC < 0. For example: KCL>COPY FILE FLPY:test.kl to MF2 :The file will actually exist on RD2:• When listing the MF: device directory, all files on the RAM and F-ROM disks are listed.However, only the files in the specified virtual devic...

  • Page 236

    9. FILE SYSTEMMARRCRLRF04071E REV BSince a pipe is really used to transfer data from one place to another some application will bereading the data out of the pipe. In the default mode, the reader will WAIT until information hasbeen written. Once the data is available in the pipe the read will com...

  • Page 237

    MARRCRLRF04071E REV B9. FILE SYSTEM• The function of the PIP: device is similar to all other devices on the controller. This means that allfile I/O operations are supported on this device. All I/O functions are supported and work thesame except the following: Chdir, Mkdir, and Rmdir.• The PIP...

  • Page 238

    9. FILE SYSTEMMARRCRLRF04071E REV BTable 9–3.System Variable Field Descriptions (Cont’d)$memtyp0If non zero use CMOS.$formatUndefinedFormatting mode: undefined, function, format stringor KAREL type.$formatterFunction pointer, "C" format specifier pointer or typecode depending on $fo...

  • Page 239

    MARRCRLRF04071E REV B9. FILE SYSTEMopen file pipe (’rw’, ’pip:example.dat’)status = io_status(pipe)write console (’Open pipe status:’,status,cr)--write extra parameters to pipewrite pipe (msg::8)status = io_status(pipe)end write_piperoutine read_pipevarrecord: string[128]status: integ...

  • Page 240

    9. FILE SYSTEMMARRCRLRF04071E REV Brecord_size,form_dict,form_ele,status)write_piperead_pipeclose file pipeclose file in_fileend pipuform9.4 FILE ACCESSYou can access files using the FILE and SELECT screens on the CRT/KB or teach pendant, or byusing KAREL language statements. During normal operat...

  • Page 241

    MARRCRLRF04071E REV B9. FILE SYSTEM• This feature provides an XML parser and the means for both KAREL and C programmersto easily extract binary data from the text information in an XML file. It does not require theapplication program to do any parsing of the XML file.NoteXML files can have only...

  • Page 242

    9. FILE SYSTEMMARRCRLRF04071E REV B<MEMBER name="sam"ipadd=“172.22.194.238" /></ROBOTRING><IPENDANTRING count="4"><MEMBER name="frodo"ipadd="172.22.200.55" dspname="leader"port_num="1" /><MEMBER name=&qu...

  • Page 243

    MARRCRLRF04071E REV B9. FILE SYSTEMsecond: realthird: BOOLEANfourth: string[20]ENDSTRUCTUREVARxml_name: string[20]tag_name: string[32]text: array[32] of string[128]attrnames: array[32] of string[32]attrvalues: array[32] of string[64]xml_file: FILEstatus: INTEGERxmlstrct:xmlstrct_ttag_ident:intege...

  • Page 244

    9. FILE SYSTEMMARRCRLRF04071E REV B-- Already looked at the attribtues get the textxml_getdata(xml_file, numattr, attrnames, attrvalues, text[text_idx],textdone, status)CASE (XML_TXCONT) :-- Usually the user will do one or the other but not both of these callstext_idx = text_idx + 1xml_getdata(xm...

  • Page 245

    MARRCRLRF04071E REV B9. FILE SYSTEMXML_TAGMATCH "End tag with no matching start"XML_INVATTR "Invalid character in attribute"XML_NOFILE "Cannot find file"XML_TAGNEST "Tag nesting level too deep"XML_COMMENT "Error in comment"XML_BADEXCHAR "Unkn...

  • Page 246

    9. FILE SYSTEMMARRCRLRF04071E REV BTable 9–4.File Listings for the MD Device (Cont’d)File NameDescriptionCONFIG.DGThis file shows a summary of system configurationCONSLOG.DGThis file is an ASCII listing of the system console log.CONSTAIL.DGThis file is an ASCII listing of the last lines of th...

  • Page 247

    MARRCRLRF04071E REV B9. FILE SYSTEMTable 9–4.File Listings for the MD Device (Cont’d)File NameDescriptionMACRO.DGThis file shows the Macro Assignment.MEMORY.DGThis file shows current memory usage.PORT.DGThis file shows the Serial Port Configuration.POSREG.VAThis file is an ASCII listing of PO...

  • Page 248

    9. FILE SYSTEMMARRCRLRF04071E REV BTable 9–4.File Listings for the MD Device (Cont’d)File NameDescriptionSYSTEM.VAThis file is an ASCII listing of non motion system variables.SYSVARS.SVThis file is a listing of system variables.SYSVARS.VAThis file is an ASCII listing of SYSVARS.SV.SYS****.SVT...

  • Page 249

    MARRCRLRF04071E REV B9. FILE SYSTEMTable 9–5.Testing Restrictions when Using the MD: Device (Cont’d)File Name or TypeREADWRITEDELETECommentsFFF.DFYESYESNOSYS***.SVYESYESNOWriteonlyatCTRLSTART.SYS***.VAYESNONOERR***.LSYESNONOHISTX.LSYESNONO***REG.VRYESYESNO***REG.VAYESNONODIOCFGSV.IOYESYESNOWr...

  • Page 250

  • Page 251

    Chapter 10DICTIONARIES AND FORMSContents 251,Chapter 251,10 251,DICTIONARIES 251,AND 251,FORMS................................................................ 251,10–1 253,10.1 253,OVERVIEW 253,................................................................................................ ...

  • Page 252

    10. DICTIONARIES AND FORMSMARRCRLRF04071E REV B 281,10.3.15 281,CRT/KB 281,Form 281,Screen............................................................................. 281,10–31 282,10.3.16 282,Form 282,File 282,Naming 282,Convention...........................................................

  • Page 253

    MARRCRLRF04071E REV B10. DICTIONARIES AND FORMS10.1 OVERVIEWDictionaries and forms are used to create operator interfaces on the teach pendant and CRT/KBscreens with KAREL programs.This chapter includes information about• Creating user dictionary files, refer to 253,Section 253,10.2.• Creat...

  • Page 254

    10. DICTIONARIES AND FORMSMARRCRLRF04071E REV B• A dictionary element can contain multiple lines of information , uptoafull screenofinformation. A user dictionary file has the following syntax:<*comment>$n<,ele_name><@cursor_pos><&res_word><#chr_code><"...

  • Page 255

    MARRCRLRF04071E REV B10. DICTIONARIES AND FORMS$3$6$-10.2.3 Dictionary Element NameEach dictionary element can have an optional element name. The name is separated from the elementnumber by a comma and zero or more spaces. Element names are case sensitive. Only the first 12characters are used to ...

  • Page 256

    10. DICTIONARIES AND FORMSMARRCRLRF04071E REV B— Cursor position ‘‘@1,1’’ is the upper left position of the "c_fu" window and is located atthe "c_sc" screen row 5 column.— The lower right position of the window is "@17,80’’ and is located at the "c_sc...

  • Page 257

    MARRCRLRF04071E REV B10. DICTIONARIES AND FORMSConversion CharacterThe conversion character is used to identify the data type of the KAREL variable that was passed. 257,Table 257,10–1 lists the conversion characters:Table 10–1.Conversion CharactersCharacterArgument Type: Printed AsdINTEGER; ...

  • Page 258

    10. DICTIONARIES AND FORMSMARRCRLRF04071E REV BSetting a width longer than the largest number aligns the numbers.• If the displayed number has fewer characters than the width, the number will be padded on theleft (or right if the "-" character is used) by spaces.• If the width numbe...

  • Page 259

    MARRCRLRF04071E REV B10. DICTIONARIES AND FORMSTable 10–2.Reserved WordsReserved WordFunction&bg_blackBackground color black&bg_blueBackground color blue&bg_cyanBackground color cyan&bg_dfltBackground color default&bg_greenBackground color green&bg_magentaBackground colo...

  • Page 260

    10. DICTIONARIES AND FORMSMARRCRLRF04071E REV BTable 10–2.Reserved Words (Cont’d)Reserved WordFunction&under_lineUnderline video attribute (#141)&double_wideWide video size (#142) (refer to description below for usage)&standardAll attributes normal (#143)&graphics_onTurn on gr...

  • Page 261

    MARRCRLRF04071E REV B10. DICTIONARIES AND FORMS10.2.9 Dictionary CommentThe asterisk character (*) indicates that all text, to the end of the line, is a comment. All commentsare ignored when the dictionary is compressed. A comment can be placed anywhere a space isallowed, except within the elemen...

  • Page 262

    10. DICTIONARIES AND FORMSMARRCRLRF04071E REV BDo not include the .UTX file type with the file name. If the compressor detects any errors, it willpoint to the offending word with a brief explanation of what is wrong. Edit the user dictionary andcorrect the problem before continuing.A loadable dic...

  • Page 263

    MARRCRLRF04071E REV B10. DICTIONARIES AND FORMS• REMOVE_DICT - Removes a dictionary from the specified language and closes the file or freesthe memory it resides in.• WRITE_DICT - Write a dictionary element to a window.• WRITE_DICT_V - Write a dictionary element that has format specifiers f...

  • Page 264

    10. DICTIONARIES AND FORMSMARRCRLRF04071E REV B10.3.1 Form SyntaxA form defines an operator interface that appears on the teach pendant or CRT/KB screens. A formis a special dictionary element. Many forms can reside in the same dictionary along with other(non-form) dictionary elements.NoteIf your...

  • Page 265

    MARRCRLRF04071E REV B10. DICTIONARIES AND FORMS• Symbols not defined here are standard user dictionary element symbols ($n, @cursor_pos,&res_word, &new_line).• form_attributes are the key words unnumber and unclear .• form_name specifies the element name that identifies the form.•...

  • Page 266

    10. DICTIONARIES AND FORMSMARRCRLRF04071E REV B.form$6, MH_APPLIO.endform10.3.3 Form Title and Menu LabelThe menu title is the first element of text that follows the form name. The menu label follows themenu title. Each consists of one row of text in a non-scrolling window.• On the teach pendan...

  • Page 267

    MARRCRLRF04071E REV B10. DICTIONARIES AND FORMSIf no menu label text is desired, the &new_line can be specified twice after the menu title as inthe following example..form$1,misc_form&home &reverse " Menu Title" &standard &new_line &new_line.endformIf the cursor ...

  • Page 268

    10. DICTIONARIES AND FORMSMARRCRLRF04071E REV B— INTEGER— INTEGER port—REAL— SHORT (32768 to 32766)—BYTE (0 to 255)— BOOLEAN— BOOLEAN port— STRING— Program name string— Function key enumeration type— Subwindow enumeration type— Subwindow enumeration type using a variable...

  • Page 269

    MARRCRLRF04071E REV B10. DICTIONARIES AND FORMS" Item 1, line 2 "• The automatic numbering uses the first three columns and does not shift the form text. Therefore,the text must allow for the three columns by either adding spaces or specifying cursor positions.For example,"- Item...

  • Page 270

    10. DICTIONARIES AND FORMSMARRCRLRF04071E REV BNoteYou should provide a field width with each format specifier, otherwise a default will beused. This default might cause your form to be mis-aligned. 270,Table 270,10–3 lists the conversion characters for an editable data item.Table 10–3.Conve...

  • Page 271

    MARRCRLRF04071E REV B10. DICTIONARIES AND FORMSTable 10–3.Conversion Characters (Cont’d)CharacterArgument Type: Printed AsvINTEGER; print characters from subwindow enumeration string. Uses a variableto define the enumeration strings.%no argument is converted; print a %.The following is an exa...

  • Page 272

    10. DICTIONARIES AND FORMSMARRCRLRF04071E REV BYESNOThe form processor will label the function keys when the cursor is moved to the enumerated item. Thevalue shown in the field is the same as the function key label except all leading blanks are removed.Edit Data Item: BOOLEAN Port• The format s...

  • Page 273

    MARRCRLRF04071E REV B10. DICTIONARIES AND FORMSThe form processor will label the function keys when the cursor is moved to the enumerated item. Thevalue shown in the field is the same as the function key label except all leading blanks are removedand the value will be truncated to fit in the fiel...

  • Page 274

    10. DICTIONARIES AND FORMSMARRCRLRF04071E REV B"CIRC" *Specifies F4The form processor will label the appropriate function keys when the enumerated item is selected.When a function key is selected, the value set in the integer is as follows:User presses F1, value = 1User presses F2, valu...

  • Page 275

    MARRCRLRF04071E REV B10. DICTIONARIES AND FORMSEdit Data Item: Subwindow Enumeration using a Variable• You can also use the format specifier %v (for enumerated integer values) to display and selectchoices from the subwindow. However, instead of defining the choices in a dictionary they aredefin...

  • Page 276

    10. DICTIONARIES AND FORMSMARRCRLRF04071E REV B10.3.8 DisplayOnlyDataItemsDisplay only data items can be specified in the form. These items have the following characteristics:• Display only data items are entered in the dictionary as a string enclosed in double quotes.• The first character in...

  • Page 277

    MARRCRLRF04071E REV B10. DICTIONARIES AND FORMSTable 10–4.Reserved Words (Cont’d)Reserved WordFunction&bg_magentaBackground color magenta&bg_redBackground color red&bg_whiteBackground color white&bg_yellowBackground color yellow&fg_blackForeground color black&fg_blueFo...

  • Page 278

    10. DICTIONARIES AND FORMSMARRCRLRF04071E REV BTable 10–4.Reserved Words (Cont’d)Reserved WordFunction&double_highHigh video size (#148) (refer to description below for usage)&normal_sizeNormal video size (#153)&multi_onTurn on multi-national characters (#154) 278,Table 278,10–...

  • Page 279

    MARRCRLRF04071E REV B10. DICTIONARIES AND FORMS" F2" &new_line" F3" &new_line" F4" &new_line" HELP >" &new_line"" &new_line"" &new_line" F8" &new_line" F9" &new_line• The form proc...

  • Page 280

    10. DICTIONARIES AND FORMSMARRCRLRF04071E REV B[RUNFORM] FKEYS must be defined as a KAREL string array. Each element of the array shoulddefine a function key label.[RUNFORM] FKEYS:ARRAY[10] OF STRING[12] =[1] ‘F1’[2] ‘F2’[3] ‘F3’[4] ‘F4’[5] ‘ HELP>’[6] ‘’[7] ‘’[8] ...

  • Page 281

    MARRCRLRF04071E REV B10. DICTIONARIES AND FORMSFigure 10–2.Teach Pendant Form Screen+––––––––––––––––––––––––––––––––––––––––+|err|stat|full|full|fscr=|prmp|ftnk+–––––––––––––––––...

  • Page 282

    10. DICTIONARIES AND FORMSMARRCRLRF04071E REV B10.3.16 Form File Naming ConventionUncompressed form dictionary files must use the following file name conventions:• The first two letters in the dictionary file name can be an application prefix.• If the file name is greater than four characters...

  • Page 283

    MARRCRLRF04071E REV B10. DICTIONARIES AND FORMScharacter dictionary name as the file name. The dictionary name is extracted from filename asdescribed previously. A third file may also be created if you used the ‘‘.kl’’ symbol to generate aKAREL include file. 283,Figure 283,10–4 illust...

  • Page 284

    10. DICTIONARIES AND FORMSMARRCRLRF04071E REV BAs explained in the file naming conventions section, the dictionary name extracted from the file nameis ‘‘PALT’’. Dictionary elements 1 and 6 are forms. A variable file named PALT.VR is generated withthe program name ‘‘*PALT.’’ It con...

  • Page 285

    MARRCRLRF04071E REV B10. DICTIONARIES AND FORMSFigure 10–5.Example of Selectable Menu ItemsRUNFORMLINE 22RUNNINGTitle hereJOINT 10%label here1/51Menu item 12Menu item 23Menu item 34Menu item 4 line 1Menu item 4 line 25Menu item 5The dictionary elements in FORM.FTX, shown in 285,Example 285,Fo...

  • Page 286

    10. DICTIONARIES AND FORMSMARRCRLRF04071E REV B"F9" &new_line"F10 >"* you can have a maximum of 10 function keys labeled$-, form1_help* help text"HelpLine 1" &new_line"Help Line 2" &new_line"Help Line3" &new_line* You can have a...

  • Page 287

    MARRCRLRF04071E REV B10. DICTIONARIES AND FORMS 287,Figure 287,10–6 shows the second template in FORM.FTX as displayed on the CRT/KB (only 10numbered lines are shown at one time). This example contains all the edit data types.Figure 10–6.Example of Edit Data ItemsTitle here ...

  • Page 288

    10. DICTIONARIES AND FORMSMARRCRLRF04071E REV B"Real:""-%12f"&new_line"Bolean:""-%10B(bool_fkey)"&new_line"String:""-%-20k"&new_line"String:""-%12k(clear)"&new_line"Byte:""-%10b"&am...

  • Page 289

    MARRCRLRF04071E REV B10. DICTIONARIES AND FORMS$-"Yellow"$-"\a"*specifies end of subwindow list* Allows you to specify the choices for the subwindow in a* variable whose type is an ARRAY[m] of STRING[n].$-,enum_var"RUNFORM"&new_line*program name of variable"...

  • Page 290

    10. DICTIONARIES AND FORMSMARRCRLRF04071E REV BProg_name3: STRING[12]prog_name4: STRING[12]choices: ARRAY[5] OF STRING[12]BEGINvalue_array [1] = ’int_var1’value_array [2] = ’int_var2’value_array [3] = ’real_var’value_array [4] = ’bool_var’value_array [5] = ’str_var1’value_arra...

  • Page 291

    MARRCRLRF04071E REV B10. DICTIONARIES AND FORMS 291,Figure 291,10–7 shows the third template in FORM.FTX as displayed on the teach pendant. This examplecontains display only items. It shows how to automatically load the form dictionary file and thevariable data file, from a KAREL program.Figur...

  • Page 292

    10. DICTIONARIES AND FORMSMARRCRLRF04071E REV BExample Program for Display Only Data ItemsPROGRAM runform%NOLOCKGROUP%INCLUDE form-- allows you to access form element numbers%INCLUDE klevccdf%INCLUDE klevkeys%INCLUDE klevkmskdevice_stat: INTEGER -- tp_panel or crt_panelvalue_array: ARRAY [20] OF ...

  • Page 293

    MARRCRLRF04071E REV B10. DICTIONARIES AND FORMSint_var2 = 1device_stat = tp_panelFORCE_SPMENU(device_stat, SPI_TPUSER2,1)def_item=1-- start with menu item 1DISCTRL_FORM(’FORM’, form3, value_array, inact_array,change_array, kc_func_key, def_item, term_char, status);END runform10–43

  • Page 294

  • Page 295

    Chapter 11SYSTEM VARIABLESContents 295,Chapter 295,11 295,SYSTEM 295,VARIABLES............................................................................ 295,11–1 296,11.1 296,ACCESS 296,RIGHTS..................................................................................... 296,11–2...

  • Page 296

    11. SYSTEM VARIABLESMARRCRLRF04071E REV BSystem variables are variables that are declared as part of the KAREL system software. They havepermanently defined variable names that begin with a dollar sign ($). Many system variables arestructure variables , in which case each field also begins with a...

  • Page 297

    MARRCRLRF04071E REV B11. SYSTEM VARIABLESSee Also: FANUC Robotics Software Reference Manual for system variables11.1.1 System Variables Accessed by KAREL ProgramsMany system variables pertaining to motion are defined as an ARRAY[n] or a structure type where“n” is the number of motion groups d...

  • Page 298

    11. SYSTEM VARIABLESMARRCRLRF04071E REV BTable 11–2.System Variables Accessed by Programs (Cont’d)$ROTSPEED$USETIMESHFT$SEGTERMTYPE$UTOOL11.2 STORAGESystem variables are assigned an initial value upon power up based on• Internal default values• Values stored in the default system variable...

  • Page 299

    Chapter 12KAREL COMMAND LANGUAGE (KCL)Contents 299,Chapter 299,12 299,KAREL 299,COMMAND 299,LANGUAGE 299,(KCL)................................................. 299,12–1 300,12.1 300,COMMAND 300,FORMAT................................................................................ 300,12...

  • Page 300

    12. KAREL COMMAND LANGUAGE (KCL)MARRCRLRF04071E REV BThe KAREL command language (KCL) environment contains a group of commands that can be usedto direct the KAREL system. KCL commands allow you to develop and execute programs, work withfiles, get information about the system, and perform many oth...

  • Page 301

    MARRCRLRF04071E REV B12. KAREL COMMAND LANGUAGE (KCL)12.1.2 Variables and Data TypesThe KCL> CREATE VARIABLE command allows you to declare variables. The KCL> SETVARIABLE command permits you to assign values to declared variables. Assigned values canbe INTEGER, REAL, BOOLEAN, and STRING dat...

  • Page 302

    12. KAREL COMMAND LANGUAGE (KCL)MARRCRLRF04071E REV B3. Enter commands at the KCL prompt.By entering the first keyword of a KCL command that requires more than one keyword, and bypressing ENTER, a list of all additional KCL keywords will be displayed.For example, entering DELETE at the KCL prompt...

  • Page 303

    MARRCRLRF04071E REV B12. KAREL COMMAND LANGUAGE (KCL)12.4.1 Command Procedure FormatAll KCL commands except RUNCF can be used inside a command procedure. For commands thatrequire confirmation, you can enter either the command and confirmation on one line or KCL willprompt for the confirmation on ...

  • Page 304

    12. KAREL COMMAND LANGUAGE (KCL)MARRCRLRF04071E REV B12.4.2 Creating Command ProceduresA command procedure can be created by typing in the list of commands into a command file andsaving the file. This can be done using the full screen editor.See Also: EDIT KCL commands, 827,Appendix 827,C, “K...

  • Page 305

    Chapter 13INPUT/OUTPUT SYSTEMContents 305,Chapter 305,13 305,INPUT/OUTPUT 305,SYSTEM...................................................................... 305,13–1 306,13.1 306,USER-DEFINED 306,SIGNALS........................................................................ 306,13–2 306,1...

  • Page 306

    13. INPUT/OUTPUT SYSTEMMARRCRLRF04071E REV BThe Input/Output (I/O) system provides user access with KAREL to user-defined I/O signals,system-defined I/O signals and communication ports. The user-defined I/O signals are controlled in aKAREL program and allow you to communicate with peripheral devi...

  • Page 307

    MARRCRLRF04071E REV B13. INPUT/OUTPUT SYSTEMDOUT[n] = ONTo turn off a DOUT:DOUT[n] = FALSE orDOUT[n] = OFFYou assign digital signals to the ports on I/O devices using teach pendant I/O menus or the KARELbuilt-in routine SET_PORT_ASG.13.1.2 GIN and GOUT SignalsThe GIN and GOUT signals provide acce...

  • Page 308

    13. INPUT/OUTPUT SYSTEMMARRCRLRF04071E REV BInput signals are accessed in KAREL programs by the name AIN[n], where“n” is the signal number.Evaluating AIN signals causes the system to perform read operations of the input port. Setting an AINsignal at the Teach Pendant is an invalid operation u...

  • Page 309

    MARRCRLRF04071E REV B13. INPUT/OUTPUT SYSTEMEvaluating AOUT signals causes the system to return the currently output value from the specifiedoutput signal. Assigning a value to an AOUT signal causes the system to perform an output operation.An AOUT can be turned on in a KAREL program with AOUT[n]...

  • Page 310

    13. INPUT/OUTPUT SYSTEMMARRCRLRF04071E REV B13.2.1 Robot Digital Input and Output Signals (RDI/RDO)Robot I/O is the input and output signals between the controller and the robot. These signals are sentto the EE (End Effector) connector located on the robot. The number of robot input and outputsig...

  • Page 311

    MARRCRLRF04071E REV B13. INPUT/OUTPUT SYSTEMTable 13–1.Standard Operator Panel Input SignalsOPIN[n]SI[n]FunctionDescriptionOPIN[0]SI[0]NOT USED-OPIN[1]SI[1]FAULT RESETThis signal is normally turned OFF, indicating thatthe FAULT RESET button is not being pressed.OPIN[2]SI[2]REMOTEThis signal is ...

  • Page 312

    13. INPUT/OUTPUT SYSTEMMARRCRLRF04071E REV BUser Operator Panel Input and Output SignalsUser operator panel input and output signals are recognized by the KAREL system as OPIN[16]-OPIN[33] and OPOUT[16]-OPOUT[35] and by the screens on the teach pendant as UI[1]-UI[18]and UO[1]-UO[20]. On the proc...

  • Page 313

    MARRCRLRF04071E REV B13. INPUT/OUTPUT SYSTEMTable 13–3.User Operator Panel Input SignalsOPIN[n]UI[n]Process I/ONumberFunctionDescriptionOPIN[16]UI[1]1*IMSTPAlways active*IMSTP is the immediate stop software signal.*IMSTP is a normally OFF signal held ON that whenset to OFF will• Pause a progr...

  • Page 314

    13. INPUT/OUTPUT SYSTEMMARRCRLRF04071E REV BTable 13–3.User Operator Panel Input Signals (Cont’d)OPIN[n]UI[n]Process I/ONumberFunctionDescriptionOPIN[18]UI[3]3*SFSPDAlways active*SFSPD is the safety speed input signal. This signalis usually connected to the safety fence.*SFSPD is anormally OF...

  • Page 315

    MARRCRLRF04071E REV B13. INPUT/OUTPUT SYSTEMTable 13–3.User Operator Panel Input Signals (Cont’d)OPIN[n]UI[n]Process I/ONumberFunctionDescriptionOPIN[19]UI[4]4CSTOPIAlways activeCSTOPI is the cycle stop input. When CSTOPIbecomes TRUE, the system variable $CSTOP isset to TRUE. In addition, if ...

  • Page 316

    13. INPUT/OUTPUT SYSTEMMARRCRLRF04071E REV BTable 13–3.User Operator Panel Input Signals (Cont’d)OPIN[n]UI[n]Process I/ONumberFunctionDescriptionOPIN[20]UI[5]5FAULT_RESETAlways activeFAULT_RESET is the external fault reset signal.When this signal is received• Errorstatusiscleared.• Servo ...

  • Page 317

    MARRCRLRF04071E REV B13. INPUT/OUTPUT SYSTEMTable 13–3.User Operator Panel Input Signals (Cont’d)OPIN[n]UI[n]Process I/ONumberFunctionDescriptionOPIN[24]-OPIN[31]UI[9]-UI[16]9- 126RSR1/PNS1,RSR2/PNS2,RSR3/PNS3,RSR4/PNS4,RSR5/PNS5,,RSR6/PNS6,,RSR7/PNS7,,RSR8/PNS8Active when the robotis in a re...

  • Page 318

    13. INPUT/OUTPUT SYSTEMMARRCRLRF04071E REV BTable 13–4.User Operator Panel Output SignalsOPOUT[n]UO[n]Process I/ONumberFunctionDescriptionOPOUT[16]UO[1]1CMDENBLCMDENBL is the command enableoutput. This output indicates that therobot is in a remote condition. Thissignal goes ON when the REMOTEsw...

  • Page 319

    MARRCRLRF04071E REV B13. INPUT/OUTPUT SYSTEMTable 13–4.User Operator Panel Output Signals (Cont’d)OPOUT[n]UO[n]Process I/ONumberFunctionDescriptionOPOUT[25]UO[10]10BUSYBUSY is the processor busy output.This signal turns on when the robotis executing a program or when theprocessor is busy.OPOU...

  • Page 320

    13. INPUT/OUTPUT SYSTEMMARRCRLRF04071E REV BTable 13–4.User Operator Panel Output Signals (Cont’d)OPOUT[n]UO[n]Process I/ONumberFunctionDescriptionOPOUT[38]UO[23]23LOCKED(option)-OPOUT[39]UO[24]24CSTOPO(option)CSTOPO is the cycle stop output.This output turns on when theCSTOPI input has been ...

  • Page 321

    MARRCRLRF04071E REV B13. INPUT/OUTPUT SYSTEMFigure 13–3.PNS Timing DiagramCMDENBL OUTPUTRemote ConditionPNS 1–8INPUTPNSTROBEINPUTPNSTROBEDETECTIONSNO1–8OUTPUTSNACKOUTPUTPROD_STARTINPUTPROGRUNOUTPUTProgram Number is SelectedWhile PNSTROBE is ON, program selection modification is not allowedP...

  • Page 322

    13. INPUT/OUTPUT SYSTEMMARRCRLRF04071E REV BTable 13–5.Teach Pendant Input Signal Assignments (Cont’d)TPIN[n]Teach Pendant KeyTPIN[250]TPIN[249]TPIN[247]TPIN[248]EMERGENCY STOPON/OFF switchRight DEADMAN switchLeft DEADMAN switchArrow KeysTPIN[212]TPIN[213]TPIN[208]TPIN[209]TPIN[0]TPIN[204]TPI...

  • Page 323

    MARRCRLRF04071E REV B13. INPUT/OUTPUT SYSTEMTable 13–5.Teach Pendant Input Signal Assignments (Cont’d)TPIN[n]Teach Pendant KeyTPIN[128]TPIN[129]TPIN[131]TPIN[132]TPIN[133]TPIN[134]TPIN[135]TPIN[136]TPIN[137]TPIN[138]TPIN[139]TPIN[140]TPIN[141]TPIN[142]PREVF1F2F3F4F5NEXTShifted PREVShifted F1S...

  • Page 324

    13. INPUT/OUTPUT SYSTEMMARRCRLRF04071E REV BTable 13–5.Teach Pendant Input Signal Assignments (Cont’d)TPIN[n]Teach Pendant KeyTPIN[173]TPIN[174]TPIN[175]TPIN[176]TPIN[177]TPIN[178]TPIN[210]TPIN[179]TPIN[180]TPIN[181]TPIN[182]TPIN[183]TPIN[184]TPIN[211]USER KEY 1USER KEY 2USER KEY 3USER KEY 4U...

  • Page 325

    MARRCRLRF04071E REV B13. INPUT/OUTPUT SYSTEMTable 13–5.Teach Pendant Input Signal Assignments (Cont’d)TPIN[n]Teach Pendant KeyMotion Keys Cont’dTPIN[214]TPIN[215]TPIN[216]TPIN[217]TPIN[218]TPIN[219]TPIN[220]TPIN[221]TPIN[222]TPIN[223]TPIN[224]TPIN[225]Shifted +XShifted +YShifted +ZShifted +...

  • Page 326

    13. INPUT/OUTPUT SYSTEMMARRCRLRF04071E REV BFigure 13–4.Location of Ports on the ControllerALARM1 23 4STATUSCA69AJRL6CRS26FSSBC0P10ATXL/RXTXL/RXCD38BCD38AETHERNETPCMCIAMAIN(SLOT 1)CP8BJGP2JGP1HDI JRL5RS-232-CJRS16RS-232-CJD17I/O LINKJD1APANEL JRS15ALARM1 23 4STATUSCA69AJRL6CRS26FSSBC0P10ATXL/RX...

  • Page 327

    MARRCRLRF04071E REV B13. INPUT/OUTPUT SYSTEMUp to four ports are available, P1-P4. 327,Table 327,13–6 lists the ports. You can set up ports P2 through P4 ifyou have them, but you cannot set up the teach pendant port, P1.Table 13–6.Ports P1 - P4PortItem Name on ScreenKind of PortUseDefault D...

  • Page 328

    13. INPUT/OUTPUT SYSTEMMARRCRLRF04071E REV BTable 13–7.Default Communications Settings for Devices (Cont’d)DeviceSpeed (baud)Parity BitStop BitTimeoutValue (sec)PMC Programmer9600None2bit0Modem/PPPRefer to the FANUC Robotics Internet Options Setup and Operations Manualforinformation on the su...

  • Page 329

    Chapter 14MULTI-TASKINGContents 329,Chapter 329,14 329,MULTI-TASKING 329,.................................................................................... 329,14–1 330,14.1 330,MULTI-TASKING 330,TERMINOLOGY............................................................. 330,14–2 331,14.2 ...

  • Page 330

    14. MULTI-TASKINGMARRCRLRF04071E REV BMulti-tasking allows more than one program to run on the controller on a time-sharing basis, so thatmultiple programs appear to run simultaneously.Multi-tasking is especially useful when you are executing several sequences of operations whichcan generally ope...

  • Page 331

    MARRCRLRF04071E REV B14. MULTI-TASKINGNoteThe task name does not change once the task is created. Therefore, when an external routineis executing, the current executing program name is not the same as the task name. When yousend any requests to the task, use the task name, not the current program...

  • Page 332

    14. MULTI-TASKINGMARRCRLRF04071E REV B• When a task calls a ROUTINE or teach pendant program, it requires control of those group(s).The group(s) required by a ROUTINE or TPP+ program are those specified, or implied, bycontroller directives or in the teach pendant DETAIL setup.A task will be giv...

  • Page 333

    MARRCRLRF04071E REV B14. MULTI-TASKINGThe following are examples of hold conditions:• Waiting for a read operation to complete.• Waiting for a motion to complete.• Waiting for a WAIT, WAIT FOR, or DELAY statement to complete.A task is ready to run when it is in running state and has no hold...

  • Page 334

    14. MULTI-TASKINGMARRCRLRF04071E REV BTable 14–1.System Function Priority TablePrioritySystem FunctionEffect of Delaying Function-8Maximum priorityNew motions, or continuation nodes of a MOVE ALONGpath statement delayed.-1Motion PlannerNew motions, or continuation nodes of a MOVE ALONGpath stat...

  • Page 335

    MARRCRLRF04071E REV B14. MULTI-TASKING• Teach pendant program executes a RUN instruction. Refer to 335,Section 335,14.5.2 , “Child Tasks,”for more information.• KAREL program executes the RUN_TASK built-in. Refer to 335,Section 335,14.5.2 , “Child Tasks,”for more information.In ea...

  • Page 336

    14. MULTI-TASKINGMARRCRLRF04071E REV BWarningDo not run a KAREL program that performs motion if more than onemotion group is defined on your controller. If your controller is set up formore than one motion group, all motion must be initiated from a teachpendant program. Otherwise, the robot could...

  • Page 337

    MARRCRLRF04071E REV B14. MULTI-TASKING• ABORT condition handler action causes a task to be aborted.• PAUSE condition handler action causes a task to be paused.• GET_TSK_INFO determines whether a specified task is running, paused, or aborted. Alsodetermines what program and line number is be...

  • Page 338

    14. MULTI-TASKINGMARRCRLRF04071E REV B• Read a semaphore (KAREL: SEMA_COUNT built-in): returns the current semaphore count.• Wait for a semaphore (KAREL: PEND_SEMA built-in, SIGNAL SEMAPHORE Action):If the semaphore count is greater than zero when the wait semaphore is issued, the semaphoreco...

  • Page 339

    MARRCRLRF04071E REV B14. MULTI-TASKING--KARELCLEAR_SEMA(4)CLEAR_SEMA(5)CLEAR_SEMA(6)RUN TASK(‘server’,0,TRUE,TRUE,1,STATUS)PEND_SEMA(4,max_time,time_out)rqst_param=10POST_SEMA(5)PEND_SEMA(6,max_time,time_out)The server task would contain the following KAREL code:Server Task--KARELPOST_SEMA (4...

  • Page 340

    14. MULTI-TASKINGMARRCRLRF04071E REV B--to make sure its count is at----zero before using it.Then----post this semaphore which will----allow the first pend to the----semaphore to continue----execution.--------------------------------------------------ROUTINE init_lockBEGINCLEAR_SEMA (motion_ctrl)...

  • Page 341

    MARRCRLRF04071E REV B14. MULTI-TASKINGSemaphore and Task Synchronization Program Example - TASK APROGRAM task_a%nolockgroupVARmotion_ctrl FROM main_task: INTEGERhome_pos: POSITIONstatus: INTEGER------------------------------------------------------RUN_HOME: Lock the robot motion----control.This t...

  • Page 342

    14. MULTI-TASKINGMARRCRLRF04071E REV B--tasks and do work.This----task is doing motion and----must lock motion control so ----that another task does not----try to do motion at the----same time.--------------------------------------------------ROUTINE do_workVARtime_out: BOOLEANBEGINPEND_SEMA (mot...

  • Page 343

    MARRCRLRF04071E REV B14. MULTI-TASKINGA QUEUE_TYPE Data Type has one user accessible element, n_entries . This is the number ofentries that have been added to the queue and not read out. The array of integer used with a queue, isused by the queue built-ins and should not be referenced by the KARE...

  • Page 344

  • Page 345

    Appendix AKAREL LANGUAGE ALPHABETICALDESCRIPTIONContents 345,Appendix 345,A 345,KAREL 345,LANGUAGE 345,ALPHABETICAL 345,DESCRIPTION............................................... 345,A–1 353,A.1 353,OVERVIEW 353,..................................................................................

  • Page 346

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B 384,A.2.26 384,ATT_WINDOW_S 384,Built-In 384,Procedure.......................................................................... 384,A–40 385,A.2.27 385,AVL_POS_NUM 385,Built-In 385,Procedure.......................................

  • Page 347

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION 426,A.4.47 426,COPY_QUEUE 426,Built-In 426,Procedure.............................................................................. 426,A–82 428,A.4.48 428,COPY_TPE 428,Built-In 428,Procedure........................................

  • Page 348

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B 486,A.7.7 486,FROM 486,Clause 486,........................................................................................................... 486,A–142 487,A.8 487,- 487,G 487,- 487,KAREL 487,LANGUAGE 487,DESCRIPTION............

  • Page 349

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION 552,A.11.2 552,JOINTPOS 552,Data 552,Type............................................................................................... 552,A–208 553,A.11.3 553,JOINT2POS 553,Built-In 553,Function.................................

  • Page 350

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B 598,A.17.8 598,PIPE_CONFIG 598,Built-In 598,Procedure............................................................................ 598,A–254 599,A.17.9 599,POP_KEY_RD 599,Built-In 599,Procedure......................................

  • Page 351

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION 654,A.20.9 654,SET_ATTR_PRG 654,Built-In 654,Procedure......................................................................... 654,A–310 655,A.20.10 655,SET_CURSOR 655,Built-In 655,Procedure.......................................

  • Page 352

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B 698,A.22.5 698,UNLOCK_GROUP 698,Built-In 698,Procedure...................................................................... 698,A–354 700,A.22.6 700,UNPAUSE 700,Action...............................................................

  • Page 353

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.1 OVERVIEWThis appendix describes, in alphabetical order, each standard KAREL language element, including:• Data types• Executable statements and clauses• Condition handler conditions and actions• Built-in routines• Transl...

  • Page 354

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BTable A–1.Syntax Notation (Cont’d)SyntaxMeaningExampleResult{| }Any combination ofalternatives can be usedAAA {BBB | CCC}AAAAAA BBBAAA CCCAAA BBB CCCAAA CCC BBBAAA BBB CCC BBB BBB<< |>>Nesting of symbols isallowed. Loo...

  • Page 355

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• Example: Displays a brief example and explanation of the element. 355,Table 355,A–2 through 360,Table 360,A–8 list the KAREL language elements, described in this appendix, by the type of element. 361,Table 361,A–9 lists ...

  • Page 356

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BTable A–4.ConditionsABORT ConditionAT NODE ConditionCONTINUE ConditionERROR ConditionEVENT ConditionPAUSE ConditionPort_Id ConditionRelational ConditionSEMAPHORE ConditionTIME ConditionTable A–5.Data TypesARRAY Data TypeBOOLEAN Da...

  • Page 357

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONTable A–6.Directives%ALPHABETIZE%CMOSVARS%CMOS2SHADOW%COMMENT%CRTDEVICE%DEFGROUP%DELAY%ENVIRONMENT%INCLUDE%LOCKGROUP%NOABORT%NOBUSYLAMP%NOLOCKGROUP%NOPAUSE%NOPAUSESHFT%PRIORITY%SHADOWVARS%STACKSIZE%TIMESLICE%TPMOTION%UNINITVARSTable...

  • Page 358

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BTable A–7.KAREL Built—In Routine Summary (Cont’d)CategoryIdentifierSerial I/O, File UsageBYTES_AHEADBYTES_LEFTCLR_IO_STATGET_FILE_POSGET_PORT_ATRIO_STATUSMSG_CONNECTMSG_DISCOMSG_PINGPIPE_CONFIGSET_FILE_ATRSET_FILE_POSSET_PORT_AT...

  • Page 359

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONTable A–7.KAREL Built—In Routine Summary (Cont’d)CategoryIdentifierRegister OperationCLR_POS_REGGET_JPOS_REGGET_POS_REGGET_PREG_CMTGET_REGGET_REG_CMTPOS_REG_TYPESET_EPOS_REGSET_INT_REGSET_JPOS_REGSET_POS_REGSET_REAL_REGString Op...

  • Page 360

  • Page 361

  • Page 362

  • Page 363

  • Page 364

  • Page 365

  • Page 366

  • Page 367

  • Page 368

  • Page 369

  • Page 370

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BThe KAREL built-ins ADD_BYNAMEPC, ADD_INTPC, ADD_REALPC, and ADD_STRINGPCcan be used to format a KAREL byte buffer in the following way: INTEGER data is added to thebuffer as follows (buffer bytes are displayed in HEX):beginning index...

  • Page 371

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONDetails:• dat_buffer -anarrayofup to244 bytes.• dat_index - the starting byte number to place the real value.• number - the real value to place into the buffer.• status - the status of the attempted operation. If not 0, then a...

  • Page 372

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BInput/Output Parameters :[in] dat_buffer :ARRAY OF BYTE[in,out] dat_index :INTEGER[in] item :string[out] status :INTEGER%ENVIRONMENT Group :PCDetails:• dat_buffer -anarrayofup to244 bytes.• dat_index - the starting byte number to ...

  • Page 373

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION00 = end of data in the bufferOn return from the built-in, index = 12.See Also: ADD_BYNAMEPC, ADD_INTPC, ADD_REALPC, ADD_STRINGPCExample: Refer to the TESTDATA example in the built-in function SEND_DATAPC.A.2.13 %ALPHABETIZE Translato...

  • Page 374

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BDetails:• path_var is thepathvariabletowhich thenodeisappended.• The appended PATH node is uninitialized. The node can be assigned values by directlyreferencing its NODEDATA structure.• status explains the status of the attempte...

  • Page 375

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.2.16 APPROACH Built-In FunctionPurpose: Returns a unit VECTOR representing the z-axis of a POSITION argumentSyntax : APPROACH(posn)Function Return Type :VECTORInput/Output Parameters :[in] posn :POSITION%ENVIRONMENT Group :VECTRDeta...

  • Page 376

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV Bwhere:size : an INTEGER literal or constantdata_type : any type except PATHDetails:• size indicates the number of elements in an ARRAY variable.• size must be in the range 1 through 32767 and must be specified in a normal ARRAY va...

  • Page 377

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION 817,Section 817,B.14 , "Applying Offsets to a Copied Teach Pendant Program" (CPY_TP.KL)A.2.18 ARRAY_LEN Built-In FunctionPurpose: Returns the number of elements contained in the specified array argumentSyntax : ARRAY_LEN(a...

  • Page 378

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BASIN Built-In FunctionROUTINE take_asinVARans_r:REALBEGINans_r = ASIN (-1)WRITE (’asin -1 ’, ans_r, CR)END take_asinThe second example causes the program to abort since the input value is less than -1 and not withinthe valid range...

  • Page 379

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• field is used to access fields in a structure.• expn must be of the same type as the variable or element of variable .• An exception is that an INTEGER expression can be assigned to a REAL. Any positional typescan be assigned ...

  • Page 380

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• variable can be any user-defined variable, system variable with write access, or output portarray with write access.• subscript is used to access elements of an array.• field is used to access fields in a structure.• expn mu...

  • Page 381

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONExample: The last example assigns all the elements of the ARRAY array_1 to those of ARRAYarray_2 , and all the fields of structure struc_var_1 to those of struc_var_2 .Assignment Statementarray_2 = array_1struc_var_2 = struc_var_1A.2....

  • Page 382

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BFunction Return Type :REALInput/Output Parameters :[in] x1 :REAL[in] y1 :REAL%ENVIRONMENT Group :SYSTEMDetails:• x1 and y1 specify the x and y coordinates of the point.• If x1 and y1 are both zero, the interpreter will abort the p...

  • Page 383

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• If the teach pendant is still enabled, execution of the KAREL program is delayed until the teachpendant is disabled. The task status will show a hold of "attach done."• Stopped motions can only be resumed following exe...

  • Page 384

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV Bexample, if the screen is 24 rows by 80 columns (as defined by its associated display device) andthe window is 2 rows by 80 columns, row must be in the range 1-23; col must be 1.• The name of the active screen is returned in screen_...

  • Page 385

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONExample: Refer to 802,Section 802,B.12 , "Displaying a List From a Dictionary File" (DCLST_EX.KL), for adetailed program example.A.2.27 AVL_POS_NUM Built-In ProcedurePurpose: Returns the first available position number in ...

  • Page 386

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B 386,Table 386,A–10 lists some examples of valid and invalid BOOLEAN values used to represent theBoolean predefined constants.Table A–10.Valid and Invalid BOOLEAN ValuesVALIDINVALIDREASONTRUETMust use entire wordON1Cannot use INT...

  • Page 387

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION 817,Section 817,B.14 , "Applying Offsets to a Copied Teach Pendant Program" (CPY_TP.KL) 739,Section 739,B.1 , "Setting Up Digital Output Ports for Monitoring" (DOUT_EX.KL)A.3.2 BYNAME Built-In FunctionPurpose: A...

  • Page 388

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BSyntax : BYTEDetails:• BYTE has a range of (0 ≤n ≥255). No uninitialized checking is done on bytes.• BYTEs are allowed only within an array or within a structure.• BYTEs can be assigned to SHORTs and INTEGERs, and SHORTs and...

  • Page 389

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION[out] status :INTEGER%ENVIRONMENT Group :FLBTDetails:• file_id specifies the file that was opened.• The file_id must be opened with the ATR_READAHD attribute set greater than zero.• n_byte is the number of bytes in the read_ahea...

  • Page 390

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BA.3.5 BYTES_LEFT Built-In FunctionPurpose: Returns the number of bytes remaining in the current input data recordSyntax : BYTES_LEFT(file_id)Function Return Type :INTEGERInput/Output Parameters :[in] file_id :FILE%ENVIRONMENT Group :F...

  • Page 391

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONCONSTdefault_1 = 0default_2 = -1VAR rqd_field, opt_field_1, opt_field_2: INTEGERBEGINWRITE(’Enter integer field(s): ’)READ(rqd_field)IF BYTES_LEFT(TPDISPLAY) > 0 THENREAD(opt_field_1)ELSEopt_field_1 = default_1ENDIFIF BYTES_LEF...

  • Page 392

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BExample: Refer to 750,Section 750,B.2 , "Copying Path Variables" (CPY_PTH.KL), for a detailed programexample.A.4.2 CALL_PROGLIN Built-In ProcedurePurpose: Allows a KAREL program to call an external KAREL or teach pendant p...

  • Page 393

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONSyntax : CANCEL <GROUP[n{,n}]>Details:• Cancels a motion currently in progress or pending (but not stopped) for one or more groups.• CANCEL does not cancel motions that are already stopped. To cancel a motion that is already...

  • Page 394

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BSyntax : CANCEL <GROUP[n{,n}]>Details:• Cancels a motion currently in progress or pending (but not stopped) for one or more groups.• CANCEL does not cancel motions that are already stopped. To cancel a motion that is already...

  • Page 395

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONENDIFA.4.5 CANCEL FILE StatementPurpose: Cancels a READ or WRITE statement that is in progress.Syntax : CANCEL FILE [file_var]where:file_var :a FILE variableDetails:• Used to cancel input or output on a specified file• The built-i...

  • Page 396

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B-- Read an integer, but cancel if F1 pressedCLR_IO_STAT(TPDISPLAY)WRITE(CR, ’Enter an integer: ’)READ(int_var)UNTIL FALSEend can_file_exA.4.6 CHECK_DICT Built-In ProcedurePurpose: Checks the specified dictionary for a specified el...

  • Page 397

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONInput/Output Parameters :[in] eposn :XYZWPREXT[in] uframe :POSITION[in] utool :POSITION[out] status :INTEGER[in] group_no :INTEGER%ENVIRONMENT Group :PBCOREDetails:• eposn is the XYZWPREXT position to be checked.• uframe specifies...

  • Page 398

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• Name_spec specifies the string to check for illegal characters. The string can be the file name orprogram name. It should not include the extension of the file or the program. This built-in doesnot handle special system names such...

  • Page 399

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONSyntax : CLEAR(file_spec, status)Input/Output Parameters :[in] file_spec :STRING[out] status :INTEGER%ENVIRONMENT Group :PBCOREDetails:• file_spec specifies the program name and type of data to clear. The following types are valid:n...

  • Page 400

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• semaphore_no must be in the range of 1 to the number of semaphores defined on the controller.• All semaphores are cleared at COLD start. It is good practice to clear a semaphore prior tousing it. Before several tasks begin shari...

  • Page 401

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• The valid range of values for hand_num is 1-2. Otherwise, the program is aborted with an error.• The statement has no effect if the value of hand_num is in range but the hand is not connected.• The program is aborted with an e...

  • Page 402

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BA.4.15 CLR_IO_STAT Built-In ProcedurePurpose: Clear the results of the last operation on the file argumentSyntax : CLR_IO_STAT(file_id)Input/Output Parameters :[in] file_id :FILE%ENVIRONMENT Group :PBCOREDetails:• Causes the last op...

  • Page 403

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONSee Also: GET_PORT_SIM, SET_PORT_SIM Built-In ProceduresA.4.17 CLR_POS_REG Built-In ProcedurePurpose: Removes all data for the specified group in the specified position registerSyntax : CLR_POS_REG(register_no, group_no, status)Input/...

  • Page 404

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• If %CMOSVARS is specified in the program, then all static variables by default will be created inpermanent memory.• If %CMOSVARS is not specified, then all static variables by default will be created in temporarymemory.• If a ...

  • Page 405

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• If there is more than one display active for this variable in this window, all the displays arecanceled.• status returns an error if there is no dynamic display active specifying this variable and window.If not equal to 0, then ...

  • Page 406

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BA.4.22 CNC_DYN_DISI Built-In ProcedurePurpose: Cancels the dynamic display of an INTEGER variable in a specified window.Syntax : CNC_DYN_DISI(int_var, window_name, status)Input/Output Parameters :[in] int_var :INTEGER[in] window_name ...

  • Page 407

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION%ENVIRONMENT Group :UIFDetails:• port_type and port_no are integer values specifying the port whose dynamic display is to becanceled.• Refer to the CNC_DYN_DISB built-in procedure for a description of the other parameterslisted ab...

  • Page 408

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BA.4.25 CNC_DYN_DISS Built-In ProcedurePurpose: Cancels the dynamic display of a STRING variable in a specified window.Syntax : CNC_DYN_DISS(str_var, window_name, status)Input/Output Parameters :[in] str_var :STRING[in] window_name :ST...

  • Page 409

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONWarningDo not run a KAREL program that performs motion if more than onemotion group is defined on your controller. If your controller is set upfor more than one motion group, all motion must be initiated from ateach pendant program. O...

  • Page 410

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BUsing a length of 25 is generally adequate because the longest configuration string of any robot is25 characters long.See Also: CNV_STR_CONF Built-In ProcedureExample: The following example converts the configuration from position pos...

  • Page 411

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONExample: Refer to the following section for detailed program examples: 776,Section 776,B.7 , "Listing Files and Programs and Manipulating Strings" (LIST_EX.KL)A.4.29 CNV_JPOS_REL Built-In ProcedurePurpose: Allows a KAREL pr...

  • Page 412

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B[in] source :REAL expression[in] length :INTEGER expression[in] num_digits :INTEGER expression[out] target :STRING%ENVIRONMENT Group :STRNGDetails:• source is the REAL value to be formatted.• length specifies the minimum length of...

  • Page 413

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION[in] real_array :ARRAY [num_joints] OF REAL[out] joint_pos :JOINTPOS[out] status :INTEGER%ENVIRONMENT Group :SYSTEMDetails:• real_array must have a declared size, equal to or greater than, the number of joints in the system.A value ...

  • Page 414

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B%ENVIRONMENT Group :STRNGDetails:• target receives the CONFIG form of the configuration string specified by source .• source must be a valid configuration string for the robot arm attached to the controller.• status explains the...

  • Page 415

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.4.34 CNV_STR_REAL Built-In ProcedurePurpose: Converts the specified STRING into a REALSyntax : CNV_STR_REAL(source, target)Input/Output Parameters :[in] source :STRING[out] target :REAL%ENVIRONMENT Group :PBCOREDetails:• Converts ...

  • Page 416

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BDetails:• Thesizeofthe string parameter, source , is STRING[20].• source must be entered using ‘‘DD-MMM-YYY HH:MM:SS’’ format. The seconds specifier,‘‘SS,’’ is optional. A value of zero (0) is used if seconds is no...

  • Page 417

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONExample: Refer to 785,Section 785,B.9 , "Using the File and Device Built-ins" (FILE_EX.KL), for a detailedprogram example.A.4.37 %COMMENT Translator DirectivePurpose: Specifies a comment of up to 16 charactersSyntax : %COM...

  • Page 418

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BSyntax : COMMON_ASSOCDetails:• COMMON_ASSOC consists of a record containing standard associated data common for allmotion groups. It contains the following predefined fields, all INTEGERs:— SEGTERMTYPE :termination type— SEGDECE...

  • Page 419

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• If a condition handler with the specified number already exists, the old one is replaced with thenew one.• The optional [with_list] can be used to specify condition handler qualifiers. See the WITHclause for more information.•...

  • Page 420

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• CONFIG contains the following predefined fields:— CFG_TURN_NO1 :INTEGER— CFG_TURN_NO2 :INTEGER— CFG_TURN_NO3 :INTEGER— CFG_FLIP :BOOLEAN— CFG_LEFT :BOOLEAN— CFG_UP :BOOLEAN— CFG_FRONT :BOOLEAN• Variables and fields...

  • Page 421

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.4.41 CONNECT TIMER StatementPurpose: Causes an INTEGER variable to start being updated as a millisecond clockSyntax : CONNECT TIMER TO clock_varwhere:clock_var :a static, user-defined INTEGER variableDetails:• clock_var is present...

  • Page 422

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BSyntax : CONTINUE <PROGRAM[n]>Details:• The CONTINUE action will not resume stopped motions.• If program execution is paused, the CONTINUE action will continue program execution.• The CONTINUE action can be followed by the...

  • Page 423

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONWHEN CONTINUE DO DOUT[1] = ONENDCONDITIONA.4.44 CONT_TASK Built-In ProcedurePurpose: Continues the specified taskSyntax : CONT_TASK(task_name, status)Input/Output Parameters :[in] task_name :STRING[out] status :INTEGER%ENVIRONMENT Gro...

  • Page 424

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV Btask_str: STRING[12]status: INTEGERBEGINWRITE(’Enter task name to continue:’)READ(task_str)CONT_TASK(task_str, status)END cont_task_exA.4.45 COPY_FILE Built-In ProcedurePurpose: Copies the contents of one file to another with the ...

  • Page 425

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONNote nowait_sw is not available in this release and should be set to FALSE.• status explains the status of the attempted operation. If not equal to 0, then an error occurred.See Also: RENAME_FILE, DELETE_FILE Built-In ProceduresExam...

  • Page 426

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• status of 0 is returned if the parameters are valid and the COPY_PATH operation was successful.Non-zero status indicates the COPY_PATH operation was unsuccessful.NoteTo copy a complete path from one path variable to another identi...

  • Page 427

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION[in] queue_t :QUEUE_TYPE[in] queue_data :ARRAY OF INTEGER[in] n_skip :INTEGER[in] sequence_no :integer[out] out_data :ARRAY OF INTEGER[out] n_got :INTEGER[out] status :INTEGER%ENVIRONMENT Group :PBQMGRDetails:• queue_t specifies the...

  • Page 428

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV Bjob_queue FROM global_vars: QUEUE_TYPEjob_data FROM global_vars: ARRAY[100] OF INTEGERROUTINE disp_queue(data: ARRAY OF INTEGER;n_disp: INTEGER) FROM disp_progROUTINE disp_page(data_array: ARRAY OF INTEGER;page_no: INTEGER): BOOLEANVA...

  • Page 429

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• to_prog specifies the new teach pendant program name, without the .tp extension, that from_progwill be copied to.• overwrite_sw , if set to TRUE, will automatically overwrite the to_prog if it already exists and itis not current...

  • Page 430

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• When CR is used as a data item in a WRITE statement, it specifies that subsequent output to thesame file will appear on a new line.See Also: 889,Appendix 889,E , ‘‘Syntax Diagrams,’’ for additional syntax informationExam...

  • Page 431

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONDetails:• prog_name specifies the name of the program to be created.• prog_type specifies the type of the program to be created. The following constants are valid forprogram type: PT_MNE_UNDEF :TPE program of undefined sub type PT...

  • Page 432

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B[in] inner_dim :INTEGER[in] mid_dim :INTEGER[in] outer_dim :INTEGER[out] status :INTEGER[in] mem_pool :INTEGER%ENVIRONMENT Group :MEMODetails:• var_prog_nam specifies the program name that the variable should be created in. If var_p...

  • Page 433

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION’JOINTPOS3’’JOINTPOS4’’JOINTPOS5’’JOINTPOS6’’JOINTPOS7’’JOINTPOS8’’JOINTPOS9’’MODEL’’POSITION’’REAL’’STRING[n]’, where n is the string length; the default is 12 if not specified.’VECTOR’...

  • Page 434

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BExample: Refer to 750,Section 750,B.2 , "Copying Path Variables" (CPY_PTH.KL), for a detailed programexample.A.4.53 %CRTDEVICEPurpose: Specifies that the CRT/KB device is the default deviceSyntax : %CRTDEVICEDetails:• Sp...

  • Page 435

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONNote axis_limit_mask and ovr_trv_mask are not available in this release and can be set to 0.WarningDo not run a KAREL program that performs motion if more than onemotion group is defined on your controller. If your controller is set u...

  • Page 436

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• If group_no is omitted, the default group for the program is assumed.• If group_no is specified, it must be in the range of 1 to the total number of groups defined onthe controller.• The group must be kinematic.• Returns the...

  • Page 437

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.5 - D - KAREL LANGUAGE DESCRIPTIONA.5.1 DAQ_CHECKP Built-In ProcedurePurpose: To check the status of a pipe and the number of bytes available to be read from the pipe.Syntax : DAQ_CHECKP(pipe_num, pipe_stat, bytes_avail)Input/Output...

  • Page 438

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV Bflag applies only to tasks that read from the pipe.See Also: DAQ_WRITE Built-In.Example: Refer to the DAQWRITE example in the built-in function DAQ_WRITE.NoteThis built-in is only available when DAQ or data monitor options are loaded....

  • Page 439

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• prog_name is the name of the program containing the variable to be used for writing to the pipe.If passed as an empty string, the name of the current program is used.• var_name is the name of the variable that defines the data t...

  • Page 440

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV Bdatavar: INTEGERBEGIN-- Register pipe 1 DRAM as kldaq.dat-- It can hold 100 copies of the datavar variable-- before the pipe overflowsDAQ_REGPIPE(1, DAQ_DRAM, 100, ’’, ’datavar’, &’kldaq.dat’, 0, status)IF status<&g...

  • Page 441

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONSee Also: DAQ_REGPIPE Built-In and DAQ_STOP Built-In,DAQ_START Built-In ProcedureThis built-in call can be made either from the same task/program asthe writing task, or from a separateactivate/deactivate task.The writing task can lie ...

  • Page 442

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B-- prompt to turn off pipeWRITE(’Press any key to stop pipe’)READ (tpinput)-- stop pipe 1DAQ_STOP(1, FALSE, status)IF status<>0 THENPOST_ERR(status,’ ’,0,er_abort)ENDIFENDIFENDIFEND PIPONOFFNoteThis built-in is only avai...

  • Page 443

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONreceived for the pipe, the count is decremented.DAQ_STOP Built-In ProcedureIf the pipe is not forced off, and the count is not zero, the pipestays on.By setting the force_off flag to TRUE,the pipe is turned off regardless of the count...

  • Page 444

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BExample: The following example unregisters KAREL pipe 1.DAQ_UNREG Built-In ProcedurePROGRAM DAQUNREG%ENVIRONMENT DAQCONSTer_abort = 2VARstatus:INTEGERBEGIN-- unregister pipe 1DAQ_UNREG(1, status)IF status<>0 THENPOST_ERR(status,...

  • Page 445

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• status is the status of the attempted operation. If not 0, then an error occurred and the datawas not written.See Also: DAQ_REGPIPE and DAQ_CHECKP.DAQ_WRITE Built-In ProcedureYou do not have to use the same variable for writing da...

  • Page 446

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV Bdatavar.count = 0WHILE (pipestat AND DAQ_PIPREG)>0DO--do while registered-- update data variabledatavar.count = datavar.count + 1datavar.dataval = $FAST_CLOCK-- check if pipe is activeIF (pipestat AND DAQ_ACTIVE) > 0 THEN-- writ...

  • Page 447

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.5.8 DEF_SCREEN Built-In ProcedurePurpose: Defines a screenSyntax : DEF_SCREEN(screen_name, disp_dev_name, status)Input/Output Parameters :[in] screen_name :STRING[in] disp_dev_name :STRING[out] status :INTEGER%ENVIRONMENT Group :UIF...

  • Page 448

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B[in] options :INTEGER[out] status :INTEGER%ENVIRONMENT Group :PBCOREDetails:• Define a window that can be attached subsequently to a screen, have files opened to it, be writtenor have input echoed to it, and have information dynamic...

  • Page 449

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.5.10 %DELAY Translator DirectivePurpose: Sets the amount of time program execution will be delayed every 250 milliseconds. Eachprogram is delayed 8ms every 250ms by default. This allows the CPU to perform other functions suchas serv...

  • Page 450

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• Aborting a program, or issuing RUN from the CRT/KB when a program is paused, terminatesany delays in progress.• While a program is awaiting expiration of a delay, the KCL> SHOW TASK command willshow a hold of DELAY.• A time...

  • Page 451

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONExample: Refer to 760,Section 760,B.3 ,"Saving Data to the Default Device" (SAVE_VRS.KL), for adetailed program example.A.5.13 DELETE_NODE Built-In ProcedurePurpose: Deletes a path node from a PATHSyntax : DELETE_NODE(path...

  • Page 452

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B[in,out] queue_data :ARRAY OF INTEGER[out] status :INTEGER%ENVIRONMENT Group :PBQMGRDetails:• Use COPY_QUEUE to get a list of the sequence numbers.• sequence_no specifies the sequence number of the entry to be deleted. Use COPY_QU...

  • Page 453

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.5.16 DET_WINDOW Built-In ProcedurePurpose: Detach a window from a screenSyntax : DET_WINDOW(window_name, screen_name, status)Input/Output Parameters :[in] window_name :STRING[in] screen_name :STRING[out] status :INTEGER%ENVIRONMENT ...

  • Page 454

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• If the condition handler is defined but not currently enabled, DISABLE CONDITION has noeffect.• When a condition handler is disabled, its conditions are not tested. Thus, if it is activated again,the conditions must be satisfied...

  • Page 455

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• cond_hand_no must be in the range of 1-1000. Otherwise, the program will be aborted with anerror.See Also: 115,Chapter 115,6 115,CONDITION 115,HANDLERS , for more information on using DISABLECONDITION in condition handlers, 8...

  • Page 456

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV Btimer_var :a static, user-defined INTEGER variableDetails:• If timer_var is not currently connected as a timer, the DISCONNECT TIMER statement hasno effect.• If timer_var is a system or local variable, the program will not be tran...

  • Page 457

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION[out] status :INTEGER%ENVIRONMENT Group :UIFDetails:• window_name identifies the window where the str is currently displayed. See also 172,Section 172,7.10.1or 174,Section 174,7.10.2 for a listing of windows that may be used for...

  • Page 458

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BA.5.21 DISCTRL_FORM Built_In ProcedurePurpose: Displays and controls a form on the teach pendant or CRT/KB screenSyntax : DISCTRL_FORM(dict_name, ele_number, value_array, inact_array, change_array,term_mask, def_item, term_char, statu...

  • Page 459

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION— The array size can be greater than or less than the number of items in the form.— If an inactive_array is not used, then an array size of 1 can be used. The array does notneed to be initialized.• change_array is an array of bo...

  • Page 460

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV Bky_f5 — Function key 5 was selectedky_f6 — Function key 6 was selectedky_f7 — Function key 7 was selectedky_f8 — Function key 8 was selectedky_f9 — Function key 9 was selectedky_f10 — Function key 10 was selected• DISCTR...

  • Page 461

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• display_data is used to display the list. Refer to the DISP_DAT_T data type for details.• list_data contains the list of data to display.• action must be one of the following:dc_disp : Positions cursor as defined in display_da...

  • Page 462

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B[out] term_char :INTEGER[out] status :INTEGER%ENVIRONMENT Group : UIFDetails:• The menu data in the dictionary consists of a list of enumerated values that are displayed andselected from a pull-up menu on the teach pendant device. A...

  • Page 463

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONDISCTRL_PLMN Built-In Procedure----------------------------------------------TPEXAMEG.TX----------------------------------------------$subwin_menu"Option 1"$"Option 2"$"Option 3"$"Option 4"$&quo...

  • Page 464

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B[in,out] def_item :INTEGER[out] term_char :INTEGER[out] status :INTEGER%ENVIRONMENT Group : UIFDetails:• The menu data in the dictionary consists of a list of enumerated values that are displayedand selected from the ’subm’ subw...

  • Page 465

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONDISCTRL_SBMN Built-In Procedure----------------------------------------------TPEXAMEG.TX----------------------------------------------$subwin_menu"Red"$"Blue"$"Green"$"Yellow"$"Brown"$...

  • Page 466

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV Bdef_item = 1DISCTRL_SBMN(’EXAM’, 0, def_item, term_char, status)IF term_char = ky_enter THENWRITE (CR, def_item, ’ was selected’)ENDIFEND tpsbmnA.5.25 DISCTRL_TBL Built-In ProcedurePurpose: Displays and controls a table on the...

  • Page 467

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• DISCTRL_TBL is similar to the INIT_TBL and ACT_TBL Built-In routines and should be usedif no special processing needs to be done with each keystroke.• dict_name is the four-character name of the dictionary containing the table h...

  • Page 468

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV Bky_f5 — Function key 5 was selectedky_f6 — Function key 6 was selectedky_f7 — Function key 7 was selectedky_f8 — Function key 8 was selectedky_f9 — Function key 9 was selectedky_f10 — Function key 10 was selected• term_m...

  • Page 469

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.5.26 DISMOUNT_DEV Built-In ProcedurePurpose: Dismounts the specified device.Syntax : DISMOUNT_DEV (device, status)Input/Output Parameters :[in] device :STRING[out] status :INTEGER%ENVIRONMENT Group :FDEVDetails:• device specifies ...

  • Page 470

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV Bcurr_field : SHORTlast_field : SHORTcurr_it_num : SHORTsob_it_num : SHORTeob_it_num : SHORTlast_it_num : SHORTmenu_id : SHORTENDSTRUCTUREDetails:• disp_dat_t can be used to display a list in four different windows. The list can cont...

  • Page 471

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.6 - E - KAREL LANGUAGE DESCRIPTIONA.6.1 ENABLE CONDITION ActionPurpose: Enables the specified condition handlerSyntax : ENABLE CONDITION [cond_hand_no]where:cond_hand_no :an INTEGER expressionDetails:• ENABLE CONDITION has no effe...

  • Page 472

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BDetails:• ENABLE CONDITION has no effect when— The condition handler is not defined— The condition handler is defined but is already enabled• cond_hand_no must be in the range of 1-1000. Otherwise, the program will be aborted ...

  • Page 473

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION— FLBT— IOSETUP—KCLOP—MEMO—MIR—MOTN—MULTI—PATHOP— PBCORE—PBQMGR—REGOPE— STRNG— SYSDEF (allows program access to most system variables)— SYSTEM—TIM— TPE—TRANS—UIF— VECTR• If no %ENVIRONMENT state...

  • Page 474

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BA.6.4 ERR_DATA Built-In ProcedurePurpose: Reads the requested error from the error history and returns the errorSyntax : ERR_DATA(seq_num, error_code, error_string, cause_code, cause_string, time_int,severity, prog_nam)Input/Output Pa...

  • Page 475

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONccc represents the error code within the specified facility.Refer to Chapter 6, "Condition Handlers," for the error facility codes.• time_int returns the time that error_code was posted. The time is in encoded format, andC...

  • Page 476

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BA.6.6 EVAL ClausePurpose: Allows expressions to be evaluated in a condition handler definitionSyntax : EVAL(expression)where:expression :a valid KAREL expressionDetails:• expression is evaluated when the condition handler is defined...

  • Page 477

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• event_no must be in the range of -32768 to 32767.See Also: SIGNAL EVENT Action, and CONDITION or SIGNAL EVENT StatementExample: Refer to 739,Section 739,B.1 , "Setting Up Digital Output Ports for Monitoring" (DOUT_EX.K...

  • Page 478

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BSyntax : fileDetails:• FILE allows you to declare a static variable as a file.• You must use a FILE variable in OPEN FILE, READ, WRITE, CANCEL FILE, and CLOSEFILE statements.• You can pass a FILE variable as a parameter to a rou...

  • Page 479

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION%ENVIRONMENT Group :BYNAMDetails:• file_spec specifies the device, name, and type of the list of files to be found. file_spec can bespecified using the wildcard (*) character.• n_skip is used when more files exist than the declare...

  • Page 480

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV Bwhere:[in]count :INTEGER variable[in]initial :INTEGER expression[in]final :INTEGER expression[in]stmnt :executable KAREL statementDetails:• Initially, count is set to the value of initial and final is evaluated. For each iteration, ...

  • Page 481

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION 802,Section 802,B.12 , "Displaying a List From a Dictionary File" (DCLST_EX.KL) 817,Section 817,B.14 , "Applying Offsets to a Copied Teach Pendant Program" (CPY_TP.KL) 739,Section 739,B.1 , "Setting Up Dig...

  • Page 482

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BSPI_TPALARM, SCR_ALM_ALL — ALARM Alarm LogSPI_TPALARM, SCR_ALM_MOT — ALARM Motion LogSPI_TPALARM, SCR_ALM_SYS — ALARM System LogSPI_TPALARM, SCR_ALM_APPL — ALARM Appl LogSPI_TPDIGIO — I/O DigitalSPI_TPANAIO — I/O AnalogSPI...

  • Page 483

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONSPI_TPUSER — USERSPI_TPSELECT — SELECTSPI_TPTCH — EDITSPI_TPREGIS, SCR_NUMREG — DATA RegistersSPI_SFMPREG, SCR_POSREG — DATA Position RegSPI_TPSYSV, SCR_NUMVAR — DATA KAREL VarsSPI_TPSYSV, SCR_POSVAR — DATA KAREL PosnsSP...

  • Page 484

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BA.7.5 FORMAT_DEV Built-In ProcedurePurpose: Deletes any existing information and records a directory and other internal information onthe specified device.Syntax : FORMAT_DEV(device, volume_name, nowait_sw, status)Input/Output Paramet...

  • Page 485

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONFunction Return Type :PositionInput/Output Parameters :[in]pos1 :POSITION[in]pos2 :POSITION[in]pos3 :POSITION[in]pos4 :POSITION%ENVIRONMENT Group :SYSTEMDetails:• The returned value is computed as follows:— pos1 is assumed to be t...

  • Page 486

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BFigure A–1.FRAME Built-In Function+X+Z+YPOS 4POS 3POS 2POS 1+X+Z+YExample: The following example allows the operator to set a frame to a pallet so that a palletizingroutine will be able to move the TCP along the x, y, z direction in...

  • Page 487

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• In a FROM clause, prog_name can be the name of any program, including the program in whichthe type, variable, or routine is declared.• If the FROM clause is used in a routine declaration and is called during program execution, t...

  • Page 488

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• attr_number is the attribute whose value is to be returned. The following attributes are valid:AT_PROG_TYPE : Program typeAT_PROG_NAME : Program name (String[12])AT_OWNER : Owner (String[8])AT_COMMENT : Comment (String[16])AT_PROG...

  • Page 489

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONPT_MNE_PROC : Teach pendant processPT_MNE_MACRO : Teach pendant macro• If the attribute data is a number, it is returned in int_value and string_value is not modified.• If the attribute data is a string, it is returned in string_v...

  • Page 490

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BWarningGET_FILE_POS is only supported for files opened on the RAM Diskdevice. Do not use GET_FILE_POS on another device; otherwise, youcould injure personnel and damage equipment.Example: The following example opens the filepos.dt dat...

  • Page 491

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• status explains the status of the attempted operation. If not equal to 0, then an error occurred.See Also: GET_POS_REG, SET_JPOS_REG, SET_POS_REG Built-in ProceduresExample: Refer to 765,Section 765,B.5 , "Using Register Bu...

  • Page 492

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BExample: Refer to 817,Section 817,B.14 , "Applying Offsets to a Copied Teach Pendant Program"(CPY_TPE.KL), for a detailed program example.A.8.5 GET_PORT_ASG Built-in ProcedurePurpose: Allows a KAREL program to determine th...

  • Page 493

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• n_ports is returned with the number of physical ports assigned to the logical port. This will be1 in all cases except when log_port_type is a group type. In this case, n_ports indicates thenumber of bits in the group.• status is...

  • Page 494

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BInput/Output Parameters :[in] port_id :INTEGER[in] atr_type :INTEGER[out] atr_value :INTEGER%ENVIRONMENT Group :FLBTDetails:• port_id specifies which port is to be queried. Use one of the following predefined constants:port_1port_2p...

  • Page 495

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONExample: The following example sets up the port to a desired configuration, if it is not already set tothe specified configuration.GET_PORT_ATR Built-In FunctionPROGRAM port_atr%ENVIRONMENT FLBTVARstat:INTEGERatr_value: INTEGERBEGIN--...

  • Page 496

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BA.8.7 GET_PORT_CMT Built-In ProcedurePurpose: Allows a KAREL program to determine the comment that is set for a specified logical portSyntax : GET_PORT_CMT(port_type, port_no, comment_str, status)Input/Output Parameters :[in] port_typ...

  • Page 497

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION[in] port_no :INTEGER[out] mode_mask :INTEGER[out] status :INTEGER%ENVIRONMENT Group :IOSETUPDetails:• port_type specifies the code for the type of port whose mode is being returned. Codes are definedin FR:KLIOTYPS.KL.• port_no sp...

  • Page 498

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BGET_PORT_MOD(port_type, port_no, mode, status)IF (status <>0) THENRETURN (status)ENDIFIF (mode AND 1) <> 0 THENreverse = TRUEELSEreverse = FALSEENDIFIF (mode AND 2) <> 0 THENcomplementary = TRUEELSEcomplementary = FA...

  • Page 499

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONSee Also: GET_PORT_MOD, SET_PORT_SIM, SET_PORT_MOD Built-in Procedures.A.8.10 GET_PORT_VAL Built-In ProcedurePurpose: Allows a KAREL program to determine the current value of a specified logical portSyntax : GET_PORT_VAL(port_type, po...

  • Page 500

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B[in] position_no :INTEGER[in] gnum :INTEGER[out] ufram_no :INTEGER[out] utool_no :INTEGER[out] status :INTEGER%ENVIRONMENT Group :pbcoreDetails:• open_id specifies the opened teach pendant program. A program must be opened before ca...

  • Page 501

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONDetails:• register_no specifies the position register to get.• If group_no is omitted, the default group for the program is assumed.• If group_no is specified, it must be in the range of 1 to the total number of groups defined o...

  • Page 502

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• If the specified position in the program is uninitialized, the returned XYZWPR value isuninitialized and status is set to 17038, "Uninitialized TPE Position."• If group_no is omitted, the default group for the program ...

  • Page 503

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• If it is in joint position, the number of the axis in the representation is returned by num_axs .• If the specified position in the program is uninitialized, then a status is set to 17038, "UnintializedTPE Position."...

  • Page 504

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B[out] sequence_no :INTEGER[out] status :INTEGER%ENVIRONMENT Group :PBQMGRDetails:• queue_t specifies the queue variable for the queue from which the value is to be obtained.• queue_data specifies the array variable with the queue ...

  • Page 505

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.8.17 GET_REG Built-In ProcedurePurpose: Gets an INTEGER or REAL value from the specified registerSyntax : GET_REG(register_no, real_flag, int_value, real_value, status)Input/Output Parameters:[in] register_no :INTEGER[out] real_flag...

  • Page 506

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BDetails:• Register_no specifies which register to retrieve the comments from. The comment of the givenregister is returned in comment_string.A.8.19 GET_TIME Built-In ProcedurePurpose: Retrieves the current time (in integer represent...

  • Page 507

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• INTEGER values can be compared to determine if one time is more recent than another.• Use the CNV_TIME_STR built-in procedure to convert the INTEGER into the ‘‘DD-MMM-YYYHH:MM:SS’’ STRING format.See Also: CNV_TIME_STR Bu...

  • Page 508

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BSyntax : GET_TPE_PRM(param_no, data_type, int_value, real_value, str_value, status)Input/Output Parameters:[in] param_no :INTEGER[out] data_type :INTEGER[out] int_value :INTEGER[out] real_value :REAL[out] str_value :STRING[out] status...

  • Page 509

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONmacro:1:! Send Event 72:! Wait for PC answer3:! Answer in REG 54:Send Event(7,1,5)5:IF R[5]<9999,JMP LBL[10]6:! Error in macro7:!8:LBL[10]Teach pendant program SENDEVNT.TP, which implements theSend Event macro by calling the GESNDE...

  • Page 510

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BA.8.22 GET_TSK_INFO Built-In ProcedurePurpose: Get the value of the specified task attributeSyntax : GET_TSK_INFO(task_name, task_no, attribute, value_int, value_str, status)Input/Output Parameters:[in,out] task_name :STRING[in,out] t...

  • Page 511

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONTSK_PARENT : Parent task numberTSK_PAUSESFT : Pause on shift releaseTSK_PRIORITY : Task priorityTSK_PROGNAME : Current program name returned in value_strTSK_PROGTYPE : Program type - refer to description belowTSK_ROUTNAME : Current ro...

  • Page 512

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BExample: See examples in 329,Chapter 329,14 329,MULTI-TASKINGA.8.23 GET_USEC_SUB Built-In ProcedurePurpose: Returns an INTEGER value indicating the elapsed time in microseconds (1/1,000,000).Syntax: us_delta = GET_USEC_SUB(us2, us1...

  • Page 513

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONSyntax: us = GET_USEC_TIMFunction Return Type: INTEGERInput/Output Parameters:None%ENVIRONMENT Group: TIMDetails:• The returned value is the INTEGER representation of the current time in microseconds stored inthe KAREL system.• Th...

  • Page 514

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• var_name can contain node numbers, field names, and/or subscripts.• If both var_name and value are ARRAYs, the number of elements copied will equal the size ofthe smaller of the two arrays.• If both var_name and value are STRI...

  • Page 515

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONpart_array: ARRAY[5] OF STRING[10]BEGINnum_of_parts = 0FORj=1to20DOnum_of_parts = num_of_parts + 1ENDFORpart_array[1] = 10part_array[2] = 20part_array[3] = 30part_array[4] = 40part_array[5] = 50END util_progPROGRAM taskVARentry, statu...

  • Page 516

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BCNV_INT_STR(idx, 1, 10, sidx)prog_name = ’\\’ + $PH_MEMBERS[idx].$NAME + ’\ipgetset’var_name = ’set_data[’+ smy_index + ’,’ + sidx + ’]’GET_VAR(entry, prog_name, var_name, set_data[$PH_ROSIP.$MY_INDEX,idx], status[...

  • Page 517

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONGET_VAR(entry, ’\\mhrob01\*numreg*’, ’$NUMREG[10]’, int_data, status)IF status <> 0 THENGET_VAR(entry, ’\\mhrob01\*numreg*’, ’$NUMREG[10]’, real_data, status)ENDIFGET_VAR(entry, ’\\mhrob01\*posreg*’, ’$POSR...

  • Page 518

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BA.8.27 GROUP_ASSOC Data TypePurpose: Declares a variable or structure field as a GROUP_ASSOC data typeSyntax : GROUP_ASSOC <IN GROUP[n]>Details:• GROUP_ASSOC consists of a record containing the standard associated data for a m...

  • Page 519

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONExample: Refer to 750,Section 750,B.2 , "Copying Path Variables" (CPY_PTH.KL), for a detailed programexample.A.9 - H - KAREL LANGUAGE DESCRIPTIONA.9.1 HOLD ActionPurpose: Causes the current motion to be held and prevents s...

  • Page 520

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BA.9.2 HOLD StatementPurpose: Causes the current motion to be held and prevents subsequent motions from startingSyntax : HOLD <GROUP[n{,n}]>Details:• Any motion in progress is held. Robot and auxiliary or extended axes decelera...

  • Page 521

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.10 - I - KAREL LANGUAGE DESCRIPTIONA.10.1 IF ... ENDIF StatementPurpose: Executes a sequence of statements if a BOOLEAN expression is TRUE; an alternatesequence can be executed if the condition is FALSE.Syntax : IF bool_exp THEN{ tr...

  • Page 522

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B 785,Section 785,B.9 , "Using the File and Device Built-ins" (FILE_EX.KL) 789,Section 789,B.10 , "Using Dynamic Display Built-ins" (DYN_DISP.KL) 802,Section 802,B.12 , "Displaying a List From a Dictionary F...

  • Page 523

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.10.3 %INCLUDE Translator DirectivePurpose: Inserts other files in a program at translation time.Syntax : %INCLUDE file_specDetails:• file_spec is the name of the file to include. It has the following details:— The file name spec...

  • Page 524

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B 739,Section 739,B.1 , "Setting Up Digital Output Ports for Monitoring" (DOUT_EX.KL)A.10.4 INDEX Built-In FunctionPurpose: Returns the index for the first character of the first occurrence of a specified STRINGargument in a...

  • Page 525

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION[in] b_var :BOOLEAN[in] window_name :STRING[in] field_width :INTEGER[in] attr_mask :INTEGER[in] char_size :INTEGER[in] row :INTEGER[in] col :INTEGER[in] interval :INTEGER[in] strings :ARRAY OF STRING[out] status :INTEGER%ENVIRONMENT G...

  • Page 526

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• char_size specifies whether data is to be displayed in normal, double-wide, or double-high,double-wide sizes. This should be one of the following constants:0:Normal1 :Double-wide (Supported only on the CRT)2 :Double-high, double-w...

  • Page 527

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION[in] strings :ARRAY OF STRING[out] status :INTEGER%ENVIRONMENT Group :UIFDetails:• The dynamic display is initiated based on the value of e_var .If e_var has a value of n,strings[n+1] is displayed; if e_var has a negative value, or ...

  • Page 528

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B[in] format :STRING[out] status :INTEGER%ENVIRONMENT Group :UIFDetails:• i_var is the integer whose dynamic display is to be initiated.• If field_width is non-zero, the display is extended with blanks if i_var is shorter than this...

  • Page 529

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONTable A–12.Conversion Characters (Cont’d)CharacterArgument Type; Printed AsfREAL; decimal notation of the form [-]mmm.dddddd, where the number of d’sis given by the precision. The default precision is 6; a precision of 0 suppres...

  • Page 530

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B[in] row :INTEGER[in] col :INTEGER[in] interval :INTEGER[in] strings :ARRAY OF STRING[out] status :INTEGERDetails:• port_type specifies the type of port to be displayed. Codes are defined in FROM: KLIOTYPS.KL.—If the port_type is ...

  • Page 531

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION[in] row :INTEGER[in] col :INTEGER[in] interval :INTEGER[in] buffer_size :INTEGER[in] format :STRING[out] status :INTEGER%ENVIRONMENT Group :UIFDetails:• r_var is the REAL variable whose dynamic display is to be initiated.• If fie...

  • Page 532

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B[in] col :INTEGER[in] interval :INTEGER[in] buffer_size :INTEGER[in] format :STRING[out] status :INTEGER%ENVIRONMENT Group :UIFDetails:• s_var is the STRING variable whose dynamic display is to be initiated.• If field_width is non...

  • Page 533

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONINIT_QUEUE Built-In ProcedurePROGRAM init_queue_x%environment PBQMGRVARjob_queue FROM globals: QUEUE_TYPEBEGININIT_QUEUE(job_queue)END init_queue_xA.10.12 INIT_TBL Built-In ProcedurePurpose: Initializes a table on the teach pendantSyn...

  • Page 534

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• INIT_TBL must be called before using the ACT_TBL built-in.INIT_TBL does not need to becalled if using the DISCTRL_TBL built-in.• The INIT_TBL and ACT_TBL built-in routines should only be used instead of DISCTRL_TBLis special pro...

  • Page 535

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION– A single dictionary element defines all of the label values. Each value must be put ona separate line using &new_line. The values are assigned to the function keys F1..F5,F6..F10 and the numeric values 1..10 in sequence. Unlab...

  • Page 536

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B– A single dictionary element the label values. Each value must be put on a separate lineusing &new_line, with the ‘‘false’’ value first.Example:$ example_boolean_c"OFF" &new_line"ON"— enum_dict...

  • Page 537

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONTable A–13.Conversion Characters (Cont’d)CharacterArgument Type; Printed AssSTRING; print characters from the string until end of string or the number ofcharacters given by the precision.fREAL; decimal notation of the form [-]mmm....

  • Page 538

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B— min_integer : Minimum value if data type is TPX_INT_ITEM, TPX_BYT_ITEM, orTPX_SHT_ITEM.— max_real : Maximum value for reals.— min_real : Minimum value for reals.— clear_flag : If data type is TPX_KST_ITEM, 1 causes the field...

  • Page 539

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION– TPX_KST_ITEM: ARRAY OF STRING containing the desired values.– TPX_KST_ITEM: ARRAY OF STRING containing the desired values.– TPX_KSL_ITEM: ARRAY OF STRING containing the desired values. These valuescannot be edited by the user....

  • Page 540

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B"f6"&new_line"f7"&new_line"f8"&new_line"f9"&new_line"f10>"$help_text "Help text goes here..."$enum1"" &new_line"" &new_line&quo...

  • Page 541

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONstatus: INTEGERaction: INTEGERdef_item: INTEGERterm_char: INTEGERattach_sw: BOOLEANsave_action:INTEGERdone: BOOLEANvalue1: ARRAY[4] OF INTEGERvalue2: ARRAY[4] OF INTEGERvalue3: ARRAY[4] OF REALvalue4: ARRAY[4] OF STRING[10]value5: ARR...

  • Page 542

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV Bcol_data[1].format_spec = ’%3d’col_data[1].max_integer = 99col_data[1].min_integer = -99col_data[2].item_type = TPX_FKY_ITEMcol_data[2].start_col = 12col_data[2].field_width = 5col_data[2].format_spec = ’%s’col_data[2].enum_el...

  • Page 543

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONWHILE NOT done DO-- Read new key, act on it, and return itACT_TBL(action, def_item, table_data, term_char,attach_sw, status)save_action = actionaction = ky_reissue -- read new key-- Debug onlyWRITE TPERROR (CHR(cc_home) + CHR(cc_clear...

  • Page 544

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B-- Perform F10SET_CURSOR(TPERROR, 1, 1, status)WRITE TPERROR (’F10 pressed’)CASE (ky_undef):-- Process special keys.SELECT (save_action) OFCASE (ky_f1_s):-- Perform Shift F1SET_CURSOR(TPERROR, 1, 1, status)WRITE TPERROR (’F1 shi...

  • Page 545

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONSee Also: CHECK_EPROS Built-in procedure, 177,Chapter 177,8 177,MOTION 177,, 92,Section 92,4.2.2 , "Group Motion"Example: The following example checks to see if the new position is in the work envelope beforemoving the...

  • Page 546

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BExample: In the following example, the PATH_LEN built-in is used to set the variable lengthequal to the number of nodes in path_var. INSERT_NODE inserts a new path node after the lastnode in path_var.INSERT_NODE Built-In Procedureleng...

  • Page 547

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONExample: In the following example, the routine ins_in_queue adds an entry value ) to a queue (queue_t and queue_data ) following the specified entry sequence_no ); it returns TRUE if this wassuccessful; otherwise it returns FALSE.INSE...

  • Page 548

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• If an INTEGER argument is passed to a routine where a REAL parameter is expected, it istreated as a REAL and passed by value.• Only INTEGER expressions can be assigned to INTEGER variables, returned from INTEGERfunction routines...

  • Page 549

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONp1 = INV(rack_pos):part_posMOVE TO p1END p_invA.10.18 IO_MOD_TYPE Built-In ProcedurePurpose: Allows a KAREL program to determine the type of module in a specified rack/slotSyntax : IO_MOD_TYPE(rack_no, slot_no, mod_type, status)Input/...

  • Page 550

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B%ENVIRONMENT IOSETUPROUTINE get_mod_type(rack_no: INTEGER;slot_no: INTEGER;mod_type: INTEGER): INTEGERVARstatus: INTEGERBEGINIO_MOD_TYPE(rack_no, slot_no, mod_type, status)RETURN (status)END get_mod_typeBEGINEND iomodtypeA.10.19 IO_ST...

  • Page 551

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONTable A–15.IO_STATUS Errors (Cont’d)12325Illegal file string12326File var is already used12327Open file failed12328File is not opened12329Cannot write the variable12330Writefilefailed12331Cannot read the variable12332Read data is ...

  • Page 552

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BFunctionReturnType:BOOLEANInput/Output Parameters:[in] posn :JOINTPOS%ENVIRONMENT Group :SYSTEMDetails:• The returned value is TRUE if posn is within the work envelope; otherwise, FALSE is returned.See Also: IN_RANGE Built-in Functi...

  • Page 553

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.11.3 JOINT2POS Built-In FunctionPurpose: This routine is used to convert joint angles (in_jnt) to a Cartesian position (out_pos) bycalling the forward kinematics routine.Syntax : JOINT2POS (in_jnt - Joint angles can be converted to ...

  • Page 554

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B— 16 :(NO_M_TURNS) = Ignore major axis (J1 only) turn number. Use the closest path.• The output out_pos is the Cartesian position corresponding to the input joint angles.• The output wjnt_cfg is the wrist joint configuration. Th...

  • Page 555

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONKCL Built-In ProcedurePROGRAM kcl_testVARcommand :STRING[20]status :INTEGERBEGINcommand = ’SHOW PROGRAMS’KCL (command, status)END kcl_testExample: Refer to 292,Example 292,Program 292,for 292,Display 292,Only 292,Data 292,I...

  • Page 556

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV Bstatus :INTEGERBEGINcommand = ’Load prog test_1’KCL_NO_WAIT (command, status)delay 5000status = KCL_STATUSEND kcl_testA.12.3 KCL_STATUS Built-In ProcedurePurpose: Returns the status of the last executed command from either KCL or ...

  • Page 557

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• The returned value is the natural logarithm of x .• x must be greater than zero. Otherwise, the program will be aborted with an error.Example: The following example returns the natural logarithm of the input variable a and assig...

  • Page 558

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BThe following value is valid for .TP files:— 1 If the program already exists, then it overwrites the program. If option_sw is not 1 and theprogram exists, an error will be returned.The following value is valid for .SV files:— 1 Co...

  • Page 559

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONExample: Refer to the following sections for detailed program examples: 776,Section 776,B.7 , "Listing Files and Programs and Manipulating Strings" (LIST_EX.KL) 789,Section 789,B.10 , "Using Dynamic Display Built-ins&...

  • Page 560

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• status explains the status of the attempted operation. If not equal to 0, an error occurred.NoteDo not use more than one motion group in a KAREL program. If you need to use morethan one motion group, you must use a teach pendant p...

  • Page 561

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• When the program or routine is called, the task will attempt to get motion control for all thespecified groups if it does not have them locked already. The task will pause if it cannot getmotion control.• If %LOCKGROUP is not sp...

  • Page 562

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• If orient_flag is TRUE, both the orientation and location component of old_pos will be mirrored.If FALSE, only the location is mirrored and the orientation of the new mirror-image position isthe sameasthatof old_pos.• The return...

  • Page 563

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONorient_flag = TRUE-- The mirrored position includes mirroring of-- the tool orientation.mir_posa = mirror(org_pos,frame,orient_flag)-- mir_posa is the mirrored position where Normal-- Orient, & Approach vectors have been mirrored....

  • Page 564

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BMODIFY_QUEUE Built-In ProcedurePROGRAM mod_queue_x%ENVIRONMENT PBQMGRROUTINE update_queue(value: INTEGER;sequence_no: INTEGER;queue_t: QUEUE_TYPE;queue_data: ARRAY OF INTEGER)VARstatus: INTEGERBEGINMODIFY_QUEUE(value, sequence_no, que...

  • Page 565

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONTable A–17.Group_mask SettingGROUPDECIMALBITGroup 111Group 222Group 343To specify multiple groups select the decimal values, shown in 565,Table 565,A–17 , which correspond tothe desired groups. Then connect them together using t...

  • Page 566

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BExample: Refer to 785,Section 785,B.9 , "Using the File and Device Built-ins" (FILE_EX.KL), for a detailedprogram example.A.14.5 MOVE ABOUT StatementPurpose: Moves the TCP to a destination an angular distance about a speci...

  • Page 567

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONWarningDo not run a KAREL program that performs motion if more than onemotion group is defined on your controller. If your controller is set upfor more than one motion group, all motion must be initiated from ateach pendant program. O...

  • Page 568

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV Bwhere:WITH clause : Described under ‘‘WITH Clause’’path_var : a PATH variablestart_node : an INTEGER expressionend_node : an INTEGER expressionNOWAIT : Described under ‘‘NOWAIT Clause’’cond_handler : a local condition ...

  • Page 569

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION 770,Section 770,B.6 , "Path Variables and Condition Handlers Program" (PTH_MOVE.KL) 739,Section 739,B.1 , "Setting Up Digital Output Ports for Monitoring" (DOUT_EX.KL)A.14.7 MOVE AWAY StatementPurpose: Moves the...

  • Page 570

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BWarningDo not run a KAREL program that performs motion if more than onemotion group is defined on your controller. If your controller is set upfor more than one motion group, all motion must be initiated from ateach pendant program. O...

  • Page 571

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONWITH_clause : Described under ‘‘WITH Clause’’axis_no : an INTEGER expressiondistance : a REAL expressionNOWAIT : Described under ‘‘NOWAIT Clause’’cond_handler : a local condition handlerDetails:• axis_no indicates th...

  • Page 572

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BENDFORA.14.9 MOVE_FILE Built-In ProcedurePurpose: Moves the specified file from one memory file device to anotherSyntax : MOVE_FILE (file_spec, status)Input/Output Parameters :[in] file_spec : string[out] status : integer%ENVIRONMENT ...

  • Page 573

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.14.10 MOVE NEAR StatementPurpose: Moves the TCP to a destination near the specified POSITION by the distance offset, whichis measured along the negative z-axis of the POSITIONSyntax : < WITH_clause >MOVE NEAR posn BY distance&...

  • Page 574

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BSee Also: Local condition handlers, composed of WHEN and UNTIL clauses, 115,Chapter 115,6 115,CONDITIONHANDLERS , 889,Appendix 889,E , ‘‘Syntax Diagrams,’’ for additional syntax information, NOWAIT,WHEN, WITH, UNTIL Claus...

  • Page 575

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONWarningDo not run a KAREL program that performs motion if more than onemotion group is defined on your controller. If your controller is set upfor more than one motion group, all motion must be initiated from ateach pendant program. O...

  • Page 576

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV Bposn : a positional expressionp_var : a PATHn : an INTEGERVIA_clause : Described under ‘‘VIA Clause’’NOWAIT : Described under ‘‘NOWAIT Clause’’cond_handler : a local condition handlerDetails:• If the destination is a...

  • Page 577

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION[in] tag :STRING[out] status :INTEGER%ENVIRONMENT Group :FLBTDetails:• Tag is the name of a client port (C1:-C8) or server port (S1:S8).• Status explains the status of the attempted operation. If it is not equal to 0, then an erro...

  • Page 578

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV Bwrite (’Opening’,cr)OPEN FILE file_var (’rw’,’S8:’)status = io_status(file_var)FOR tmp_int1 TO 1000 DOwrite(’Reading’,cr)BYTES_AHEAD(file_var, entry, status)-- Read 10 bytesREAD file_var (tmp_str::10)status = i/o_statu...

  • Page 579

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.14.15 MSG_PINGSyntax : MSG_PING (host name, status)Input/Output Parameters :[in] host name :STRING[out] status :INTEGER%ENVIRONMENT Group :FLBTDetails:• Host name is the name of the host to perform the check on. An entry for the h...

  • Page 580

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• If the program is aborted by itself (i.e., executing an ABORT statement, run time error), theNOABORT action will be ignored and program execution will be aborted.Example: The following example uses a global condition handler to te...

  • Page 581

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONSyntax: %NOBUSYLAMPDetails:• The busy lamp can be set during task execution by the SET_TSK_ATTR built-in.A.15.4 NODE_SIZE Built-In FunctionPurpose: Returns the size (in bytes) of a PATH nodeSyntax : NODE_SIZE(path_var)Function Retur...

  • Page 582

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV Bmax_node_no = PATH_LEN(my_path)node_size = NODE_SIZE(my_path)path_base = GET_FILE_POS(file_var)END read_headerROUTINE read_node(node_no: INTEGER)--VAR status: INTEGERBEGINSET_FILE_POS(file_var, path_base+(node_no-1)*node_size, status)...

  • Page 583

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• The UNLOCK_GROUP built-in routine can be used to release control.• If a motion statement is encountered in a program that has the %NOLOCKGROUP Directive, thetask will attempt to get motion control for all the required groups if ...

  • Page 584

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B 799,Section 799,B.11 , "Manipulating Values of Dynamically Displayed Variables" (CHG_DATA.KL) 802,Section 802,B.12 , "Displaying a List From a Dictionary File" (DCLST_EX.KL) 812,Section 812,B.13 , "Using t...

  • Page 585

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONROUTINE uninit_errorBEGINWRITE (’Uninitialized operand’,CR)WRITE (’Use KCL> SET VAR to initialize operand’,CR)WRITE (’Press Resume at Test/Run screen to ’,cr)WRITE (’continue program’,cr)PAUSE--pauses program (undoe...

  • Page 586

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BA.15.10 NOWAIT ClausePurpose: Allows program execution to overlap with motion or a pulseSyntax : NOWAITDetails:• If NOWAIT is included in a motion statement, the next statement will be executed at the sametime motion begins.• NOWA...

  • Page 587

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONDetails:• file_var must be a static variable not already in use by another OPEN FILE statement.• The usage_string is composed of the following:‘RO’ :Read only‘RW’ :Read write‘AP’ :Append‘UD’ :Update• The file_str...

  • Page 588

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• The statement has no effect if the value of hand_num is in range but the hand is not connected.• If the value of hand_num is in range but the HAND signal represented by that value has not beenassigned, the program is aborted wit...

  • Page 589

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONTPE_RWACC : Read/Write Access• reject_mode determines the reject code to the program. The program that has been with a rejectcode cannot be opened by another program. The reject codes are defined as follows:TPE_NOREJ : noneTPE_RDREJ...

  • Page 590

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• str_index specifies the indexed position of a character in the argument str . A value of 1 indicatesthe first character.• If str_index is less than one or greater than the current length of str , the program is pausedwith an err...

  • Page 591

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.17 - P - KAREL LANGUAGE DESCRIPTIONA.17.1 PATH Data TypePurpose: Defines a variable or routine parameter as PATH data typeSyntax : PATHDetails:• A PATH is a varying length list of elements called path nodes, numbered from 1 to the...

  • Page 592

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• The path header structure can be copied from one path to another with the path_var1 = path_var2statement.• The path node structure can be copied from one node to another with the path_var[2] =path_var[1] statement.• Apathcan b...

  • Page 593

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONpath_2:PATH NODEDATA = node_struct -- no headerpath_3:PATH -- equivalent to PATH NODEDATA = std_pth_nodepath_4:PATH PATHHEADER = hdr_struct -- std_pth_nodeThe following example shows how an element of a NODEDATA structure can be refer...

  • Page 594

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BSee Also: COPY_PATH Built-inExample: Refer to the following sections for detailed program examples: 750,Section 750,B.2 , "Copying Path Variables" (CPY_PTH.KL) 770,Section 770,B.6 , "Path Variables and Condition Handl...

  • Page 595

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• The PAUSE condition is satisfied when a program is paused, for example, by an error, a PAUSEStatement, or the PAUSE Action.• If one of the actions corresponding to a PAUSE condition is a routine call, it is necessary tospecify a...

  • Page 596

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• The PAUSE statement can be followed by the clause PROGRAM[n], where n is the task numberto be paused.• Use GET_TSK_INFO to find a task number.See Also: 889,Appendix 889,E , ‘‘Syntax Diagrams,’’ for more syntax informat...

  • Page 597

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• force_sw specifies whether a task should be paused even if the task has the ‘‘ignore pauserequest’’ attribute set. This parameter is ignored if task_name is ’*ALL*’.• stop_mtn_sw specifies whether all motion groups b...

  • Page 598

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• semaphore_no specifies the semaphore number to use.• semaphore_no must be in the range of 1 to the number of semaphores defined on the controller.• max_time specifies the expiration time, in milliseconds. A max_time value of -...

  • Page 599

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• form_dict is the name of the dictionary containing formatting information.• form_ele is the element number in form_dict containing the formatting information.• status explains the status of the attempted operation. If it is no...

  • Page 600

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BSyntax : port_id[n] = expressionwhere:port_id :an output port arrayn :an INTEGERexpression :a variable, constant, or EVAL clauseDetails:• The value of expression is assigned to the port array element referenced by n .• The port ar...

  • Page 601

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONDetails:• n specifies the port array signal to be monitored.• port_id must be one of the predefined BOOLEAN port array identifiers with read access. Refer toChapter 2, ‘‘Language Elements.’’• For event conditions, only t...

  • Page 602

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BPOS Built-In FunctionCNV_STR_CONF(’n’, config_var, status)next_pos = POS(100,-400.25,0.5,10,-45,30,config_var)MOVE TO next_posA.17.13 POS2JOINT Built-In FunctionPurpose: This routine is used to convert Cartesian positions (in_pos)...

  • Page 603

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• The input config_ref is an integer representing the type of solution desired. The values listedbelow are valid. Also, the pre-defined constants in the parentheses can be used and the values canbe added as required. One example inc...

  • Page 604

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• If group_no is specified, it must be in the range of 1 to the total number of groups defined onthe controller.• posn_type returns the position type. posn_type is defined as follows:— 1 :POSITION— 2 :XYZWPR— 6 :XYZWPREXT—...

  • Page 605

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONCASE (6):xyzext = GET_POS_REG(register_no, status)CASE (9):jpos = GET_JPOS_REG(register_no, status)ELSE:ENDSELECTENDFOREND get_reg_dataA.17.15 POSITION Data TypePurpose: Defines a variable, function return type, or routine parameter a...

  • Page 606

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BCONFIG_DATA:CONFIG-- read-writeENDSTRUCTURESee Also: 177,Chapter 177,8 177,MOTION , POS, UNPOS Built-In FunctionsExample: Refer to 739,Section 739,B.1 , "Setting Up Digital Output Ports for Monitoring" (DOUT_EX.KL)for a...

  • Page 607

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONccc represents the error code within the• severity is defined as follows:0 : WARNING, no change in task execution1 : PAUSE, all tasks and stop all motion all motion2 : ABORT, all tasks and cancelSee Also: ERR_DATA Built-In Procedure...

  • Page 608

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B[in] file_spec :STRING[in] nowait_sw :BOOLEAN[out] status :INTEGER%ENVIRONMENT Group : FDEVDetails:• file_spec specifies the device, name, and type of the file to print.• If nowait_sw is TRUE, execution of the program continues wh...

  • Page 609

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION%PRIORITY Translator Directive%PRIORITY = 49A–265

  • Page 610

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BA.17.20 PROG_BACKUP Built-In ProcedurePurpose: Saves the specified program and all called programs from execution memory to a storagedevice. If the called programs call other programs they will be saved recursively. You can specifytha...

  • Page 611

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• If the required disk space to backup the programs exceeds max_size the backup will continue.The backup might still fail if there is not enough space to save all the programs. The return statuswill equal 2002, “ FILE-002 Device i...

  • Page 612

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BExample : The following example saves MAIN to MC: device with the appropriate file extension.It will save all programs and variables that are called recursively by MAIN. It will fail if there isless than 300k of free space on the MC: ...

  • Page 613

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.17.21 PROG_CLEAR Built-In ProcedurePurpose: Clear the specified program and all called programs from execution memory. If the calledprograms call other programs they will be cleared recursively. You can specify that any associatedpr...

  • Page 614

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• Clearing of any VR data is subject to being referenced by another program. This error willbe ignored for any variable clear operation.• If a programs which is identified for clearing is the selected program it will not be cleare...

  • Page 615

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.17.22 PROG_RESTORE Built-In ProcedurePurpose: Restores (loads) the specified program and all called programs into execution memory.If the called programs call other programs they will be loaded recursively. Any associated programvar...

  • Page 616

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BVARstatus: INTEGERBEGINPROG_RESTORE(‘FR:\GMX_211\ANS00003.TP’, status)Example: The following example restores ANS00003.TP from GMX_211 subdirectory on FR:device. It will restore only TP programs that are called recursively by ANS0...

  • Page 617

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.17.23 PROG_LIST Built-In ProcedurePurpose: Returns a list of program names.Syntax : prog_list(prog_name, prog_type, n_skip, format, ary_name, n_progs <,f_index>)Input/Output Parameters :[in] prog_name :STRING[in] prog_type :IN...

  • Page 618

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• n_skip is used when more programs exist than the declared length of ary_name. Set n_skip to 0the first time you use PROG_LIST. If ary_name is completely filled with program names, copythe array to another ARRAY of STRINGS and exec...

  • Page 619

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONDetails:• It must be the first statement (other than comments) in a program.• The identifier used to name a program cannot be used in the program for any other purpose, suchas to identify a variable or constant.• prog_name must ...

  • Page 620

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• If the program is paused while a pulse is in progress, the pulse will end at the correct time.• If the program is aborted while a pulse is in progress, the port stays in whatever state it was inwhen the abort occurred.• If tim...

  • Page 621

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• If NOWAIT is specified in a PULSE statement, the next KAREL statement will be executedconcurrently with the pulse.• If NOWAIT is not specified in a PULSE statement, the next KAREL statement will not beexecuted until the pulse is...

  • Page 622

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BPURGE CONDITION StatementIF ignore_cond THENPURGE CONDITION[1]ELSEENABLE CONDITION[1]ENDIFA.17.28 PURGE_DEV Built-In ProcedurePurpose: Purges the specified memory file device by freeing any used blocks that are no longerneededSyntax :...

  • Page 623

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.17.29 PUSH_KEY_RD Built-In ProcedurePurpose: Suspend key input from a keyboard deviceSyntax : PUSH_KEY_RD(key_dev_name, key_mask, pop_index, status)Input/Output Parameters:[in] key_dev_name :STRING[in] key_mask :INTEGER[out] pop_ind...

  • Page 624

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• pop_id is returned and should be used in a call to POP_KEY_RD to re-activate the read requests.• status explains the status of the attempted operation. If not equal to 0, then an error occurred.See Also: POP_KEY_RD Built-In Proc...

  • Page 625

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONdata_item : a variable identifier and its optional format specifiers or the reserved word CRDetails:• If file_var is not specified in a READ statement the default TPDISPLAY is used. %CRTDEVICEdirective will change the default to INP...

  • Page 626

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B 817,Section 817,B.14 , "Applying Offsets to a Copied Teach Pendant Program" (CPY_TP.KL)A.19.2 READ_DICT Built-In ProcedurePurpose: Reads information from a dictionarySyntax : READ_DICT(dict_name, element_no, ksta, first_li...

  • Page 627

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONExample: Refer to 802,Section 802,B.12 , "Displaying a List From a Dictionary File" (DCLST_EX.KL), for adetailed program example.A.19.3 READ_DICT_V Built-In-ProcedurePurpose: Reads information from a dictionary with format...

  • Page 628

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BSee Also: WRITE_DICT_V Built-In Procedure, 251,Chapter 251,10 251,DICTIONARIES 251,AND 251,FORMSExample: In the following example, TPTASKEG.TX contains dictionary text information which willdisplay a system variable. This informa...

  • Page 629

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION[in] time_out : INTEGER[in] term_mask : INTEGER[in] init_data : STRING[out] n_chars_got : INTEGER[out] term _char : INTEGER[out] stat us : INTEGER%ENVIRONMENT Group :PBCOREDetails:• Causes data from specified classes of characters t...

  • Page 630

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• accept_mask is a bit-wise mask indicating the classes of characters that will be accepted as input.This should be an OR of the constants defined in the include file klevkmsk.kl.kc_display :Displayable keyskc_func_key :Function key...

  • Page 631

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONkc_other :Other keys (such as Prev)• time_out specifies the time, in milliseconds, after which the input operation will be automaticallycanceled. A value of -1 implies no timeout.• init_data_p points to a string which is displayed...

  • Page 632

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B%ENVIRONMENT uif%INCLUDE FR:eklevkmskVARfile_var: FILEkey: INTEGERn_chars_got: INTEGERpop_index: INTEGERstatus: INTEGERstr: STRING[1]BEGIN-- Suspend any outstanding TP Keyboard readsPUSH_KEY_RD(’TPKB’, 255, pop_index, status)IF (s...

  • Page 633

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.19.5 REAL Data TypePurpose: Definesavariable, functionreturntype,orroutineparameter asaREALdatatypewith anumeric value that includes a decimal point and a fractional part, or numbers expressed in scientificnotationSyntax : REALDetai...

  • Page 634

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BTable A–18.Valid and Invalid REAL operatorsVALIDINVALIDREASON1.515Decimal point is required (15 is an INTEGER not a REAL)1..Must includeanINTEGER or afractionalpart+2500.450+2,500.450Commas not allowed1.25E-41.25E -4Spaces not allow...

  • Page 635

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION< :less than=< :less than or equal>:greaterthan>= :greater than or equal• Both operands must be of the same data type and can only be of type INTEGER, REAL, orBOOLEAN. INTEGER values can be used where REAL values are req...

  • Page 636

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BExample: In the following example, the robot hand, specified by gripper , is relaxed using theRELAX HAND statement. The robot then moves to the POSITION pstart before closing the hand.RELAX HAND StatementPROGRAM p_release%NOPAUSE=TPEN...

  • Page 637

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONInput/Output Parameters:[in] dict_name : STRING[in] lang_name : STRING[out] status : INTEGER%ENVIRONMENT Group :UIFDetails:• dict_name specifies the name of the dictionary to remove.• lang_name specifies which language the diction...

  • Page 638

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B[in] new_file : STRING[in] nowait_sw : BOOLEAN[out] status : INTEGER%ENVIRONMENT Group :FDEVDetails:• old_file specifies the device, name, and type of the file to rename.• new_file specifies the name and type of the file to rename...

  • Page 639

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• new_nam is the new name of the variable.• status explains the status of the attempted operation. If not equal to 0, then an error occurred.See Also: CREATE_VAR, SET_VAR Built-In ProceduresA.19.12 RENAME_VARS Built-In ProcedurePu...

  • Page 640

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV Bboolean_exp : a BOOLEAN expressionDetails:• boolean_exp is evaluated after execution of the statements in the body of the REPEAT loop todetermine if the statements should be executed again.• statement continues to be executed and ...

  • Page 641

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• successful will be TRUE even if conditions exist which prevent resetting the controller.• To determine whether the reset operation was successful, delay 1 second and check OPOUT[3](FAULT LED). If this is FALSE, the reset operati...

  • Page 642

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BA.19.16 RESUME StatementPurpose: Restarts the last stopped motion issued by the taskSyntax : RESUME <GROUP[n{,n}]>• A motion set is a group of motions issued but not yet terminated when a STOP statementor action is issued.• ...

  • Page 643

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.19.17 RETURN StatementPurpose: Returns control from a routine/program to the calling routine/program, optionally returningaresultSyntax : RETURN < (value) >Details:• value is required when returning from functions, but is no...

  • Page 644

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• The returned value is the INTEGER value closest to the REAL value x, as demonstrated bythe following rules:— If x >= 0, let n be a positive INTEGER such that n <= x <= n + 1— If x >= n + 0.5, then n + 1 is returned...

  • Page 645

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION—If a param_type or return_type is an ARRAY, the size is excluded. If the param_type isa STRING, the string length is excluded.• When the routine body follows the ROUTINE statement, the names in param_list are used toassociate arg...

  • Page 646

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B[in] line_number : INTEGER[in] pause_on_sft : BOOLEAN[in] tp_motion : BOOLEAN[in] lock_mask : INTEGER[out] status : INTEGER%ENVIRONMENT Group :MULTIDetails:• task_name is the name of the task to be run. This creates a child task. Th...

  • Page 647

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONWarningDo not run a KAREL program that performs motion if more than onemotion group is defined on your controller. If your controller is set upfor more than one motion group, all motion must be initiated from ateach pendant program. O...

  • Page 648

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BThe following types are valid:.TP : Teach pendant program.VR : KAREL variables.SV : KAREL system variables.IO : I/O configuration data• If file_spec already exists on the specified device, then an error is returned the save does not...

  • Page 649

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.20.3 SELECT ... ENDSELECT StatementPurpose: Permits execution of one out of a series of statement sequences, depending on the valueof an INTEGER expression.Syntax: SELECT case_val OFCASE(value{,value}):{statement}{ CASE(value{, valu...

  • Page 650

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BSee Also: 889,Appendix 889,E , ‘‘Syntax Diagrams,’’ for more syntax informationExample: Refer to the following sections for detailed program examples: 760,Section 760,B.3 , "Saving Data to the Default Device" (SAV...

  • Page 651

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.20.5 SEMA_COUNT Built-In FunctionPurpose: Returns the current value of the specified semaphoreSyntax : SEMA_COUNT (semaphore_no)Function Return Type :INTEGERInput/Output Parameters :[in] semaphore_no : INTEGER%ENVIRONMENT Group :MUL...

  • Page 652

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• When the value of the indicated semaphore is greater than zero, the condition is satisfied (TRUE).A.20.7 SEND_DATAPC Built-In ProcedurePurpose: To send an event message and other data to the PC.Syntax : SEND_DATAPC(event_no, dat_b...

  • Page 653

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONstatus:INTEGERBEGINindex = 1ADD_INTPC(dat_buffer,index,55,status)ADD_REALPC(dat_buffer,index,123.5,status)ADD_STRINGPC(dat_buffer,index,’YES’,status)-- send event 12 and data buffer to PCSEND_DATAPC(12,dat_buffer,status)IF status&...

  • Page 654

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B-- send event 12 to PCSEND_EVENTPC(12,status)-- call built-in hereIF status<>0 THENPOST_ERR(status,’’,0,er_abort)ENDIFEND testevtA.20.9 SET_ATTR_PRG Built-In ProcedurePurpose: Sets attribute data of the specified teach penda...

  • Page 655

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONAT_CRE_TIME : (#) Created (loaded) timeAT_MDFY_TIME : (#) Modified timeAT_SRC_NAME : Source file ( or original file ) name (String[128])AT_SRC_VRSN : Source file versionAT_DEF_GROUP : Default motion groups (for task attribute)AT_PROTE...

  • Page 656

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B[in] file_var : FILE[in] row : INTEGER[in] col : INTEGER[out] status : INTEGER%ENVIRONMENT Group :PBCOREDetails:• Sets the current cursor of the specified file that is open to a window so subsequent writes willstart in the specified...

  • Page 657

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION%ENVIRONMENT Group :REGOPEDetails:• register_no specifies the position register in which to store the value.• The position data is set in XYZWPREXT representation.• status explains the status of the attempted operation. If it is...

  • Page 658

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B[in] open_id : INTEGER[in] position_no : INTEGER[in] posn : XYZWPREXT[out] status : INTEGER[in] group_no : INTEGER%ENVIRONMENT Group :PBCOREDetails:• open_id specifies the opened teach pendant program. A program must be opened befor...

  • Page 659

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• ATR_XML specifies the attribute type to set. The predefined constants as specified in Table7-2 should be used.• The file must then be opened as a RO file. You cannot do any other XMl operations until thefile has been opened.See ...

  • Page 660

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BSET_FILE_POS Built-In ProcedureOPEN FILE file_id (’RW’,’filepos.dt’)FORi=1TO PATH_LEN(my_path) DOSET_FILE_POS(file_id, pos_dir[i], status)IF status = 0 THENREAD file_id (temp_pos)my_path[i].node_pos = temp_posENDIFENDFORA.20.1...

  • Page 661

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONInput/Output Parameters :[in] register_no : INTEGER[in] jpos : JOINTPOS[out] status :INTEGER[in] group_no :INTEGER%ENVIRONMENT Group :REGOPEDetails:• register_no specifies the position register in which to store the position, jpos ....

  • Page 662

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B%ENVIRONMENT Group :PBCOREDetails:• open_id specifies the opened teach pendant program. Before calling this built-in, a program mustbe opened using the OPEN_TPE Built-In, and have read/write access.• position_no specifies the posi...

  • Page 663

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONdp_frenchdp_germandp_spanish• The read-only system variable $LANGUAGE indicates which language is currently in use.• status explains the status of the attempted operation. If not equal to 0, then an error occurredsetting the langu...

  • Page 664

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BWarningDo not run a KAREL program that performs motion if more than onemotion group is defined on your controller. If your controller is set upfor more than one motion group, all motion must be initiated from ateach pendant program. O...

  • Page 665

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION[in] n_ports : INTEGER[out] status : INTEGER%ENVIRONMENT Group :IOSETUPDetails:• log_port_type specifies the code for the type of port to be assigned. Codes are defined inKLIOTYPS.KL.• log_port_no specifies the number of the port ...

  • Page 666

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BInput/Output Parameters :[in] port_id : INTEGER[in] atr_type : INTEGER[in] atr_value : INTEGER%ENVIRONMENT Group :FLBTDetails:• port_id is one of the predefined constants as follows:port_1port_2port_3port_4• atr_type specifies the...

  • Page 667

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONTable A–20.Attribute ValuesATR_TYPEATR_VALUEatr_readahdany integer, represents multiples of 128 bytes (for example: atr_value=1 meansthe buffer length is 128 bytes.atr_baudbaud_9600baud_4800baud_2400baud_1200atr_parityparity_nonepar...

  • Page 668

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BSyntax : SET_PORT_CMT(port_type, port_no, comment_str, status)Input/Output Parameters :[in] port_type : INTEGER[in] port_no : INTEGER[in] comment_str : STRING[out] status : INTEGER%ENVIRONMENT Group :IOSETUPDetails:• port_type speci...

  • Page 669

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION%ENVIRONMENT Group :IOSETUPDetails:• port_type specifies the code for the type of port whose mode is being set. Codes are definedin KLIOTYPS.KL.• port_no specifies the port number whose mode is being set.• mode_mask is a mask sp...

  • Page 670

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• port_type specifies the code for the type of port to simulate. Codes are defined in KLIOTYPS.KL.• port_no specifies the number of the port to simulate.• value specifies the initial value to set.• status is returned with zero...

  • Page 671

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONSET_PORT_VAL Built-In ProcedurePROGRAM setvalprog%ENVIRONMENT IOSETUP%INCLUDE FR:\kliotypsROUTINE set_value(port_type: INTEGER;port_no:INTEGER;g_value:BOOLEAN): INTEGERVARvalue: INTEGERstatus: INTEGERBEGINIF g_value THENvalue = 1ELSEv...

  • Page 672

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• The position data is set in XYZWPR representation with no conversion.• status explains the status of the attempted operation. If not equal to 0, then an error occurred.• If group_no is omitted, the default group for the progra...

  • Page 673

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• If group_no is specified, it must be in the range of 1 to the total number of groups defined onthe controller.Example: Refer to 817,Section 817,B.14 , "Applying Offsets to a Copied Teach Pendant Program"(CPY_TP.KL), fo...

  • Page 674

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BSee Also: SET_INT_REG, GET_REAL_REG, GET_INT_REG Built-in ProceduresA.20.30 SET_REG_CMT Built-In-ProcedurePurpose: To set the comment information of a KAREL register based on a given register numberandagivencomment.Syntax: SET_REG_CMT...

  • Page 675

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONTable A–21.32–Bit INTEGER Format of Time31–2524–2120–16yearmonthday15–1110–54–0hourminutesecond• The contents of the individual fields are as follows:— DATE:Bits 15-9 — Year since 1980Bits 8-5 — Month (1-12)Bit...

  • Page 676

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BA.20.32 SET_TPE_CMT Built-In ProcedurePurpose: Provides the ability for a KAREL program to set the comment associated with a specifiedposition in a teach pendant program.Syntax : SET_TPE_CMT(open_id, pos_no, comment, status)Input/Outp...

  • Page 677

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION[in] position_no : INTEGER[in] posn : POSITION[out] status : INTEGER%ENVIRONMENT Group :PBCOREDetails:• open_id specifies the opened teach pendant program. A program must be opened before callingthis built-in.• position_no specifi...

  • Page 678

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BTSK_TIMESLIC :Time slice duration, see %TIMESLICE for value informationTSK_NOBUSY :Busy lamp off, see %NOBUSYLAMPTSK_NOABORT :Ignore abort requestPg_np_error :no abort on errorPg_np_cmd :no abort on commandTSK_NOPAUSE :Ignore pause re...

  • Page 679

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION[out] status : INTEGER%ENVIRONMENT Group :MULTIDetails:• task_name is the name of the task of interest. A blank task_name will indicate the calling task.• new_name will become the new task name.• status explains the status of th...

  • Page 680

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• var_name can contain node numbers, field names, and/or subscripts.• If both var_name and value are ARRAYs, the number of elements copied will equal the size ofthe smaller of the two arrays.• If both var_name and value are STRI...

  • Page 681

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONsstate = ’ Offline’CASE (1) : -- Onlinesstate = ’ Online ’CASE (2) : -- Synchronizedsstate = ’ Synch’CNV_INT_STR(idx, 1, 10, sidx)prog_name = ’\\’ + $PH_MEMBERS[idx].$NAME + ’\ipgetset’var_name = ’set_data[’+ s...

  • Page 682

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV Bentry: integerstatus: integerint_data: integerreal_data: realposext_data: xyzwprextBEGINGET_VAR(entry, ’\\mhrob01\*numreg*’, ’$NUMREG[10]’, int_data, status)IF status <> 0 THENGET_VAR(entry, ’\\mhrob01\*numreg*’, ’...

  • Page 683

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.20.39 SIGNAL EVENT ActionPurpose: Signals an event that might satisfy a condition handler or release a waiting programSyntax : SIGNAL EVENT[event_no]where:event_no : an INTEGER expressionDetails:• You can use the SIGNAL EVENT acti...

  • Page 684

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BSee Also: 889,Appendix 889,E , ‘‘Syntax Diagrams’’ for more syntax information, EVENT ConditionExample: Refer to the DISABLE CONDITION Statement example program.A.20.41 SIGNAL SEMAPHORE ActionPurpose: Adds one to the value o...

  • Page 685

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.20.43 SQRT Built-In FunctionPurpose: Returns a REAL value that is the positive square root of the specified REAL argumentSyntax : SQRT(x)Function Return Type :REALInput/Output Parameters :[in] x : REAL%ENVIRONMENT Group :SYSTEMDetai...

  • Page 686

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BSyntax : STD_PTH_NODE = STRUCTUREnode_pos : POSITION in GROUP[1]group_data : GROUP_ASSOC in GROUP[1]common_data : COMMON_ASSOCENDSTRUCTUREDetails:• If the NODEDATA clause is omitted from the PATH declaration, then STD_PTH_NODE willb...

  • Page 687

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONWarningDo not run a KAREL program that performs motion if more than onemotion group is defined on your controller. If your controller is set upfor more than one motion group, all motion must be initiated from ateach pendant program. O...

  • Page 688

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BSee Also: 177,Chapter 177,8 177,MOTION , RESUME Action, RESUME Statement, 889,Appendix 889,E , ‘‘SyntaxDiagrams,’’ for more syntax informationExample: The following example stops motion if the digital input is ON.STOP Sta...

  • Page 689

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONTable A–22.Example STRING LiteralsVALIDINVALIDREASON‘123456’123456Without quotes 123456 is an INTEGER literalExample: Refer to the following sections for detailed program examples: 750,Section 750,B.2 , "Copying Path Varia...

  • Page 690

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BA.20.50 STRUCTURE Data TypePurpose: Defines a data type as a user-defined structureSyntax : new_type_name = STRUCTUREfield_name_1: type_name_1field_name_2: type_name_2...ENDSTRUCTUREDetails:• A user-defined structure is a data type ...

  • Page 691

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONInput/Output Parameters :[in] src : STRING[in] strt : INTEGER[in] len : INTEGER%ENVIRONMENT Group :SYSTEMDetails:• A substring of src is returned by the function.• The length of substring is the number of characters, specified by ...

  • Page 692

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BDetails:• The value of angle must be in the range of ± 18000 degrees. Otherwise, the program will beaborted with an error.Example: The following example uses the TAN Built-In function to specify the tangent of thevariable angle . T...

  • Page 693

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• If n is greater than the length of the path (or greater than 1 if the move is to a POSITION), thecondition is never satisfied.• If n is less than zero or greater than 1000, the program is aborted with an error.See Also: 115,Cha...

  • Page 694

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BA.21.5 TRANSLATE Built-In ProcedurePurpose: Translates a KAREL source file (.KL file type) into p-code (.PC file type), which can beloaded into memory and executed.Syntax : TRANSLATE(file_spec, listing_sw, status)Input/Output Paramete...

  • Page 695

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONExample: The following example program will create, translate, load, and run another programcalled hello.TRANSLATE Built-In ProcedureOPEN FILE util_file (’RW’, ’hello.kl’)WRITE util_file (’PROGRAM hello’, CR)WRITE util_fil...

  • Page 696

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• ROUND and TRUNC can both be used to convert a REAL expression to an INTEGER expression.See Also: ROUND Built-In FunctionExample: The following example uses the TRUNC Built-In to determine the actual INTEGERvalue of miles divided b...

  • Page 697

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMOVE ALONG pathvar,WHEN TIME 200 BEFORE NODE[3] DOHOLDENDMOVEA.22.2 UNHOLD StatementPurpose: Releases a HOLD of motionSyntax : UNHOLD <GROUP [n{,n}]>Details:• Any motion that was in progress when the last HOLD was executed is ...

  • Page 698

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BInput/Output Parameters :[in] variable :any KAREL variable%ENVIRONMENT Group :SYSTEMDetails:• A value of TRUE is returned if variable is uninitialized. Otherwise, FALSE is returned.• variable can be of any data type except an unsu...

  • Page 699

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONTable A–23.Group_mask SettingsGROUPDECIMALBITGroup 111Group 222Group 343To specify multiple groups select the decimal values, shown in 699,Table 699,A–23 , which correspond tothe desired groups. Then connect them together using ...

  • Page 700

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• status explains the status of the attempted operation. If not equal to 0, then an error occurred.See Also: LOCK_GROUP Built-In Procedure, 329,Chapter 329,14 329,MULTI-TASKING , for more informationand examples.Example: The foll...

  • Page 701

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONExample: Refer to 739,Section 739,B.1 , "Setting Up Digital Output Ports for Monitoring" (DOUT_EX.KL)for a detailed program example.A.22.7 UNPOS Built-In ProcedurePurpose: Sets the specified REAL variables to the location ...

  • Page 702

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BSyntax : UNTIL cond_list < THEN action_list >where:cond_list : one or more conditionsaction_list : one or more actionsDetails:• Multiple conditions in cond_list must be separated by the AND operator or the OR operator.Mixing o...

  • Page 703

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONDetails:• In the executable statement, if the same name is both a field name and a variable name, thefield name is used.• If the same field name appears in more than one variable, the right-most variable in the USINGstatement is u...

  • Page 704

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BExample:------------------------------------------------------------------PROGRAM cal------------------------------------------------------------------%NOLOCKGROUP%ENVIRONMENT CVIS%ALPHABETIZE%COMMENT = ’IRVision CAL Built-in’%NOP...

  • Page 705

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONDetails:• vp_name is the name of the vision process created in setup mode• register_no is the register number in which the offset and vision data is placed.• status explains the status of the attempted operation. If not equal to...

  • Page 706

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BGET_TPE_PRM(1,3,int_value,real_value,visprocess,STATUS)-- V_RUN_FIND, snap an image and run the vision processV_RUN_FIND(visprocess, 0, STATUS)-- success if status is zeroIF STATUS <> 0 THENWRITE (’V_RUN_FIND FAILED with ERROR...

  • Page 707

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONSyntax:V_GET_PASSFL (vp_name, register_no, status)[in] vp_name : STRING[in] register_no : INTEGER[out] status : INTEGER%ENVIRONMENT GROUP: CVISDetails:• vp_name is the name of the error proofing vision process created in setup mode...

  • Page 708

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BENDIF-- Put error proofing result into R[1]V_GET_PASSFL(’EP1’,1,STATUS)-- success if status is zeroIF STATUS <> 0 THENWRITE (’V_GET_PASSFL FAILED with ERROR CODE ’, STATUS, CR)ABORTENDIFEND eproofA.23.4 V_RUN_FIND iRVisi...

  • Page 709

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION%ALPHABETIZE%COMMENT = ’IRVision Built-it’%NOPAUSE = ERROR + COMMAND + TPENABLEVARSTATUS: INTEGERvisoffset: XYZWPRentry: INTEGERXoffset: REALYoffset: REALZoffset: REALWoffset: REALPoffset: REALRoffset: REALconfig_var: CONFIGvispro...

  • Page 710

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BIF STATUS <> 0 THENWRITE (’V_GET_OFFSET FAILED with ERROR CODE ’, STATUS, CR)ABORTENDIF-- Get all the offset values from VR[1] so they can be put into a PRGET_VAR (entry, ’*SYSTEM*’, ’$VR[1].$OFFSET.$X’,Xoffset, STAT...

  • Page 711

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.23.6 VAR_INFO Built-In ProcedurePurpose: Allows a KAREL program to determine data type and numerical information regardinginternal or external program variablesSyntax: VAR_INFO(prog_name, var_name, uninit, type_nam, type_value, dims...

  • Page 712

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BTable A–24.Valid Data TypesData TypeValuePOSITION1XYZWPR2XYZWPREXT6INTEGER16REAL17BOOLEAN18VECTOR19COMMON_ASSOC20VIS_PROCESS21MODEL22SHORT23BYTE24JOINTPOS125CONFIG28FILE29GROUP_ASSOC30PATH31CAM_SETUP32JOINTPOS241JOINTPOS357JOINTPOS4...

  • Page 713

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION— dims[1] = 0 if not an array— dims[2] = 0 if not a two-dimensional array— dims[3] = 0 if not a three-dimensional array• slen returns the declared length of the variable specified by var_name if it is a STRING variable.• sta...

  • Page 714

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B[in] prog_name : STRING[in] var_name : STRING[in] var_type : INTEGER[in] n_skip : INTEGER[in] format : INTEGER[out] ary_nam : ARRAY of STRING[out] n_vars : INTEGER[out] status : INTEGER%ENVIRONMENT Group :BYNAMDetails:• prog_name sp...

  • Page 715

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONTable A–25.Valid Data Types (Cont’d)Data TypeValueBYTE24JOINTPOS125CONFIG28FILE29GROUP_ASSOC30PATH31CAM_SETUP32JOINTPOS241JOINTPOS357JOINTPOS473JOINTPOS589JOINTPOS6105JOINTPOS7121JOINTPOS8137JOINTPOS9153JOINTPOS153STRING209user-de...

  • Page 716

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• ary_nam is an ARRAY of STRINGs to store the variable names. If the declared length of theSTRING in ary_nam is not long enough to store the formatted data, then status is returned with anerror.• n_vars is the number of variables ...

  • Page 717

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONExample: The following example shows VECTOR as variable declarations, as parameters in aroutine, and as a function routine return type.VECTOR Data TypeVARdirection, offset : VECTORROUTINE calc_offset(offset_vec:VECTOR):VECTOR FROM uti...

  • Page 718

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B[out] total :INTEGER[out] free :INTEGER[out] volume :STRING%ENVIRONMENT Group :FLBTDetails:• devices can be:RD: The RAM disk returns all three parameters, but the volume name is ’’ since it is notsupported. The RAM disk must be ...

  • Page 719

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONPROGRAM space%NOLOCKGROUP%ENVIRONMENT FLBTVARtotal:INTEGERfree:INTEGERvolume: STRING [30]BEGINVOL_SPACE(’rd:’, total, free, volume)VOL_SPACE(’fr:’, total, free, volume)VOL_SPACE(’frp:’, total, free, volume)VOL_SPACE(’fr:...

  • Page 720

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BA.24.2 WHEN ClausePurpose: Used to specify a conditions/actions pair in a local or global condition handlerSyntax : WHEN cond_list DO action_listwhere:cond_list : one or more conditionsaction_list : one or more conditionsDetails:• A...

  • Page 721

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONDetails:• boolean_exp is evaluated before each iteration.• As long as boolean_exp is TRUE, the statements in the loop are executed.• If boolean_exp is FALSE, control is transferred to the statement following ENDWHILE, and thesta...

  • Page 722

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BWarningDo not run a KAREL program that performs motion if more than onemotion group is defined on your controller. If your controller is set upfor more than one motion group, all motion must be initiated from ateach pendant program. O...

  • Page 723

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• Optional format specifiers can be used to control the amount of data that is written for eachdata_item .• ThereservedwordCR, whichcan be used asadata item, specifies that the next data item to bewritten to the file_var will star...

  • Page 724

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BA.24.7 WRITE_DICT_V Built-In ProcedurePurpose: Writes information from a dictionary with formatted variablesSyntax : WRITE_DICT_V(file_var, dict_name, element_no, value_array, status)Input/Output Parameters:[in] file_var :FILE[in] dic...

  • Page 725

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONTPTASKEG.TX----------------------------------------------$ "Maximum number of tasks = %d"----------------------------------------------UTILITY PROGRAM:----------------------------------------------PROGRAM util_prog%ENVIRONME...

  • Page 726

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• tag_name Name of the tag you want to know about• numchar specifies the number of characters to use when looking for the tag• caseflag If TRUE, specifies whether the tag_name is case sensitive• tag_ident Application identifie...

  • Page 727

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION• attrnames indicates attribute names• attrvalues indicates attribute values• textdata indicates the text that follows the tag• textdone If this is FALSE, more text is to be read• status indicates the result of the operation...

  • Page 728

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B[out] func_code::INTEGER[out] status :INTEGERDetails:• xml_file Open KAREL file with AR_XML attribute set• tag_name Name of the tag system found• tag_ident Taguserassociatedinaddtag call• func_code Function code, start etc• ...

  • Page 729

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTION— XML_TAGNEST Tag nesting level too deep— XML_COMMENT Error in comment• The system will provide a separate return for the start of the tag and the end of the tag if the tagdoes not contain both starting and ending information. T...

  • Page 730

    A. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BA.25.6 XYZWPR Data TypePurpose: Defines a variable, function return type, or routine parameter as XYZWPR data typeSyntax : XYZWPR <IN GROUP [n]>Details:• An XYZWPR consists of three REAL components specifying a Cartesian locat...

  • Page 731

    MARRCRLRF04071E REV BA. KAREL LANGUAGE ALPHABETICAL DESCRIPTIONA.25.7 XYZWPREXT Data TypePurpose: Defines a variable, function return type, or routine parameter as an XYZWPREXTSyntax : XYZWPREXT <IN GROUP [n]>Details:• An XYZWPREXT consists of three REAL components specifying a Cartesian ...

  • Page 732

  • Page 733

    Appendix BKAREL EXAMPLE PROGRAMSContents 733,Appendix 733,B 733,KAREL 733,EXAMPLE 733,PROGRAMS................................................................................ 733,B–1 739,B.1 739,SETTING 739,UP 739,DIGITAL 739,OUTPUT 739,PORTS 739,FOR 739,PROCESS 739,MONITORING...........

  • Page 734

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BThis appendix contains some KAREL program examples. These programs are meant to show youhow to use the KAREL built-ins and commands described in 345,Appendix 345,A , "KAREL LanguageAlphabetical Description."This section includes examples o...

  • Page 735

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMSTable B–1.KAREL Example ProgramsProgram NameProgramFunctionBuilt-ins UsedSection to ReferCPY_PTH.KLCopies pathvariables.APPEND_NODEBY_NAMECALL_PROGCNV_INT_STRCOPY_PATHCREATE_VARCURPOSDELETE_NODELOADPATH_LENPROG_LISTREAD_KBSET_CURSORSET_FILE_ATRSET_V...

  • Page 736

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BTable B–1.KAREL Example Programs (Cont’d)Program NameProgramFunctionBuilt-ins UsedSection to ReferLIST_EX.KLListsfilesandprograms, andmanipulate strings.ABSARRAY_LENCNV_INT_STRFILE_LISTLOADLOAD_STATUSPROG_LISTROUNDSUB_STR 776,Section 776,B.7GEN_H...

  • Page 737

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMSTable B–1.KAREL Example Programs (Cont’d)Program NameProgramFunctionBuilt-ins UsedSection to ReferCHG_DATA.KLProcesses andchanges valuesof dynamicallydisplayedvariables. 799,Section 799,B.11DCLST_EX.KLDisplays a list froma dictionary file.ADD_DIC...

  • Page 738

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BTable B–1.KAREL Example Programs (Cont’d)Program NameProgramFunctionBuilt-ins UsedSection to ReferCPY_TP.KLApplies offsetsto copied teachpendant programs.AVL_POS_NUMCHRCLOSE_TPECNV_JPOS_RELCNV_REL_JPOSCOPY_TPEGET_JPOS_TYPGET_POS_TPEGET_POS_TYPOPEN...

  • Page 739

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMSB.1 SETTING UP DIGITAL OUTPUT PORTS FOR PROCESSMONITORINGThis program sets up digital output ports for process monitoring. The DOUT are to monitor theexternal equipment status and show the current status of the process. The equipment status DOUT’sar...

  • Page 740

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV B----XYZWPRSec 2Setting Up Digital Output Ports for Monitoring Teach Pendant Program - Overview Continued----Directives:----ALPHABETIZESec 1----COMMENTSec 1----CMOSVARSSec 1----INCLUDESec 1----Built-in Functions & Procedures:----CHRSec 3-E; 4-E----...

  • Page 741

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMSSetting Up Digital Output Ports for Process Monitoring - Declaration Section--------------------------------------------------------------------------------Section 1:Program and Environment Declaration--------------------------------------------------...

  • Page 742

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BSetting Up Digital Output Ports for Process Monitoring - Declare Routines-------------------------------------------------------------------------------Section 3:Routine Declaration----------------------------------------------------------------------...

  • Page 743

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMS----complementary signal of each other.-----------------------------------------------------------------------------ROUTINE set_mode(port_type:INTEGER;port_no:INTEGER;reverse:BOOLEAN;complmnt:BOOLEAN)VARmode:INTEGERBEGIN-- set_modeIF reverse THENmode ...

  • Page 744

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BFOR port_n=0TO5DOSET_PORT_ASG(IO_DOUT, port_n*8+1, 0, 0, io_mem_boo, port_n*8+1, 8, status)IF (status <> 0 ) THEN-- Verify that SET_PORT_ASG was successfulWRITE (’SET_PORT_ASG built-infor DOUT (assignment) failed’,CR)WRITE (’Status = ’,s...

  • Page 745

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMSSET_PORT_CMT(IO_DOUT, EQIP_ON, ’Equip- ON’,status)IF (status <> 0 ) THEN-- Verify SET_PORT_CMT was successfulWRITE (’SET_PORT_CMT built-in failed’,CR)WRITE (’Status = ’,status,CR)ENDIFSET_PORT_CMT(IO_DOUT, EQIP_OFF, ’Equip- OFF’,...

  • Page 746

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BBEGINTP_CLS-- store the current position, where the process is stopped due to failure-- so after resuming the process can be started from this point.stop_pos = CURPOS(0,0)-- move the robot to the perch position so the equipment-- can be worked on safe...

  • Page 747

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMS-----------------------------------------------------------------------------CONDITION[UNINIT_CH]:WHEN ERROR[12311] DO-- Trap UNINITIALIZATION errorNOMESSAGE-- Supress the error messageUNPAUSE-- UNPAUSEinit_port-- Allow ports to be initialized.ENDCOND...

  • Page 748

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BRELEASEWHILE (TPIN[249] = OFF ) DOWRITE TPPROMPT(CHR(128),CHR(137),’Turn the TP ON’)DELAY 1000ENDWHILEWRITE (’ROBOT is ready to move from TP’,cr)WRITE (’After moving ROBOT to PERCH position ’,cr)WRITE (’Turn OFF the TP then RELEASE DEADM...

  • Page 749

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMSDOUT[EQIP_FIXED] = FALSEDOUT[EQIP_READY] = FALSEENABLE CONDITION[RESTART]service_rtnENDCONDITIONENABLE CONDITION[EQIP_FAIL]-- Define a condition handler to monitor the servicing process.-- Once Servicing/Fixing of equipment is complete, wait for the e...

  • Page 750

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BSetting Up Digital Output Ports for Process Monitoring - MainWRITE (’ NOW YOU WILL SEE THE DOUT[’,NODE_PULSE,’] PULSE’,CR)WRITE (’ as the robot moves through every node.’,CR,CR)WRITE (’ To simulate EQUIPMENT failure, change ’,CR)WRITE ...

  • Page 751

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMSCopy Path Variables Program - Overview----------------------------------------------------------------------------------Detail about CPY_PTH.Kl---------------------------------------------------------------------------------- Elements of KAREL Languag...

  • Page 752

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV B----SET_CURSORSec 4-E----SET_FILE_ATRSec 4-A----SET_VARSec 4-B----SUB_STRSec 4-E----VAR_LISTSec 4-E----Statements:----ABORTSec 4-C,E----CLOSE FILESec 4-E----FOR .... ENDFORSec 3-C; 4-C,D,E----IF...THEN...ENDIFSec 3-B,C; 4-B,C,D,E----MOVE ALONGSec 4-D-...

  • Page 753

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMSgrup_dat:GROUP_ASSOCcomn_dat:COMMON_ASSOCENDSTRUCTUREuser_path= PATH nodedata = node_struc--Create a user defined pathVARpth1,pth2,pth3pth4:PATH-- These are system defined PATHsupth1,upth2,upth3,upth4:user_path-- These are user defined PATHsp1_len,p2_...

  • Page 754

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BCopy Path Variables Program - Monitor User Response----------------------------------------------------------------------------------Section 3:Routine Declaration-----------------------------------------------------------------------------------------...

  • Page 755

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMSCopy Path Variables Program - Copying Path Variables---------------------------------------------------------------------------------- Section 3-C: PTH_CPY Declaration----Copy one user defined path variable to another user defined path----variable. Th...

  • Page 756

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BOPEN FILE crt_kb (’RO’, ’KB:crkb’) -- Open a file to the CRT/KB-- Used within the YES_NO routine.---------------------------------------------------------------------------------Section 4-B: Check if SAVE_VRS.PC is loaded. If loaded then execu...

  • Page 757

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMSSET_VAR (entry, prog_name, ’prog_name’,cur_name , status)SET_VAR (entry, prog_name, ’sav_type’, 1, status)SET_VAR (entry, prog_name, ’dev’, ’FLPY:’, status)WRITE (’Saving program variables before copy’, CR)CALL_PROG(prog_name,prog_...

  • Page 758

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV B-----------------------------------------------------------------------------total_node = p1_len + p2_len-- Total number of nodes needed for pth3-- Copy the node data from pth1 to pth3WRITE (’copying pth1 to pth3’,cr)COPY_PATH (pth1, 0,0, pth3, st...

  • Page 759

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMS-----------------------------------------------------------------------------CRT_CLSSET_CURSOR(OUTPUT,2,10, status)-- Position cursor nicely on CRTIF (status <> 0 ) THENWRITE (’SET_CURSOR built-in failed with status = ’,status,cr)ENDIF-- wri...

  • Page 760

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BCNV_INT_STR(des_num,2,0,dummy_str)-- Convert des_num to a stringdes_var = ’UPTH’+ SUB_STR(dummy_str,2,1)-- The SUB_STR will remove the leading-- blank from dummy_str before-- concatenating to create the-- source variable name-- Verify that the des...

  • Page 761

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMS----INTEGERSec 2----STRINGSec 2----Directives:----COMMENTSec 1----ENVIRONMENTSec 1----NOLOCKGROUPSec 1----Built-in Functions & Procedures:----DELETE_FILESec 4-B----SAVESec 4-B----Statements:----IF, THEN, ENDIFSec 4-B----SELECT, CASE, ENDSELECTSec ...

  • Page 762

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV B------------------------------------------------------------------------------Section 3:Routine Declaration--------------------------------------------------------------------------Saving Data Program - Create File Spec--------------------------------...

  • Page 763

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMSIF (del_vr = TRUE)THENDELETE_FILE (file_spec, FALSE, status) -- Delete the file.IF (status <> SUCCESS) AND (status <> 10003) AND(status <> 85014) THENWRITE (’Error ’, status,’ in attempt to delete ’,cr, file_spec,cr)ENDIFENDI...

  • Page 764

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV B----CRSec 3-B----ENDSec 3-A,B; 4----PROGRAMSec 1----Predefined File Names:----CRTERRORSec 3-A----CRTFUNCSec 3-A----CRTPROMPTSec 3-A----CRTSTATUSSec 3-A----OUTPUTSec 3-A----TPERRORSec 3-B----TPFUNCSec 3-B----TPSTATUSSec 3-B----TPPROMPTSec 3-BStandard R...

  • Page 765

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMS-- avoid the screen from flashing-- since the screen will be clean-- when you see it.END CRT_CLSStandard Routines - Clears Screen and Displays Menu----------------------------------------------------------------------------Section 3-B:TP_CLS Declarati...

  • Page 766

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BAfter PROG_1.TP has completed, the KAREL program gets the value from R[2] and verifies itwas the expected value.The PROG_VAL.TP teach pendant program should look similar to the following.PROG_VAL JOINT 10%1: !POSITION REG VAL...

  • Page 767

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMS• After the looping is complete, PROG_1.TP stores value 1 in R[2], which will be checkedby the KAREL program.Using Register Built-ins Program - Overview------------------------------------------------------------------------------REG_EX.Kl----------...

  • Page 768

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BUsing Register Built-ins Program - Declaration Section-----------------------------------------------------------------------------Section 1:Program and Environment Declaration-------------------------------------------------------------------------PR...

  • Page 769

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMSIF (status = cc_success) THEN-- verify SET_POS_REG is successfulWRITE(’Executing "PROG_VAL.TP"’,cr)CALL_PROGLIN(’PROG_VAL’,2,prg_indx, FALSE)--Execute ’PROG_VAL.TP’ starting-- at line 2.Do not pause on-- entry of PROG_VAL.-------...

  • Page 770

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BWRITE(’Getting Value from R[2]’,cr)GET_REG(2,r_flg, i_val, r_val, status) --Get R[2] valueIF (status = cc_success) THEN--Verify GET_REG successIF (r_flg) THEN--REAL value in registerWRITE(’Got REAL value from R[2]’,cr)IF (r_val <> 1.0) T...

  • Page 771

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMS• The first condition handler detects if the user has pushed a teach pendant key, and if so aborts theprogram.• The second condition handler sets a variable when the program is aborted.Path Variables and Condition Handlers Program - Overview------...

  • Page 772

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV B----FOR...ENDFORSec 4-D----ROUTINESec 3-A, B----WAIT FORSec 3-B----WRITESec 3-B; 4-B,C,D----Reserve Words:----BEGINSec 3-A,B, 4----CONSTSec 2----ENDSec 3-A,B: 4-D----VARSec 2----PROGRAMSec 1----Predefined File Names:----TPFUNCSec 3-B; 4-D----TPDISPLAY...

  • Page 773

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMSPath Variables and Condition Handlers Program - Declare Routines----------------------------------------------------------------------------------Section 3:Routine Declaration----------------------------------------------------------------------------...

  • Page 774

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV B-- (ie: set DOUT/GOUT’s, send signals to a PLC)ENDCONDITIONCONDITION[CH_F1]:WHEN TPIN[129] DO-- Monitor TP ’F1’ Key. If ’F1’ key is pressed,ABORT-- abort the program.ENDCONDITIONprg_abrt = false-- Initialize variable which is setonly if-- th...

  • Page 775

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMS----Section 4-D: Creating a joint position and moving along path’s----------------------------------------------------------------------------FOR indx=1to6DO--Set all joint angles to zeroreal_ary[indx] = 0.0ENDFORreal_ary[5] = 90.0-- Make sure that ...

  • Page 776

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BMOVE ALONG pth1ENDFORWRITE TPFUNC(CHR(128),CHR(137))-- Home Cursor and Clear to-- End-of-line.This will remove-- the ABORT displayed above F1.WRITE (’pth_move Successfully Completed’,cr)END PTH_MOVEB.7 LISTING FILES AND PROGRAMS AND MANIPULATINGST...

  • Page 777

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMS----SUB_STRSec 4-AListing Files and Programs and Manipulating Strings - Overview Continued----Statements:----FOR .... ENDFORSec 3-B----IF...THEN...ENDIFSec 4-A,B,C,D----ROUTINESec 3-A,B,C----REPEAT...UNTILSec 4-C,D----RETURNSec 3-A----WRITESec 3-B; 4-...

  • Page 778

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BMULTIPLIER= 25173VARpr_cases:STRING[6]-- psuedo random number converted to stringprg_nm:STRING[50] -- Concatenated program nameloaded:BOOLEAN-- Used to see if program is loadediniti:BOOLEAN-- Used to see if variables initializedindx1:INTEGER-- FOR loo...

  • Page 779

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMS---------------------------------------------------------------------------------Section 3-C:TP_CLSDeclaration----This routine is from ROUT_EX.KL and will----clear the TP USER menu screen and force it to be visible.------------------------------------...

  • Page 780

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BLOAD(prg_nm, 0 , status)-- Load in the programIF (status =0 ) THEN-- Verify load is successfulWRITE (’Loading ’,’MYPROG’ + pr_cases + ’.VR’,cr)LOAD(’MYPROG’ + pr_cases + ’.VR’, 0, status) -- Load the .vr fileIF (status <> 0 )...

  • Page 781

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMS-- declared size of ary_name then--all files have been listed.----------------------------------------------------------------------------------Section 4-D: Show the programs loaded in controller--------------------------------------------------------...

  • Page 782

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV B----Directives:%COMMENTSec 1----Built-in Functions &Procedures:----CHECK_EPOSSec 4-B----CNV_REL_JPOSSec 3-B----COSSec 3-A----CURPOSSec 4-A----SINSec 3-A----Statements:----CONNECT TIMERSec 4-A----FOR ... ENDFORSec 3-A,B; 4-B----MOVE TOSec 3-B; 4-B-...

  • Page 783

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMS----------------------------------------------------------------------------------------------------------------------------------------------------------------Section 3-A:R_CALC_HEX Declaration----Calculates the hexagon points based on distance----be...

  • Page 784

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV B-- Set JOINT 3 and 5 to -45 and 45 degreesp_cntr_arry[3] = -45p_cntr_arry[5] =45-- Convert the REAL array to a joint position,p_cntrCNV_REL_JPOS(p_cntr_arry,p_cntr,status)$motype= JOINTWITH $GROUP[1].$SPEED = 1000MOVE TO p_cntrEND r_hex_centerGenerate...

  • Page 785

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMSWITH $GROUP[1].$MOTYPE = LINEAR MOVE TO p_cntr -- Move TCP in a straight-- line to the center positiont_end = clock-- Record ending timeWRITE(’Total motion time = ’,t_end-t_start,CR) --Display the total time for-- motion.-- NOTE that the total was...

  • Page 786

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV B----SUB_STRSec 4-A----Statements:----IF...THEN...ELSE...ENDIFSec 4-B----REPEAT...UNTILSec 4-A----ROUTINESec 3----SELECT...ENDSELECTSec 4-B----WRITESec 4-A,BFile and Device Built-ins Program - Overview Continued----Reserve Words:----BEGINSec 4----CONST...

  • Page 787

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMSSetup and Operations Manual for an Error Code listingVARtime_int: INTEGERtime_str: STRING[30]status: INTEGERcpy_stat: BOOLEANto_dev: STRING[5]----------------------------------------------------------------------------------Section 3: Routine Declarat...

  • Page 788

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV B-- Increase the size of RD:WRITE(’Increasing RD: size...’,cr)$FILE_MAXSEC = ROUND($FILE_MAXSEC * 1.2)-- Increase the RAM disk size-- Format the RAM-DISKWRITE(’FORMATTING RD:......’,cr)FORMAT_DEV(’RD:’,’’ ,FALSE, status) -- Format the R...

  • Page 789

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMSCASE (SUCCESS):WRITE (’Copy completed successfully!’,CR)ELSE:WRITE (’Copy failed, status:’, status,CR)ENDSELECTUNTIL (cpy_stat = FINISHED)END file_exB.10 USING DYNAMIC DISPLAY BUILT-INSThis program demonstrates how to use the dynamic display b...

  • Page 790

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV B----Built-in Functions & Procedures:----ABORT_TASKSec 4-C----CNC_DYN_DISISec 4-C----CNC_DYN_DISRSec 4-C----CNC_DYN_DISBSec 4-C----CNC_DYN_DISESec 4-C----CNC_DYN_DISPSec 4-C----CNC_DYN_DISSSec 4-C----INI_DYN_DISISec 3-A, 4-A----INI_DYN_DISRSec 3-B,...

  • Page 791

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMS%INCLUDE KLIOTYPS---------------------------------------------------------------------------------Section 2:Variable Declaration-----------------------------------------------------------------------------CONSTcc_success= 0-- Success statuscc_clear_wi...

  • Page 792

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BBegin-- Valid predefined windows are described in-- Chapter 7.9.1, "USER MENU on the Teach Pendant--ErrorLine--> ’ERR’1line--Status Line--> ’T_ST’3lines--Display Window--> ’T_FU’10 lines--Prompt Line--> ’T_PR’1line--Fu...

  • Page 793

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMS--- With the format and field_width specification the REAL will be--- displayed as follows:----------------|xxxx.xx|----------------Where the real valuewill be left justified.---There will always be two digits after the decimal point.---A maximum widt...

  • Page 794

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV B---The x’s will be one of the strings ’YES’ or ’NO’, depending on---the value of bool1.The string will be blinking.End Set_BoolUsing Dynamic Display Built-ins - Declare Routines Continued------------------------------------------------------...

  • Page 795

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMS----Set all the input parameters for the INI_DYN_DISP call.-----------------------------------------------------------------------------ROUTINE Set_PortBegin-- Valid predefined windows are described in-- Chapter 7.9.1, "USER MENU on the Teach Pen...

  • Page 796

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV B--Prompt Line--> ’T_PR’1line--Function Key--> ’T_FK’1lineInt_Wind= ’T_FU’-- Use th predefined display windowField_Width= 10-- Use the minimum width neccessaryAttr_Mask= 1 OR 4-- BOLD and UNDERLINEDChar_Size= 0-- NormalRow= 6-- Specif...

  • Page 797

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMSInt1= 1Real1= 1.0Bool1= FALSEEnum1= 0Strl= ’’-- Display messages to the TP USER screenWRITE (’Current INT1 =’,CR)WRITE (’Current REAL1=’,CR)WRITE (’Current BOOL1=’,CR)WRITE (’Current ENUM1=’,CR)WRITE (’Current PORT =’,CR)WRITE ...

  • Page 798

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BENDIFSet_Str-- Set parameter values for STRING DYNAMICDISPLAYINI_DYN_DISS(Str1,Int_Wind,Field_Width,Attr_Mask,Char_Size,Row,Col, Interval, Buffer_Size, Format ,Status)IF Status <> cc_success THEN -- Check the statusWRITE(’ INI_DYN_DISS failed,...

  • Page 799

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMS----Section 4-C: Wait for user response, and cancel dynamic displays-----------------------------------------------------------------------------WRITE TPPROMPT(CHR(cc_clear_win))-- Clear the prompt lineWRITE TPPROMPT(’Enter a number to cancel DYNAMI...

  • Page 800

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV B--------------------------------------------------------------------------------CHG_DATA.KL------------------------------------------------------------------------------------------------------------------------------------------------------------Sect...

  • Page 801

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMS-- other specified CMOS.Int1 IN CMOS FROM dyn_disp:INTEGER-- dynamically displayed variableReal1 IN CMOS FROM dyn_disp:REAL-- dynamically displayed variableBool1 IN CMOS FROM dyn_disp:BOOLEAN-- dynamically displayed variableEnum1 IN CMOS FROM dyn_disp...

  • Page 802

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BB.12 DISPLAYING A LIST FROM A DICTIONARY FILEThis program controls the display of a list which is read in from the dictionary file DCLISTEG.UTX.For more information on DCLISTEG.UTX refer to 811,Section 811,B.12.1 . DCLST_EX.KL controls theplacement ...

  • Page 803

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMS----READ_DICTSec 4-E,FDisplay List from Dictionary File - Overview Continued----REMOVE_DICTSec 4-I----SET_FILE_ATRSec 4-G----STR_LENSec 4-F----UNINITSec 3-C----WRITE_DICTSec 4-D,H,I----Statements:----ABORTSec 3-B----CLOSE FILESec 4-I----FOR...ENDFORSe...

  • Page 804

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BPROGRAM DCLST_EX%COMMENT=’DISCTRL_LIST ’%ALPHABETIZE%NOLOCKGROUP%INCLUDE DCLIST -- the include file from the dictionary DCLISTEG.UTX---------------------------------------------------------------------------------Section 2:VariableDeclarations----...

  • Page 805

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMS---------------------------------------------------------------------------------Section 3-B: Chk_Add_DctDeclaration----Check whether a dictionary is loaded.----If not loaded then load in the dictionary.------------------------------------------------...

  • Page 806

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV B-----------------------------------------------------------------------------ROUTINE Chk_Stat ( err_str: STRING)BEGIN -- Chk_StatIF( status <> 0) thenLog_Errors(Err_File, err_str,Status)ENDIFEND Chk_Stat------------------------------------------...

  • Page 807

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMSATT_WINDOW_S(’T_PR’, ’LIST’, 15, 1, status)-- attach the prompt windowChk_Stat(’T_PR not attached’)ATT_WINDOW_S(’T_FK’, ’LIST’, 16, 1, status)-- attach the function windowChk_Stat(’T_FK not attached’)Display List from Dictionar...

  • Page 808

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV B------------------------------------------------------------------------------- Initialize the display data structure-- In this example we only deal with window 1.display_data.win_start[1] = 1-- Starting row for window 1.display_data.win_end[1]= 10-- ...

  • Page 809

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMS------------------------------------------------------------------------------- Initial Display the menu list.DISCTRL_LIST(TPDISPLAY, display_data, list_data, DC_DISP, status)Chk_Stat(’Error displaying list’)-- Open a file to the TPDISPLAY window ...

  • Page 810

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BDisplay List from Dictionary File - Control Cursor Movement ContinuedCASE (KY_ENTER) :-- Perform laterCASE (KY_F4) : -- "YES" function key pressedIF act_pending <> 0 THEN -- If a menu item was selected...-- Clear confirmation promptWRI...

  • Page 811

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMSDisplay List from Dictionary File - Cleanup and Exit Program---------------------------------------------------------------------------------Section 4-I:Cleanup before exiting program--------------------------------------------------------------------...

  • Page 812

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV B$-,TPTSSP_CLRSC &home &clear_2_eow$-,TPTSSP_FK1 &home" [TYPE]"$-,TPTSSP_FK2 &home"YESNO"$-,TPTSSP_INSTR &home "Press ’ENTER’ or number key to select." &clear_2_eol* Add menu options here, "...

  • Page 813

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMSMethod 1 allows a program name to be entered using the default value for the dictionary name. SeeSection 4-A in 814,Using 814,the 814,DISCTRL_ALPHA 814,Built-in 814,- 814,Enter 814,Data 814,from 814,Teach 814,Pendant 814,.Method 2 allows a ...

  • Page 814

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV B----OUTPUTSec 4-C----TPDISPLAYSec 4-A,B----Predefined Windows:----T_FUSec 4-A,B----C_FUSec 4-CUsing the DISCTRL_ALPHA Built-in - Declaration Section---------------------------------------------------------------------------------Section 1:Program and ...

  • Page 815

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMSFORCE_SPMENU(tp_panel, SPI_TPUSER, 1)-- Force TP USER menu to be-- visibleSET_CURSOR(TPDISPLAY, 12, 1, status)-- reposition cursorWRITE (’prog_name: ’)prog_name = ’’-- initialize program nameDISCTRL_ALPH(’t_fu’, 12, 12, prog_name, ’PROG...

  • Page 816

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV B-- to see what the current language, $language, is and load the-- correct dictionary.-- For instance you could have a DCALPHJP.TX file which-- would be the Japanese dictionary. If the current language, $language,-- was set to Japanese you would load t...

  • Page 817

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMS.KL DCALPH$, alpha_prog" PRGMAINSUBTEST>"&new_line" PROCJOBMACRO>"&new_line" TEST1TEST2TEST3TEST4>"NoteThe greater than symbol (>) in 816,DCALPHEG.UTX 816,Dictionary 816,File is a reminder to use th...

  • Page 818

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV B----CLOSE_TPESec 3-E----CNV_REL_JPOSSec 3-E----CNV_JPOS_RELSec 3-E----COPY_TPESec 3-E----GET_JPOS_TPESec 3-E----GET_POS_TYPSec 3-E----GET_POS_TPESec 3-E----OPEN_TPESec 3-E----PROG_LISTSec 3-B----SELECT_TPESec 3-E----SET_JPOS_TPESec 3-E----SET_POS_TPES...

  • Page 819

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMS------------------------------------------------------------------------------CONSTER_WARN = 0-- warning constant for use in POST_ERRSUCCESS = 0-- success constantJNT_POS = 9-- constant for GET_POS_TYPXYZ_POS = 2-- constant for GET_POS_TYPMAX_AXS = 9-...

  • Page 820

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BROUTINE GetFromPrgVARtp_type: INTEGER-- Types of program to listn_skip: INTEGER-- Index into the list of programsformat: INTEGER-- What type of format to store programs inn_progs: INTEGER-- Number of programs returned in prg_nameprg_name: ARRAY [8] of...

  • Page 821

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMSf_index = 0--reset f_index to re-generate list.n_progs = arr_size--set so the REPEAT/UNTIL will continueENDIF-- Check if user user has made a selectionIF (prg_select <> -1) thenfrom_prog = prg_name[prg_select]-- Set from_prog to name selectedn_p...

  • Page 822

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV BBEGIN--Get the XYZWPR offset, off_xyzREPEATWRITE ( ’Enter offset for XYZWPR positions’,CR)WRITE (’X=’)READ(off_xyz.x)WRITE (’Y=’)READ(off_xyz.y)WRITE (’Z=’)READ(off_xyz.z)WRITE (’W=’)READ(off_xyz.w)WRITE (’P=’)READ(off_xyz.p)WR...

  • Page 823

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMSnum_axs : INTEGER-- The number of axes if position is a JOINTPOS typeindx_pos: INTEGER-- FOR loop counter, that increments through TP positiongroup_no: INTEGER-- The group number of the current position setting.num_pos : INTEGER-- The next available p...

  • Page 824

    B. KAREL EXAMPLE PROGRAMSMARRCRLRF04071E REV Bchk_stat (status)-- Apply the offset to the REAL arrayFOR indx_axs=1to num_axs DOjp_new[indx_axs] = jp_org[indx_axs] + jp_off[indx_axs]ENDFOR-- Converted back to a JOINTPOS.-- The input array, jp_new, must not have any uninitialized values-- or the er...

  • Page 825

    MARRCRLRF04071E REV BB. KAREL EXAMPLE PROGRAMS----Section 4:Main Program-----------------------------------------------------------------------------BEGIN-- CPY_TPtp_cls-- Clear the TP USER Menu screenGetFromPrg-- Get the TPE program to copy FROMGetOvrSw-- Get the TPE program name to copy TOGetOf...

  • Page 826

  • Page 827

    Appendix CKCL COMMAND ALPHABETICALDESCRIPTIONContents 827,Appendix 827,C 827,KCL 827,COMMAND 827,ALPHABETICAL 827,DESCRIPTION...................................................... 827,C–1 831,C.1 831,ABORT 831,command............................................................................

  • Page 828

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B 841,C.21 841,DISABLE 841,CONDITION 841,command................................................................................. 841,C–15 841,C.22 841,DISMOUNT 841,command................................................................

  • Page 829

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTION 861,C.62 861,SET 861,DEFAULT 861,command........................................................................................... 861,C–35 861,C.63 861,SET 861,GROUP 861,command......................................................

  • Page 830

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B 877,C.103 877,WAIT 877,command.......................................................................................................... 877,C–51C–4

  • Page 831

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONThis section describes each KCL command in alphabetical order. Each description includes thepurpose of the command, its syntax, and details of how to use it. Examples of each command are alsoprovided.The following notation is used to des...

  • Page 832

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV Bprog_name : the name of any KAREL or TP program which is a taskALL : aborts all running or paused tasksFORCE : aborts the task even if the NOABORT attribute is set. FORCE only works with ABORTprog_name; FORCE does not work with ABORT ALL...

  • Page 833

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONExamples: KCL> APPEND NODE [test_prog]weld_pthKCL> APPEND NODE weld_pthC.4 CHDIR commandSyntax: CHDIR < device_name >\< path_name >\ or CD < device_name >\< path_nam e >where:device_name : a specified device...

  • Page 834

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BC.6 CLEAR BREAK CONDITION commandSyntax: CLEAR BREAK CONDITION < prog_name >( brk_pnt_no | ALL)where:prog_name : the name of any KAREL program in memorybrk_pnt_no : a particular condition break pointALL : clears all condition break...

  • Page 835

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONlang_name : the name of the language. The available choices are ENGLISH, JAPANESE, FRENCH,GERMAN, SPANISH or DEFAULT.ALL : clears the dictionary from all languagesPurpose: Clears a dictionary from the specified language or from all langu...

  • Page 836

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BAre you sure? YESKCL> CLEAR VARS test_prog YC.11 COMPRESS DICT commandSyntax: COMPRESS DICT file_namewhere:file_name : the file name of the user dictionary you want to compress.Purpose: Compresses a dictionary file from the default st...

  • Page 837

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONprog_name : the name of any KAREL or teach pendant program which is a taskALL : continues all paused tasksPurpose: Continues program execution of the specified task that has been paused by a hold,pause, or test run operation. If the prog...

  • Page 838

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BKCL> COPY FILE *.kl TO rd:\*.bak OVERWRITEKCL> COPY FILE flpy:\*main*.kl TO rd:* OVKCL> COPY mdb:*.tp TO mc:C.15 CREATE VARIABLE commandSyntax: CREATE VARIABLE <[ prog_name ]> var_name <IN (CMOS | DRAM)> : data_typew...

  • Page 839

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONfile_spec : a valid file specificationYES : confirmation is not promptedPurpose: Deletes the specified file from the specified storage device. The wildcard character (*) canbe used to replace the entire file name, the first part of the f...

  • Page 840

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BExamples: KCL> DELETE VARIABLE [test_prog]weld_pthKCL> DELETE VAR weld_pthC.19 DIRECTORY commandSyntax: DIRECTORY < file_spec >where:file_spec : a valid file specificationPurpose: Displays a list of the files that are on a st...

  • Page 841

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONbrk_pnt_no : a particular program break pointPurpose: Disables the specified break point in the specified or default program.Examples: KCL> DISABLE BREAK PROGRAM test_prog 3KCL> DISABLE BREAK PROG 3C.21 DISABLE CONDITION commandSyn...

  • Page 842

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BPurpose: Provides an ASCII text editor which can be used for editing dictionary files, commandfiles and KAREL source files.If file_spec is not specified, the default program name is used as the file name and the default filetype is .KL (...

  • Page 843

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONC.26 FORMAT commandSyntax: FORMAT device_name: < volume_name > <YES>where:device_name : the specified device to be initializedvolume_name : label for the deviceYES : confirmation is not promptedPurpose: Formats a specified de...

  • Page 844

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BPurpose: Pauses the specified or default program that is being executed and holds motion at thecurrent position (after a normal deceleration).Use the KCL> CONTINUE command or the CYCLE START button on the operator panel to resumeprogr...

  • Page 845

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONIf file_name is not specified, the default program is used. If the default has not been set, then themessage, ‘‘Default program name not set,’’ will be displayed.Examples: KCL> LOAD ALL test_progKCL> LOAD ALLC.31 LOAD DICT ...

  • Page 846

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BExample: KCL> LOAD FORMLoading FORM.TX with dictionary name FORMLoading FORM.VRKCL> LOAD FORM tpexamegLoading TPEXAMEG.TX with dictionary name EXAMLoading EXAM.VRC.33 LOAD MASTER commandSyntax: LOAD MASTER < file_name ><CO...

  • Page 847

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONC.35 LOAD SERVO commandSyntax: LOAD SERVO < file_name > <CONVERT>where:file_name : a valid file nameCONVERT : converts variables to system definitionPurpose: Loads a servo parameter file from the default storage device and de...

  • Page 848

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV B• If an array system variable that is referenced by a program already exists when a .SV file witha SMALLER size is loaded, the size in the .SV file is ignored but ALL the array values areloaded. No errors are posted.• If a .SV file w...

  • Page 849

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONCONVERT : converts variables to system definitionPurpose: Loads the specified or default variable data file from the default storage device anddirectory into memory. The file type is assumed to be ‘‘.VR.’’If file_name is not spec...

  • Page 850

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BExample: KCL>LOGOUT(The alarm message: "Logout (SAM) SETUP from KCL")KCL Username>C.40 MKDIR commandSyntax: MKDIR <device_name>\path_namewhere:device_name : a valid storage devicepath_name : a subdirectory previousl...

  • Page 851

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONPurpose: Moves the specified file from one memory file device to another. The file should existon the FROM or RAM disks. If file_spec is a file on the FROM disk, the file is moved to the RAMdisk, and vice versa.The wildcard character (*)...

  • Page 852

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BC.44 PURGE commandSyntax: PURGE device_namewhere:device_name : the name of the memory file device to be purgedPurpose: Purges the specified memory file device by freeing any used blocks that are no longerneeded. The device should be set ...

  • Page 853

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONPurpose: Records the position of the TCP and/or auxiliary or extended axes. The robot must becalibrated before the RECORD command is issued. The variable can be a system variable or a programvariable that exists in memory. The position i...

  • Page 854

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BThe new_var_name cannot already exist in memory. The variable still belongs to the same program.You cannot specify a prog_name with the new_var_name.You must enter the KCL> SAVE VARS command to make the change permanent.Examples: KCL&...

  • Page 855

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONThe name of the program to which the variable data belongs is stored in the variable file. The KCL>COPY FILE command does not change that stored program name, so the data cannot be used withanother program.C.50 RESET commandSyntax: RE...

  • Page 856

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BExecution begins at the first executable line. RUN is a motion command; therefore, the device fromwhich it is issued must have motion control. If a RUN command is issued in a command file, it isexecuted as a NOWAIT command. Therefore, th...

  • Page 857

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONPurpose: Saves the mastering data file from the default storage device and default directory intomemory using the specified or default file name. The file type will be ‘‘.SV.’’If file_name is not specified, the default file name,...

  • Page 858

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BC.57 SAVE TP commandSyntax: SAVE TP < file_name ><= prog_name >where:file_name : a valid file nameprog_name : the name of any TP programPurpose: Saves the specified TP program to the specified file (.TP). If you do not specif...

  • Page 859

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONSAVE VARS file_1In this case, the variable data for the program file_1 is saved in a variable file called file_1.VR.SAVE VARS = prog_ 1In this case, the variable data for prog_ 1 is saved in a variable file whose name is the defaultprogr...

  • Page 860

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV Bprog_name : the name of any KAREL or TP program in memorybrk_pnt_no : a particular program break pointline_no : a line numberPAUSE : task is paused when break point is executedDISPLAY : message is displayed on the teach pendant USER menu...

  • Page 861

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONThe date and time are included in directory and translator listings.See Also: SHOW CLOCK commandExample: KCL> SET CLOCK ’02-JAN-xx 21:45’C.62 SET DEFAULT commandSyntax: SET DEFAULT prog_namewhere:prog_name : the name of any KAREL ...

  • Page 862

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BExample: KCL> SET LANG ENGLISHC.65 SET LOCAL VARIABLE commandSyntax: SET LOCAL VARIABLE var_name <IN rout_name ><FROM prog_name ><task_name >= value <{, value }>where:var_name :a local variable or parameter nam...

  • Page 863

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONDIN, DOUT, RDO, OPOUT, TPOUT, WDI, WDO (BOOLEAN)-AIN, AOUT, GIN, GOUT(INTEGER)See Also: SIMULATE, UNSIMULATE command, 305,Chapter 305,13 305,INPUT/OUTPUT 305,SYSTEM 305,,application-specific FANUC Robotics Setup and Operations Manua...

  • Page 864

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BC.69 SET VARIABLE commandSyntax: SET VARIABLE <[ prog_name ]> var_name = value <{, value }>where:prog_name : the name of any KAREL or TP programvar_name : a valid program variablevalue : new value for variable or a program or...

  • Page 865

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONKCL> SET VARIABLE var_name.C = ’1,0’You must enter the KCL>SAVE VARS command to make the changes permanent.See Also: 66,Section 66,2.3, ‘‘Data Types’’Examples: KCL> SET VARIABLE [prog1] scale = $MCR.$GENOVERRIDEKCL...

  • Page 866

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BC.72 SHOW BUILTINS commandSyntax: SHOW BUILTINSPurpose: Displays all the softpart built-ins that are loaded on the controller.Example: KCL> SHOW BUILTINSC.73 SHOW CONDITION commandSyntax: SHOW CONDITION < prog_name >< conditi...

  • Page 867

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONC.76 SHOW DEFAULT commandSyntax: SHOW DEFAULTPurpose: Shows the current default program name.Example: KCL> SHOW DEFAULTC.77 SHOW DEVICE commandSyntax: SHOW DEVICE device_name:where:device_name : device to be shownPurpose: Shows the st...

  • Page 868

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BC.81 SHOW LANG commandSyntax: SHOW LANGPurpose: Shows the language specified in the system variable $LANGUAGE.Example: KCL> SHOW LANGC.82 SHOW LANGS commandSyntax: SHOW LANGSPurpose: Shows all language currently available in the syste...

  • Page 869

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONThis is done automatically when you load the program from the KCL.KCL> SET DEF testprogKCL> LOAD PROGCopied testprog.rs to RD:testprog.rsTo show local variables, the program must be running, paused, or aborted in the routine specif...

  • Page 870

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BIf the IN clause is omitted, the routine at the top of the stack is assumed. If the FROM clause isomitted, the default program is assumed. If the task_name is omitted, the stack of the KCL defaulttask is searchedNoteThe file RD: prog_nam...

  • Page 871

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONC.88 SHOW SYSTEM commandSyntax: SHOW SYSTEM < data_type > <VALUES>where:data_type : any valid KAREL data typePurpose: Displays a list including the name, type, and if specified, the current value of each systemvariable. If yo...

  • Page 872

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BC.91 SHOW TRACE commandSyntax: SHOW TRACE < prog_name >where:prog_name : the name of any KAREL or TP program which is a taskPurpose: Shows all the program statements and line numbers that have been executed since TRACEhas been turn...

  • Page 873

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONvar_name : a valid program variablePurpose: Displays the name, type, and value of the specified variable.You can display the values of system variables that allow KCL read access or the values of programvariables. Use brackets ([]) after...

  • Page 874

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BVALUES : specifies values should be displayedPurpose: Displays a list of variables in the specified or default program ( prog_name )ofthespecified data type ( data_type ). The list includes the name, type, and if specified, the currentva...

  • Page 875

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONC.97 SKIP commandSyntax: SKIP < prog_name >where:prog_name : the name of any KAREL or TP program which is a taskPurpose: Skips execution of the current statement in the specified task. If prog_name is notspecified, the default prog...

  • Page 876

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BC.99 STEP ON commandSyntax: STEP ON < prog_name >where:prog_name : the name of any KAREL or TP program which is a taskPurpose: Enables single stepping for the specified or default program.Examples: KCL> STEP ON test_progKCL> ...

  • Page 877

    MARRCRLRF04071E REV BC. KCL COMMAND ALPHABETICAL DESCRIPTIONPurpose: This command allows you to display the contents of the specified ASCII file on theCRT/KB. You can specify any type of ASCII file.Examples: KCL> TYPE rd:testprog.klKCL> TYPE testprog.klC.102 UNSIMULATE commandSyntax: UNSIMU...

  • Page 878

    C. KCL COMMAND ALPHABETICAL DESCRIPTIONMARRCRLRF04071E REV BDONE : specifies that the command procedure wait until execution of the current task is completedor abortedPAUSE : specifies that the command procedure wait until execution of the current task is paused,completed, or aborted.Purpose: Def...

  • Page 879

    Appendix DCHARACTER CODESContents 879,Appendix 879,D 879,CHARACTER 879,CODES............................................................................................... 879,D–1 880,D.1 880,CHARACTER 880,CODES....................................................................................

  • Page 880

    D. CHARACTER CODESMARRCRLRF04071E REV BD.1 CHARACTER CODESThis appendix lists the ASCII numeric decimal codes and their corresponding ASCII, Multinational,graphic, and European characters as implemented on the KAREL system. The ASCII character set isthe default character set for the KAREL system....

  • Page 881

    MARRCRLRF04071E REV BD. CHARACTER CODESTable D–1.ASCII Character Codes (Cont’d)DecimalCodeCharacterValueDecimalCodeCharacter ValueDecimalCodeCharacterValueDecimalCodeCharacterValue024(CAN)0568088X120x025(EM)0579089Y121y026(SUB)058:090Z122z027(ESC)059;091[123{028(FS)060<092\124|029(GS)061=0...

  • Page 882

    D. CHARACTER CODESMARRCRLRF04071E REV BTable D–2.Special ASCII Character Codes (Cont’d)Decimal CodeCharacter ValueDecimal CodeCharacter Value137Home cursor in window155 127Foreground color default138Blink video attribute156 48Background color black139Reverse video attribute156 49Background co...

  • Page 883

    MARRCRLRF04071E REV BD. CHARACTER CODESTable D–3.Multinational Character Codes (Cont’d)DecimalCodesCharacterValueDecimalCodesCharacterValueDecimalCodesCharacterValueDecimalCodesCharacter Value008(HTS)040¤072È104è009(HTJ)041©073É105é010(VTS)042a074Ê106ê011(PLD)043«075Ë107ë012(PLU)04...

  • Page 884

    D. CHARACTER CODESMARRCRLRF04071E REV BTable D–4.Graphics Character CodesDecimalCodesCharacterValueDecimalCodesCharacterValueDecimalCodesCharacterValueDecimalCodesCharacter Value000(NUL)032SP064@096♦001(SOH)033!065A097002(STX)034"066B098HT003(ETX)035#067C099FF004(EOT)036$068D100CR005(ENQ...

  • Page 885

    MARRCRLRF04071E REV BD. CHARACTER CODESTable D–4.Graphics Character Codes (Cont’d)DecimalCodesCharacterValueDecimalCodesCharacterValueDecimalCodesCharacterValueDecimalCodesCharacter Value021(NAK)0535085U117022(SYN)0546086V118023(ETB)0557087W119024(CAN)0568088X120|025(EM)0579089Y121≤026(SUB)...

  • Page 886

    D. CHARACTER CODESMARRCRLRF04071E REV BTable D–5.Teach Pendant Input Codes (Cont’d)CodeValueCodeValue856188+X957189+Y128PREV190+Z129F1191+X rotation131F2192+Y rotation132F3193+Z rotation133F4194-X134F5195-Y135NEXT196-Z143SELECT197-X rotation144MENUS198-Y rotation145EDIT199-Z rotation146DATA21...

  • Page 887

    MARRCRLRF04071E REV BD. CHARACTER CODESTable D–6.European Character Codes (Cont’d)CodeValueCodeValueCodeValue198AE219U^240199CC220U:241n~200E‘221Y:242o‘201E‘222243o‘202E^223Bb244o^203E:224a‘245o~204I‘225a‘246o:205I‘226a^247oe206I^227a~248207I:228a:249u‘208229ao250u‘209N~23...

  • Page 888

    D. CHARACTER CODESMARRCRLRF04071E REV BTable D–7.Graphics CharactersDecimal ValueASCII CharacterGraphic Character97asolid box102fdiamond103gplus/minus106jlower-right box corner107kupper-right box corner108lupper-left box corner109mlower-left box corner110nintersection lines111opixel row 1 horiz...

  • Page 889

    Appendix ESYNTAX DIAGRAMSContents 889,Appendix 889,E 889,SYNTAX 889,DIAGRAMS................................................................................................. 889,E–1E–1

  • Page 890

    E. SYNTAX DIAGRAMSMARRCRLRF04071E REV BKAREL syntax diagrams use the following symbols:RectangleA rectangle encloses elements that are defined in another syntax diagram or inaccompanying text.OvalAn oval encloses KAREL reserved words that are entered exactly as shown.CircleA circle encloses speci...

  • Page 891

    MARRCRLRF04071E REV BE. SYNTAX DIAGRAMSFigure E–1.PROGRAMidentifierVAR declarationCONST declarationdirective list^ROUTINE definitionTYPE declarationBEGINstatementENDidentifierprogram bodyprogram nameROUTINE declarationline-end^-- 0 or more line-ends--newlineline-end;PROGRAM– –module definit...

  • Page 892

    E. SYNTAX DIAGRAMSMARRCRLRF04071E REV BFigure E–2.directive listdirective^directive%COMMENT=quotedstring%ALPHABETIZE%CRTDEVICE=(integer)constant%DEFGROUP%ENVIRONMENTidentifier=(integer)constant%LOCKGROUP,^=%NOABORT+ERRORCOMMAND%NOBUSYLAMP=%NOPAUSE+ERRORCOMMAND+TPENABLE%NOLOCKGROUP%NOPAUSESHFT=%...

  • Page 893

    MARRCRLRF04071E REV BE. SYNTAX DIAGRAMSFigure E–3.–^+CONST --constant declarationCONSTidentifier=constantconstantidentifierliteral^constant nameconstant namevalueTYPE -- type declarationTYPE^identifierFROMprogram nameidentifiertype name=user type^E–5

  • Page 894

    E. SYNTAX DIAGRAMSMARRCRLRF04071E REV BFigure E–4.user typedata typeSTRUCTUREfield listENDSTRUCTURE^field listidentifierfield name:structure array typedata typestructure arraytypeSHORTBYTEE–6

  • Page 895

    MARRCRLRF04071E REV BE. SYNTAX DIAGRAMSFigure E–5.data typeINTEGERREALBOOLEANVECTORVIS_PROCESSMODELCAM_SETUPFILECONFIGPATHCOMMON_ASSOCidentifiertype namesystem identifiersystem type namePATH HEADER=identifierstructure type name^NODE DATA=identifierstructure type name^,E–7

  • Page 896

    E. SYNTAX DIAGRAMSMARRCRLRF04071E REV BFigure E–6.data type continuedSTRINGposition typeINGROUP(integer)constant[](integer)constant[]ARRAYOFstructure arraytype,(integer)constant[]string sizeE–8

  • Page 897

    MARRCRLRF04071E REV BE. SYNTAX DIAGRAMSFigure E–7.position typeJOINTPOS1JOINTPOS2JOINTPOS3JOINTPOS4JOINTPOS5JOINTPOS6JOINTPOSXYZWPREXTPOSITIONXYZWPRJOINTPOS7JOINTPOS8JOINTPOS9GROUP_ASSOCE–9

  • Page 898

    E. SYNTAX DIAGRAMSMARRCRLRF04071E REV BFigure E–8.ROUTINE -- routine declarationROUTINEidentifierroutine nameidentifierparameter name(parametertype:):return datatype^FROMidentifierprogram nameVAR declarationlocal variablesCONST declarationlocal constantsBEGINstatementlistroutine bodyENDidentifi...

  • Page 899

    MARRCRLRF04071E REV BE. SYNTAX DIAGRAMSFigure E–9.return data typeINTEGERREALBOOLEANVECTORCONFIGCOMMON_ASSOCidentifiertype namesystem identifiersystem type nameIN(integer)position typeGROUPconstant[]STRING[]ARRAYstructure arraytype*,OFE–11

  • Page 900

    E. SYNTAX DIAGRAMSMARRCRLRF04071E REV BFigure E–10.parameter typeINTEGERREALBOOLEANVECTORVIS_PROCESSMODELCAM_SETUPFILECONFIGPATHCOMMON_ASSOCidentifiertype namesystem identifiersystem type name=identifierstructure type name^=identifierstructure type name^,PATHHEADERNODEDATAE–12

  • Page 901

    MARRCRLRF04071E REV BE. SYNTAX DIAGRAMSFigure E–11.parameter type continuedSTRINGposition typeINGROUP(integer)constant[]ARRAYOFstructure arraytype[]*,E–13

  • Page 902

    E. SYNTAX DIAGRAMSMARRCRLRF04071E REV BFigure E–12.statement listABORT statementassignment statementATTACH statementcall statement routineCANCEL statementCANCEL FILE statementCLOSE FILE statementCLOSE HAND statementCONDITION statementCONNECT TIMER statementDELAY statementDISABLE statementDISC...

  • Page 903

    MARRCRLRF04071E REV BE. SYNTAX DIAGRAMSFigure E–13.(integer)expression[]variableaccessATTACHABORTPROGRAMtask number=expressionATTACH –- statementCALL –- routineidentifier(expressionassignmemnt –- statementABORT –- statement),^routine nameactual parameterCANCEL –- statementCANCELGROUP(...

  • Page 904

    E. SYNTAX DIAGRAMSMARRCRLRF04071E REV BFigure E–14.^(integer)expression[]WITHCONDITIONcondition handler-numberCONDITION statementANDCONNECT TIMER –- statementCONNECTTIMER(integer)identifierclock variableDELAY –- statementDELAY(integer)expressiontime spec (ms)DISABLE –- statementDISABLECON...

  • Page 905

    MARRCRLRF04071E REV BE. SYNTAX DIAGRAMSFigure E–15.GOTODISCONNECT TIMER –- statementDISCONNECTTIMER(integer)identifierclock variableENABLE –- statementENABLECONDITION(integer)expressioncondition handler-number[]FOR –- statementFOR(integer)identifiercount variable=^TODOWNTO(integer)express...

  • Page 906

    E. SYNTAX DIAGRAMSMARRCRLRF04071E REV BFigure E–16.MOVE –- statementWITHsystemidentifiersystem var nameMOVEABOUT(vector)expression=^BY(integer)contstant],[expressionvalue.systemidentifierfield name(real)expressionangle specAWAY(real)expressiondistance specAXIS(integer)expressionaxis numberBY(...

  • Page 907

    MARRCRLRF04071E REV BE. SYNTAX DIAGRAMSFigure E–17.OPEN FILE –- statementOPENFILE(string)expressionusage specOPEN HAND –- statement(integer)identifierhand specPULSE –- statementPURGE –- statementPURGECONDITION(integer)expression[(,^(string)expressionfile specvariableaccessfile variableO...

  • Page 908

    E. SYNTAX DIAGRAMSMARRCRLRF04071E REV BFigure E–18.READ –- statementREADreaditemread item –- statementRELAX –- statementRELEASE –- statementRELEASE)variableaccessfile variableCR(integer)hand specRELAXHAND(,^variableaccess::(integer)expression1st format spec::(integer)expression2nd forma...

  • Page 909

    MARRCRLRF04071E REV BE. SYNTAX DIAGRAMSFigure E–19.USINGUSING –- statementSIGNAL –- statementSIGNALEVENT(integer)expression](integer)expressionSELECT –- statementSELECT(integer)constantcase valueUNHOLD –- statementvariablestructurevariableaccess,^DOstatementlistENDUSING[RETURN –- stat...

  • Page 910

    E. SYNTAX DIAGRAMSMARRCRLRF04071E REV BFigure E–20.WRITEWRITE –- statementwrite itemCRWHILE –- statementWHILE(boolean)expressionvariablefile variableaccess^WAIT –- statementWAITFORglobalconditionANDORstatementlistloop body^DOENDWHILE(writeitem),expression::(integer)1st formatspecexpressio...

  • Page 911

    MARRCRLRF04071E REV BE. SYNTAX DIAGRAMSFigure E–21.global conditionglobalcondition*(^ERROREVENT)[(integer)error/event/sema-phore numberexpression]* only allowed on error conditionSEMAPHOREABORTPAUSEPROGRAM(integer)task numberexpression[]CONTINUEPOWERUPvariableaccess<>=<<=>>=va...

  • Page 912

    E. SYNTAX DIAGRAMSMARRCRLRF04071E REV BFigure E–22.condition handler actionHOLDUNHOLDRESUMESTOPNOABORTNOPAUSEUNPAUSENOMESSAGECANCELRESTORESIGNALENABLEDISABLEGROUP(integer)contstant],[CONDITION(integer)condition handler num-berexpression[]EVENTSEMAPHORE(integer)event/semaphore num-berexpression[...

  • Page 913

    MARRCRLRF04071E REV BE. SYNTAX DIAGRAMSFigure E–23.condition handler action continuedport variable nameidentifierport index(integer)expression[]variableaccessEVAL()^constant^variableaccess==^port variable nameidentifierport index(integer)expression[]ABORTCONTINUEPAUSE(integer)expression[]PROGRA...

  • Page 914

    E. SYNTAX DIAGRAMSMARRCRLRF04071E REV BFigure E–24.local condition handler clauselocalconditionDO,^WHEN^^actionENDMOVEANDOR,localconditionTHENUNTIL^^ANDOR,^action^local conditionNODE^AT(localcondition^)[(integer or *)expression]NODETIME[(integer)expression]time specBEFOREAFTER(integer)expressio...

  • Page 915

    MARRCRLRF04071E REV BE. SYNTAX DIAGRAMSFigure E–25.variable accessidentifiervar/port/field/param namesystem identifiersystem var or field name]variable access.identifierfield namesystem identifierfield namevariable access[(integer)array indexexpression,. .variable access[(integer)start node ind...

  • Page 916

    E. SYNTAX DIAGRAMSMARRCRLRF04071E REV BFigure E–26.productsum+–+–OR^^factorproduct/^*ANDDIVMODprimaryfactor@^:#NOT^E–28

  • Page 917

    MARRCRLRF04071E REV BE. SYNTAX DIAGRAMSFigure E–27.primarycharacterliteralvariable accessconstant)identifier(actual parameterexpressionfunction name(^expression),^’’unsignednumericvalueE–29

  • Page 918

  • Page 919

    MARRCRLRF04071E REV BGlossaryGlossaryAabortAbnormal termination of a computer program caused by hardware or software malfunction oroperator cancellation.absolute pulse code systemA positional information system for servomotors that relies on battery-backed RAM to store encoderpulse counts when th...

  • Page 920

    GlossaryMARRCRLRF04071E REV BAMPSAmperage amount.analogThe representation of numerical quantities by measurable quantities such as length, voltage orresistance. Also refers to analog type I/O blocks and distinguishes them from discrete I/O blocks.Numerical data that can vary continuously, for exa...

  • Page 921

    MARRCRLRF04071E REV BGlossaryaxis1. A straight line about which a robot joint rotates or moves. 2. One of the reference lines or acoordinate system. 3. A single joint on the robot arm.BbackplaneA group of connectors mounted at the back of a controller rack to which printed circuit boards aremated...

  • Page 922

    GlossaryMARRCRLRF04071E REV BBus Switching ModuleA device that switches a block cluster to one bus or the other of a dual bus.byteA sequence of binary digits that can be used to store a value from 0 to 255 and usually operated uponas a unit. Consists of eight bits used to store two numeric or one...

  • Page 923

    MARRCRLRF04071E REV BGlossaryC-MOS RAMComplementary metal-oxide semiconductor random-access memory. A read/write memory inwhich the basic memory cell is a pair of MOS (metal-oxide semiconductor) transistors. It is animplementation of S-RAM that has very low power consumption, but might be less de...

  • Page 924

    GlossaryMARRCRLRF04071E REV BcontrollerA hardware unit that contains the power supply, operator controls, control circuitry, and memorythat directs the operation and motion of the robot and communications with external devices. Seecontrol unit.control, open-loopAn operation where the computer app...

  • Page 925

    MARRCRLRF04071E REV BGlossarycylindricalType of work envelope that has two linear major axes and one rotational major axis. Robotic devicethat has a predominantly cylindrical work envelope due to its design. Typically has fewer than 6 jointsand typically has only 1 linear axis.DD/A converterA dig...

  • Page 926

    GlossaryMARRCRLRF04071E REV BdefaultThe value, display, function or program automatically selected if you have not specified a choice.deviationUsually, the absolute difference between a number and the mean of a set of numbers, or betweena forecast value and the actual data.deviceAny type of contr...

  • Page 927

    MARRCRLRF04071E REV BGlossaryDRAMDynamic Random Access Memory. A read/write memory in which the basic memory cell is acapacitor. DRAM (or D-RAM) tends to have a higher density than SRAM (or S-RAM). Due to thesupport circuitry required, and power consumption needs, it is generally impractical to u...

  • Page 928

    GlossaryMARRCRLRF04071E REV BEPROMErasable Programmable Read Only Memory. Semiconductor memory that can be erased andreprogrammed. A non-volatile storage memory.errorThe difference in value between actual response and desired response in the performance of acontrolled machine, system or process. ...

  • Page 929

    MARRCRLRF04071E REV BGlossaryfield devicesUser-supplied devices that provide information to the PLC (inputs: push buttons, limit switches, relaycontacts, an so forth) or perform PLC tasks (outputs: motor starters, solenoids, indicator lights, andso forth.)file1. An organized collection of records...

  • Page 930

    GlossaryMARRCRLRF04071E REV BGenius I/O busThe serial bus that provides communications between blocks, controllers, and other devices in thesystem especially with respect to GE FANUC Genius I/O.gripperThe "hand" of a robot that picks up, holds and releases the part or object being handl...

  • Page 931

    MARRCRLRF04071E REV BGlossaryhttp.Hypertext transfer protocol. The protocol used to transfer HTML files between web servers.IimpedanceA measure of the total opposition to current flow in an electrical circuit.incremental encoder systemA positional information system for servomotors that requires ...

  • Page 932

    GlossaryMARRCRLRF04071E REV Binput processing timeThe time required for input data to reach the microprocessor.input/outputInformation or signals transferred between devices, discreet electrical signals for external control.input/output controlA technique for controlling capacity where the actual...

  • Page 933

    MARRCRLRF04071E REV BGlossaryI/O electrical isolationA method of separating field wiring from logic level circuitry. This is typically done through opticalisolation devices.I/O moduleA printed circuit assembly that is the interface between user devices and the Series Six PLC.I/O scanA method by w...

  • Page 934

    GlossaryMARRCRLRF04071E REV BJOINTA motion type in which the robot moves the appropriate combination of axes independently to reach apoint most efficiently. (Point to point, non-linear motion).joint interpolated motionA method of coordinating the movement of the joints so all joints arrive at the...

  • Page 935

    MARRCRLRF04071E REV BGlossarylimit switchA switch that is actuated by some part or motion of a machine or equipment to alter the electricalcircuit associated with it. It can be used for position detection.linearA motion type in which the appropriate combination of axes move in order to move the r...

  • Page 936

    GlossaryMARRCRLRF04071E REV Bmachine lockA test run option that allows the operator to run a program without having the robot move.macroA source language instruction from which many machine-language instructions can be generated.magnetic diskA metal or plastic floppy disk (not supported on versio...

  • Page 937

    MARRCRLRF04071E REV BGlossarymicrosecondOne millionth (0.000001) of a secondmilliampereOne one-thousandth of an ampere. Abbreviated mA.millisecondOne thousandth of a second. Abbreviated msec.moduleA distinct and identifiable unit of computer program for such purposes as compiling, loading, andlin...

  • Page 938

    GlossaryMARRCRLRF04071E REV Boff-line programmingThe development of programs on a computer system that is independent of the "on-board" control ofthe robot. The resulting programs can be copied into the robot controller memory.offsetThe count value output from a A/D converter resulting ...

  • Page 939

    MARRCRLRF04071E REV BGlossaryOTSee overtravel.outputInformation that is transferred from the CPU for control of external devices or processes.output deviceA device, such as starter motors, solenoids, that receive data from the programmable controller.output moduleAn I/O module that converts logic...

  • Page 940

    GlossaryMARRCRLRF04071E REV BPCBSee printed circuit board.PC InterfaceThe PC Interface software uses Ethernet connections to provide file transfer protocol (FTP) functions,PC send macros, telnet interface, TCP/IP interface web server functions, and host communications.pendantSee teach pendant.PLC...

  • Page 941

    MARRCRLRF04071E REV BGlossaryprotocolA set of hardware and software interfaces in a terminal or computer that allows it to transmit over acommunications network, and that collectively forms a communications language.psiPounds per square inch.Qqueue.1. Waiting lines resulting from temporary delays...

  • Page 942

    GlossaryMARRCRLRF04071E REV BrecordTo store the current set or sets of information on a storage device.recoveryThe restoration of normal processing after a hardware or software malfunction through detailedprocedures for file backup, file restoration, and transaction logging.register1. A special s...

  • Page 943

    MARRCRLRF04071E REV BGlossaryroutine1. A list of coded instructions in a program. 2. A series of computer instructions that performs aspecific task and can be executed as often as needed during program execution.Ssaving data.Storing program data in Flash ROM, to a floppy disk (not supported on ve...

  • Page 944

    GlossaryMARRCRLRF04071E REV Bslip sheetA sheet of material placed between certain layers of a unit load. Also known as tier sheet.SOSystem output.specific gravityThe ratio of a mass of solid or liquid to the mass of an equal volume of water at 45C. You must knowthe specific gravity of the dispens...

  • Page 945

    MARRCRLRF04071E REV BGlossaryteachingGenerating and storing a series of positional data points effected by moving the robot arm througha path of intended motions.teach mode1. The mode of operation in which a robot is instructed in its motions, usually by guiding it throughthese motions using a te...

  • Page 946

    GlossaryMARRCRLRF04071E REV BURLUniversal Resource Locator. A standard addressing scheme used to locate or reference files onweb servers.USB memory stickThe controller USB memory stick interface supports a USB 1.1 interface. The USB Organizationspecifies standards for USB 1.1 and 2.0. Most memory...

  • Page 947

    MARRCRLRF04071E REV BGlossaryby limiting devices. The maximum distance the robot can travel after the limit device is actuated isconsidered the basis for defining the restricted work envelope.writeTo deliver data to a medium such as storage.E–58

x