L-force | plc designer – Lenze PLC Designer PLC Designer (R2-x) User Manual

Page 513

Advertising
background image

L-force | PLC Designer

Operands in PLC Designer



DMS 3.2 EN 02/2011 TD29

511

See in the following examples for such a bitaccess on a variable resp. a structure
variable:

Declaration in global variables list for both examples:

Variable enable defines which bit should be accessed:

VAR_GLOBAL CONSTANT

enable:int:=2;

END_VAR

Example 1, Bitaccess on an integer variable:

Declaration in POU:

VAR

xxx:int;

END_VAR

Bitaccess:

xxx.enable:=true; -> the third bit in variable xxx will be set TRUE

Example 2, Bitaccess on an integer structure component:

Declaration of structure stru1:

TYPE stru1 :

STRUCT

bvar:BOOL;

rvar:REAL;

wvar:WORD;

{bitaccess enable 42 'Start drive'}

END_STRUCT

END_TYPE

Advertising