0% found this document useful (0 votes)
12 views8 pages

Ch2 DigitalElectronics Notes

Chapter 2 covers the number systems used in computing, focusing on binary, octal, and hexadecimal systems, as well as signed binary numbers. It explains binary arithmetic operations, complements for representing negative numbers, and various coding techniques for data representation and error detection. The chapter emphasizes the importance of these concepts in digital systems and computer operations.

Uploaded by

hurraimshaikh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views8 pages

Ch2 DigitalElectronics Notes

Chapter 2 covers the number systems used in computing, focusing on binary, octal, and hexadecimal systems, as well as signed binary numbers. It explains binary arithmetic operations, complements for representing negative numbers, and various coding techniques for data representation and error detection. The chapter emphasizes the importance of these concepts in digital systems and computer operations.

Uploaded by

hurraimshaikh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

📘 Chapter 2: Number System

🔹 Bit 1: Binary & Signed Binary

🔢 Binary Number System

What it is:

 Binary is a number system that uses only two digits: 0 and 1.

 It’s the language of computers—everything inside a computer is stored and processed in


binary.

Key Points:

 Base: 2 (because it has 2 digits)

 Each digit is called a bit (short for binary digit).

 Binary numbers grow like this:


0, 1, 10, 11, 100, 101, 110, 111, 1000...
(Just like decimal grows: 0, 1, 2, 3, 4...)

Example:

 Decimal 5 → Binary 101

 Decimal 10 → Binary 1010

Why it matters:

 All digital devices (computers, calculators, etc.) use binary to store and process data.

➕➖ Signed Binary Numbers

What it is:

 Signed binary numbers represent positive and negative values in binary.

 Since binary only has 0 and 1, we need a way to show sign (like + or -).

Common Methods:

1. Sign-Magnitude

o First bit = sign (0 for +, 1 for -)

o Remaining bits = magnitude (value)

o Example:
+5 → 0101
-5 → 1101

2. 1’s Complement
o Flip all bits of the positive number to get the negative.

o Example:
+5 → 0101
-5 → 1010 (flip each bit)

3. 2’s Complement (most commonly used)

o Flip all bits and add 1 to the result.

o Example:
+5 → 0101
-5 → 1011 (flip → 1010, then add 1)

Why it matters:

 Computers need to handle both positive and negative numbers—signed binary makes that
possible.

🔹 Bit 2: Octal & Hexadecimal Numbers

🟠 Octal Number System

What it is:

 Octal uses 8 digits: 0 to 7.

 It’s a shortcut for binary—each octal digit represents 3 binary bits.

Base: 8
Digits used: 0, 1, 2, 3, 4, 5, 6, 7

Why it’s useful:

 Easier to read and write long binary numbers.

 Used in older computer systems and programming (like UNIX file permissions).

Conversion Example:

 Binary 101011 → Group into 3 bits: 101 011


→ Octal: 5 3 → 53₈

 Octal 45₈ → Binary:


4 → 100
5 → 101
→ Binary: 100101

🟣 Hexadecimal Number System


What it is:

 Hexadecimal uses 16 digits: 0–9 and A–F


(A=10, B=11, ..., F=15)

 Each hex digit represents 4 binary bits.

Base: 16
Digits used: 0–9, A–F

