Partial access of ANY_BIT variables
variable_name.size#
Meaning |
||||||||||||||||||||||||||||||||||||||||||||||||||||
partial access to →variables of one of the following ANY_BIT data types: BYTE, WORD, DWORD or LWORD Enhancement to IEC-standard logi.CAD 3 supports the write access to a bit, byte, word or double word of a variable, too. This write access is an enhancement to the →IEC-standard. The following data is necessary to address a part of a variable:
|
VAR
VarBo : BOOL;
VarBy1, VarBy2 : BYTE;
VarLW : LWORD;
VarW : WORD;
VarDW : DWORD;
END_VAR;
(* reading accesses *)
VarBo := VarBy1.%X0; (* 'Bit 0' of 'VarBy1' is assigned to 'VarBo'. *)
VarBo := VarBy1.%7; (* 'Bit 7' of 'VarBy1' is assigned to 'VarBo'. *)
(* 'VarBy1.%7' is interpreted as 'VarBy1.%X7' or 'VarBy1.7'. *)
VarBo := VarLW.63; (* 'Bit 63' of 'VarLW' is assigned to 'VarBo'. *)
(* 'VarLW.63' is interpreted as 'VarLW.%X63' or 'VarLW.%63'. *)
VarBy1 := VarW.%B1; (* 'Byte 1' of 'VarW' is assigned to 'VarBy1'. *)
VarW := VarLW.%W3; (* 'Wort 3' of 'VarLW' is assigned to 'VarW'. *)
(* writing accesses *)
VarBy2.4 := TRUE; (* 'TRUE' is assigned to 'bit 4' of 'VarBy2'. *)
(* 'VarBy2.4' is interpreted as 'VarBy2.%X4' or 'VarBy2.%4'. *)
VarDW.%B2 := 16#F0; (* '16#F0' is assigned to 'byte 2' of 'VarDW'. *)