24.01.2015 Views

PLC Programming

  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

5 - Editors in CoDeSys<br />

Input Variable<br />

Between the key words VAR_INPUT and END_VAR, all variables are declared that serve as input<br />

variables for a POU. That means that at the call position, the value of the variables can be given along<br />

with a call.<br />

Example:<br />

VAR_INPUT<br />

in1:INT (* 1. Inputvariable*)<br />

END_VAR<br />

Output Variable<br />

Between the key words VAR_OUTPUT and END_VAR, all variables are declared that serve as output<br />

variables of a POU. That means that these values are carried back to the POU making the call. There<br />

they can be answered and used further.<br />

Example:<br />

VAR_OUTPUT<br />

out1:INT; (* 1. Outputvariable*)<br />

END_VAR<br />

Input and Output Variables<br />

Between the key words VAR_IN_OUT and END_VAR, all variables are declared that serve as input<br />

and output variables for a POU.<br />

Attention: With this variable, the value of the transferred variable is changed ("transferred as a pointer", Call-by-<br />

Reference). That means that the input value for such variables cannot be a constant. For this reason,<br />

even the VAR_IN_OUT variables of a function block can not be read or written directly from outside<br />

via .<br />

Example:<br />

VAR_IN_OUT<br />

inout1:INT; (* 1. Inputoutputvariable *)<br />

END_VAR<br />

CoDeSys V2.3 5-3

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!