Skip to content
Unit 2 Syllabus Note· Digital Electronics

Digital Electronics

Comprehensive exam revision notes for BCA-108N Unit 2 (Number Systems, Binary Codes & Error Detection). Includes Section A (2M), Section B (5M), and Section C (15M) questions, answers, and diagrams.

Digital Electronics

Number Systems, Binary Codes & Error Detection

Core Definitions & Key Concepts

How is negative number representation achieved in 1's Complement and 2's Complement

  • 1's Complement: Invert all bits (0 becomes 1, 1 becomes 0). Suffers from dual zero (+0: 0000, -0: 1111).
  • 2's Complement: Take 1's complement and add 1 to the LSB (2's comp = 1's comp + 1). Has a single unique zero (0000).

Why is 2's Complement arithmetic universally preferred in digital computer hardware

  1. Unique representation for zero.
  2. Subtraction is performed using standard addition hardware: A - B = A + (2's comp of B).
  3. End-around carry is discarded rather than requiring an extra addition cycle as in 1's complement.

BCD (Binary Coded Decimal / 8421 Code) and state its valid range

BCD represents each decimal digit (0 to 9) using an individual 4-bit binary nibble (0000 to 1001). Binary combinations 1010 to 1111 (10 to 15) are invalid states requiring correction by adding 0110 (6).

What is Excess-3 (XS-3) Code and why is it called a Self-Complementing Code

Excess-3 is obtained by adding 3 (0011) to each BCD digit. It is self-complementing because the 1's complement of an Excess-3 representation directly produces the Excess-3 representation of its 9's complement.

Gray Code (Reflected Binary Code) and state its primary engineering application

A non-weighted unit-distance code where two successive code words differ in only one bit position. Application: Optical rotary shaft encoders to prevent erroneous multi-bit transition glitches.

Convert Binary 10110 to Gray Code

MSB remains same: g4 = b4 = 1. g3 = b4 ⊕ b3 = 1 ⊕ 0 = 1. g2 = b3 ⊕ b2 = 0 ⊕ 1 = 1. g1 = b2 ⊕ b1 = 1 ⊕ 1 = 0. g0 = b1 ⊕ b0 = 1 ⊕ 0 = 1. Gray Code: `11101`.

Differentiate Even Parity from Odd Parity

  • Even Parity: Parity bit is set to 1 if the count of 1s in data is odd, ensuring total count of 1s is always even.
  • Odd Parity: Parity bit is set to 1 if the count of 1s in data is even, ensuring total count of 1s is always odd.

State the Hamming Rule formula for determining the number of parity check bits p for m data bits

$2^p ≥ m + p + 1 For 4 data bits (m = 4): 2^3 = 8 \ge 4 + 3 + 1 = 8. Thus, p = 3$ parity bits are required (positions 1, 2, 4).

Conceptual & Architectural Analysis

BCD Addition and show how invalid states are corrected with an example: 28 + 45

1. BCD Addition Rule

Add two BCD numbers using binary addition. If the sum of any 4-bit nibble exceeds 9 (1001) or generates an output carry, add 0110 (decimal 6) to correct the nibble and propagate carry to the next decimal digit.

2. Example: 28 + 45 (Decimal = 73)

  • 28 in BCD = 0010 1000
  • 45 in BCD = 0100 0101

Add lower nibbles:

CODE
1 1000 (8)
2 + 0101 (5)
3 -------
4 1101 (13 in binary > 9, INVALID!)
5 + 0110 (Add 6 correction)
6 -------
7 (1)0011 (Carry 1 generated, Lower nibble = 3)

Add upper nibbles with carry:

CODE
1 0010 (2)
2 + 0100 (4)
3 + 0001 (Carry from lower nibble)
4 -------
5 0111 (7, valid <= 9)

Combined Result: 0111 0011 = 73 in BCD.

Perform binary subtraction using 2's Complement method: (1) 25 - 14, (2) 14 - 25 using 8-bit registers

1. Case 1: 25 - 14 (Positive Result)

  • +25 = 00011001
  • +14 = 00001110 => 1's comp = 11110001 => 2's comp of 14 = 11110010

Add 25 + (-14):

CODE
1 00011001 (25)
2 + 11110010 (-14)
3 ----------
4 1 00001011

End carry 1 indicates positive result. Discard carry: 00001011 = +11.

2. Case 2: 14 - 25 (Negative Result)

  • +14 = 00001110
  • +25 = 00011001 => 2's comp of 25 = 11100111

Add 14 + (-25):

CODE
1 00001110 (14)
2 + 11100111 (-25)
3 ----------
4 11110101

No end carry indicates negative result in 2's complement form. Magnitude = 2's comp of 11110101 = 00001010 + 1 = 00001011 (11). Result: -11.

In-Depth Analysis & Implementation

The 7-bit Hamming Code (Single Error Detection and Correction) in complete detail. Construct a 7-bit Hamming code for 4-bit data 1011, and demonstrate how an error in bit position 5 is detected and corrected

1. Structure of 7-Bit Hamming Code

For m = 4 data bits (D_7, D_6, D_5, D_3), parity bits occupy powers of 2: P_1, P_2, P_4. Bit positions: 1, 2, 3, 4, 5, 6, 7

  • P_1 checks bits with bit 1 set in binary address (1, 3, 5, 7): P_1 = D_3 \oplus D_5 \oplus D_7
  • P_2 checks bits with bit 2 set in binary address (2, 3, 6, 7): P_2 = D_3 \oplus D_6 \oplus D_7
  • P_4 checks bits with bit 4 set in binary address (4, 5, 6, 7): P_4 = D_5 \oplus D_6 \oplus D_7

2. Encoding Data 1011 (D_7=1, D_6=0, D_5=1, D_3=1)

  • P_1 = D_3 \oplus D_5 \oplus D_7 = 1 \oplus 1 \oplus 1 = 1
  • P_2 = D_3 \oplus D_6 \oplus D_7 = 1 \oplus 0 \oplus 1 = 0
  • P_4 = D_5 \oplus D_6 \oplus D_7 = 1 \oplus 0 \oplus 1 = 0

Transmitted 7-bit Code Word:

Pos 7Pos 6Pos 5Pos 4Pos 3Pos 2Pos 1
D7=1D6=0D5=1P4=0D3=1P2=0P1=1

Code Word = `1010101`

3. Error Detection & Correction Trace

Suppose bit position 5 is corrupted during transmission (1 flips to 0): Received Code Word: `1000101` (b_7=1, b_6=0, b_5=0, b_4=0, b_3=1, b_2=0, b_1=1). Compute Syndrome Bits (S_4, S_2, S_1):

  • S_1 = b_1 \oplus b_3 \oplus b_5 \oplus b_7 = 1 \oplus 1 \oplus 0 \oplus 1 = 1
  • S_2 = b_2 \oplus b_3 \oplus b_6 \oplus b_7 = 0 \oplus 1 \oplus 0 \oplus 1 = 0
  • S_4 = b_4 \oplus b_5 \oplus b_6 \oplus b_7 = 0 \oplus 0 \oplus 0 \oplus 1 = 1

Syndrome Word: S_4 S_2 S_1 = 101_2 = \mathbf{5}_{10}. Since syndrome is non-zero (5), an error occurred at Bit Position 5! Correction: Invert bit 5 from 0 back to 1, restoring the original data 1011 without retransmission.

Important Exam Points & Quick Revision

In BCA-108N Unit 2, 2's complement arithmetic and 7-bit Hamming code error correction generation/detection are classic exam problems. Always show the binary bit position mapping and syndrome evaluation.

Your reading progress
0%

100% left on this page — finishing it closes the gap for Number Systems, Binary Codes & Error Detection.

Weak topic hint

Number Systems, Binary Codes & Error Detection still counts as a weak topic until you finish this note and answer its questions.

Practise this unit
What Should You Do Next?

Test Your Understanding

Now that you've read through these notes, practice unit MCQs to identify weak points and solidify your learning before exams.