GETBIT32

GETBIT32 1:

The function returns the status of the bit specified by a bit number in the 32 bit value that is passed to it as a boolean resulting value. The input value is not altered.

FUNCTION GETBIT32 : BOOL

VAR_INPUT
    inVal32     :DWORD;
    bitNo       :SINT;
END_VAR

inVal32: The 32-bit value that is to be modified;

bitNo:  The number of the bit that is to be set (0-31). This number is internally converted to a modulo 32 value prior to execution;

 

Example of calling the function in FBD:

GETBIT32 2:

Bit 2 in the input value '04' is interrogated here, and assigned to the boolean variable 'aGetBitResultVar'. When examined, it is found in this example to be 'TRUE'.

Requirements

Development environment

Target system type

PLC libraries to include

TwinCAT v2.7.0

PC or CX (x86)

PLCSystem.Lib

TwinCAT v2.8.0

PC or CX (x86)

TcSystem.Lib

TwinCAT v2.10.0 Build >= 1301

CX (ARM)

TcSystem.Lib