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.

Declaration Editor...<br />

Depending on the type and contents of pragma, the pragma either operates on the line in which it is<br />

located or on all subsequent lines until it is ended by an appropriate pragma, or the same pragma is<br />

executed with different parameters, or the end of the file is reached. By file we mean here: declaration<br />

part, implementation portion, global variable list, type declaration.<br />

The opening bracket may immediately follow a variable name. Opening and closing brackets must be<br />

located on the same line.<br />

The following pragma may currently be used:<br />

{flag [] [off|on]}<br />

can be a combination of the following flags:<br />

noinit:<br />

nowatch:<br />

noread:<br />

nowrite:<br />

The variable will not be initialized.<br />

The variable can not be monitored<br />

The variable is exported to the symbol file without read permission<br />

The variable is exported to the symbol file without write permission<br />

noread,<br />

nowrite:<br />

The variable will not get exported to the symbol file<br />

With the „on" modifier, the pragma operates on all subsequent variable declarations until it is ended<br />

by the pragma {flag off}, or until overwritten by another {flag on} pragma.<br />

Without the „on" or „off" modifier, the pragma operates only on the current variable declaration (that is<br />

the declaration that is closed by the next semicolon).<br />

Examples:<br />

The variable a will not be initialized and will not be monitored. The variable b will not be initialized:<br />

VAR<br />

a : INT {flag noinit, nowatch};<br />

b : INT {flag noinit };<br />

END_VAR<br />

VAR<br />

{flag noinit, nowatch on}<br />

a : INT;<br />

{flag noinit on}<br />

b : INT;<br />

{flag off}<br />

END_VAR<br />

Neither variable will be initialized:<br />

{flag noinit on}<br />

VAR<br />

a : INT;<br />

b : INT;<br />

END_VAR<br />

{flag off}<br />

VAR<br />

{flag noinit on}<br />

a : INT;<br />

b : INT;<br />

{flag off}<br />

END_VAR<br />

The flags „noread" and „nowrite" are used, in a POU that has read and/or write permission, to<br />

provide selected variables with restricted access rights. The default for the variable is the same as the<br />

setting for the POU in which the variable is declared. If a variable has neither read nor write<br />

permission, it will not be exported into the symbol file.<br />

Examples:<br />

5-10 CoDeSys V2.3

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

Saved successfully!

Ooh no, something went wrong!