Introduction to KUKA-DECL variables and protocols

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



To declare an array or a constant array in a data list with simultaneous initialization:

Declaration and initialization on one line is not allowed. However, initialization must be done directly on the line with the declaration. No lines in between are allowed, nor are empty lines.

If you want to initialize multiple elements of an array, you must specify the elements in ascending array subscript order, starting with the array subscript on the right.

If all array elements of a CHAR type array hold the same string, you do not have to initialize each array element individually. The right-hand side of the array subscript is ignored. (For a one-dimensional array subscript, the subscript is not written.)

Declare the array in the data list and initialize it at the same time:

Data type name [Dimension1 <,..., Dimension3> ]

name[1 <, 1, 1> ] = value 1

] = value2>

...

Name[Dimension1 <, Dimension2, Dimension3> ] = Value N

Declare a constant array in a data list and initialize it at the same time:

DECL CONST data type name [Dimension1 <,..., Dimension3> ]

name[1 <, 1, 1> ] = value 1

] = value2>

...

Name[Dimension1 <, Dimension2, Dimension3> ] = Value N

element illustrate
DECL When the data type is a predefined data type, DECL can be omitted. When the data type is a user-defined data type, DECL is required.
GLOBAL (>>> 11.4.4 "Scope of Application" Page 326)
CONST The keyword CONST is only allowed in data lists.
Data Types Description of the required data type
name The name of the declared object (variable, array, or constant)
Dimensionality Type: INT
Dimension determines the number of array elements for the corresponding dimension. An array must have at least 1 and at most
3 dimensions.
value The data type of the value must be compatible with the data type, but it does not need to be the same. When the data types are compatible, the system automatically adjusts the types.

Example 1: Declaration with predefined data types. The keyword DECL can also be omitted.

DECL INT X DECL INT X1, X2 DECL REAL ARRAY_A[7], ARRAY_B[5], A

Example 2

Declare an array with simultaneous initialization (only possible in data lists).

INT A[7] A[1]=27
A[2]=313 A[6]=11 CHAR XT1[80] TEXT1[]="message" CHAR TEXT2[2,80] TEXT2[1,]="fit message" TEXT2[2,]="second message"

Naming conventions

The maximum length allowed for names in the KRL is 24 characters.

Names in the KRL are allowed to contain letters (A - Z), numbers (0 - 9), and the special characters "_" and "$".

Names in the KRL are not allowed to start with a number.

Names in KRL are not allowed to be keywords.

Upper and lower case does not matter.

Double declaration of variables

Double declarations always occur when the same variable name (string) is used.

If the same name is used in different *.SRC or *.DAT files, it is not a double declaration.

Double declaration in the same *.SRC and *.DAT file is not allowed and will generate an error message.

Dual declaration in *.SRC or *.DAT file and $CONFIG.DAT is allowed in the following cases:

When the program in which the variable is declared ends, only the value on the local machine is changed, not the value in $CONFIG.DAT.

When a "foreign" program ends, it has access only to the values ​​in $CONFIG.DAT and can only change those values.

Data types in KRL

Predefined standard data types

BOOL: Classic "yes"/"no" result

REAL: Real number, calculation result to avoid rounding errors

INT: Integer, classic counting variable for counting loops or piece counters

CHAR: Only one character





Review editor: Liu Qing

Reference address:Introduction to KUKA-DECL variables and protocols

Previous article:DesignCon Interpretation I The robot dog "Benben" in "The Wandering Earth 2" has become a reality
Next article:How to use the docking quick-change coupling of DOCK Profinet

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号