ece – iii sem binary codes
DESCRIPTION
BINARY CODES Electronic digital systems use signals that have two distinct values and circuit elements that have two stable states. There is a direct analogy among binary signals, binary circuit elements, and binary digits. A binary number of n digits, for example, may be represented by n binary circuit elements, each having an output signal equivalent to a 0 or a 1. Digital systems represent and manipulate not only binary numbers, but also many other discrete elements of information. Any discrete element of information distinct among a group of quantities can be represented by a binary code. For example, red is one distinct color of the spectrum. The letter A is one distinct letter of the alphabet. A bit, by definition, the binary digit. When used in conjunction with a binary code, it is better to think of it as denoting a binary quantity equal to 0 or 1. To represent a group of 2n distinct elements in a binary code requires a minimum of n bits. This is because it is possible to arrange n bits in 2n distinct ways. For example, a group of four distinct quantities can be represented by a two-bit code, with each quantity assigned one of the following bit combinations: 00, 01, 10, 11. Manav Rachna UniversityTRANSCRIPT
ECE III SEM BINARY CODES
Manav Rachna University Manav Rachna College of Engineering BINARY
CODES Electronic digital systems use signals that have two distinct
valuesand circuit elements that have two stable states. There is a
direct analogy among binary signals, binary circuitelements, and
binary digits. A binary number of n digits, for example,may be
represented by n binary circuit elements, each having anoutput
signal equivalent to a 0 or a 1. Digital systems represent and
manipulate not only binary numbers,but also many other discrete
elements of information. Any discrete element of information
distinct among a group ofquantities can be represented by a binary
code. For example, red isone distinct color of the spectrum. The
letter A is one distinct letter ofthe alphabet. A bit, by
definition, the binary digit. When used in conjunction with abinary
code, it is better to think of it as denoting a binary
quantityequal to 0 or 1. To represent a group of 2n distinct
elements in a binary code requiresa minimum ofn bits. This is
because it is possible to arrange n bits in2n distinct ways. For
example, a group of four distinct quantities can be represented bya
two-bit code, with each quantity assigned one of the following
bitcombinations: 00, 01, 10, 11. Manav Rachna University A group of
eight elements requires a three-bit code, with eachelement assigned
to one of the following: 000, 001, 010, 011,100, 101, 110, 111. The
examples show that the distinct bit combinations ofan n- bit code
can be found by counting in binary from 0 to (2n-1).Some bit
combinations of n-bit code can be found by the numberof elements of
the group to be coded is not a multiple of thepower of2. The ten
decimal digits 0, 1, 2, 3, ., 9 are anexample of such a group. A
binary code that distinguishes among ten elements mustcontain at
least four bits; three bits can distinguish a maximumof eight
elements. Four bits can form 16 distinct combinations, but since
only tendigits are coded, the remaining six combinations are
unassignedand not used Although the minimum number of bits required
to code 2ndistinct quantities is n, there is no maximum number of
bitsthat may be used for a binary code.] For example, the ten
decimal digits can be coded with ten bits,and each decimal digit
assigned a bit combination of nine 0sand a 1.In this particular
binary code, the digit 6 is assigned thebit combination Manav
Rachna University Binary Codes Binary codes are codes which are
represented inbinary system with modification from the
originalones. Below we will be seeing the following: Weighted
Binary Systems Non Weighted Codes Manav Rachna University Manav
Rachna College of Engineering Weighted Binary Systems
Weighted binary codes are those which obey the positional weighting
principles, each position of the number represents a specific
weight. The binary counting sequence is an example Manav Rachna
University Decimal 8421 2421 5211 Excess-3 0000 0011 1 0001 0100 2
0010 0101 3 0110 4 1010 0111 5 1011 1000 6 1001 7 1101 1100 8 1110
9 1111 Manav Rachna University Manav Rachna College of Engg.
Binary Codes A binary code is a group of n bits that assume up to
2n distinct combinations of 1s and 0s with each combination
representing one element of the set that is being coded. Manav
Rachna University Manav Rachna College of Engg. BCD Binary Coded
Decimal ASCII American Standard Code for Information Interchange
BCD Binary Coded Decimal
Decimal BCD Number Number When the decimal numbers are represented
in BCD, each decimal digit is represented by the equivalent BCD
code.(4-BITS PER DIGIT) Example :BCD Representation of Decimal 6349
Manav Rachna University 8421/BCD Codes Binary codes for decimal
digits require aminimum of four bits. Numerous different codescan
be obtained by arranging four or more bits inten distinct possible
combinations. The BCD (Binary Coded Decimal) is a
straightassignment of the binary equivalent. It ispossible to
assign weights to the binary bitsaccording to their positions. The
weights in theBCD code are 8,4,2,1. Example: The bit assignment
1001, can be seenby its weights to represent the decimal 9because:
1x8+0x4+0x2+1x1 = 9 Manav Rachna University When specifying data,
the user likes to give the data in decimal form.
The BCD (binary-coded decimal) is a straightassigned of the binary
equivalent. It is possible toassign weight to the binary bits
according to theirposition. The weights in the BCD code are
8,4,2,1.The weights in the BCD code are 8,4,2,1. The bitassignment
0110 for example can be interpreted bythe weights to represent the
decimal digit 6because 0X8+1X4+1X2+0X1=6. Numbers are represented
in digital computerseither in binary or in decimal through a
binarycode. When specifying data, the user likes to give thedata in
decimal form. The input decimal numbers are stored internally inthe
computer by means of decimal code. Each decimal digit requires at
least four binarystorage elements. The decimal numbers are
converted to binarywhen arithmetic operations are done
internallywith numbers represented in binary. Manav Rachna
University It is possible to perform the arithmetic
operationsdirectly in decimal with all numbers left in a codedform
throughout. For example, the decimal number 395, whenconverted to
binary, is equal to andconsists of nine binary digits. The same
number,when represented internally in the BCD code,occupies four
bits of each decimal digit, for a total of12 bits The first four
bits represent a3, the next four a 9 and the last four a 5. It is
every important to understand the differencebetween conversion of a
decimal number to binaryand the binary coding of a decimal number.
In each case the final results is a series of bits. Thebits
obtained from conversion are binary digits. Bits obtained from
coding are combinations of 1sand 0s in the digital system may
sometimesrepresent a binary number and at other timesrepresent some
other discrete quantity ofinformation as specified by a given
binary code. Manav Rachna University The BCD code, for example, has
been chosen tobe both a code and a direct binary conversion, aslong
as the decimal numbers are integers from 0to 9. For numbers greater
than 9, the conversion andthe coding are completely different. This
conceptis so important that it is worth repeating withanother
example. The binary conversion of decimal 13 is 1101, thecoding of
decimal 13 with BCD is Manav Rachna University Binary Codes for the
decimal digits
(BCD) 8421 Excess-3 84-2-1 2421 (Biquinary) 0000 0011 1 0001 0100
0111 2 0010 0101 0110 3 4 5 1000 1011 6 1001 1010 1100 7 1101 8
1110 9 1111 Binary Codes for the decimal digits Manav Rachna
University The components used to construct digital systems are
enclosed within IC packages. It is important that the digital
designer be familiar w/ the various digital components encountered
in IC form BINARY CODES It is possible to assign weights to the
binary bitsaccording to their positions. BCD code, , 2421, Weighted
codes Numbers are represented in digital computerseither in binary
or in decimal through a binarycode. Manav Rachna University When
specifying data, the user likes to give the data in decimal form.
2421 Code This is a weighted code, its weights are 2, 4, 2 and 1.
Adecimal number is represented in 4-bit form and thetotal four bits
weight is = 9. Hence the code represents the decimal numbers from 0
to 9. Manav Rachna University 5211 Code This is a weighted code,
its weights are 5, 2, 1 and 1. A decimal number is represented in
4-bit form and the total four bits weight is = 9. Hence the 5211
code represents the decimal numbers from 0 to 9. Manav Rachna
University REFLECTION CODES A code is said to be reflective when
code for 9 iscomplement for the code for 0, and so is for 8 and1
codes, 7 and 2, 6 and 3, 5 and 4. Codes 2421,5211, and excess-3 are
reflective, whereas the code is not. Manav Rachna University
Sequential Codes A code is said to be sequential when twosubsequent
codes, seen as numbers in binaryrepresentation, differ by one. This
greatly aidsmathematical manipulation of data. The and Excess-3
codes are sequential, whereas the and 5211 codes are not Manav
Rachna University Non Weighted Codes Non weighted codes are codes
that are notpositionally weighted. That is, each positionwithin the
binary number is not assigned a fixedvalue. Manav Rachna University
WHAT ARE GRAY CODES Manav Rachna University REFLCETED CODES
Reflected Code(also known as the Gray code)
Digital systems can be designed toprocess data in discrete form
only. Manyphysical systems supply continuousoutput data. These data
must beconverted into digital or discrete formbefore they are
applied to a digital system. Advantage: A number in the reflected
codechanges by only one bit as it proceedsfrom one number to the
next. Manav Rachna University Forming a Gray Code Start with all
0's
Change the least significant bit that forms a newcode word a b c d
e Manav Rachna College of Engg. Binary Reflected Gray Code
Manav Rachna College of Engg. Reflected Gray and Binary Codes
Binary Gray Manav Rachna College of Engg. Why Gray Codes? Single
output changes at a time
Asynchronous sampling Permits asynchronous combinational circuits
to operate in fundamental mode Potential for power savings
Multiphase, multifrequency clock generator Manav Rachna College of
Engg. Why Gray Codes? Manav Rachna College of Engg. Why Gray Codes?
Manav Rachna College of Engg. BINARY CODES Reflected Code Decimal
Equivalent 0000 0001 1 0011 2 0010
0001 1 0011 2 0010 3 0110 4 0111 5 0101 6 0100 7 1100 8 Manav
Rachna College of Engg. BINARY CODES 1101 9 1111 10 1110 11 1010 12
1011 13 1001 14 1000 15 Manav Rachna College of Engg. The Reflected
Code Digital system can be designed to process data indiscrete form
only. Many physical systems supply continuous outputdata. These
data must be converted into digital ordiscrete form before they are
applied to a digitalsystem. Continuous or analog information is
converted touse the reflected code shown in table 1-4 torepresent
the digital data converted from theanalog data. The advantage of
the reflected code over purebinary numbers is that a number in the
reflectedcode changes by only one bit as it proceeds fromone number
to the next. A typical application of the reflected code occurswhen
the analog data are represented by acontinuous change of a shaft
position. The shaft is partitioned into segments, and eachsegment
is assigned a number. Manav Rachna College of Engg. APPLICATION OF
GRAY CODE
Manav Rachna College of Engg. APPLICATION OF GRAY CODE
Manav Rachna College of Engg. GRAY CODES Manav Rachna College of
Engg. CONVERTING BETWEEN GRAY & BINARY CODES
Manav Rachna College of Engg. CONVERTING BETWEEN GRAY & BINARY
CODES
Manav Rachna College of Engg. CONVERTING BETWEEN GRAY & BINARY
CODES
Manav Rachna College of Engg. CONVERTING BETWEEN GRAY & BINARY
CODES
Manav Rachna College of Engg. CONVERTING BETWEEN GRAY & BINARY
CODES
Manav Rachna College of Engg. CONVERTING BETWEEN GRAY & BINARY
CODES
Manav Rachna College of Engg. CONVERTING BETWEEN GRAY & BINARY
CODES
Manav Rachna College of Engg. CONVERTING BETWEEN GRAY & BINARY
CODES
Manav Rachna College of Engg. CONVERTING BETWEEN GRAY & BINARY
CODES
Manav Rachna College of Engg. CONVERTING BETWEEN GRAY & BINARY
CODES
Manav Rachna College of Engg. CONVERTING BETWEEN GRAY & BINARY
CODES
Manav Rachna College of Engg. CONVERTING BETWEEN GRAY & BINARY
CODES
Manav Rachna College of Engg. CONVERTING BETWEEN GRAY & BINARY
CODES
Manav Rachna College of Engg. CONVERTING BETWEEN GRAY & BINARY
CODES
Manav Rachna College of Engg. CONVERTING BETWEEN GRAY & BINARY
CODES
Manav Rachna College of Engg. CONVERTING BETWEEN GRAY & BINARY
CODES
Manav Rachna College of Engg. CONVERTING BETWEEN GRAY & BINARY
CODES
Manav Rachna College of Engg. CONVERTING BETWEEN GRAY & BINARY
CODES
Manav Rachna College of Engg. CONVERTING BETWEEN GRAY & BINARY
CODES
Manav Rachna College of Engg. CONVERTING BETWEEN GRAY & BINARY
CODES
Manav Rachna College of Engg. CONVERTING BETWEEN GRAY & BINARY
CODES
Manav Rachna College of Engg. Excess-3 Code Excess-3 is a non
weighted code used to expressdecimal numbers. The code derives its
name fromthe fact that each binary code is thecorresponding 8421
code plus 0011(3). Example: 1000 of 8421 = 1011 in Excess-3 Manav
Rachna College of Engg. EXCESS-3 CODE Manav Rachna College of Engg.
Alphanumeric Codes Many applications of digital computers require
thehandling of data that consist not only of numbers, butalso of
letters. For instance, an insurance company with millions ofpolicy
holders may use a digital computer to process itsfiles. To
represent the policy holders name in binary form, itis necessary to
have a binary code for the alphabet. In addition, the same binary
code must representdecimal numbers and some other special
characters. An alphanumeric (sometimes abbreviatedalphanumeric)
code is binary code of a group of elementconsisting of special
symbol such as $. The total number of elements in an in
alphanumericgroup is greater than 36. Manav Rachna College of Engg.
Therefore, it must be coded with a minimumofsix bits (26=64, but 25
= 32) isinsufficient.
One possible arrangement of six bitalphanumeric code is shown in
Table1-5under the name internal code. With few variations, it is
used in manycomputers to represent alphanumericcharacters
internally. The need to represent more than 64characters (the
lowercase letters and specialcontrol characters for the
transmission ofdigital information) gave rise to seven andeight-bit
alphanumeric codes. One such code is known as ASCII
(AmericanStandard Code for InformationInterchange); another is
known as EBCDIC(Extended BCD Interchange Code). Manav Rachna
College of Engg. The ASCII code listed in table 1-5 consists of
sevenbits but is, for all practical purposes, an eight-bitcode
because an eighth bit is invariably added forparity. Most computers
translate the input code into aninternal six-bit code. As an
example, the internalcode representation of the name John Doe is: J
O H N blank D O E Manav Rachna College of Engg. ASCII CODES The
Problem
Representing text strings, such as Hello, world, in a computer
Manav Rachna College of Engg. Codes and Characters Each character
is coded as a byte
Most common coding system is ASCII(Pronounced ass-key) ASCII =
American National Standard Code forInformation Interchange Defined
in ANSI document X Manav Rachna College of Engg. ASCII Features
7-bit code 8th bit is unused (or used for a parity bit)
27 = 128 codes Two general types of codes: 95 are Graphic codes
(displayable on a console) 33 are Control codes (control features
of the console or communications channel) Manav Rachna College of
Engg. ASCII Chart Manav Rachna College of Engg. Most significant
bit Least significant bit e.g., a = 95 Graphic codes 33 Control
codes Alphabetic codes Numeric codes Punctuation, etc. Hello, world
Example = Binary 01001000 01100101 01101100 01101111
Hexadecimal 48 65 6C 6F 2C 20 77 67 72 64 Decimal 101 108 111 44 32
119 103 114 100 H e l o , w r d Manav Rachna College of Engg.
Common Control Codes CR 0D carriage return LF 0A line feed
HT09horizontal tab DEL7Fdelete NULL00null Manav Rachna College of
Engg. Hexadecimal code Terminology Learn the names of the special
symbols [ ] brackets
{ }braces ( )parentheses @commercial at sign & ampersand ~tilde
Manav Rachna College of Engg. Escape Sequences Extend the
capability of the ASCII code set
For controlling terminals and formattingoutput Defined by ANSI in
documents X and X The escape code is ESC =1B16 An escape sequence
begins with twocodes:ESC [ Manav Rachna College of Engg. 5B16 1B16
Examples Erase display: ESC [ 2 J Erase line: ESC [ K
Manav Rachna College of Engg. EBCDIC Extended BCD Interchange Code
(pronounced ebb-se-dick)
8-bit code Developed by IBM Rarely used today IBM mainframes only
Manav Rachna College of Engg. THE END Manav Rachna College of
Engg.