Bit Set

Set specified bit of stored integer to one

  • Library:
  • Simulink / Logic and Bit Operations

    HDL Coder / Logic and Bit Operations

  • Bit Set block

Description

The Bit Set block sets the specified bit of the stored integer to one. Scaling is ignored.

You can specify the bit to be set to one with the Index of bit parameter, where bit zero is the least significant bit.

Ports

Input

expand all

Input signal with the specified bit of the stored integer.

Data Types: single | double | Boolean | fixed point

Output

expand all

Output signal with the specified bit set to 1.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | Boolean | fixed point | enumerated | bus

Parameters

expand all

Index of bit where bit 0 is the least significant bit.

Programmatic Use

Block Parameter: iBit
Type: character vector
Values: positive integer
Default:'0'

Block Characteristics

Data Types

Boolean[a] | fixed point | integer

Direct Feedthrough

yes

Multidimensional Signals

yes

Variable-Size Signals

no

Zero-Crossing Detection

no

[a] Bit operations are not recommended for use with Boolean signals.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

PLC Code Generation
Generate Structured Text code using Simulink® PLC Coder™.

Fixed-Point Conversion
Design and simulate fixed-point systems using Fixed-Point Designer™.

See Also

| | (HDL Coder) | (HDL Coder)

Introduced before R2006a