KUKA User Defined Messages
KUKA User Defined Messages
Structure of a message
Structure of a message
Item Description
1 Message type
2 Time at which the message was generated
3 Originator of the message
Note: To differentiate them from system messages, the originator of user-defined messages is
displayed in angle brackets <>.
4 Message number
5 Button for confirming, acknowledging and/or clearing the message
6 Message text
Message types
There are 5 message types available. Each type of message has a specific symbol assigned to it.
No predefined reactions of the robot are linked to the different message types. The desired reactions must be
programmed.
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductCa… 1/37
09.06.22 11:26 Programming user-defined messages
Symbol Type
Notification message
Notification messages are suitable for displaying general information.
Notification messages are not managed in the message buffer and can only be cleared using the
buttons OK and Confirm all.
Acknowledgement message
Acknowledgement messages are suitable for displaying information of which the user must be
made aware.
Acknowledgement messages can be cleared (acknowledged) using the buttons OK and Confirm
all. In the case of an acknowledgement message (unlike a notification message), it is possible to
check whether or not the user has acknowledged it. It is possible, for example, to stop the
program until the message has been acknowledged.
Wait message
Wait messages indicate a state for which the system is waiting.
They can be cleared by means of a function from the program.
The user can also clear the message using the Simulate button.
Status message
Status messages are suitable for indicating a change of status (e.g. variable X changes from
TRUE to FALSE).
They are cleared by means of a function from the program. The message is then cleared when
the status that triggered it is no longer applicable.
Dialog message
Dialog messages are suitable for displaying questions that must be answered by the user.
Dialog messages can be cleared using a button that can be labeled by the programmer. Up to 7
buttons can be defined. How program execution continues can be made dependent on which
button the user selects.
A dialog message can only be generated if no other dialog message is active.
Parameters in messages
Up to 3 parameters can be displayed in a message. The parameters are displayed instead of the placeholders in
the message text and can have the following forms:
Text as directly transferred string
CHAR, INT, REAL or BOOL variable
Text from a KXR file (e.g. for language-specific messages) (>>> Programming language-specific messages)
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductCa… 2/37
09.06.22 11:26 Programming user-defined messages
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductCa… 3/37
09.06.22 11:26 Programming user-defined messages
Element Description
Text[] Type: CHAR
Mandatory parameter
Type of transfer: IN parameter
Message text
Notes:
Maximum 80 characters
Permissible characters: letters, numbers, underscores
The text must not consist of blanks.
The text can contain %1 as a placeholder.
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductCa… 4/37
09.06.22 11:26 Programming user-defined messages
Element Description
MsgOpt Type: KrlMsgOpt_T
Optional parameter
Type of transfer: IN parameter
MsgOpt = { vl_stop TRUE|FALSE, clear_p_reset TRUE|FALSE, log_to_DB
TRUE|FALSE }
Variable with the following options for the effect of the message of the robot system:
vl_stop, type: BOOL
TRUE: message triggers an advance run stop.
FALSE: message does not trigger an advance run stop.
Default: TRUE
clear_p_reset, type: BOOL
Note: Has no function in the case of notification messages
Default: TRUE
log_to_DB, type: BOOL
TRUE: message is logged.
FALSE: message is not logged.
Default: FALSE
Example 1
In the following example, a notification message is generated with a text only.
Example 2
In the following example, a notification message is generated with a text inserted via the placeholder %1,
specification of the originator and a defined message number.
Notification message
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductCa… 5/37
09.06.22 11:26 Programming user-defined messages
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductCa… 6/37
09.06.22 11:26 Programming user-defined messages
Element Description
Text[] Type: CHAR
Mandatory parameter
Type of transfer: IN parameter
Message text
Notes:
Maximum 80 characters
Permissible characters: letters, numbers, underscores.
The text must not consist of blanks.
The text can contain %1 and %2as placeholders.
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductCa… 7/37
09.06.22 11:26 Programming user-defined messages
Element Description
MsgOpt Type: KrlMsgOpt_T
Optional parameter
Type of transfer: IN parameter
MsgOpt = { vl_stop TRUE|FALSE, clear_p_reset TRUE|FALSE, log_to_DB
TRUE|FALSE }
Variable with the following options for the effect of the message:
vl_stop, type: BOOL
TRUE: message triggers an advance run stop.
FALSE: message does not trigger an advance run stop.
Default: TRUE
clear_p_reset, type: BOOL
Note: Has no function in the case of notification messages
Default: TRUE
log_to_DB, type: BOOL
TRUE: message is logged.
FALSE: message is not logged.
Default: FALSE
Example 1
In the following example, a notification message is generated with 2 CHAR parameters and a defined message
number.
The text fragments Task 4 and is finished are transferred as CHAR parameters and output for the placeholders
%1 and %2.
Notification message
Example 2
In this example, the same notification message as in example 1 is implemented with 1 INT and 1 CHAR parameter.
The numerical value 4 is transferred as an INT parameter and output for the placeholder %1.
The word finished is transferred as a CHAR parameter and output for the placeholder %2.
Notification message
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductCa… 8/37
09.06.22 11:26 Programming user-defined messages
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductCa… 9/37
09.06.22 11:26 Programming user-defined messages
Element Description
Text[] Type: CHAR
Mandatory parameter
Type of transfer: IN parameter
Message text
Notes:
Maximum 80 characters
Permissible characters: letters, numbers, underscores
The text must not consist of blanks.
The message text can contain “%1” as a placeholder.
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 10/37
09.06.22 11:26 Programming user-defined messages
Element Description
MsgOpt Type: KrlMsgOpt_T
Optional parameter
Type of transfer: IN parameter
MsgOpt = { vl_stop TRUE|FALSE, clear_p_reset TRUE|FALSE, log_to_DB
TRUE|FALSE }
Variable with the following options for the effect of the message of the robot system:
vl_stop, type: BOOL
TRUE: message triggers an advance run stop.
FALSE: message does not trigger an advance run stop.
Default: TRUE
clear_p_reset, type: BOOL
TRUE: the message is cleared when the program is deselected or reset.
FALSE: the message is still displayed when the program is deselected or reset.
Default: TRUE
log_to_DB, type: BOOL
TRUE: message is logged.
FALSE: message is not logged.
Default: FALSE
Example 1
In the following example, an acknowledgement message is generated with a message number and specification
of the originator. When the program is deselected or reset, the message is to be cleared if it has not yet been
acknowledged. The message is additionally to be logged.
KrlMsgOpt_T MsgOpt
MsgQuit("Check tool.", "MyTech",,, 231, {vl_stop TRUE, clear_p_reset TRUE, log_to_DB
TRUE})
Acknowledgement message
Example 2
Example of an acknowledgement message in which a variable of type INT is output by means of the placeholder
%1.
INT myInt
myInt = 123
MsgQuit("This is quit message %1.", "MyMod", myInt)
Acknowledgement message
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 11/37
09.06.22 11:26 Programming user-defined messages
Example
In the following example, a status message is generated with the text This is a loop message. The message is
cleared after 60 seconds.
Status message
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 12/37
09.06.22 11:26 Programming user-defined messages
Element Description
nAnswer Type: INT
Mandatory parameter
Type of transfer: OUT parameter
Return value of the method. Saves which button was pressed by the user.
sText[] Mandatory parameter
Type: CHAR
Type of transfer: IN parameter
Message text
Notes:
Maximum 80 characters
Permissible characters: letters, numbers, underscores.
The text must not consist of blanks.
The text can contain %1 as a placeholder.
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 13/37
09.06.22 11:26 Programming user-defined messages
Element Description
nMsgNr Type: INT
Optional parameter
Type of transfer: IN parameter
Message number
Notes:
If no message number has been assigned, the message number 1 is displayed by default.
Message number must be > 0.
Example 1
In the following example, a dialog message is generated with 2 buttons, specification of the originator and a
defined message number. The return value is assigned to the variable DialogAnswer.
INT nAnswer
nAnswer = 0
MsgDialog(nAnswer, "Continue?","MyTech", , "yes", "no", , , , , , , 7)
Dialog message
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 14/37
09.06.22 11:26 Programming user-defined messages
Example 2
In the following example, a dialog message is generated with 5 buttons, 1 CHAR placeholder, specification of the
originator and a defined message number.
INT nAnswer
nAnswer = 0
MsgDialog(nAnswer, "Please select a %1 mode:", "MyTech", "welding", "5", "4", "3", "2",
"1", , , , 12345)
Dialog message
Overview
The procedure for programming a message is generally as follows:
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 15/37
09.06.22 11:26 Programming user-defined messages
Element Description
name Type: KrlMsg_T
Name of the variable for the message
originator Type: CHAR
Originator of the message
Note: The originator must not consist of blanks.
Maximum 24 characters
Number Type: INT
Message number
Notes:
Message number must be > 0.
Message numbers may be used more than once.
KrlMsg_T
STRUC KrlMsg_T CHAR modul[24], INT nr, CHAR msg_txt[80]
Example
In this example, the originator mymodule, the message number 57 and the message text This is my message.
are defined for a message with the name mymessage.
Defining parameters
Description
To display the content of parameters, a maximum of 3 placeholders, %1, %2 and %3, can be integrated into the
message text. The file type and content of the parameters must be defined in advance.
When the message is generated, all 3 parameters must always be transferred, even if the parameters
are not used. Accordingly, each of the 3 parameters must either be assigned a value or defined as empty.
A text or string (CHAR parameter), a numerical value (INT or REAL parameter) or a Boolean value (BOOL
parameter) can be generated for the placeholders.
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 16/37
09.06.22 11:26 Programming user-defined messages
Syntax
param[n] = {par_type type , par_txt[] " text " | par_int int | par_real real | par_bool
bool }
Explanation of the syntax
Element Description
param[n] Type: KrlMsgPar_T
Array for the 3 possible parameters
Array index[n]:
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 17/37
09.06.22 11:26 Programming user-defined messages
If the component par_type is initialized with #KEY, the component par_txt[] is not initialized, but one of the
remaining components is initialized (par_int, par_real, par_bool), this results in an error message.
If the component par_type is initialized with #VALUE or #KEY, and if more than one of the remaining
components (par_txt[], par_int, par_real, par_bool) is initialized, the first initialized component is always
deemed to be valid. (Order: par_txt[], par_int, par_real, par_bool)
Example: par[1]={par_type #value, par_int 7, par_bool true} : The value of the parameter is
7.
KrlMsgPar_T
STRUC KrlMsgPar_T KrlMsgParType_T par_type, CHAR par_txt[26], INT par_int, REAL
par_real, BOOL par_bool
Par_int int, par_real real and par_bool bool enable the programmer to use an INT, REAL or BOOL
value as a parameter without first having to convert the value to a string. Conversion is carried out
automatically. Par_Bool is converted to the string TRUE or FALSE.
KrlMsgParType_T
ENUM KrlMsgParType_T value, key, empty
Example 1
In this example, a text is assigned to the parameter for %1 and an INT value is assigned to the parameter for %2.
The 3rd parameter is defined as empty.
Line Description
1 Declaration of the parameter array
2 Declaration of an INT variable, the value of which is to be transferred
4 Initialization of the INT variable
6 The parameter for placeholder %1 is assigned the text gripper .
7 ... 8 The parameter for placeholder %2 is assigned the value of the INT variable part_number .
9 Placeholder %3 is not used; the parameter remains empty.
Example 2
In this example, the value of analog output $ANOUT[5] is displayed for placeholder %1.
Description
Up to 7 buttons can be displayed in dialog messages. The buttons must be declared and initialized.
Syntax
softkey[n] = {sk_type keytype , sk_txt[] " keyname "}
Explanation of the syntax
Element Description
softkey[n] Type: KrlMsgDlgSK_T
Name of the variable for the buttons
KrlMsgDlgSK_T
STRUC KrlMsgDlgSK_T KrlMsgParType_T sk_type, CHAR sk_txt[10]
Example
Example for labeling 2 buttons with the words yes and no.
Dialog message
KrlMsgOpt_T
STRUC KrlMsgOpt_T BOOL vl_stop, BOOL clear_p_reset, BOOL clear_p_SAW, BOOL
log_to_DB
Example
In this example, the response of the message is defined as follows:
The message is to trigger an advance run stop.
On resetting or deselecting the program, all status, acknowledgement and wait messages generated with the
variable “opt” are to be cleared.
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 20/37
09.06.22 11:26 Programming user-defined messages
In the case of a block selection, the messages generated with the variable “opt” are not to be cleared.
The message is to be logged.
Exceptions:
EKrlMsgType
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 21/37
09.06.22 11:26 Programming user-defined messages
Example
In the following example, an acknowledgement message is generated.
Example
In the following example, a dialog message is generated.
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 22/37
09.06.22 11:26 Programming user-defined messages
Example
A message is generated and cleared again later in the program sequence.
Example
DECL INT handle
DECL BOOL result
...
handle = SetKrlMsg(Type, MyMessage, Parameter[], Options)
...
result = Exists_KrlMsg(handle)
Example
DECL INT handle
DECL BOOL result
...
handle = SET_KRLDLG(Type, MyMessage, Parameter[], Options)
...
result = EXISTS_KRLDLG(handle)
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 24/37
09.06.22 11:26 Programming user-defined messages
MsgBuf_T
STRUC MsgBuf_T MsgBufMsgType_T type, INT nr, modul[24], CHAR msg_txt[80],
KrlMsgParType_T par_type1, CHAR par_txt1[40], KrlMsgParType_T par_type2, CHAR
par_txt2[40], KrlMsgParType_T par_type3, CHAR par_txt3[40], INT handle
Element Description
type Message type
#SYS_STATE: Kernel system status message
#SYS_QUIT: Kernel system acknowledgement message
#USR_STATE: User-defined status message
#USR_QUIT: User-defined acknowledgement message
#USR_DLG: User-defined dialog message
#USR_WAIT: User-defined wait message
nr Message number
modul[ ] Originator of the message
Note: Only initialized with user-defined messages
msg_txt[ ] Message text or KXR key
Note: Only initialized with user-defined messages
par_type1 ... Type of parameter
par_type3 #VALUE
#KEY
#EMPTY
Example
In this example, the messages from the message buffer are written into the variable “buffer[]” using
GET_MSGBUFFER. The relevant message type of the read message is then requested using a FOR loop.
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 25/37
09.06.22 11:26 Programming user-defined messages
Def ReadMsgBuffer ( )
decl MsgBuf_T buffer[100]
int message_count
message_count = GET_MSGBUFFER (buffer[])
FOR n=1 TO message_count
if (buffer[n].type==#SYS_QUIT) then
...
endif
ENDFOR
End
Example
In the example, a check is carried out to see whether the message with the number 123 is in the message buffer.
Examples
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 26/37
09.06.22 11:26 Programming user-defined messages
Notification message
Line Description
1 … 4 The required variables are declared:
message : Variable for the definition of message name, number, and text
parameter[3] : Variables for the definition of the parameters
options : Variable for the definition of the message response
Acknowledgement message
The words Check and tool are to be inserted via placeholders. The program is not to continue until the message
has been acknowledged.
Program
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 27/37
09.06.22 11:26 Programming user-defined messages
...
1 decl KrlMsg_T message
2 decl KrlMsgPar_T parameter[3]
3 decl KrlMsgOpt_T options
4 int handle
5 ...
6 message = {modul[] "MyTech", nr 231, msg_txt[] "%1 %2."}
7 parameter[1] = {par_type #VALUE, par_txt[] "Check"}
8 parameter[2] = {par_type #VALUE, par_txt[] "tool"}
9 options = {vl_stop true, clear_p_reset TRUE, clear_p_SAW FALSE, log_to_DB TRUE}
10 ...
11 handle = SET_KRLMSG (#QUIT, message, parameter[], options)
12 while (EXISTS_KRLMSG(handle))
13 wait sec 0.1
14 endwhile
Line Description
1 … 4 The required variables are declared:
message : Variable for the definition of message name, number, and text
parameter[3] : Variables for the definition of the parameters
options : Variable for the definition of the message response
Wait message
The wait message is to be removed from the message window when a valid program number is received from
the PLC (valid program numbers in this example are ≥ 1.)
In the case of wait messages, the user can also hide the message using the Simulate button. In this example,
program number 0 is simulated by means of Simulate.
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 28/37
09.06.22 11:26 Programming user-defined messages
Program
...
1 decl KrlMsg_T message
2 decl KrlMsgPar_T parameter[3]
3 decl KrlMsgOpt_T options
4 int handle, validPgNo
5 bool retVal
6 ...
7 message = {modul[] "MsgTech", Nr 1, msg_txt[] "This is a test."
8 validPgNo = -1
9 ...
10 handle = SET_KRLMSG (#WAITING, message, parameter[], options)
11 IF (handle > 0) THEN
12 repeat
13 validPgNo = GETPGNOFROMPLC()
14 if (EXISTS_KRLMSG (handle) == FALSE) then
15 validPgNo = 0
16 endif
17 until (validPgNo > -1)
18
19 if (EXISTS_KRLMSG (handle) == TRUE) then
20 retVal = CLEAR_KRLMSG (handle)
21 endif
22 ENDIF
...
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 29/37
09.06.22 11:26 Programming user-defined messages
Line Description
1 … 5 The required variables are declared:
message : Variable for the definition of message name, number, and text
parameter[3]: Variables for the definition of the parameters
options : Variable for the definition of the message response
handle : Variable for the return value of the SET_KRLMSG function
validPgNo : Variable for the program number from the PLC
retVal : Variable for the return value of the CLEAR_KRLMSG function
Status message
The container number is to be taken from a KXR file. The message is to be triggered by state_OK = FALSE .
Once this status has been eliminated, the message is to be reset.
Program
1 decl KrlMsg_T message
2 decl KrlMsgPar_T parameter[3]
3 decl KrlMsgOpt_T options
4 int handle
5 bool state_OK, result
6 ...
7 IF state_OK == FALSE THEN
8 message = {modul[] "MyTech", Nr 5, msg_txt[] "Container nr %1 is empty."}
9 parameter[1] = {par_type #KEY, par_txt[] "mytech_container_nr"}
10 options = {vl_stop TRUE, clear_p_reset TRUE, clear_p_SAW FALSE, log_to_DB FALSE}
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 30/37
09.06.22 11:26 Programming user-defined messages
11
12 handle = SET_KRLMSG (#STATE, message, parameter[], options)
13 ENDIF
14 ...
15 REPEAT
16 IF (handle > 0) THEN
17 ENDIF
18 ...
19 REPEAT
20 IF (handle > 0) THEN
21 IF state_OK == TRUE THEN
22 result = CLEAR_KRLMSG (handle)
23 ENDIF
24 ENDIF
25 wait sec 0.5
26 UNTIL state_OK == TRUE
27 ...
Line Description
1 … 5 The required variables are declared:
message : Variable for the definition of message name, number, and text
parameter[3] : Variables for the definition of the parameters
options : Variable for the definition of the message response
handle : Variable for the return value of the SET_KRLMSG function
state_OK : Variable for the “state” that causes the message to be generated
result : Variable for the return value of the CLEAR_KRLMSG function
Dialog message
Program
...
1 decl KrlMsg_T msg
2 decl KrlMsgPar_T par[3]
3 decl KrlMsgOpt_T opt
4 decl KrlMsgDlgSK_T SK[7]
5 int nHandle, keynumber
6 ...
7 msg = {modul[] "MyTech", Nr 7, msg_txt[] "Continue?"}
8 SK[1] = {sk_Type #value, sk_txt[] "yes"}
9 SK[2] = {sk_Type #value, sk_txt[] "no"}
10 nHandle = Set_KrlDlg (msg, par[], SK[], opt)
11 IF (nHandle > 0) THEN
12 while (Exists_KrlDlg(nHandle, keynumber))
13 wait Sec 0.1
14 endwhile
15 switch keynumber
16 case 1
17 ...
18 case 2
19 ...
20 case 0
21 ...
22 endswitch
23 ENDIF
...
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 32/37
09.06.22 11:26 Programming user-defined messages
Line Description
1 … 5 The required variables are declared:
msg : Variable for the definition of message name, number, and text
par[3]: Variables for the definition of the parameters
opt : Variable for the definition of the message response
SK[7] : Variable for labels of the 7 buttons
nHandle : Variable for the return value of the SET_KRLMSG function
keynumber : Variable for addressing a button
Precondition
Work computer with text editor, e.g. Notepad++.
USB stick
Procedure
1. Create a new file with the extension *.kxr on the work computer.
2. Name the KXR file after the originator of the associated message. Example: MyTech.kxr
3. Open the KXR file in the text editor.
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 33/37
09.06.22 11:26 Programming user-defined messages
KXR file name, KXR module name and the originator specified in the message must match.
The languages are distinguished from one another by specifying language abbreviations. (>>> Language
abbreviation)
Line Description
3 Module name/originator of the message
4 Message key for text 1
5 Text 1 in German
6 Text 1 in English
8 Message key for text 2
9 Text 2 in German
10 Text 2 in English
12 Message key for text 3
13 Text 3 in German
14 Text 3 in English
Example 1
Example of a notification message created without placeholders using the MsgNotify method.
The text Check gripper. is loaded via the key Notify_Text_1 from the KXR language file MyTech.kxr.
In accordance with the language currently set on the smartHMI, the string is displayed in English.
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 34/37
09.06.22 11:26 Programming user-defined messages
Notification message
Example 2
Example of a manually programmed acknowledgement message with 2 string placeholders.
The text fragments Check and tool. are loaded using the keys Quit_Textpara_1 and Quit_Textpara_2 from the
language file MyTech.kxr.
In accordance with the language currently set on the smartHMI, the texts are displayed in English.
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 35/37
09.06.22 11:26 Programming user-defined messages
Line Description
1 ... 5 Declarations
7 The variable handle is initialized with the value 0.
10 The general message information is transferred: the originator MyTech, the message number and the
message text with placeholders.
12 Options for the effects of the message are defined.
14 The text with the message key Quit_Textpara_1 is assigned to placeholder %1.
15 The text with the message key Quit_Textpara_2 is assigned to placeholder %2.
16 Placeholder %3 is not used; the parameter therefore remains empty.
18 The acknowledgement message is generated. The message type (#QUIT) and all required parameters
are transferred.
20 ... 22 The acknowledgement message is repeated with a loop until it has been acknowledged with OK or All
OK and thus cleared.
Acknowledgement message
Language abbreviation
The following table provides an overview of the language abbreviations used in the KUKA System Software.
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 36/37
09.06.22 11:26 Programming user-defined messages
https://xpert.kuka.com/service-express/portal/project1_p/document/kuka-project1_p-basic_SS2262_en?context=%7B"filter"%3A%7B"ProductC… 37/37