CSETBIT32
The function sets/resets the bit specified by a bit number in the 32 bit value that is passed to it and returns the resulting value.
FUNCTION CSETBIT32 : DWORD
Inputs
VAR_INPUT
inVal32 : DWORD;
bitNo : SINT;
bitVal : BOOL;
END_VAR
Name | Type | Description |
---|---|---|
inVal32 | DWORD | 32-bit value |
bitNo | SINT | Number of the bit to be set or reset (0-31). This number is internally converted to a modulo 32 value prior to execution. |
bitVal | BOOL | Value to which the bit is to be set or reset (TRUE = 1, FALSE = 0). |
Sample of calling the function in FBD:
Here bit 15 in the input value "16#80000000" is set to 1. The result (16#80008000) is assigned to the variable CSetBitResultVal.
Requirements
Development environment |
Target system type |
PLC libraries to include (Category group) |
---|---|---|
TwinCAT v3.1.0 |
PC or CX (x86, x64, ARM) |
Tc2_System (System) |