VAR_INPUT

Top  Previous  Next

The VAR_INPUT statement is used to initiate the section where a function, function block, or the main program input variables can be declared. If the VAR_INPUT section is used in the main program, variables declared within this section can be configured from the configuration dialog. Variables declared in the VAR_INPUT section can only be read from within the program and not written.

 

Please note that when declaring variables in this section, a | sign followed by a description is a special type of comment. Comments following this syntax will be shown as comments when the configuration dialog is invoked. This helps the person who does the configuration to remember the function of the variable being configured.

 

A variable in the VAR_INPUT section can have the attribute R_EDGE or F_EDGE. This enables detection of leading and falling edges on a digital input.

 

It is allowed to have more than one VAR_INPUT section within the same scope.

 

Example:

INCLUDE rtcuinc
 
VAR_INPUT
  variable_temp : INT; | This is a variable that can be configured from the configuration dialog
  variable_test : DINT; | This is another variable that can be configured from the configuration dialog
END_VAR;
 
PROGRAM Greenhouse_1;
 
BEGIN
  ...
END;
 
END_PROGRAM;