You can use message pragmas to force the output of messages in the view (by default in the menu) during the compilation (build) of the project.
You can insert the pragma instruction in an existing line or in a separate line in the text editor of a POU. Message pragmas positioned within currently not defined sections of the implementation code will not be considered when the project is compiled. For further information, refer to the example provided with the description of the defined (identifier) in the chapter Conditional Pragmas.
There are 4 types of message pragmas:
Pragma |
Icon |
Message Type |
---|---|---|
{text ’text string’} |
– |
text type The specified text string will be displayed. |
{info ’text string’} |
|
information The specified text string will be displayed. |
{warning digit ’text string’} |
|
alert type The specified text string will be displayed. In contrast to the global obsolete pragma, this alert is explicitly defined for the local position. |
{error ’text string’} |
|
error type The specified text string will be displayed. |
VAR
ivar : INT; {info 'TODO: should get another name'}
bvar : BOOL;
arrTest : ARRAY [0..10] OF INT;
i:INT;
END_VAR
arrTest[i] := arrTest[i]+1;
ivar:=ivar+1;
{warning 'This is an alert'}
{text 'Part xy has been compiled completely'}
Output in
view: