0% found this document useful (0 votes)
64 views32 pages

Digital Logic Design Lec04

The document discusses various binary number representations and coding systems, including: 1) Signed binary numbers which use a sign bit to indicate positive or negative values in two's complement or signed magnitude representations. 2) Binary coded decimal which encodes each decimal digit as a 4-bit code to represent numbers for devices like calculators. 3) Gray code which minimizes bit changes between consecutive codes for applications like rotary encoders. 4) ASCII character codes which represent text characters using 7-bit codes.

Uploaded by

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

Digital Logic Design Lec04

The document discusses various binary number representations and coding systems, including: 1) Signed binary numbers which use a sign bit to indicate positive or negative values in two's complement or signed magnitude representations. 2) Binary coded decimal which encodes each decimal digit as a 4-bit code to represent numbers for devices like calculators. 3) Gray code which minimizes bit changes between consecutive codes for applications like rotary encoders. 4) ASCII character codes which represent text characters using 7-bit codes.

Uploaded by

mobeen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 32

DIGITAL LOGIC DESIGN (DLD)

DR. BENISH AMIN


Signed Binary Numbers
• To represent negative integers, we need a notation for
negative values.
• It is customary to represent the sign with a bit placed in
the leftmost position of the number since binary digits.
• The convention is to make the sign bit 0 for positive and
1 for negative.
Signed Binary Numbers
• Signed-Magnitude Representation: Negates a number
by changing its sign.
• Complement Number Systems: negates a number by
taking its complement.
• One’s-Complement
• Two’s-Complement
Signed Binary Numbers
• Example: Representation of -9
Signed Binary Numbers
Signed Binary Numbers
Signed Binary Numbers
• Arithmetic addition
• The addition of two numbers in the signed-magnitude system
follows the rules of ordinary arithmetic. If the signs are the
same, we add the two magnitudes and give the sum the
common sign. If the signs are different, we subtract the smaller
magnitude from the larger and give the difference the sign if the
larger magnitude.
• The addition of two signed binary numbers with negative
numbers represented in signed-2's-complement form is obtained
from the addition of the two numbers, including their sign bits.
• A carry out of the sign-bit position is discarded.
Signed Binary Numbers
Example:
Signed Binary Numbers
Signed Binary Numbers
• Arithmetic Subtraction
• In 2’s-complement form:
1. Take the 2’s complement of the subtrahend (including the sign
bit) and add it to the minuend (including sign bit).
2. A carry out of sign-bit position is discarded.

( 6)  ( 13)
(11111010  11110011)
• Example: (11111010 + 00001101)
00000111 (+ 7)
Signed Binary Numbers
Binary Codes
• BCD Code
• A number with k decimal digits will require 4k bits in BCD.
• Decimal 396 is represented in BCD with 12bits as 0011 1001
0110, with each group of 4 bits representing one decimal digit.
• A decimal number in BCD is the same as its equivalent binary
number only when the number is between 0 and 9.
• The binary combinations 1010 through 1111 are not used and
have no meaning in BCD.
• Examples are digital wrist watches, calculators, voltmeter etc.
Binary Codes
Binary Codes
• BCD addition
• Step 1: Add the two BCD numbers, using the rules for binary
addition
• Step 2: If a 4-bit sum is equal to or less than 9, it is a valid BCD
number.
• Step 3: If a 4-bit sum is greater than 9, or if a carry out of the 4-bit
group is generated,
• it is an invalid result. Add 6 (0110) to the 4-bit sum in order to skip the
six invalid states and return the code to 8421.
• If a carry results when 6 is added, simply add the carry to the next 4-bit
group.
Binary Codes
• Example:
• Consider decimal 185 and its corresponding value in BCD and
binary:

• BCD addition
Binary Codes
• Example:
• Consider the addition of 184 + 576 = 760 in BCD:
Binary Codes
Add the following numbers in BCD:
• 3+4
• 23+15
• 86+13
• 450+917
Binary Codes
• Other Decimal Codes
Binary Codes
Gray Code
The advantage is that only one bit in the code group
changes in going from one number to the next.

Applications
• Rotary Encoder
• Karnaugh Map
• Error correction in digital communication
Binary Codes
Binary-to-Gray Code Conversion:
1. The most significant bit (left-most) in the Gray code is the same as the
corresponding MSB in the binary number.
2. Going from left to right, add each adjacent pair of binary code bits to get
the next Gray code bit. Discard carries.

The Gray code is 11101.


Binary Codes
Gray-to-Binary Code Conversion:
1. The most significant bit (left-most) in the binary code is the same as the
corresponding bit in the Gray code.
2. Add each binary code bit generated to the Gray code bit in the next
adjacent position. Discard carries.

The binary number is 10010.


Binary Codes
ASCII Character Codes
• American Standard Code for Information Interchange (Refer
to Table 1.7)
• A popular code used to represent information sent as
character-based data.
• It uses 7-bits to represent:
• 94 Graphic printing characters.
• 34 Non-printing characters.
• Some non-printing characters are used for text format (e.g.
BS = Backspace, CR = carriage return).
• Other non-printing characters are used for record marking
and flow control (e.g. STX and ETX start and end text areas).
Codes and Characters
• Each character is coded as a byte
• Most common coding system is ASCII (Pronounced ass-
key)
• ASCII = American National Standard Code for
Information Interchange
Most significant
bit

Least significant
bit
e.g., ‘a’ = 1100001
95 Graphic codes
33 Control codes
Alphabetic codes
Numeric codes
Punctuation, etc.

You might also like