Skip to content

System.Messages

Programming messages in KRL.

Enum Types


EKrlMsgType


Message types

Name Type
EKrlMsgType ENUM
Value Description
#NOTIFY Notification message
#STATE Status message
#QUIT Acknowledgment message
#WAITING Wait message
#DIALOG End of program reached

KrlMsgParType_T


Message parameter types

Name Type
KrlMsgParType_T ENUM
Value Description
#VALUE The parameter is inserted into the message text as specified in text, int, real or bool.
#KEY The parameter is a key that must be searched for in the message database.
#EMPTY The parameter is empty.

MsgBufMsgType_T


Message parameter types

Name Type
MsgBufMsgType_T ENUM
Value Description
#SYS_QUIT Acknowledgement messages from the kernel system
#SYS_STATE Status messages from the kernel system
#USR_QUIT User-defined acknowledgement messages
#USR_WAIT User-defined wait messages
#USR_STATE User-defined status messages
#USR_DLG User-defined dialog messages

Struc Types


KrlMsg_T


Message data structure

Name Type
KrlMsg_T STRUC
Field Type Description
Modul[] CHAR[24] Originator displayed in the message window.
Nr INT Message number. Message numbers may be used more than once.
Msg_Txt[] CHAR[80] Message text (or key for a message database).

KrlMsgDlgSK_T


Softkey data structure for dialog message

Name Type
KrlMsgDlgSK_T STRUC
Field Type Description
Sk_Type KrlMsgParType_T The type of the softkey.
Sk_Txt CHAR[10] Label of the softkey (or key for a message database).

KrlMsgOpt_T


Message options data structure

Name Type
KrlMsgOpt_T STRUC
Field Type Description
Vl_Stop BOOL If true Set_KrlMsg() or Set_KrlDlg() trigger an ADVANCE run stop. Default to true.
Clear_P_Reset BOOL If true delete messages when the program is reset or deselected. In that case, all status messages, acknowledgement messages and wait messages generated by Set_KrlMsg() with the variable options are deleted.

Notification messages can only be deleted using the softkeys Ackn. and Ackn. All. For dialog messages Clear_P_Reset si always set to true.

Clear_P_Saw BOOL Delete message when a block selection is carried out using the softkey Line Sel. If true all status messages, acknowledgement messages and wait messages generated by Set_KrlMsg() with the variable options are deleted. Default to false.

Notification messages can only be deleted using the softkeys Ackn. and Ackn. All. For dialog messages no block selection is possible while a dialog is present on the KUKA.HMI, as all operator control elements are deactivated.

Log_To_DB BOOL If true the message is logged. Default to false.

KrlMsgPar_T


Message parameter data structure

Name Type
KrlMsgPar_T STRUC
Field Type Description
Par_Type KrlMsgParType_T Type of parameter.
Par_Txt[] CHAR[26] Text of the parameter (or key for a message database).
Par_Int INT This can be used to fill the placeholder with an integer value. It can only be used in conjunction with type=#value.
Par_Real REAL This can be used to fill the placeholder with a real value. It can only be used in conjunction with type=#value.
Par_Bool BOOL This can be used to fill the placeholder with a Boolean value. It can only be used in conjunction with type=#value.

MsgBuf_T


Message buffer data structure

Name Type
MsgBuf_T STRUC
Field Type Description
Type MsgBufMsgType_T Message type.
Nr INT Message number.
Modul[] CHAR[24] Represents the originator of the message. Only initialized for messages of type #usr_..., because with type #sys_... the parameter is usually a database key that cannot be used by the user.
Msg_Txt[] CHAR[80] Message text or message database key. Only initialized for messages of type #usr_..., because with type #sys_... the parameter is usually a database key that cannot be used by the user.
Par_Type1 KrlMsgParType_T Parameter type.
Par_Txt1[] CHAR[40] Text or database key of the parameter.
Par_Type2 KrlMsgParType_T Parameter type.
Par_Txt2[] CHAR[40] Text or database key of the parameter.
Par_Type2 KrlMsgParType_T Parameter type.
Par_Txt2[] CHAR[40] Text or database key of the parameter.
Handle INT internal handle for this message (only initialized for user-defined messages).

Comments

...

Notes

Array of buffer elements containing all the messages in the buffer. The array is filled in ascending order, without gaps, starting with Index = 1.

If there are fewer messages in the buffer than represented by the size of the array, these array elements are not initialized.

Functions


Clear_KrlMsg


Delete a a specific message.

Parameters

Parameter Type Value/Ref Description
handle INT IN The handle of the message to delete. This handle is returned by the function Set_KrlMsg().

Return

Type Description
BOOL
  • true if the message was sucessfully deleted.
  • false otherwise

Comments

...

Notes

The function Clear_KrlMsg() can be used to delete a message. This means that the message is removed from the message buffer and the message window.

