KUKA Link Robot Program

Publisher:范隆Latest update time:2023-03-02 Source: 机器人及PLC自动化应用Author: Lemontree Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Subroutines can be used to modularize programs, making them more efficient in terms of structure. The goal is not to put all instructions into one program, but to transfer specific flows, calculations, or processes into separate programs.

A number of advantages arise from the use of subroutines:

 As the program length is shortened, the main program structure is clearer and easier to read.

 Subroutines can be developed independently: time consumption can be shared, minimizing sources of errors.

 Subroutines can be applied repeatedly.

In principle, there are two different types of subroutines:

 Global subroutine

A global subroutine is an independent robot program that can be called from another robot program. Programs can be branched according to specific requirements, i.e. a program can be used as a main program in one application and as a subroutine in another.

Local Subroutines

A local subroutine is a program integrated into a main program, that is, the instructions are contained in the same SRC file. The point coordinates of the subroutine are stored in the same DAT file.

Each program starts with a DEF line and ends with an END line. If you call a subroutine from the main program, the subroutine will normally run from DEF to END. After reaching the END line, the program pointer jumps back to the program that issued the calling instruction (the main program).

In order to exit the subroutine early (that is, before the END line), you can program a RETURN instruction in the subroutine. When the program reads this line, the subroutine will be terminated early.

Steps to call a subroutine:

To be able to program a subroutine call, the "Expert" user group must have been selected. The syntax for a subroutine call is: Name ( )

1. Select Configuration > User Group from the main menu. The current user groups will be displayed.

2. If you want to switch to another user group: Press Login…. Select the user group Expert.

3. Enter the password kuka and confirm with Login.

4. Use Open to load the desired main program into the editor.

INI

PTP HOME Vel= 100% DEFAULT

PTP HOME Vel= 100% DEFAULT

5. Position the cursor in the desired row.

6. Enter the subroutine name and brackets, for example: myprog ( ).

INI

PTP HOME Vel= 100% DEFAULT

myprog()

PTP HOME Vel= 100% DEFAULT

7. Close the editor with the close icon and save the changes.

A KRL file contains up to 255 local subroutines.

The maximum nesting depth of subroutines is 20

The local subroutine is located after the main program and is distinguished by DEF and END.

Local subroutines can be called repeatedly

The point coordinates are saved in the corresponding DAT list and can be called by all files

When the local subroutine is executed, the program jumps back to the next instruction after the calling subroutine

A subroutine is a program that is linked from the main program. After processing the subroutine, the main program continues running on the line immediately following the subroutine call.

 Local subroutines are contained in the same SRC file as the main program. They can be defined as global using the keyword GLOBAL.

 A global subroutine is a program that is linked from another program and contains its own SRC file.

To call a subroutine, give it a name in the main program followed by parentheses.

In the following example, the subroutine my_subprog is called:

my_subprogram()

Calling Function

A function is a subroutine that returns a value to the main program. A function has a data type.

The call of a function is similar to that of a subroutine: The name of the function is specified in the main program, enclosed in parentheses. However, a function call can never exist on its own, but must always be assigned a value to a variable of the same data type.

Example called from the main program:

REALVAR = REALFUNCON()

INTVAR = 5 * INTFUNCTION() + 1

The use of subroutines can make the main program structured, and the structuring of the program makes the program clearly structured.

A subroutine cannot call itself.

Reviewing Editor: Li Qian

Reference address:KUKA Link Robot Program

Previous article:Gluing equipment principle and KUKA robot control analysis + MAKRO
Next article:Vision Smart Manufacturing won the Photovoltaic Industry Light Energy Cup Most Influential "Smart Manufacturing" Enterprise Award

Latest robot Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号