BOOL

Top  Previous  Next

BOOL is one of the basic data types. A BOOL can only take two values - either FALSE or TRUE. BOOL is often used as a data type for Digital I/O's because a Digital I/O can be represented by either FALSE (not active) or TRUE (active).

 

A BOOL data type occupies 1 byte of storage.

 

 

For assigning values to a BOOL type, please see:

 

TRUE, ON

FALSE, OFF

 

or

 

Datatypes and Typecasting

 

 

Example:

INCLUDE rtcu.inc
 
VAR_INPUT
  I1 : BOOL; | Input signal
END_VAR;
 
VAR_OUTPUT
  O1 : BOOL; | Output signal
END_VAR;
 
PROGRAM test;
 
BEGIN
  IF I1 THEN
     O1 := TRUE;
  ELSE
     O1 := FALSE;
  END_IF;
END;
 
END_PROGRAM;