Binary System: The Core Language of Computers
Binary (Base-2) is a numbering system that uses only two digits: 0 and 1. This system directly models the two states of electrical circuits in a computer: On (1) and Off (0).
1. Basic Units of Binary
- Bit: The smallest unit of data, representing a single binary digit (
0or1). - Byte: A group of 8 bits. (e.g.,
1010 1010). A byte is the fundamental unit for memory and data storage.
2. Place Values and Decimal Conversion
Like the decimal system, binary uses place values, but based on powers of 2 instead of powers of 10. The places start from $2^0$ on the right: $2^0, 2^1, 2^2, 2^3, \dots$
Example: Converting 1011 (Binary)
| Place Value (Powers of 2) | $2^3$ (8) | $2^2$ (4) | $2^1$ (2) | $2^0$ (1) |
|---|---|---|---|---|
| Binary Digit | 1 | 0 | 1 | 1 |
| Calculation | $1 \times 8$ | $0 \times 4$ | $1 \times 2$ | $1 \times 1$ |
| Result | 8 | 0 | 2 | 1 |
- Decimal Value: $8 + 0 + 2 + 1 = 11$
Thus, the binary number 1011 is 11 in decimal.
3. Common 8-Bit Values (1 Byte)
| Binary | Hexadecimal | Decimal | Description |
|---|---|---|---|
0000 0000 |
00 |
0 | Minimum value |
0000 0001 |
01 |
1 | |
1000 0000 |
80 |
128 | Most Significant Bit (MSB) is set |
1111 1111 |
FF |
255 | Maximum value (All 8 bits are 'on') |
4. Logic Operations
Binary numbers are crucial for performing bitwise logic operations, essential for controlling hardware at the lowest level.
- AND Operation: Result is 1 only if both bits are 1 (
1 & 1 = 1). - OR Operation: Result is 1 if at least one bit is 1 (
1 \| 0 = 1). - NOT Operation: Inverts the bit (
!1 = 0).