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'>} 6c20332725deec40c0a8640e01db3025_0b05a60ecf4d4947c0a8640e005ffc38 Information: display of <textstring>.
{warning digit <'textstring'>}

6c20332725deec40c0a8640e01db3025_496194c3cf4dbbd4c0a8640e01f4a7de Warning: display of <textstring>.

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

{error <'textstring'>} 6c20332725deec40c0a8640e01db3025_2e85a840cf4c8070c0a8640e01c0004b 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:

../_images/6cc407b626289811c0a8640e0052986d

See also