BOOL
Quick answer
BOOL is a PLC Boolean data type whose logical value is TRUE or FALSE. Use it for conditions, commands and digital states; its physical storage allocation and I/O behavior depend on the controller and runtime.
Key Takeaways
- BOOL is a PLC Boolean data type whose logical value is TRUE or FALSE. Use it for conditions, commands and digital states...
- Beginner-level topic in Data Types & Variables
- Commonly used in: Digital input and output state, Permissives, alarms and sequence conditions
- Related to: Bit Field, BYTE, Signed
Detailed Definition
BOOL represents a two-state logical value: FALSE or TRUE. Ladder contacts evaluate Boolean conditions and coils write Boolean results, while Structured Text uses BOOL values directly in expressions such as StartRequest AND PermissiveOK. A BOOL tag describes logic state; it does not by itself detect an edge, debounce an input or implement a safety function.
IEC semantics describe a one-bit Boolean value, but memory allocation is platform-specific. Rockwell documents BOOL as a one-bit Boolean, while CODESYS documents an ordinary BOOL as reserving eight bits and offers a separate BIT type for packed structure members. Do not infer memory layout, atomic access or fieldbus encoding from the logical type alone.
Technical reference
TRUE/FALSE semantics are consistent; storage allocation, direct I/O mapping and conversion rules are controller-specific.
Reviewed against current primary documentation:
BOOL PLC Data Type at a glance
- Type family
- Boolean
- Width
- 1-bit logical value; allocated storage varies
- Signedness
- Not numeric signedness
- Range / values
- FALSE or TRUE
- IEC-style literal
- BOOL#TRUE
- Best fit
- Conditions, commands, comparison results and digital states
Avoid this type when: You need an event count, elapsed time, packed protocol field or safety-rated function.
Vendor notation and support boundaries
IEC names help portability, but controller generations, compiler options and instruction signatures still differ.
CODESYS
An ordinary BOOL is documented as reserving eight bits. CODESYS BIT is a separate one-bit member type for defined layouts.
Siemens SIMATIC
S7 documentation treats Bool as a bit value. Addressing and optimized data-block layout still depend on the selected CPU and block settings.
Rockwell Logix
Studio 5000 documents BOOL as a one-bit value and warns against converting data to or from BOOL. Use Boolean instructions rather than relying on numeric coercion.
IEC-style Structured Text
Build a non-safety run request
VAR
StartRequest : BOOL;
StopRequest : BOOL;
PermissiveOK : BOOL;
RunCommand : BOOL;
END_VAR
RunCommand := StartRequest AND PermissiveOK AND NOT StopRequest;RunCommand is recalculated each execution. This example illustrates Boolean logic only; an actual motor circuit needs the approved stop behavior, interlocks and safety design.
Ladder equivalent: Illustrative Logix-style rung: XIC StartRequest, XIC PermissiveOK and XIO StopRequest driving OTE RunCommand. Mnemonics and input polarity vary by platform.
Boundary cases to test
These are mathematical boundaries, not promises about one runtime's failure mode.
| Input / operation | Mathematical result | Safe engineering action |
|---|---|---|
| FALSE → TRUE transition | The BOOL is TRUE after evaluation. | Use a documented rising-edge instruction or one-shot when the action must occur once rather than every scan. |
| Physical input chatters between states | The program may observe multiple transitions. | Apply appropriate hardware filtering or validated debounce logic; BOOL alone provides no filtering. |
Conversion guidance
- Prefer direct Boolean expressions such as IF Ready THEN instead of comparing the value with numeric 1.
- Use a platform-documented conversion only when an interface explicitly requires 0/1 numeric encoding.
- Document whether a field signal is active-high or active-low before assigning it to a semantic BOOL tag.
- Treat edge memory and debounce state as separate logic, not as properties of the BOOL type.
Before using this type
- 1Confirm the field signal polarity and de-energized state.
- 2Test cold start, communications loss and first-scan initialization.
- 3Check whether a one-shot, latch or debounce function is actually required.
- 4Verify storage and network mapping rather than assuming one physical bit.
Primary technical sources
These sources support the type ranges and platform notes above. The project's controller, firmware and compiler documentation remains authoritative for execution.
- Data type: BOOL
CODESYS Development System — TRUE/FALSE values and CODESYS storage allocation.
- Bit access in variables
CODESYS Development System — Documents indexed bit access and the valid integer and bit-string operands.
- Studio 5000 elementary data types
Rockwell Automation — Ranges, conversion behavior and controller-family support in current Logix documentation.
- S7-1200 system manual: data types
Siemens — S7-1200 integer widths, ranges and constant examples; verify the manual for the CPU and firmware in use.
Common Questions
What is BOOL?
BOOL is a PLC Boolean data type whose logical value is TRUE or FALSE. Use it for conditions, commands and digital states; its physical storage allocation and I/O behavior depend on the controller and runtime.
When should I use BOOL?
BOOL is particularly useful in scenarios such as Digital input and output state and Permissives, alarms and sequence conditions. Consider implementing it when you need reliable, efficient solutions for these types of applications.
What should I verify before using BOOL?
Confirm the field signal polarity and de-energized state. Test cold start, communications loss and first-scan initialization. Check whether a one-shot, latch or debounce function is actually required. Verify storage and network mapping rather than assuming one physical bit.
What are related concepts I should learn?
To fully understand BOOL, you should also familiarize yourself with Bit Field, BYTE, and Signed. These concepts work together in industrial automation systems.
Continue Learning
Ready to deepen your understanding of BOOL? Here are some recommended resources:
Was this helpful?
Let us know if this glossary term helped you understand BOOL better.
Your feedback helps us improve our glossary and create better content for the PLC programming community.
Quick Info
- Category
- Data Types & Variables
- Difficulty
- Beginner
- Tier
- Essential
About Data Types & Variables
Data structures, variable types, and memory organization