Message pragmas

Message pragmas serve to force the display of messages in the Message window during the compilation process.

Insertion position: separate or already existing line in the text editor of a POU.

4 types of message pragmas
Pragma Message type
{text <'textstring'>} Text: display of <textstring>.
{info <'textstring'>} Information : display of <textstring>.
{warning  <'textstring'>}

Warning: display of <textstring>.

Unlike the attribute pragma 'obsolete', you define the warning locally for the current position.

{error <'textstring'>} Error : display of <textstring>.

Note

In the CODESYS Message window you can jump with the help of the commands Next message and Previous message from a message of the category Information, Warning and Error to the source position of the message. This means you jump to the position where the pragma is added in the source code.

Example

VAR
    var : 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 a warning'}
 {text 'Part xy has been compiled completely'}

Display in the Message window:

See also