Notification messages cannot be deleted in this way, as they are not managed in the message buffer. Notification messages can only be deleted via the KUKA.HMI using the softkeys Ackn. and Ackn. All.

  • -1 : all messages initiated by this process are deleted.
  • -99: all user-defined messages are deleted (for all processes: ROBOT, SUBMIT and COMMAND interpreters).

Exists_KrlDlg


Checks whether a specific dialog message still exists.

Parameters

Parameter Type Value/Ref Description
handle INT IN The handle provided for the dialog message by the function Set_KrlDlg().
answer INT OUT Number 1..7 of the softkey used to answer the dialog. 0 if the dialog was deleted before answering.

Return

Type Description
BOOL
  • true if the dialog message still exists in the message buffer.
  • false if the dialog message no longer exists in the message buffer and has therefore been answered

Comments

...

Notes

The function Exists_KrlDlg() can be used to check whether a specific dialog still exists. It also checks whether this dialog is still present in the message buffer.

The function does not wait until the dialog has been deleted, but merely searches the buffer for the dialog with this handle. The KRL program must therefore be polled cyclically until the dialog has been answered or deleted.

Returns

  • 1..7 : answer with the corresponding softkey.
  • 0 : the dialog has not been answered,but deleted (e.g. the dialog has been deleted by means of Clear_KrlMsg() by an interrupt or by a different process).

Exists_KrlMsg


Checks whether a specific message still exists.

Parameters

Parameter Type Value/Ref Description
handle INT IN The handle provided for the message by the function Set_KrlMsg().

Return

Type Description
BOOL Returns true if the message still exists in the message buffer.

Comments

...

Notes

The function Exists_KrlMsg() can be used to check whether a specific message still exists. It also checks whether this message is still present in the message buffer. This means that the message is transferred to the message buffer and displayed from there in the message window.

The function does not wait until the message has been deleted, but merely searches the buffer for the message with this handle. The KRL program must therefore be polled cyclically until the message has been deleted.

Notification messages cannot be checked, as they are not managed in the message buffer.

Get_MsgBuffer


Copy the content of the message buffer.

Parameters

Parameter Type Value/Ref Description
msgBuf[] MsgBuf_T[100] OUT Array of buffer elements containing all the messages in the buffer

Return

Type Description
INT Returns the number of messages in the message buffer.

Comments

...

Notes

The function Get_MsgBuffer() reads the message buffer and writes the messages in the buffer to the OUT parameter msgBuff[]. The size of the buffer is 100.

Get_MsgBuffer() can read the following message types from the buffer :

  • Status messages from the kernel system (#sys_state)
  • Acknowledgement messages from the kernel system (#sys_quit)
  • User-defined status messages (#usr_state)
  • User-defined acknowledgement messages (#usr_quit)
  • User-defined dialog messages (#usr_dlg)
  • User-defined wait messages (#usr_wait)

Set_KrlDlg


Generates a dialog message.

Parameters

Parameter Type Value/Ref Description
msg KrlMsg_T OUT Structure defining the name, originator and message text.
params KrlMsgPar_T OUT Structure containing the message parameters.
softkey KrlMsgDlgSK_T OUT Structure containing the softkey assignment.
options KrlMsgOpt_T OUT Structure containing the message reaction.

Return

Type Description
INT Returns a handle to the generated dialog message.

  • handle > 0 on success
  • handle = -1 on failure

Comments

...

Notes

The function Set_KrlDlg() generates a dialog message. This means that the message is transferred to the message buffer and displayed from there in the message window.

The function merely generates the dialog. It does not wait until the dialog has been answered. A dialog cannot be generated until no other dialog is active.

Set_KrlMsg


Generate a message.

Parameters

Parameter Type Value/Ref Description
type EKrlMsgType IN Defines the type of the message to be generated (#notify, #state, #quit, #waiting).
msg KrlMsg_T OUT Structure defining the name, originator and message text
params KrlMsgPar_T OUT Structure containing the message parameters
options KrlMsgOpt_T OUT Structure containing the message reaction

Return

Type Description
INT Returns a handle to the generated message. handle > 0 on success, handle = -1on failure.

Comments

...

Notes

The function Set_KrlMsg() generates a message. This means that the message is transferred to the message buffer and displayed from there in the message window.

Return

  • -1: The message could not be generated (e.g.because the message buffer is too full).
  • >0: The message was generated successfully.

The return value is a valid handle that can be used for further operations for this message, e.g. for deleting the message with Clear_KrlMsg(). No handle is required for notification messages.

Exceptions

  • Notification messages are displayed in the message window by means of Set_KrlMsg(). They are not managed in the message buffer, however (“fire and forget” principle).
  • To generate dialog messages, the function Set_KrlDlg() must be used.