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

U14 Binary Codes

Uploaded by

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

U14 Binary Codes

Uploaded by

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

BINARY CODES

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
•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
• A BCD number greater than 10 looks
different from its equivalent binary
number, even though both contain 1's
and 0's.
• Moreover, the binary combinations
1010 through 1111 are not used and
have no meaning in BCD.
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:

■ Decimal Arithmetic
Binary Codes
■ Other Decimal Codes
Binary Codes
■ Gray Code
Binary Codes
■ ASCII Character Code
Binary Codes
■ ASCII Character Code
ASCII Character Codes
• American Standard Code for Information Interchange
• 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).
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.

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:
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.
Binary Storage and Registers
■ Registers
 A binary cell is a device that possesses two stable states and is capable of storing one
of the two states.
 A register is a group of binary cells. A register with n cells can store any discrete
quantity of information that contains n bits.
n cells 2n possible states
• A binary cell
– two stable state
– store one bit of information
– examples: flip-flop circuits, ferrite cores, capacitor
• A register
– a group of binary cells
– AX in x86 CPU
• Register Transfer
– a transfer of the information stored in one register to another
– one of the major operations in digital system
– an example
Transfer of information
• The other major component of a digital system
– circuit elements to manipulate individual bits of information
DIGITAL LOGIC GATES
DIGITAL LOGIC GATES
DIGITAL LOGIC GATES
• Extension to Multiple Inputs
DIGITAL LOGIC GATES
• Positive and Negative Logic
DIGITAL LOGIC GATES
• Positive and Negative Logic

You might also like