0% found this document useful (0 votes)
55 views

Chapter 4 Computer Codes

The document discusses various binary codes including binary coded decimal (BCD), Gray code, and ASCII character codes. It provides examples of how decimal numbers are represented in BCD and how BCD addition is performed. Gray code is introduced as having the advantage that only one bit changes between code values. ASCII character codes are discussed as using 7 bits to represent both printing and non-printing characters with various character properties and uses outlined. Finally, the concept of parity bits is introduced as a way to detect errors in binary codes by making the total number of 1s either even or odd.

Uploaded by

Jontex 254
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)
55 views

Chapter 4 Computer Codes

The document discusses various binary codes including binary coded decimal (BCD), Gray code, and ASCII character codes. It provides examples of how decimal numbers are represented in BCD and how BCD addition is performed. Gray code is introduced as having the advantage that only one bit changes between code values. ASCII character codes are discussed as using 7 bits to represent both printing and non-printing characters with various character properties and uses outlined. Finally, the concept of parity bits is introduced as a way to detect errors in binary codes by making the total number of 1s either even or odd.

Uploaded by

Jontex 254
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/ 12

ECE 2310 Digital Systems Design

Chapter 4
Computer Codes

Digital Logic Design Ch1-1


Binary Codes
• Binary Coded Decimal 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.
11/9/22 2
Digital Logic Design Ch1-2
Binary Code
• Example:
– Consider decimal 185 and its corresponding value
in BCD and binary:

• BCD addition

11/9/22 3
Digital Logic Design Ch1-3
Binary Code
• Example:
– Consider the addition of 184 + 576 = 760 in BCD:

Decimal Arithmetic: (+375) + (-240) = +135

Hint 6: using 10’s of BCD

11/9/22 4
Digital Logic Design Ch1-4
Binary Codes
• Other Decimal Codes

11/9/22 5
Digital Logic Design Ch1-5
Binary Codes)
• Gray Code
– The advantage is that only bit in the
code group changes in going from one
number to the next.
• Error detection.
• Representation of analog data.
• Low power design.
000 001

010 011
100 101

110 111
11/9/22
1-1 and onto!! 6
Digital Logic Design Ch1-6
Binary Codes
American Standard Code for Information Interchange (ASCII) Character Code

11/9/22 7
Digital Logic Design Ch1-7
Binary Codes
• ASCII Character Code

11/9/22 8
Digital Logic Design Ch1-8
ASCII Character Codes
• 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).
11/9/22 9
Digital Logic Design Ch1-9
ASCII Properties
• ASCII has some interesting properties:
– Digits 0 to 9 span Hexadecimal values 3016 to 3916
– Upper case A-Z span 4116 to 5A16
– Lower case a-z span 6116 to 7A16
• Lower to upper case translation (and vice versa) occurs
by flipping bit 6.

11/9/22 10
Digital Logic Design Ch1-10
Binary Codes
• Error-Detecting Code
– To detect errors in data communication and
processing, an eighth bit is sometimes added to
the ASCII character to indicate its parity.
– A parity bit is an extra bit included with a message
to make the total number of 1's either even or
odd.
• Example:
– Consider the following two characters and their
even and odd parity:

11/9/22 11
Digital Logic Design Ch1-11
Binary Codes
• Error-Detecting Code
– Redundancy (e.g. extra information), in the form of extra bits, can
be incorporated into binary code words to detect and correct
errors.
– A simple form of redundancy is parity, an extra bit appended onto
the code word to make the number of 1’s odd or even. Parity can
detect all single-bit errors and some multiple-bit errors.
– A code word has even parity if the number of 1’s in the code word
is even.
– A code word has odd parity if the number of 1’s in the code word
is odd.
– Example: Message A: 100010011 (even parity)
Message B: 10001001 0 (odd parity)

11/9/22 12
Digital Logic Design Ch1-12

You might also like