Bitwise Boolean instructions
544
Part III FP Instructions
F136_DBCU
Number of ON bits in 32-bit data
The number of 1 (ON) bits is stored in the 16-bit area specified by d.
This instruction also exists as a P instruction (for FP2/2SH, FP3/5, FP10/10SH PLC types), which
is only executed at the rising edge of the EN trigger. Select [Insert P instruction] from the
"Instructions" pane if you require a P instruction. To facilitate reuse, the instruction then appears
under "Recently used" in the pop-up menu. Press <Ctrl>+<Shift>+<v> within the programming
area to open the list of recently used elements.
PLC types
Availability of F136_DBCU (see page 1321)
Variable Data type Function
s ANY32 source
d INT destination area for storing the number of bits in the ON (1)
state
For Relay T/C Register Constant
s DWX DWY DWR DWL DSV DEV DDT DLD DFL dec. or hex.
d - WY WR WL SV EV DT LD FL -
Description
Counts the number of bits in the ON state (1) in the 32-bit data specified by s if the trigger EN is in
the ON-state.
Data types
Operands
Example
In this example, the same POU header is used for all programming languages. For an example
using IL (instruction list), please refer to the online help.
POU header
All input and output variables used for programming this function have been declared in the POU
header.
Body
When the variable start is set to TRUE, the function is carried out.
LD
ST
When programming with structured text, enter the following:
IF start THEN
F136_DBCU(checked_value, output_value);
END_IF;