decimal to bcd conversion steps | what is decimal to bcd calculator with steps circuit in electronics digital communication

By   December 18, 2020

what is decimal to bcd calculator with steps circuit in electronics digital communication decimal to bcd conversion steps ?

Binary Coded Decimal System
The binary coded decimal (BCD) system used each of the 10 decimal digits as a 4 bit binary code. binary coded decimal is useful for outputting to display that are always numeric (0 to 9).
Decimal to BCD conversion
To express any decimal number in BCD simply repalce each decimal digit by the appropriate four bit code.
For example
(a) (1 5 1)10 = (?)BCD
0001 0101 0001 = 000101010001
(b) 3 4 8
0011 0100 1000
= (0011 0100.100)
The 8421 code is predominant BCD code and when we referred to BCD, we always mean 8421 code unless otherwise stated.
BCD to Decimal conversion
in this conversion every four bit digit BCD code is replaced by its equivalent decimal number.
For example
(a) 1001 0110 = (96)10
9 6
(b) 1011 0001
* 1
This conversion is impossible because 1011 is not a valid binary coded decimal. it is not in the range 0 to 9.
(c) 0110 0010 0100
6 2 4
= (62.4)10
Digital Codes
the Gray Code
the gray code is unweighted code. the gray code exhibits only a single bit change from one code number to the next. the gray code can have any number of bits. four bit gray code list is
Decimal Binary Gray
0 0000 0000
1 0001 0001
2 0010 0011
3 0011 0010
4 0100 0110
5 0101 0111
6 0110 0101
7 0111 0100
8 1000 1100
9 1001 1101
Binary to Gray conversion
Step 1. The left most gray digit is the same as the left most binary digit
1 0 1 1 0 Binar
1 Gray
Step 2. Add the left most binary digit to the adjacent one
Step 3. Add the next adjacent
1 0 + 1 1 0 Binary
1 1 1 Gray
Step 4. Add the next adjacent pair
1 0 1 1 0 Binary
1 1 1 0 Gray
Step 5. Add the next adjacent pair
1 0 1 1 0 Binary
1 1 1 0 Gray
thus, required gray code is 11101.
Gray to Binary conversion
For example the conversion of gray code number 11011 to binary is as follows
Step 1. the left most digits are the same
1 1 0 1 1 1 Gray
1 Binary
Step 2. Add last binary digit just generated to the gray digit in the next position. discard carry.
1 1 0 1 1 1 Gray
1 0 Binary
Step 3. Add the last generated binary digit to the next gray digit.
1 1 0 1 1 1 Gray
1 0 0 Binary
Step 4. Add the last binary digit generated to the next gray digit.
1 1 0 1 1 Gray
1 0 0 1 Binary
Step 5. Follow the same as step 2
1 1 0 1 1 Gray
1 0 0 1 0 Binary
the final binary number is 100102.
USE Gray code is not used in arithmetic circuits but is used for input and output devices in digital systems. they are used in instrumentation such as shaft encoders and linear encoders.
Excess – 3 Code
The excess-3 is a digital code that is derived by adding 3 to each decimal digital and converting the result to four bit binary. the following table illustrates this situation for excess-3 code.
Excess-3 codes show seif complemnting property. that is the 1’s complement of excess-3 number is the excess-3 code for the9’s complement of the corresponding decimal number.
Use Excess-3 codes are used in arithmetic circuit because of its property of self complementation.
Alphanumeric Codes
Codes that represent number and alphabetic characters (letters) are called alphanumeric codes. the commonly used alphaumeric codes are
ASCII Code
One standarized alpanumeric code called the American Standard Code for information Interchange (ASCII) most widely used type. it is a seven bit code. seven bit yields 128 different code combinations.
EBCDIC
Another alphanumerirc code frquently encountered is called the Extended binary coded Decimal Interchange Code (EBCDIC). This is an eight bit code.
Binary Arithmetic
Addition There are four basic rules for adding binary digits.
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 102
Sum
Carry
For example Addition of numbers 111 00 and 111 11 is
11 Carry
1 1 1 0 0
+ 1 1 1 1 1
1 1 1 0 1 1
Subtraction There are four basic rules for subtracting binary digits
0 – 0 = 0
1 – 1 = 0
1 – 0 = 1
102 – 1 = 1
Example 5. Subtract 0112 form the number 1012.
Sol. 1
1 0 1 Borrow 1 from next column making a 10 in this columm
Multiplication The following are four basic rules for multiplying binary digits
0 x 0 = 0
0 x 1 = 0
1 x 0 = 0
1 x 1 = 1
Multiplication is performed in binary in the same manner as with decimal numbers.
Example 6. Find out the multiplication of 1 1 1 to 100.
Sol.
1 1 1
1 0 0
0 0 0
0 0 0 x
1 1 1 x x
1 1 1 0 02
Division Division in binary follows the same procedure as division in decimal.
Example 7. Find out 1100 100
BCD Addition
BCD is a numerical code and many applications require that arithmetic operations to be performed. here is, how to add two BCD numbers
1. Add the two numbers, using the rules for binary addition.
2. If a four bit sum is equal to or less than 9, it is valid BCD number.
3. If a four is greater than 9 or if a carry out of the group is generated, it is invalid result. Add 6 (0110)2 to the four bit sum and if a carry is generated when 6 is added, simply add the carry to the next four bit group.
6 (0110)2 is added in the four bit sum in order to skip the six invalid states and return the code to 8421.
For example Addition of the following BCD numbers
BCD Decimal
1 1
0 0 0 1 0 1 1 0 1 6
0 0 0 1 0 1 0 1 1 5
0 0 1 0 1 0 1 1 + 3 1
0 1 1 0
0 0 1 1 0 0 0 1
3 110
Right group is invalid (>9). Left group is valid. Add 6 to invalid code. (Add carry 0001 to next group).
Signed Numbers
There are three binary signed number systems in decimal number system
(i) Sign-Magnitude Representation In this representation, MSB is used to represent sign (0 for positive and 1 for negative ) and the remaining bits are used to represent the magnitude of the number.
For example Binary six bit number 011000 represnt a positive number and its value is 24 whereas 111000 represents a negative number – 24.
The maximum positive number that can be represent using sign magnitude form is + (2n-1 – 1) and maximum negative number is – (2n-1 – 1). Where,n is number of bits.
(ii) One Complement Notation : The 1’s complement of a binary number is found by simply changing all 1’s to 0’s and all 0’s to 1’s.
For example +910 is represented by (1001)2 and its 1’s complement.
1 0 0 1 +9
0 1 1 0 -9
(0110)2 represents -910.
The maximum positive and negative number that can be represented are (2n-1 – 1) and – (2n-1 – 1) respectively.
(iii) 2’s Complement Notation The 2s complement of a binary number is found by adding 1 to the 1’s complemnt.
For example
Binary number
1 0 0 1 1 0 1 1 0 0 1’s complement of 1 0 0 1 1
+ 1 Add 1
0 1 1 0 1 2’s complement of 1 0 0 1 1
An alternative method of obtaining the 2’s complement
1. Start at the right and write the bits as they are upto and including the first 1.
2. Take the 1’s complement of the remaining bits.
For example
First 1 jonit right to left
Binary number
0 0 1 0 0 0 1 1 0 1 0 0 0
1’s complement of original bits These bits remain as they were
2’s complement 1 1 0 1 1 1 0 0 1 1 0 0 0
Complement Binary Arithmetic
The sign number are represnted by 1’s complement or 2’s complement representation and there is a need to use 1’s complement or 2’s complement arithmetic for sign binary number. there are four cases that must be considered when adding two numbers
(i) Both numbers are positive .
(ii) Positive number and smaller negative number.
(iii)Positive number and larger negative number.
(iv) Both numbers are negativa.
2’s Complement Arithmetic
Both number positive
In this case, both sign bits are zero and a 2’s complement is not required.
For example add + 7 and + 4.
7 0 0 0 0 0 1 1 1 MSB is 0
+ 4 0 0 0 0 0 1 0 0 So, result = 11
11 0 0 0 0 0 1 0 1 1
Positive Number and Smaller Negative Number
in this case, the true binary form of the positive number is added to the 2’s complement of the negative number. the sign bits are included in the addition and the result will be positive.
For example Find out the addition of + 15 and -6.
15 0 0 0 0 1 1 1 1 MSB is 0.
– 6 1 1 1 1 1 0 1 0 so, result = 9
9 0 0 0 0 0 1 0 0 1
discard carry
Positive Number and Larger Negtive Number
The true binary form of the positive number is added to the 2’s complement of the negative number. the sign bits are included in the addition and the result will be negative.
For example Find out the addition of + 16 and -24.
16 0 0 0 1 0 0 0 0
+ – 24 1 1 1 0 1 0 0 0
– 8 1 1 1 1 1 0 0 0
2’s complement of – 8.
Because MSB is 1 so, result
= – (2’s complement of 1 1 1 1 1 0 0 0)
= – (0 0 0 0 1 0 0 0 ) = – 8
Both the Numbers are Negative
In this case, the 2’s complement form.
For example find out the adition of -5 and -9.
1 1 1 1 1 1 1 1
– 5 1 1 1 1 1 0 1 1
– 9 1 1 1 1 0 1 1 1
– 14 1 1 1 1 0 0 1 0
2’s complement of – 14
Because MSB is 1 so, output will be
= – (2’s complement of 11110010)
= – (00001110) = – 14
1’s Complement Arithmetic
the addition of sign-numbers takes place using 1’s complement.
Both Number are positive
In this case both sign bits are zero and 1’s complement is not required.
For example Add + 7 and + 3.
7 0 0 0 0 0 1 1 1
+ 3 + 0 0 0 0 0 0 1 1
10 0 0 0 0 1 0 1 0
The most significant bit is 0, so the sign of the number is positive.
Result = + (0 0 0 0 1 0 1 0) = + 10
Addition of Positive and Negative number
in this case, true binary form of positive number is added and sum is negative number in 1’s complement form.
for example Find out the addition of addition of (-7) and (-9).
– 7 1 1 1 1 1 0 0 0
– 9 1 1 1 1 0 1 1 0
-16 1 1 1 1 0 1 1 1 0
1 1 1 0 1 1 1 1
The most significant bit is 1, so the answer is negative and it is in 1’s complement form.
Result = – (1’s complement of 11101111)
= – (00010000) = – 16
these rules can be summarized as follows
1. Add both numbers in true (uncomplemented) form, including the sign bit. the sum bit of the sum will be 0(+).
2. Overflow into the sign bit is possible. the sign bit and the magnitude of the sum will be incorrect, if an overflow occurs.
Case ii Both numbers are negative
1. Takes the 1’s complement or 2’s complement of the magnitude of both numbers. leave the sign bits as they are.
2. Add the numbers in their complement form, including sign bits.
3. Add the end- around carry in the case of the 1’s complement method, drop the carry in the case of the 2’s complement method. the sign bit of the sum will be 1 (-) and the magnitude of the sum will be in complement form.
4. Overflow into the sign bit is possible. the sign bit and magnitude of sum will be incorrect, if an overflow occurs.
Case iii Larger number positive, smaller number negative
1. Take the 1’s or 2’s complement of the magnitude of the negative number. leave the sign bit as it is. a positie number remains in true form.
2. Add the numbers, including the sign bit.
3. Add the end-around carry for the 1’s complement method: drop the carry for the 2’s complement method. the sign bit of the sum will be a 0 (+) and the magnitude will be in the true form.
4. No overflow is possible.
Case iv Larger number negative, smaller number positive
1. Take the 1’s complement or 2’s complernent of the magnitude of the negative number. leave the sign bit as it is. a positive number remains form
2. Add the numbers, including sign bit.
3. No carries will occur. the sum will have the proper sign bit and the magnitude will be in complement.
4. No overflow is possible.

Leave a Reply

Your email address will not be published. Required fields are marked *