Programming a message (#MSG)
Syntax: |
#MSG [<mode>] [<receiver>] ["<message_text>"] |
<mode> | The mode defines the time of the message output. If the message is to be output synchronously with the processing state in the interpolator, the mode SYN or SYN_ACK must be specified. If the mode is not specified or is specified by ACK , the message is output directly after decoding. ---: Immediately after decoding (default). SYN: Synchronous with processing state in interpolator. SYN_ACK: Synchronous with processing state in interpolator with acknowledgement by the receiver (e.g. SPS). Processing is only continued in the interpolator after the acknowledgement is received. ACK: Immediately after decoding with acknowledgement by the receiver (e.g. SPS). Decoding is only continued after the acknowledgement is received. |
<receiver> | The receiver of the message is specified by its receiver ID. If no receiver is specified, it is sent to the default receiver. ISG_DIAG_BED: Message is sent to the CNC diagnosis interface (default) DIAG: Message is sent to diagnosis data, see P-CHAN-00514 HMI: Message is sent to the system-specific user interface PLC: Message is sent to the system-specific PLC |
| EVENT_LOGGER: Message goes to TwinCAT Event Logger |
Notice | |
Messages must be read by the corresponding receiver, otherwise the CNC stops after sending 10 messages. |
<message_text> | The message text must be enclosed in quotation marks "...". |
Programming Example
Programming a message
Text_1 is sent immediately after decoding to the system-specific user interface; the Text_2 string is sent synchronously for processing in the interpolator.
Text_3 is sent immediately after decoding to the default receiver; the Text_4 string is sent to the same device synchronously for processing in the interpolator.
Text_5 is also sent to the default receiver synchronously for processing in the interpolator but processing is stopped until the acknowledgement is received.
The following format elements to output numerical values and to output strings are available:
%d or %D | Outputting decimal numbers with sign (signed integer) |
%u or %U | Outputting decimal numbers without sign (unsigned integer) |
%f or %F | Outputting real numbers (float) |
%s or %S | Outputting strings (<String>, Macros, V.E.STRING) |
![]() | A maximum of 10 parameters can be output with %xx. The number of format characters must match the number of subsequent parameters. |
Programming Example
Programming a message with format elements:
Sent string: Message text_1 and message text_2
Sent string: Current measured value: 3.4567800000E+001
Sent string: Current state: End of roughing
The control sequence "%%" must be programmed to output the "%" character. The "\" character must precede quotation marks.
Programming Example
Programming a message with "%" and quotation marks:
Sent string: Text with % character and text in quotation marks: "TEXT"
A message text may also be specified with parameters and variables.
Programming Example
Programming a message with parameters and variables:
This example sends the Text_1 and Text_2 strings synchronously to processing in the interpolator to the default receiver.