BOOL
BOOL type variables may be given the values TRUE and FALSE.
Type | Memory use |
---|---|
BOOL | 8 Bit |
A BOOL type variable is true, if the least significant bit in the memory is set (e.g. 2#00000001 ). If no bit is set in the memory, the variable is FALSE (2#00000000). All other values can´t be interpeted accurately and be displayed (***INVALID: 16#xy *** in the Online View). Such problems may appear, if for example overlapped memory ranges are used in the PLC program. |
Example:
The boolean variable is in the same memory range as the byte variable.
PROGRAM MAIN
VAR
bBool AT%MB0 : BOOL;
nByte AT%MB0 : BYTE := 3;
bIsTRUE : BOOL;
END_VAR
IF bBool THEN
bIsTRUE := TRUE;
ELSE
bIsTRUE := FALSE;
END_IF
Online display after program start