In-Depth Notes on Number Systems, Operations, and Codes in Digital Electronics
Decimal Numbers
Definition: The decimal number system is a weighted number system with a radix (base) of 10, using digits 0 through 9.
Column Weights: Each digit place represents a power of ten, increasing from right to left:
- Whole numbers:
- Fractional numbers:
Example: Representing 568.23 in weighted sums:
- Calculation:
Binary Numbers
Definition: The binary number system is used in digital systems, having a radix (base) of 2 with digits 0 and 1.
Column Weights: Powers of two increase from right to left:
- Whole numbers:
- Fractional numbers:
Counting Up To: With bits, the highest number is .
Example with 6 bits: Maximum = (0 to 63)
Binary Weighting Structure
- Right-most bit = LSB (Least Significant Bit)
- Left-most bit = MSB (Most Significant Bit)
- For fractional binary, weights are negative powers of 2.
Binary to Decimal Conversion
Procedure: Add values of bits equal to 1 and ignore bits that are 0.
Example: Binary number 1101101:
Fractional Example: Binary number 0.1011:
Decimal to Binary Conversion
- Sum of Weights Method: Identify powers of 2 that sum to the decimal number.
- Example: Convert 25:
- Repeated Division by 2: Continually divide by 2 and track remainders.
- Example: Decimal 19 to binary:
- 19 / 2 = 9 remainder 1
- 9 / 2 = 4 remainder 1
- 4 / 2 = 2 remainder 0
- 2 / 2 = 1 remainder 0
- 1 / 2 = 0 remainder 1
- Thus, 19 = 10011
Binary Arithmetic Operations
Binary Addition Rules:
- , , , (carry 1 to next bit)
- Example: (3 + 3 = 6)
Binary Subtraction Rules:
- Requires borrowing like decimal subtraction.
- Example: (3 - 1 = 2)
Binary Multiplication:
- Similar to decimal multiplication; involves partial products.
- Example: (3*3=9)
Binary Division:
- Follows the same principles as decimal division.
Complements in Binary Numbers
- 1's Complement: Invert all bits.
- 2's Complement: Add 1 to the 1's complement.
- Example: 1's complement of 10110010 is 01001101; adding 1 makes it 01001110.
Signed Binary Numbers
- Sign Bit: Left-most bit indicates the sign (0 = positive, 1 = negative).
- Sign-Magnitude Form: Sign bit + magnitude.
- Example: +81 as
01010001, -25 as10011001.
- 1's Complement Form: Positive same as sign-magnitude, negative as 1's complement.
- Example: +25 as
00011001, -25 as11100110(1's complement).
- Example: +25 as
- 2's Complement Form: Positive same as elsewhere, negative as 2's complement of positive.
- Example: +25 as
00110001, -25 as11001111(2's complement).
- Example: +25 as
Hexadecimal Number System
- Definition: Base 16 system using digits 0-9 and letters A-F.
- Conversion:
- Binary to Hexadecimal: Groups of 4 bits.
- Hexadecimal to Binary: Reverse process.
ASCII and Digital Codes
- ASCII: American Standard Code for Information interchange, using 7-bit binary.
- Example: Character
'A'is1000001. - Gray Code: A binary numeral system where two successive values differ in only one bit.