Posts

Gray Code in Digital Electronics – Binary to Gray and Gray to Binary Conversion

Image
Introduction In Digital Electronics , codes are used to represent numbers and data efficiently. One such code is the Gray Code , also known as the Reflected Binary Code . Unlike normal binary numbers, Gray Code ensures that only one bit changes at a time between successive numbers. This makes it highly useful in error detection, position encoders, and digital systems . In this blog, we’ll learn: What is Gray Code? Properties of Gray Code Conversion: Binary to Gray Code Conversion: Gray Code to Binary Applications of Gray Code What is Gray Code? Gray Code is a non-weighted code . It differs from BCD and Excess-3 codes, which are weighted. In Gray Code, only one bit changes when moving from one value to the next. Also called Unit Distance Code because only one bit differs between consecutive codes. Example (4-bit Gray Code sequence): 0000, 0001, 0011, 0010, 0110, 0111, 0101, 0100, 1100, … Notice how only one bit changes each time. Conversion Methods B...

Excess-3 (XS-3) Code in Digital Electronics – Explained with Examples

Image
 Introduction In digital electronics, numbers are often represented in binary-coded forms to make processing easier for computers. One such code is the Excess-3 Code (XS-3) , which is widely used in arithmetic operations and error detection. Excess-3 is a non-weighted code derived from the standard 8421 BCD code . It is called “excess-3” because the value 3 is added to each decimal digit before converting it to binary . What is Excess-3 Code? A self-complementing code → the 9’s complement of a decimal digit can be obtained directly by complementing its Excess-3 representation. Each decimal digit (0–9) is represented by its BCD code + 0011 (3 in binary) Conversion Method Decimal → Excess-3 Write the decimal digit. Add 3 to it. Convert the result into 4-bit binary. Example: Convert Decimal 59 into Excess-3 Code Decimal 5 → 5 + 3 = 8 → 1000 Decimal 9 → 9 + 3 = 12 → 1100 So, 59 = 1000 1100 (Excess-3 Code) Excess-3 → Decimal Take the Excess-3 code. ...

Decimal to BCD Conversion (8421, 5421, 2421 Codes) – Digital Electronics

Image
Introduction In Digital Electronics, Binary Coded Decimal (BCD) is a way to represent decimal numbers (0–9) in binary form. Instead of converting the whole decimal number into a binary equivalent, each decimal digit is represented separately by a 4-bit binary code . There are different types of BCD codes depending on the weights assigned to each binary digit: 8421 Code (Natural BCD, Weighted Code) 5421 Code (Weighted Code) 2421 Code (Self-Complementing Weighted Code) Let’s understand each one in detail. 1. 8421 BCD Code (Natural Binary Coded Decimal) This is the most common BCD code . Each digit has positional weights: 8, 4, 2, 1 Decimal numbers 0–9 are represented as 0000–1001       Decimal     8421 BCD 0 0000 1 0001 2 0010 3 0011 4 0100 5 0101 6 0110 7 0111 8 1000 9 1001 Example: Convert Decimal 59 into 8421 BCD 5 → 0101 9 → 1001 So, 59 = 0101 1001 (BCD) 2. 5421 BCD Code In this system, the weights are: 5, 4, 2, 1 Each decima...

Complement of Numbers in Digital Electronics

Image
  Introduction In digital electronics, the concept of complements plays an important role in performing arithmetic operations, representing negative numbers, and simplifying circuit design. Complements are alternative representations of numbers that make it possible to carry out subtraction by addition, which is much easier to implement in hardware. They are also used in error detection techniques. There are two types of complements generally considered for any number system with base r : (r – 1)’s complement, known as the diminished radix complement r’s complement, known as the radix complement Depending on the base of the number system, these complements take different forms such as 9’s and 10’s complements for decimal numbers, 1’s and 2’s complements for binary numbers, and 15’s and 16’s complements for hexadecimal numbers. Complements in the Binary System (Base 2) 1’s Complement The 1’s complement of a binary number is obtained by replacing every 0 with 1 and every 1 ...

Hexadecimal Number System Conversion

Image
  Hexadecimal Number System Conversion – Complete Guide Introduction to the Hexadecimal Number System The hexadecimal number system is a base-16 system that uses 16 symbols : 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , A , B , C , D , E , F Here, A = 10, B = 11, C = 12, D = 13, E = 14, F = 15 (in decimal). It is widely used in digital electronics, computer programming, memory addressing, and color codes in web design because it provides a compact way to represent binary numbers. Types of Hexadecimal Number Conversions Hexadecimal numbers are often converted to and from other number systems: Hexadecimal to Decimal Decimal to Hexadecimal Hexadecimal to Binary Binary to Hexadecimal Hexadecimal to Octal (via binary as an intermediate step) 1. Hexadecimal to Decimal Conversion To convert from hexadecimal to decimal: Multiply each digit by 16 raised to the power of its position (starting from 0 at the rightmost digit). Add the results. ...

Decimal Number Conversion

Image
  Decimal Number System Conversion – Complete Guide Introduction to the Decimal Number System The decimal number system is the most commonly used number system in our daily life. It is a base-10 system that uses ten digits : 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Each digit’s value depends on its position (place value) and the base (10). For example: 345 = (3 × 10²) + (4 × 10¹) + (5 × 10⁰) Types of Decimal Number Conversions We often convert decimal numbers into other number systems in digital electronics, computer science, and mathematics . The main conversions are: Decimal to Binary (Base-2) Decimal to Octal (Base-8) Decimal to Hexadecimal (Base-16) Reverse Conversions (Binary/Octal/Hexadecimal to Decimal) 1. Decimal to Binary Conversion The binary number system uses only two digits: 0 and 1 . Steps for Integer Part: Divide the decimal number by 2. Write down the remainder (0 or 1). Repeat division with the quotient until it becomes 0. Read the ...

Octal conversion

Image
Scroll down to ger pdf What Is the Octal Number System? The Octal (base-8) number system uses digits from 0 to 7 . It's used in computing as a shorthand for binary because 1 octal digit = 3 binary digits (bits) . Example: Octal: 237₈ This is different from Decimal ( 237₁₀ ) or Binary ( 101011₂ ).  1. Octal to Decimal – Explained We convert each octal digit into a power of 8. Decimal (base-10) is what we normally use. So, we want to rewrite the base-8 number into base-10 , by evaluating powers of 8.  Integral Part Let’s take: 237₈ Break it down: 2 × 8² = 2 × 64 = 128 3 × 8¹ = 3 × 8 = 24 7 × 8⁰ = 7 × 1 = 7 Now, add them: 128 + 24 + 7 = 159 So, 237₈ = 159₁₀ Fractional Part Example: 0.52₈ We apply powers of 8 in negative , starting from −1. 5 × 8⁻¹ = 5 × 0.125 = 0.625 2 × 8⁻² = 2 × 0.015625 = 0.03125 Add: 0.625 + 0.03125 = 0.65625 So, 0.52₈ = 0.65625₁₀ 2. Decimal to Octal – Explained We reverse the above process. Integral Part Let’s convert: 1...