Try a PLC free — no signup
Type ConversionBeginnerIEC 61131-3

BOOL_TO_INT (Boolean to Integer Conversion)

Converts FALSE to 0 and TRUE to 1 for numeric operations.

The BOOL_TO_INT function converts a boolean value to an integer: FALSE becomes 0 and TRUE becomes 1. This conversion is useful for accumulating boolean conditions into numeric values, creating status codes from individual bits, and using boolean signals in arithmetic calculations.

Parameters

Inputs

NameTypeDescription
INBOOLBoolean value to convert

Outputs

NameTypeDescription
OUTINT0 for FALSE, 1 for TRUE

Structured Text Example

// Count active sensors
Active_Count := BOOL_TO_INT(Sensor_1) + BOOL_TO_INT(Sensor_2) 
               + BOOL_TO_INT(Sensor_3) + BOOL_TO_INT(Sensor_4);

// Use boolean as multiplier
Output := Base_Value * BOOL_TO_INT(Enable);

Free · no signup to try

Run this block in your browser

Try the instruction on a live rung before you copy it into a project — nothing to install.

Try it in your browser — no signup

Opens plcsimulationsoftware.com — same team

Prefer ready-made code? Ladder Logic Pack — $29 on Gumroad

Platform-Specific Implementation

S

Siemens (TIA Portal)

Use CONVERT instruction or BOOL_TO_INT in SCL.

AB

Allen-Bradley (Studio 5000)

Implicit in most contexts; boolean contacts evaluate to 0/1.

C

CODESYS

Use BOOL_TO_INT() function in ST.

Common Applications

  • Counting active conditions
  • Status code construction
  • Conditional arithmetic
  • Boolean to numeric conversion for HMI
  • Weighted voting systems

Frequently Asked Questions

What is BOOL_TO_INT (Boolean to Integer Conversion) in PLC programming?

Converts FALSE to 0 and TRUE to 1 for numeric operations. The BOOL_TO_INT function converts a boolean value to an integer: FALSE becomes 0 and TRUE becomes 1. This conversion is useful for accumulating boolean conditions into numeric values, creating status codes from individual bits, and using boolean signals in arithmetic calculations.

What are common applications of BOOL_TO_INT (Boolean to Integer Conversion)?

BOOL_TO_INT (Boolean to Integer Conversion) is commonly used for: Counting active conditions, Status code construction, Conditional arithmetic, Boolean to numeric conversion for HMI, Weighted voting systems.

How do I use BOOL_TO_INT (Boolean to Integer Conversion) in different PLC platforms?

Siemens: Use CONVERT instruction or BOOL_TO_INT in SCL. Allen-Bradley: Implicit in most contexts; boolean contacts evaluate to 0/1. CODESYS: Use BOOL_TO_INT() function in ST.

Free · no signup to try

Wire this block up and run it

Drop the instruction into a rung, press Run and watch it execute in your browser — then adapt it to your vendor tool.

Try it in your browser — no signup

Opens plcsimulationsoftware.com — same team

Prefer ready-made code? Ladder Logic Pack — $29 on Gumroad