Question.3
What is the 1's complement of the binary number 101101₂?
Digital electronics processes the information using discrete values or logic levels.
Digital circuits represent binary values using voltage ranges.
In a simplified 5 V logic example,
| 5 V | Logic 1 |
| 0 V or GND | Logic 0 |
Actual HIGH and LOW voltage thresholds depend on the logic family.
Digits: 0 to 9. (0,1,2,3,4,5,6,7,8,9)
Base = 10
Examples: - 3, 5, 87, 123, 543
Commonly used by humans for everyday numerical representation.
Digits: 0 and 1
Base = 2
Examples: - 0, 1, 10, 1001, 00110101, 1110001011010100
It is used in digital electronics because it enables –
Digits: 0 to 7 (0,1,2,3,4,5,6,7)
Base = 8
Examples: - 4, 7, 34, 23, 17 (Digits 8 and 9 do not appear in an octal number.)
Octal provides a compact representation of binary because one octal digit corresponds to three binary bits.
Digits: 0 to 9 and A to F (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F)
Base = 16
Examples: - 2, 4, C, D, 3D, 2A, 23B, BD8, 45F
| Decimal | Binary | Octal | Hexadecimal |
|---|---|---|---|
| 0 | 0 | 0 | 0 |
| 1 | 1 | 1 | 1 |
| 2 | 10 | 2 | 2 |
| 3 | 11 | 3 | 3 |
| 4 | 100 | 4 | 4 |
| 5 | 101 | 5 | 5 |
| 6 | 110 | 6 | 6 |
| 7 | 111 | 7 | 7 |
| 8 | 1000 | 10 | 8 |
| 9 | 1001 | 11 | 9 |
| 10 | 1010 | 12 | A |
| 11 | 1011 | 13 | B |
| 12 | 1100 | 14 | C |
| 13 | 1101 | 15 | D |
| 14 | 1110 | 16 | E |
| 15 | 1111 | 17 | F |
| 16 | 10000 | 20 | 10 |
| 17 | 10001 | 21 | 11 |
| 18 | 10010 | 22 | 12 |
| 19 | 10011 | 23 | 13 |
| 20 | 10100 | 24 | 14 |
Same value can be represented in different number systems.
Decimal number 45 is converted into binary with following method:
| Division | Quotient | Remainder |
|---|---|---|
| 45 ÷ 2 | 22 | 1 (LSB) |
| 22 ÷ 2 | 11 | 0 |
| 11 ÷ 2 | 5 | 1 |
| 5 ÷ 2 | 2 | 1 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 (MSB) |
45₁₀ = 101101₂To convert binary number 10101 into decimal:
| Position (n) | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|
| Binary digits: (from MSB to LSB) | 1 | 0 | 1 | 0 | 1 |
| Positional Weights: 2ⁿ | 16 | 8 | 4 | 2 | 1 |
| Product of Weights and binary digit | 16 | 0 | 4 | 0 | 1 |
| Sum | 16 + 0 + 4 + 0 + 1 = 21 | ||||
Examples:
10101₂ = 21₁₀
110111₂ = 55₁₀
1001₂ = 9₁₀For an n-bit unsigned binary number, the maximum value is 2ⁿ − 1.
For 3-bit, highest value is 2³ – 1 = 8 – 1 = 7
For 4-bit, highest value is 2⁴ – 1 = 16 – 1 = 15Group 3 Binary Digits from LSB and write equivalent Octal Digit
Examples:
101100₂ = (101 100)₂ = 54₈
1011₂ = (001 011)₂ = 13₈Represent each Octal digit to its equivalent 3-digit Binary Number
Examples: -
34₈ = (011 100)₂ = 011100₂
65₈ = (110 101)₂ = 110101₂Binary Equivalent Octal Table
| Binary | Octal |
|---|---|
000 | 0 |
001 | 1 |
010 | 2 |
011 | 3 |
100 | 4 |
101 | 5 |
110 | 6 |
111 | 7 |
Group 4 Binary Digits from LSB and write equivalent Hexadecimal Digit
Examples:
00110111₂ = (0011 0111)₂ = 37₁₆
10100010₂ = (1010 0010)₂ = A2₁₆
11101011₂ = (1110 1011)₂ = EB₁₆Represent each Hexadecimal Digit to its equivalent 4-digit Binary or 4-bit Binary
5F₁₆ = (0101 1111)₂ = 01011111₂
3D9₁₆ = (0011 1101 1001)₂ = 001111011001₂
A54₁₆ = (1010 0101 0100)₂ = 101001010100₂Binary equivalent Hexadecimal
| Binary | Hexadecimal | Binary | Hexadecimal |
|---|---|---|---|
0000 | 0 | 1000 | 8 |
0001 | 1 | 1001 | 9 |
0010 | 2 | 1010 | A |
0011 | 3 | 1011 | B |
0100 | 4 | 1100 | C |
0101 | 5 | 1101 | D |
0110 | 6 | 1110 | E |
0111 | 7 | 1111 | F |
Convert the Decimal into Binary and convert the Binary into Hexadecimal
Example: Decimal number = 78₁₀
| Division | Quotient | Remainder |
|---|---|---|
| 78 ÷ 2 | 39 | 0 (LSB) |
| 39 ÷ 2 | 19 | 1 |
| 19 ÷ 2 | 9 | 1 |
| 9 ÷ 2 | 4 | 1 |
| 4 ÷ 2 | 2 | 0 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 (MSB) |
78₁₀ = 1001110₂ = (0100 1110)₂ = 4E₁₆
78₁₀ = 4E₁₆Convert the Hexadecimal into Binary and convert the Binary into Decimal
Example: - Hexadecimal number = D4₁₆
D4₁₆ = (1101 0100)₂ = 11010100₂| Position (n) | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
|---|---|---|---|---|---|---|---|---|
| Binary digits: (from MSB to LSB) | 1 | 1 | 0 | 1 | 0 | 1 | 0 | 0 |
| Positional Weights: 2ⁿ | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| Product of Weights and binary digit | 128 | 64 | 0 | 16 | 0 | 4 | 0 | 0 |
| Sum | 128 + 64 + 0 + 16 + 0 + 4 + 0 + 0 = 212 | |||||||
D4₁₆ = 212₁₀Convert the Octal to Binary and then Binary to Decimal.
31₈ = (011 001)₂ = 11001₂ = 25₁₀
123₈ = (001 010 011)₂ = 1010011₂ = 83₁₀
234₈ = (010 011 100)₂ = 10011100₂ = 156₁₀Convert the Decimal to Binary and then Binary to Octal.
15₁₀ = 1111₂ = (001 111)₂ = 17₈
52₁₀ = 110100₂ = (110 100)₂ = 64₈
197₁₀ = 11000101₂ = (011 000 101)₂ = 305₈Convert Hexadecimal to Binary and then Binary to Octal.
Example: - Hexadecimal Number: - 72C₁₆
| Hexadecimal Number: | 7 | 2 | C | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Equivalent Binary Number: | 0 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 0 |
| Equivalent Octal Number | 3 | 4 | 5 | 4 | ||||||||
4F0₁₆ = (0100 1111 0000)₂ = (010 011 110 000)₂ = 2360₈
AD₁₆ = (1010 1101)₂ = (010 101 101)₂ = 255₈Convert Octal to Binary and then Binary to Hexadecimal.
Examples: -
31₈ = (011 001)₂ = (0001 1001)₂ = 19₁₆
123₈ = (001 010 011)₂ = (0101 0011)₂ = 53₁₆
305₈ = (011 000 101)₂ = (1100 0101)₂ = C5₁₆Suppose A and B are two 1-bit binary numbers. The sum of A and B can be
| A | B | Sum | Carry |
|---|---|---|---|
0 | 0 | 0 | 0 |
0 | 1 | 1 | 0 |
1 | 0 | 1 | 0 |
1 | 1 | 0 | 1 |
Examples: -
Suppose A = 101 and B = 001
| A | 1 | 0 | 1 |
|---|---|---|---|
| B | 0 | 0 | 1 |
| Carry from previous bit | 1 | ||
| Sum | 1 | 1 | 0 |
011₂ + 011₂ = 110₂
1010₂ + 0110₂ = 10000₂ (Equivalently: 10 + 6 = 16)In common signed representations, the MSB indicates the sign.
MSB represents sign bit.
MSB = 0 | Positive Value |
MSB = 1 | Negative Value |
Remaining bits represents value depending on representation method.
Signed Binary Representation Methods:
Represent number as: Sign (MSB) and Magnitude (Remaining Bits).
Example for 4-bit signed magnitude representation.
0101 = +5
1101 = -5Limitations:
1000, 0000)Negative Numbers obtained by inverting all bits of positive number
Examples: -
| Numbers | Operations |
|---|---|
-3 | Given number |
011 | Represent equivalent binary of +3 |
100 | Take 1’s complement (invert 1 to 0 and 0 to 1) |
+3 = 011
-0 = 111Limitation: -
For Negative Number, after 1’s Complement, 1 is added to the result to generate 2’s Complement
Example for 4-bit binary number: -
| Number | Operation |
|---|---|
-5 | Given Number |
0101 | 4-bit binary representation of +5 |
1010 | 1s compliment |
1011 | 2s compliment (add 1 to the 1’s compliment) |
Range of n-bit signed binary number: −2ⁿ⁻¹ to +(2ⁿ⁻¹ − 1)3-bit signed binary equivalent decimal integer
| Signed Binary | Decimal |
|---|---|
100 | -4 |
101 | -3 |
110 | -2 |
111 | -1 |
000 | 0 |
001 | +1 |
010 | +2 |
011 | +3 |
Suppose A and B are 2 1-bit binary numbers.
| A | B | Subtraction | Borrow |
|---|---|---|---|
0 | 0 | 0 | 0 |
0 | 1 | 1 | 1 |
1 | 0 | 1 | 0 |
1 | 1 | 0 | 0 |
Examples: - Suppose A = 010 and B = 001
| A | 0 | 1 | 0 |
|---|---|---|---|
| B | 0 | 0 | 1 |
| Borrow from previous bit | 1 | ||
| Subtraction | 0 | 0 | 1 |
0110₂ – 0100₂ = 0010₂ (6 – 4 = 2)
0101₂ – 0111₂ = 1110₂ (5 – 7 = -2,
Here 1110 is 2s complement of 2 representing -2)A – B can also represent as: A + (-B)
Or it can be written as: A + (2s complement of B)
Example: - A = 0110₂, B = 0100₂ Find: A – B
| Operation | Values |
|---|---|
| Write A | 0110 (+6₁₀) |
| Write B | 0100 (+4₁₀) |
| 1s compliment of B | 1011 |
| 2s compliment of B | 1100 |
| A + 2s compliment of B | 0110 + 1100 = 1 0010 |
| Discard Carry Bit as it is out of 4-bit range | 0010 (+2₁₀) |
Examples: -
101₂ − 011₂ = 101₂ + 101₂ = 010₂
1011₂ − 0110₂ = 1011₂ + 1010₂ = 0101₂This method is used to perform addition and subtraction from single adder circuit
Predefined binary patterns used to represent different types of information in digital circuits.
Two consecutive Gray-code values differ by exactly one bit.
It is used to reduce errors or ambiguity during transitions between consecutive values.
| Decimal | Binary | Gray |
|---|---|---|
0 | 000 | 000 |
1 | 001 | 001 |
2 | 010 | 011 |
3 | 011 | 010 |
4 | 100 | 110 |
5 | 101 | 111 |
6 | 110 | 101 |
7 | 111 | 100 |
Applications
Each Decimal Digit is separately represented by 4-bit binary number.
Binary values: 1010 to 1111 are invalid in BCD Code
| Decimal | BCD | Decimal | BCD |
|---|---|---|---|
0 | 0000 | 5 | 0101 |
1 | 0001 | 6 | 0110 |
2 | 0010 | 7 | 0111 |
3 | 0011 | 8 | 1000 |
4 | 0100 | 9 | 1001 |
Examples: -
56 = 0101 0110
93 = 1001 0011
15 = 0001 0101Applications
Decimal measurement systems
Represent Decimal digit by adding 3 and converting result into binary.
Binary values 0000 to 0010 and 1101 to 1111 are invalid in Excess-3 Code
It is used to simplify decimal arithmetic and complement operations
| Decimal | Excess-3 | Decimal | Excess-3 |
|---|---|---|---|
0 | 0011 | 5 | 1000 |
1 | 0100 | 6 | 1001 |
2 | 0101 | 7 | 1010 |
3 | 0110 | 8 | 1011 |
4 | 0111 | 9 | 1100 |
Examples: -
23 = 0101 0110
85 = 1011 1000Applications
ASCII stands for American Standard Code for Information Interchange.
Represents – Numbers, Letters, Symbols, Control Characters
1000001 = A
1000010 = B
1100001 = a
0110000 = 0
0100000 = Space
0100001 = !
0111111 = ?Applications
| Code | Main Purpose | Type | Example | Main Application |
|---|---|---|---|---|
| Gray | Represent changing positions | Non-weighted | 7 = 100 | Rotary encoders |
| BCD | Represent decimal digits | Weighted 8421 | 59 = 0101 1001 | Displays and calculators |
| Excess-3 | Represent decimal digits with offset | Non-weighted | 12 = 0100 0101 | Decimal arithmetic |
| ASCII | Represent characters | Character code | A = 1000001 | Text communication |