Function - Set a bit in an integer register.

Inputs

Input

Data type

Description

IN

ANY

8 to 64 bit integer register.

BIT

DINT

Bit number (0 = least significant bit).

VAL

BOOL

Bit value to apply.

Outputs

Output

Data type

Description

Q

ANY

Modified register.

Remarks

Types REAL, LREAL, TIME and STRING are not supported for IN and Q. IN and Q must have the same type. In case of invalid arguments (bad bit number or invalid input type) the function returns the value of IN without modification.

In LD language, the operation is executed only if the input rung (EN) is TRUE. The output rung (ENO) keeps the same value as the input rung.

ST Language

Q := SETBIT (IN, BIT, VAL);

FBD Language

Fixed_Image

LD Language

The function is executed only if EN is TRUE.
ENO keeps the same value as EN.

Fixed_Image

Fixed_Image See also

TESTBIT


Created with the Personal Edition of HelpNDoc: Easily create EPub books