Why it’s useful:

 Very compact way to represent binary.

 Widely used in programming, memory addresses, and color codes (like #FF5733).

Conversion Example:

 Binary 11010111 → Group into 4 bits: 1101 0111


→ Hex: D7₁₆

 Hex 2F₁₆ → Binary:


2 → 0010
F → 1111
→ Binary: 00101111

🧠 Quick Tip to Remember:

System Base Digits Used Binary Grouping

Binary 2 0, 1 —

Octal 8 0–7 3 bits per digit

Hexadecimal 16 0–9, A–F 4 bits per digit

🔹 Bit 3: Binary Arithmetic

➕ Binary Addition

Rules (just 4 simple ones):

0+0=0

0+1=1

1+0=1

1 + 1 = 10 (which means 0 and carry 1)

Example:
1011

+ 1101

------

11000

➖ Binary Subtraction

Rules:

0−0=0

1−0=1

1−1=0

0 − 1 = 1 (borrow 1 from left)

Example:

1010

− 0011

------

0111

✖️Binary Multiplication

Rules (same as decimal, but simpler):

0×0=0

0×1=0

1×0=0

1×1=1

Example:

101

× 11

------

101 (101 × 1)

+1010 (101 × 1, shifted one place)

------

1111
➗ Binary Division

Just like long division in decimal, but with binary.

Example:

1010 ÷ 10 = 101

(Decimal: 10 ÷ 2 = 5)

🧠 Quick Tip:

Binary arithmetic is used in:

 CPU operations

 Logic circuits

 Programming (bitwise operations)

🔹 Bit 4: One’s and Two’s Complement Arithmetic

🧮 What Are Complements?

Complements are ways to represent negative binary numbers so that computers can do subtraction
using addition. Sounds strange? It’s actually brilliant!

🔸 One’s Complement

How to find it:

 Flip every bit of the binary number:


0 → 1, 1 → 0

Example:

 Binary of +5 (4-bit): 0101

 One’s complement of -5: 1010

Arithmetic Rule:

 To subtract B from A, do:


A + (One’s complement of B)

 If there’s a carry, add it back to the result.

Example:
A = 6 → 0110

B = 3 → 0011

One’s complement of B = 1100

Add: 0110 + 1100 = 10010

Drop extra bit → 0010

Add carry (1): 0010 + 1 = 0011 → Result = 3

🔹 Two’s Complement

How to find it:

1. Take the One’s complement

2. Add 1 to it

Example:

 Binary of +5 (4-bit): 0101

 One’s complement: 1010

 Two’s complement: 1010 + 1 = 1011 → -5

Arithmetic Rule:

 To subtract B from A, do:


A + (Two’s complement of B)

 Ignore overflow (extra carry bit)

Example:

A = 6 → 0110

B = 3 → 0011

Two’s complement of B = 1101

Add: 0110 + 1101 = 10011

Ignore overflow → Result = 0011 → 3

🧠 Why It Matters

Method Used For Carry Handling

One’s Complement Older systems Add carry back

Two’s Complement Modern computers Ignore overflow

Two’s complement is preferred because:


 Only one representation for zero

 Easier hardware implementation

🔹 Bit 5: Codes & Error Detection/Correction

🧾 What Are Codes?

Codes are binary patterns used to represent characters, numbers, or instructions in digital systems.

✅ Common Types of Codes:

Code Type Purpose Example

BCD (Binary-Coded Decimal) Represents decimal digits in binary 5 → 0101

ASCII (American Standard Code for


Represents text characters A → 01000001
Information Interchange)

Only one bit changes at a time Decimal 3 → Binary


Gray Code
(used in rotary encoders) 0011, Gray 0010

5 → BCD 0101 →
Excess-3 Code BCD + 3 (used in older systems)
Excess-3 1000

Error Detecting Codes

These help identify if data has been corrupted during transmission.

🔍 Common Techniques:

1. Parity Bit

o Adds an extra bit to make the number of 1s either even (even parity) or odd (odd
parity).

o Example:
Data: 1010 → Even parity → Add 0 → 10100

2. Checksum

o Adds all data blocks and sends the sum.

o Receiver checks if the sum matches.

3. Hamming Distance

o Measures how many bits differ between two binary strings.

o Used to detect and correct errors.


4. Cyclic Redundancy Check (CRC)

o Uses polynomial division to detect errors.

o Very powerful and used in networks, storage devices.

Error Correcting Codes

These not only detect errors but also fix them without needing retransmission.

🧠 Key Method:

Hamming Code

 Adds multiple parity bits at specific positions.

 Can detect and correct single-bit errors.

Example (4-bit data + 3 parity bits):

Data: D3 D2 D1 D0

Hamming Code: P1 P2 D3 P4 D2 D1 D0

Parity bits (P1, P2, P4) are calculated based on positions.

If an error occurs, the parity bits help locate and correct it.

🧠 Why It Matters

Feature Detect Errors Correct Errors Used In

Parity Bit ✅ ❌ Simple data checks

Checksum ✅ ❌ Internet protocols, files

CRC ✅✅✅ ❌ Ethernet, storage devices

Hamming Code ✅ ✅ RAM, communication systems

You might also like