Comments

Top  Previous  Next

Comments are very useful when writing VPL programs, as well as when trying to read and understand VPL code written by yourself and others. Comments can occupy one line or multiple lines. When declaring variables, one of two methods can be used (see the example below). The "multiple line comment" is sometimes useful when certain parts of the program are to be disabled - possibly because one is running the program in the RTCU Emulator and does not want to test all aspects of the program in question. It can also be useful if one is looking to disable certain parts of the program that are not yet finished.

 

Another type of comments is comments written in the declaration of variables in the VAR_INPUT and VAR_OUTPUT sections. These comments will be shown for each variable in the configuration dialog (this is only true for the VAR_INPUT and VAR_OUTPUT sections in the main program, not for the individual function blocks !)

 

All comments in a VPL program are shown in grey color when viewed in the built-in syntax highlighting editor. Comments written as part of declaring variables in the VAR_INPUT and VAR_OUTPUT sections are written in orange.

 

 

Example:

INCLUDE rtcu.inc
 
VAR_INPUT
  variable_temp : INT; | This is a comment that will be shown in the configuration dialog
END_VAR;
 
PROGRAM test;
 
BEGIN
  ...
  // This is an example of a one-line comment that extends to the end of the line
  ...
  /* And this is
     an example of a comment
     that extends
     more than one line
  */
  ...
END;
 
END_PROGRAM;