Bit Clear

Set specified bit of stored integer to zero

Libraries:
Simulink / Logic and Bit Operations
HDL Coder / Logic and Bit Operations

Description

The Bit Clear block sets the specified bit, given by its index, of the stored integer to zero. Scaling is ignored.

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

Examples

expand all

If the Bit Clear block is turned on for bit 2, bit 2 is set to 0.

A vector of constants 2.^[0 1 2 3 4] is represented in binary as [00001 00010 00100 01000 10000].

With bit 2 set to 1, the result is [00101 00110 00100 01100 10100], which is represented in decimal as [5 6 4 12 20].

With bit 2 set to 0, the result is [00001 00010 00000 01000 10000], which is represented in decimal as [1 2 0 8 16]

Ports

The Bit Clear block supports Simulink® integer, fixed-point, and Boolean data types. The block does not support true floating-point data types or enumerated data types.

Input

expand all

The input signal is the specified bit of the stored integer.

Data Types: `single` | `double` | `Boolean` | `fixed point`

Output

expand all

The output consists of the specified bit set to zero.

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: scalar or vector Values: {'0'} Default: '0'

Block Characteristics

 Data Types `Booleana` | `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.

Version History

Introduced before R2006a