Skip to main content

Data Type: BIT

The data type BIT is valid only in structures for the declaration of structure members or in a function block for the declaration of variables. A BIT variable can have the values TRUE (1) and FALSE (0). In this case, the variable requires exactly one bit of memory.

As a result, you can symbolically address individual bits by a name. BIT variables that are declared in succession are bundled in bytes. In this way, you can optimize memory use as opposed to BOOL types, which reserve 8 bits each. On the other hand, bit access is significantly more time-consuming. Therefore, you should use the BIT data type only when you need to define data in a predefined format.