SETBIT32

SETBIT32 1:

The function sets the bit specified by a bit number in the 32-bit value that is passed to it and returns the resulting value.

FUNCTION SETBIT32 : DWORD

VAR_INPUT

VAR_INPUT
    inVal32         :DWORD;
    bitNo           :SINT;
END_VAR

inVal32: the 32-bit value to be changed.

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

 

 

Sample of calling the function in FBD:

SETBIT32 2:

Bit 31 is set to the input value '0'. The result is the (hex) value '80000000'.

Requirements

Development environment

Target platform

PLC libraries to include

TwinCAT v2.7.0 and above

BCxxxx (165)

Standard.Lb6, PlcSystemBC.Lb6, TcPlcUtilitiesBC.Lb6