0% found this document useful (0 votes)
266 views15 pages

Understanding 8421 BCD Code

Here are the steps to add the 2s complement numbers (+5) and (+4) which equals (+1): (+5): 0101 (+4): 0100 Add: 0101 0100 1001 Discard carry bit: 1001 = (+1) Therefore, the sum of (+5) and (+4) in 2s complement notation is (+1).

Uploaded by

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

Understanding 8421 BCD Code

Here are the steps to add the 2s complement numbers (+5) and (+4) which equals (+1): (+5): 0101 (+4): 0100 Add: 0101 0100 1001 Discard carry bit: 1001 = (+1) Therefore, the sum of (+5) and (+4) in 2s complement notation is (+1).

Uploaded by

taufiqridz
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
  • The 8421 BCD Code
  • BCD Code Quiz
  • The Excess-3 Code
  • Excess-3 Code Quiz
  • The Gray Code
  • Gray Code Quiz
  • The ASCII Code
  • ASCII Code Quiz
  • 2s Complement Notation
  • 2s Complement Conversions
  • 2s Complement Conversion Quiz
  • 2s Complement Arithmetic
  • 2s Complement Arithmetic Quiz

The 8421 BCD Code

BCD stands for Binary-Coded Decimal.


A BCD number is a four-bit binary group that
represents one of the ten decimal digits 0
through 9.
Example:

Decimal number 4926

8421 BCD coded number 0100 1001 0010 0110

QUIZ
Convert the BCD coded number
1000 0111 0001 into decimal.

BCD Coded Number


Decimal Number

1000 0111 0001


8

QUIZ
Convert the decimal number
350 to its BCD equivalent.
Decimal Number
BCD Coded Number

0011 0101 0000

The Excess-3 Code


Add 3 to each digit of decimal
and convert to 4-bit binary form
A BCD code (not 8421 BCD)
Decimal Binary +3 Excess-3
0
0000 0011 0011
1
0001 0011 0100
2
0010 0011 0101
3
0011 0011 0110
4
0100 0011 0111
5
0101 0011 1000
6
0110 0011 1001
7
0111 0011 1010
8
1000 0011 1011
9
1001 0011 1100

Sample Problem:
Decimal

Excess-3

0110 1000 1100

QUIZ
1. To form an excess-3 coded number,
decimal 3 is added to the decimal
number and this is converted to its
4-bit binary code. (True or False)

True

2. The excess-3 BCD number 1010 0100


equals __________ in decimal.

71

3. The decimal number 428 equals


what excess-3 number.

0111 0101 1011

The Gray Code


The Gray codes most
important characteristic is
that only one digit changes
as you increment or
decrement the count.
The Gray code is commonly
associated with input/output
devices such as an optical
encoder of a shafts angular
position.
The Gray code is NOT a BCD
code.

Decimal
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

Gray code
00000
00001
00011
00010
00110
00111
00101
00100
01100
01101
01111
01110
01010
01011
01001
01000
11000

QUIZ
1. The Gray code is not a type of BCD
code. (True or False)
2. The most important characteristic
of the ____________ (BCD, Gray
code) is that only one digit changes
state as you increment or decrement
the count.
3. The Gray code is commonly
associated with input/output devices
such as an optical encoder of a
shafts angular position. (True or
False)

True
Gray code

True

The

ASCII

Code

ASCII is an acronym for American


Standard Code for Information
Interchange
Represents numbers, letters, punctuation
marks and control characters
Standard ASCII is a 7-bit code (127
characters)
Extended ASCII (IBM ASCII), an 8-bit code,
is also very popular
Extended ASCII adds graphics and math
symbols to code (total of 256 symbols)

QUIZ
1. A common 7-bit code used to represent
numbers, letters, punctuation marks,
and control characters is known by
the acronym __________.
2. The acronym ASCII stands for
__________________________.
3. Extended ASCII code is a(n)
__________ (8-bit, 10-bit) code
which adds graphic and math
symbols to ASCII for a total of
256 symbols.

ASCII

American Standard
Code for Information
Interchange
8-bit

2s Complement Notation
2s complement representation - widely
used in microprocessors.
Represents sign and magnitude
MSB

LSB

Sign bit (0 = + ; 1 = -)
Decimal:
-7
2s Complement:
1001

+7

+4

0111

0100

+1
0001

0
0000

-1

-4

1111

1100

2s Complement - Conversions
Converting

positive numbers to 2s complement:

Same as converting to binary


Converting negative numbers to 2s complement:
Decimal to 2s
Complement
- 4 (decimal)
Convert decimal
to binary
0100
1s
complement

1011

Add 1
- 4 = 1 1 0 0 (2s Complement)

2s Complement to
Binary
1 1 0 0 (2s C)
0011

1s
complement
Add 1

0 1 0 0 (Binary)

QUIZ
Q#1Convert
the
decimal
number
4
toto2s2scomplement.
Q#2Convert
the
decimal
number
-7
complement.
Q#3Convert
the
decimal
number
1
toto2s
complement.
Q#4Convert
the
decimal
number
+6
2s
Q#5- Convert the decimal number -8 to 2s complement.
complement.
47(decimal)
16(decimal)
(decimal)
8 (decimal)
(decimal)
0100
0111
0001
0110
1000
1011
1000
Not1110
needed
0111
1100
2s
CC
1001
2s
1111
2s
C
Not
needed
1000
2sC

Step 1: convert decimal to binary

Step 2: convert to 1s complement

Step 3: add +1 equaling 2s complement

ANS:
-4
2sC
ANS:
-7-1===1100
1001
2sC
ANS:
1111
2sC
ANS:
+6
=
0110
ANS: -8 = 1000 2sC
2sC

QUIZ
Q#1Convert
the
2s
complement
number
1110
totodecimal.
Q#2Convert
the
2s
complement
number
0101
decimal.
Q#3Convert
the
2s
complement
number
1001
Q#4- Convert the 2s complement number 1111 to
to decimal.
decimal.
Not1110
needed
1001
1111
Step 1: convert to 1s complement
Not0001
needed
0110
0000
Step 2: Add +1
0010
binary
0101
binary
0111
0001binary
binary
Step 3: convert binary to decimal
25decimal
71decimal
decimal
decimal

ANS:
1110
2sC
==-2
decimal
ANS:
0101
2sC
+5
decimal
ANS:
1001
2sC
=
-7
ANS: 1111 2sC = -1 decimal
decimal

Adding/Subtracting in 2s Complement
2s complement notation makes it possible
to add and subtract signed numbers
(Decimal
)
(- 1)
+ (- 2)
(- 3)

2s
Complement
1111
+ 111
0
1 1 1 0 1 2s complement
Discar
d

(+1)
+ (- 3)
(- 2)

0001
+ 110
1
11 1 0

2s complement

QUIZ
Add the following 2s complement numbers:

(+5)
+ (4)
(+1)

0 1 0 1
+ 1 1 0
0
10 0 0 1

Discard

Common questions

Powered by AI

BCD coding, which encodes each decimal digit into a 4-bit binary equivalent, is less computationally efficient than 2's complement for arithmetic operations, as it often requires additional steps for conversion and can lead to increased data size . In contrast, 2's complement allows easy arithmetic operations without special handling for positive and negative numbers, as it directly supports addition and subtraction of binary values, facilitating faster and simpler computation in hardware implementations .

To convert a decimal number, for instance, -7 into a 2's complement binary number, first convert 7 into binary as 0111, then find the 1's complement as 1000, and add 1 to obtain 1001 as 2's complement . This technique is significant in digital computing as it simplifies arithmetic operations, allowing both positive and negative numbers to be processed uniformly without requiring separate operation paths for different signs, increasing computational efficiency and reducing logic circuit complexity .

The 2's complement notation simplifies arithmetic operations on signed numbers by using a single representation for positive and negative values, which allows direct addition and subtraction without separate sign handling. For example, to convert -4 to 2's complement, convert it to binary as 0100, find its 1's complement 1011, and add 1 to get 1100 . Adding two's complement numbers like -4 (1100) and 5 (0101) results in 1 (0001) without overflow handling, demonstrating efficient handling of sign and magnitude .

The 8421 BCD code represents decimal numbers by converting each decimal digit to a 4-bit binary equivalent. For example, the decimal number '4926' is converted to the BCD code as 0100 1001 0010 0110 . The main limitation of the BCD code in computational use is that it is not efficient for arithmetic operations compared to binary systems, as it uses more bits to store numbers and often requires conversion steps for processing .

ASCII, a 7-bit code, is crucial in digital communication and data storage because it provides a standard way to represent text, including numbers, letters, punctuation marks, and control characters . Extended ASCII, an 8-bit version, expands this set to include graphical and mathematical symbols, essential for diverse computing and display purposes . They facilitate interoperability between different systems and software, allowing consistent data encoding and interpretation across platforms .

ASCII is strategically used in modern data interchange due to its simplicity and widespread adoption, offering consistency in text representation across different platforms . However, its limitation to 127 characters restricts support for international characters and symbols crucial in globalization. This gap is addressed by advancements like Unicode, which encompasses a broader character set suitable for various languages and symbols, enhancing ASCII's capability in global communications .

Excess-3 code provides benefits over standard BCD coding as it is a self-complementary code, simplifying arithmetic processes by eliminating carry issues when performing direct addition without adjustments . Additionally, its uniform gap between any two numbers avoids the complications present in BCD, where gap variations can lead to additional conversion overheads . These features result in more efficient hardware implementations .

The property of the Gray code, where only one bit changes between consecutive numbers, improves reliability by reducing the chance of errors during transitions, which are common in noisy environments or when physical movements are involved, such as in rotary encoders . BCD does not possess this property, making it more susceptible to errors during bit transitions as multiple bits can change simultaneously, potentially causing glitches or incorrect readings .

To convert a decimal number to an Excess-3 code, first add 3 to each decimal digit and then convert the result to a 4-bit binary number. For instance, the decimal digit '4' becomes '7' (4+3) and is represented as 0111 in binary . The advantages of the Excess-3 code include being self-complementary, which simplifies arithmetic operations as each digit's complement can be obtained directly by inverting its bits. This property reduces carry-over complications during addition and subtraction in digital circuits .

The distinguishing feature of the Gray code is that only one bit changes at a time when incrementing or decrementing the count, unlike binary systems where multiple bits might change simultaneously . This property is beneficial in applications such as digital encoders for angular position measurement, where minimizing errors due to simultaneous bit changes (e.g., noise) is critical .

The 8421 BCD Code
• BCD stands for Binary-Coded Decimal.
• A BCD number is a four-bit binary group that 
represents one of th
Convert the BCD coded number
1000  0111  0001 into decimal.
QUIZ
Decimal Number      
  8       7       1
BCD Coded Number
Convert the decimal number 
350 to its BCD equivalent.
Decimal Number      
  3       5        0
BCD Coded Number        0011
The Excess-3 Code
• Add 3 to each digit of decimal 
and convert to 4-bit binary form
• A BCD code (not 8421 BCD)
Decimal   Bi
QUIZ
1.  To form an excess-3 coded number, 
decimal 3 is added to the decimal 
number and this is converted to its 
4-bit bin
The Gray Code
• The Gray code’s most 
important characteristic is 
that  only one digit changes 
as you increment or 
decreme
QUIZ
1.  The Gray code is not a type of BCD 
code.  (True or False)
2.  The most important characteristic 
of the ___________
The  ASCII  Code
• ASCII is an acronym for American 
Standard Code for Information 
Interchange
• Represents numbers, letters
QUIZ
1.  A common 7-bit code used to represent 
numbers, letters, punctuation marks, 
and control characters is known by 
the
• 2s complement representation - widely 
used in microprocessors.
• Represents sign and magnitude
2s Complement Notation
Deci

You might also like