Function - Set a bit in an integer register.
IN : ANY
8 to 32 bit integer
BIT : DINT Bit number (0 = less significant bit)
VAL : BOOL Bit value to apply
Q : ANY Modified register
Types LINT, 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.
Q := SETBIT (IN, BIT, VAL);
(* The function is executed only if EN is
(* ENO keeps the same value as EN *)