Message Pragmas
Message pragmas generate output texts which are displayed in the Messages view after a compile operation. In addition, a message type (Message, Warning, or Error ) can be assigned.
Insertion location: Separate or existing line in the text editor of a POU.
Syntax of Message Pragma | Example of Code Fragment | Description |
|---|---|---|
| {text 'Hallo Allgäu!'}{text 'Part PLC_PRG has been compiled completely'} | No type Output; defined in string literal Hallo Allgäu! Part PLC_PRG has been compiled completely |
| {info 'I01: This is for your information.' } | Typed as a message Output:
|
| {warning 'W01: This is a warning to you.'} | Typed as a warning Unlike the attribute pragma ImportantThe Output:
|
| {error 'E00: Error has occured.'}
| Typed as an error Output:
|
Tip
In the Messages view, the
Error,
Warning(s), and
Message(s) buttons are available to filter the output texts. Or you can use the Next Message and Previous Message commands to navigate through the individual messages.
Note the Go To Source Position command. You can use this command to jump to the position where the pragma is implemented in the source code.
PROGRAM PLC_PRG
VAR
iVar : INT; {info 'Info0: This is for your information.'}
bVar : BOOL;
arrTest : ARRAY [0..10] OF INT;
END_VAR{text 'Hello Allgäu!'}
arrTest[iVar] := arrTest[iVar]+1;
{warning 'W01: This is a warning'}
iVar := iVar+1;
{warning 'W02: This is a second warning'}
{text 'Part PLC_PRG has been compiled completely'}Display in the message view:
