LGF_BitCount (FC / V3.0.2)


Author: SiemensSIMATICSystemsSupport

Short description

This block counts in a variable of type DWord how many bits are set (TRUE) and how many are not set (FALSE) and outputs the number at the outputs.
Instead of DWord, Word and Byte can also be used by converting the past parameter with e.g. BYTE_TO_DWORD and connecting the corresponding bit length of the data type at the parameter "numberOfBits".
Byte=8, Word=16, DWord=32

Block Interface

LGF_BitCount (FC)
DWord  value Ret_Val  Void
    
USInt  numberOfBits countBitsFalse  USInt
    
   countBitsTrue  USInt
    
   

Input parameter

IdentifierData typeDescription
valueDWordTag where the bit states has to be counted
numberOfBitsUSIntNumber of bits in input tag "value" (bit size of Datatype), in case of Byte=8, Word=16, DWord=32

Output parameter

IdentifierData typeDescription
Ret_ValVoidVoid - Function has no return value
countBitsFalseUSIntNumber of bits are FALSE in input tag "value"
countBitsTrueUSIntNumber of bits are TRUE in input tag "value"

Change log

Version & DateChange description
01.00.00Siemens Industry Support
06.06.2015first release
03.00.00Siemens Industry Support
23.04.2020Set version to V3.0.0
harmonize the version of the whole library
03.00.02Simatic Systems Support
19.01.2021Insert documentation