Set a Bit
This block sets to 1 the specified bit of its input. The user gives the bit index in the field Index of Bit with index 0, as that of the least significant bit.The operation can be summarized by this expression:
i.e. a bitwise OR between Input and Mask, an integer of the same length as the input with a value 1 for the bit to set and a value 0 for the other bits.
The block supports the following types :
Data Type (3:int32, 4:int16, 5int8, ...) It indicates the integer type of the input (output) data: between 3 and 8. Properties : Type ‘vec’ of size 1.
Index of Bit (0 is least significant) It indicate the index of the bit to set. The index must be, when the type is:
- int32 or uint32: positive and less than 32.
- int16 or uint16: positive and less than 16.
- int8 or uint8: positive and less than 8.
Properties : Type ‘vec’ of size 1.
Below a simple use case of the block. Open this example in Xcos