What is code conversion?

The method or technique used to convert code from one format to another is termed code conversion. Code conversions are most commonly used in computers, digital electronics, microprocessors, etc.

What is code?

In digital electronics, a group of symbols is used to represent a letter or word, it can be said that letter is being encoded. The group of a symbol used to represent certain letters is known as code. Digitally, data is generated, stored, and transmitted with the help of bits. Combined circuits containing Logic gates. These circuits operate at binary values. Combined circuit results depend on the combination of current inputs.

Bits

The smallest unit of data is termed bits. The bits are used to represent a logical state that consists of one or two values. To represent any data in the computer, the values are either 0 or 1.

Binary code

The group of bits is termed binary codes. Computer programming uses binary language to calculate or represent all the data. Binary code represents any information in terms of 0 or 1. Binary code can be classified into two forms.

  • Weighted code
  • Non-weighted code

When binary code weights each digit they are termed as weighted code whereas when a digit does not have weights it is termed as non-weighted code.

Types of code conversion

In digital electronics, several code conversion techniques are listed below.

  • Binary to BCD conversion code
  • BCD to binary conversion code
  • BCD to excess-3 conversion code
  • Excess-3 to BCD conversion code

What is BCD?

BCD stands for binary coded decimal. The type of number system which uses binary numbers to represent a decimal number. With the help of BCD code, a decimal number is represented by a four-digit binary digit. BCD uses 0000-1001 binary numbers which are equivalent to 0-9 decimal numbers. Assume 1 digit decimal number, then its equivalent BCD will have 4 binary digits. Similarly, if a decimal number has 2 digits, then its equivalent BCD will have 8 binary digits. The list is given below shows binary and BCD code for decimal numbers 0-15.

Decimal NumberBinary NumberBCD
000000000
100010001
200100010
300110011
401000100
501010101
601100110
701110111
810001000
910011001
1010100001 0000
1110110001 0001
1211000001 0010
1311010001 0011
1411100001 0100
1511110001 0101
BCD

What is Excess-3 code?

Excess-3 code can also be represented as XS-3 code. It is a non-weighted code used to represent a decimal number. The decimal number can be easily represented in excess-3 code by adding 3 in its respective binary number. The excess-3 code of some number is represented in the list given below.

Decimal NumberBinary NumberExcess-3 Code
000000011
100010100
200100101
300110110
401000111
501011000
601101001
701111010
810001011
910011100
Excess-3 Code

Binary to BCD conversion

BCD is a decimal number with a binary code, where each digit of the decimal number is represented by its equivalent binary number, and other important decimal numbers are also represented by the same binary number.

For example, a binary number system has base 2 because it has only two numbers representing any number. Similarly, a decimal number system has a base of 10, as it has 10 numbers representing a number.

The following steps are followed to convert the binary number into BCD.

Step 1- Convert the given binary code into a decimal number.

Step 2- Convert a decimal number into BCD code.

BCD to Binary conversion

BCD is a decimal number with a binary code, where each digit of a decimal number is denoted by its equal binary number. That is to say, the LSB decimal number is represented by its equal binary number and similarly, the other important pieces of a decimal number are also represented by their same binary numbers.

Following are the steps to convert BCD code to binary code.

Step 1- Convert the given BCD number to a decimal number.

Step 2- Convert decimal to binary number.

BCD to Excess-3 code conversion

The process of converting BCD to Excess-3 is much simpler in some versions. The Excess-3 code can be calculated by adding 3, i.e., 0011 to each four-letter BCD code. Below is a true BCD conversion table into Excess-3 code. In the table below, the variables A, B, C, and D represent the pieces of binary numbers. The variable 'D' represents LSB, while the 'A' represents MSB. In the same way, the variables w, x, y, and z represent the pieces of code Excess-3. The variable 'z' represents LSB, and the variable 'w' represents MSB. ‘Indifference situations’ are expressed in the ‘X’ variable.

Follow the steps given below to find the excess-3 code of the given BCD number.

Step 1- Convert the given BCD number to its decimal equivalent.

Step 2- Add 310 to the decimal number.

Step 3- Convert decimal to its equivalent binary to obtain excess-3 code.

Excess-3 code to BCD code conversion

Note the step to convert excess-3 code to its equivalent BCD code.

Step: Subtract 00112 to the given excess-3 code to obtain its equivalent BCD.

Common Mistakes

  • Following are the code with their base number.

Binary – 2

Excess-3 – XS-3

Decimal- 10

Octal – 8

Hexadecimal – 16

  • While converting a decimal number to their binary equivalent, the decimal number is divided by 2 whereas converting binary to decimal number gets multiplied by 2.

Context and Applications

In each of the expert exams for undergraduate and graduate publications, this topic is huge and is mainly used for:

  • Bachelor of technology in the electrical and electronic department
  • Bachelor of Science in physics
  • Master of Science in physics
  • Number system
  • Base conversions

Practice Problems

Q1. Gray code are used_____.

  1. Shaft encoders

  2. Shaft encoders

  3. Both

  4. None of these

Correct option: (a)

Explanation: Gray codes are used in shaft encoders because the code of successive numbers differs exactly by one bit from its precede.

Q2 Excess-3 is extensively used for_____.

  1. Addition
  2. Subtraction
  3. Multiplication
  4. Divide

Correct answer: (b)

Explanation: Excess-3 is extensively used for subtraction because every code in XS-3 has its complement. 1’s complement of the code yields 9’s complement of a number itself.

Q3. ECC codes are used for checking the information on the disk.

  1. MBR disks

  2. RAID disks

  3. Both

  4. None of these

Correct option: (b)

Explanation: In RAID disks, ECC codes are used for checking the information on the disk at the time of reading and writing the information, and if it's a mismatch with the information then the correction is made on the fly.

Q4. Binary coded decimal is a combination of____________.

(a) two binary digits

(b) three binary digits

(c) four binary digits

(d) five binary digits

Correct answer: (c)

Explanation:  Binary coded decimal is a combination of 4 binary digits. For example-8421.

Q5. Code is a symbolic representation of __________ information.

(a) continuous

(b) discrete

(c) analog

(d) none of these

Correct answer: (b)

Explanation:  A code is a symbolic representation of different information, which may be present in numbers, letters, or the plural. In particular, it is represented using a numerical system such as decimal or binary and the like.

Want more help with your electrical engineering homework?

We've got you covered with step-by-step solutions to millions of textbook problems, subject matter experts on standby 24/7 when you're stumped, and more.
Check out a sample electrical engineering Q&A solution here!

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.

Search. Solve. Succeed!

Study smarter access to millions of step-by step textbook solutions, our Q&A library, and AI powered Math Solver. Plus, you get 30 questions to ask an expert each month.

Tagged in
EngineeringElectrical Engineering

Digital Electronics

Number System

Arithmetic Operation and Code Conversion in Number System

Code Conversion Homework Questions from Fellow Students

Browse our recently answered Code Conversion homework questions.

Search. Solve. Succeed!

Study smarter access to millions of step-by step textbook solutions, our Q&A library, and AI powered Math Solver. Plus, you get 30 questions to ask an expert each month.

Tagged in
EngineeringElectrical Engineering

Digital Electronics

Number System

Arithmetic Operation and Code Conversion in Number System