0% found this document useful (0 votes)
20 views24 pages

BIT102 SLM Library - SLM - Unit 03

Uploaded by

pavanmay227597
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)
20 views24 pages

BIT102 SLM Library - SLM - Unit 03

Uploaded by

pavanmay227597
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/ 24

Digital Electronics Unit 3

Unit 3 Digital Codes


Structure:
3.1 Introduction
Objectives
3.2 BCD Code
3.3 Gray code
3.4 Alphanumeric Codes
3.5 Error Detection Codess
3.6 Summary
3.7 Terminal Questions
3.8 Answers

3.1 Introduction
In the previous unit we studied different types of number systems and
conversion of numbers from one number system into the other. We also
studied negative number representation and arithmetic operations using 1’s
and 2’s complements. Computers play a very important role in modern IT
world and have touched every part of our lives. We know that digital
systems use signals that have two separate or distinct values and the
corresponding circuit elements have two stable states. We can represent
any information using binary code (i.e., a pattern of 0’s and 1’s). The codes
must be in binary because, digital circuits manipulate patterns of 0’s and 1’s.
However, it must be realized that binary codes merely change the symbols,
not the meaning of the elements of information that they represent. If we
inspect the bits of a computer at random, we will find that most of the time
they represent some type of coded information rather than binary numbers.
Computers and other digital circuits process data in binary format. Various
binary codes are used to represent data which may be numeric, alphabetic
or special characters. Codes are also used for error detection and error
correction in digital systems. Although, the information is represented in
binary form, the interpretation of data is possible only if the code in which
the data is being represented is known. For example, the binary number
1000010 represents 66 (decimal) in straight binary, 42 (decimal) in BCD,
and letter B in ASCII code. Hence, while interpreting the data, one must be
very careful regarding the code used. In this unit, we will discuss some of

Sikkim Manipal University B2072 Page No.: 58


Digital Electronics Unit 3

the commonly used digital codes namely BCD, Gray code and
alphanumeric codes.

Objectives:
After studying this unit, you should be able to:
 discuss the importance of BCD code
 convert a given gray code to binary and vice versa
 illustrate the use of ASCII code
 discuss EBCIDIC code
 list and compare different error detection codes.

3.2 BCD Code


When we use special group of symbols to represent numbers, letters, or
words, then we say they are being encoded, and the group of symbols used
is called a code. However, when we convert the decimal into straight binary
equivalent it forms a kind of code as well, but when a decimal number value
is large, the conversion becomes complicated and lengthy. Another way of
encoding decimal numbers is using a technique called BCD (Binary Coded
decimal).
In BCD, decimal digits are coded with 4 bit binary code. This means, in BCD,
each decimal digit is represented by a four bit binary code. With 4 bit code
we can get 24 =16 combination of codes. However, only ten different codes
are required for representing ten decimal digits 0 through 9. So the
remaining six codes are invalid in BCD. Though there are other BCD codes
like 2421 code, we normally use 8421 BCD code. So when we mean BCD,
it refers to 8421 code. This 8421 indicates the weights assigned to the 4 bits
as 23, 22, 21, 20.

Sikkim Manipal University B2072 Page No.: 59


Digital Electronics Unit 3

The table 3.1 shows the BCD representation of decimal digits.


Table 3.1: BCD (8421) Code
BCD
Decimal
(8421)
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001

We observe from the table 3.1 that only ten codes from 0000 to 1001 are
valid in BCD. The remaining codes 1010, 1011, 1100, 1101, 1110 and 1111
are not allowed in BCD and hence these six codes are invalid codes.
The advantage of the BCD encoding is that the conversion of binary
sequence to decimal digits for printing or display is easier and also the
decimal calculations will be faster. The drawbacks of the BCD encoding are
the complexity of the digital circuits which are used to implement the
mathematical operations increases, and because of a relative inefficient
encoding than a pure binary representation, BCD requires more space.
Decimal to BCD Conversion:
The following example illustrates the conversion of decimal number to BCD
code.
Example 3.1: Convert (6838)10 into its BCD equivalent
6 8 3 8 ← Decimal Number

0110 1000 0011 1001← BCD


∴ (6838)10 = 0110100000111001 (BCD)

Sikkim Manipal University B2072 Page No.: 60


Digital Electronics Unit 3

BCD to Decimal Conversion:


The following example illustrates the conversion of BCD code to decimal
number.
Example 3.2: Covert the BCD code 1000001001111001 to decimal.
1000 0010 0111 1001 : BCD

9 6 7 9 : Decimal

∴ (1000001001111001) BCD = (9679)10

Big-endian and Little-endian Systems


The terms endian and endianness refer to the convention used to interpret
the bytes making up a data word when those bytes are stored in computer
memory. In computing memory, the data will be stored as a group of eight
bits called byte. When reading or writing a data word consisting of multiple
such units, the order of the bytes stored in memory determines the
interpretation of the data word.
Each memory will have its own address assigned to it. Big-endian systems
store the most significant byte of a word in the smallest address and the
least significant byte is stored in the largest address. Little-endian systems,
store the least significant byte in the smallest address and most significant
byte of a word in the largest address.
The figure 3.1 shows an example using the data word "0A 0B 0C 0D" (a set
of 4 bytes (written in hexadecimal notation) and the four memory locations
with addresses a, a+1, a+2 and a+3.

Sikkim Manipal University B2072 Page No.: 61


Digital Electronics Unit 3

Figure 3.1: Big endian and Little endian representation

In big-endian systems, byte 0A is stored in a, 0B in a+1, 0C in a+2 and 0D


in a+3.
In little-endian systems, the order is reversed with 0D stored in memory
address a, 0C in a+1, 0B in a+2, and 0A in a+3.
BCD Arithmetic: In BCD we perform the following two operations.
BCD addition:
We can perform addition in BCD using the following in three steps:
1) Add the numbers in binary.
2) Check if the number is greater than 9 or any carry is generated from
lower nibble to higher nibble (i.e. from bit D3 to D4).
3) If the number is greater than 9 (i.e.>1001) or any carry is generated from
lower nibble to higher nibble, then convert the sum of two numbers to
BCD number by adding correction value .
The following examples illustrate this procedure.
Example 3.3: Add 8 + 6 in BCD
8 1000
+6 + 0110
14 0000 1110 invalid BCD sum since 1110 cannot exist
and is greater than 1001.

Sikkim Manipal University B2072 Page No.: 62


Digital Electronics Unit 3

To get correct answer, a correction value of 6 (0110) will be added to the


invalid BCD sum as illustrated below.
0000 1110
+ 0000 0110 Correction factor 6 added.
0001 0100 = 14 Valid BCD sum.

Example 3.4: Add 8 + 9 in BCD


1 ← CARRY
8 1000
+9 + 1001
17 0001 0001 Invalid BCD sum since carry generated
and from D3 to next higher column.
To get correct answer, a correction value of 6 (0110) will be added to the
lower nibble of BCD sum from which a carry has been generated as
illustrated below.
0001 0001
+ 0110
0001 0111 =17 Valid BCD sum.

BCD Subtraction
In BCD subtraction, each difference should be less than or equal to 9 (1001).
If it exceeds 9, then 6 (0110) is subtracted from that difference.
Example 3.5: Subtract (45)10-(18)10 in BCD
Decimal BCD subtraction
45 → 0100 0101
- 18 → 0001 1000
27 0010 1101 → Invalid BCD
- 0110 → subtract 0110
0010 0111 → Valid BCD
 0010 1110 which is 27 in decimal is the answer.

Sikkim Manipal University B2072 Page No.: 63


Digital Electronics Unit 3

Packed BCD and Unpacked BCD: A packed BCD uses two digits per byte
where as an unpacked BCD uses one digit per byte.
For example, consider the decimal number 79.This can be put in packed
and unpacked format as follows:
Decimal Number: 7 9
Packed BCD: 0111 1001
Un Packed BCD: 0000 0111 0000 1001
To convert a two-byte unpacked BCD number into a single byte packed
BCD number, shift the upper byte left four times, then perform logic OR
operation with the results with the lower byte.
Decimal to Packed BCD Conversion:
To convert a decimal number into a packed BCD number, assign each digit
of the decimal to its 4-bit equivalent, adding zeroes to the upper nibble if
necessary. For example, consider the number 235. This number can be put
in Packed BCD format as follows:
Decimal Number: 2 3 5
Packed BCD: 0000 0010 0011 0101
Decimal to Unpacked BCD conversion: To convert a decimal number into
an unpacked BCD number, assign each decimal digit its 8-bit binary
equivalent. Now consider the number 235. This can be put in unpacked
BCD as follows:
Decimal Number: 2 3 5
Packed BCD: 0000 0010 00000011 00000101
Self-Assessment Questions
1. In BCD, each decimal digit is represented by a ______ bit binary code.
2. In BCD, which of the following codes is invalid?
(a) 1000 (b) 1011 (c) 0101 (d) 1001
3. The BCD code for decimal number (6838)10 is _________________.
4. The BCD code 1001011000010101 represents __________ in decimal.
5. ______________ systems store the most significant byte of a word in
the smallest address and the least significant byte is stored in the
largest address.
6. For the decimal number 235, the packed BCD is ________________.

Sikkim Manipal University B2072 Page No.: 64


Digital Electronics Unit 3

3.3 Gray Code


Digital systems respond to changes in the digital inputs at a faster rate. But
when multiple inputs change at the same time, possibility of
misinterpretation can happen and this causes an erroneous reaction. For
example, consider when the three-bit binary number for 3 changes to 4, all
three bits must change state. To reduce the likelihood of a digital circuit
misinterpreting a changing input, the Gray code can be used as a way to
represent a sequence of numbers. The Gray code is an unweighted code
which means, various bits in their position do not represent their positional
weightage. The Gray code may contain any number of bits. Table 3.2 shows
the three-bit binary and corresponding Gray code.
Table 3.2: Three-bit binary and corresponding Gray code

It is observed from the table 3.2 that there is only one bit change between
two successive numbers in the sequence. This is the unique property of the
Gray code. For example, if we consider the Gray codes 010 and 110, there
is only one bit change in the Gray code bit G2. Similarly, when we consider
the next codes 110 and 111, there is a single bit change in Gray code bit
G0. In other words, there is only one bit in the code group that changes
while going from one number to the next. Hence it is called unit distance
code.

Sikkim Manipal University B2072 Page No.: 65


Digital Electronics Unit 3

The common application of the Gray code is in shaft position encoders as


shown in figure 3.2.

Figure 3.2: Eight position, three-bit shaft encoder.

These devices produce a binary value that represents the position of a


rotating mechanical shaft. There will be more bits in case of a practical shaft
encoder and the rotation gets divided into many more segments than eight,
enabling it to detect much smaller increments of rotation.
Binary to Gray Conversion:
Binary to gray conversion employs following rules
1) The most significant bit (MSB) in the Gray code is the same as the
corresponding digit in the binary number
2) Starting from left to right, perform Ex-OR operation on adjacent pair of
binary bits to get the next Gray code bit.
Example 3.6: Compute the Gray code of the Binary number 110010(2)
Binary
1 1 0 0 1 0
Number

Gray
1
Code
Binary
1  1 0 0 1 0
Number

Gray
1 0
Code
Binary
1 1  0 0 1 0
Number

Sikkim Manipal University B2072 Page No.: 66


Digital Electronics Unit 3

Gray
1 0 1
Code
Binary
1 1 0  0 1 0
Number

Gray
1 0 1 0
Code
Binary
1 1 0 0  1 0
Number

Gray
1 0 1 0 1
Code
Binary
1 1 0 0 1  0
Number

Gray
1 0 1 0 1 1
Code

Thus Binary number 110010 has a Gray code 101011


A combinational logic circuit to implement binary to gray code conversion is
shown in figure 3.3 which employs EX-OR logic gates.

Figure 3.3: Logic circuitry for 5 bit Binary to Gray Conversion

Now we shall see some more examples


Example 3.7: Covert binary 10111011 into Gray code.
Binary Code : 1─  → 0 ─  →1 ─  →1─  →1─  →0─  →1  →1
↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
Gray Code : 1 1 1 0 0 1 1 0

Sikkim Manipal University B2072 Page No.: 67


Digital Electronics Unit 3

Example 3.8: Covert binary 10011001 into Gray code.


Binary Code : 1─  → 0 ─  →0 ─  →1─  →1─  →0─  →0  →1
↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓
Gray Code : 1 1 0 1 0 1 0 1

Gray code to Binary Conversion


To convert from Gray code to binary, a similar method is used with the
following rules
1) The most significant bit (MSB) in the binary code is the same as the
corresponding digit in the Gray code
2) Perform Ex-OR operation with each binary bit generated to the next
Gray code bit to get new binary bit.
Example 3.9: Convert the Gray code 101011 to Binary
Gray
1 0 1 0 1 1
Code

Binary
1
Number
Gray
1 0 1 0 1 1
Code
 ↓
Binary
1 1
Number
Gray
1 0 1 0 1 1
Code
 ↓
Binary
1 1 0
Number
Gray
1 0 1 0 1 1
Code
 ↓
Binary
1 1 0 0
Number
Gray
1 0 1 0 1 1
Code
 ↓

Sikkim Manipal University B2072 Page No.: 68


Digital Electronics Unit 3

Binary
1 1 0 0 1
Number
Gray
1 0 1 0 1 1
Code
 ↓
Binary
1 1 0 0 1 0
Number

Thus Gray code 101011 has a Binary number 110010


A combinational logic circuit to implement binary to gray code conversion is
shown in figure 3.4 which employs Ex-OR logic gates.

Figure 3.4: Logic circuitry for 5 bit Gray to Binary Conversion

Example 3.10: Convert the Gray Code 11100110 into binary code.

Example 3.11: Convert the gray code 11010101 to binary

Sikkim Manipal University B2072 Page No.: 69


Digital Electronics Unit 3

Self-Assessment Questions
7. The ______________ code is an unweighted code.
8. The Gary code is called unit distance code because there is a single bit
change when we go from one code to the next successive code.
(State true or false)
9. The Gray code for binary number110010 is ___________________.

3.4 Alphanumeric Codes


A numeric data consists of numbers like 0.1,2 3,…,9 and alphabetic data
consists of letters a,b,c,…, z (in both upper and lower case), and blank
characters. Alphanumeric data consists of letters, characters and special
symbols or characters such as +,-,*,/, . , = , etc.
Alphanumeric codes are binary codes used to represent alphanumeric data.
In other words, the codes that can represent both letters and numbers are
called alphanumeric codes. The codes write alphanumeric data, including
letters of the alphabet, numbers, mathematical symbols and punctuation
marks, in a form that is understandable and processable by a computer.
These codes enable us to interface input–output devices such as
keyboards, printers, VDUs (Visual Display Units), etc., with the computer.
Let us study two such alphanumeric codes: ASCII code and EBCIDIC code
ASCII Code:
ASCII stands for American Standard Code for Information Interchange. It is
pronounced ‘ask-ee’. This code was first published as a standard in 1967.
Basically it is a 7-bit character code that represents 27=128 code groups for
different characters where every single bit represents a unique character.
ASCII code can be considered an 8 bit code with MSB always 0 (Zero).
ASCII codes are used to transfer alphanumeric information between a
computer and external communication equipments or devices such as
printer or another computer. Most computer keyboards use ASCII code. So
when we type any letter or number, this gets converted to ASCII code that
goes into the computer. ASCII code defines 95 printable characters
including 26 upper-case letters (A to Z), 26 lower-case letters (a to z), 10
numerals (0 to 9) and 33 special characters including mathematical
symbols, punctuation marks and space characters. In addition, it also
defines codes for 33 nonprinting, mostly obsolete control characters that

Sikkim Manipal University B2072 Page No.: 70


Digital Electronics Unit 3

affect how text is processed. So all the standard keyboard characters and
control functions like return and linefeed functions can conveniently be
represented with different code groups. The table 3.3 shows the partial
listing of ASCII code. The table also shows the hexadecimal and octal
equivalents.
Table 3.3: Partial listing of ASCII code.

Example 3.12: What is the message that the code


1000011 1001111 1001101 1000101 represents?
1000011 1001111 1001101 1000101 ← Given code
C O M E ← Character
Thus, 1000011 1001111 1001101 1000101 represents COME.

Sikkim Manipal University B2072 Page No.: 71


Digital Electronics Unit 3

EBCDIC Code
EBCDIC pronounced as ‘eb-si-dik stands for Extended Binary Coded
Decimal Interchange Code. It is also alphanumeric code used by IBM
mainframes for its operating systems. EBCDIC is an 8 bit character coding
and represents 28=256 combinations. However several combinations are
not being used. EBCDIC has more control characters compared to ASCII.
Although EBCDIC is not widely used with personal computers, it is well-
known and recognized primarily as an IBM code for the corporation's
mainframes and minicomputers. EBCDIC currently exists in at least six
mutually incompatible versions. Although most characters are the same in
ASCII and EBCDIC, some ASCII characters do not exist in EBCDIC
(e.g., square brackets--[]) and EBCDIC contains some characters (e.g., the
"cent" sign--¢--and the "not" sign--¬) that are not in ASCII.
The character encoding is based on Binary Coded Decimal (BCD), so the
contiguous characters in the alphanumeric range are formed up in blocks of
up to 10 from 0000 binary to 1001 binary. Non alphanumeric characters are
almost all outside the BCD range.
There are four main blocks in the EBCDIC code page: 0000 0000 to 0011
1111 is reserved for control characters; 0100 0000 to 0111 1111 for
punctuation; 1000 0000 to 1011 1111 for lowercase characters and 1100
0000 to 1111 1111 for uppercase characters and numbers.
The table 3.4 shows the partial listing of EBCDIC code.

Sikkim Manipal University B2072 Page No.: 72


Digital Electronics Unit 3

Table 3.4: Partial listing of EBCDIC code

UNICODE:
We know that digital computers deal with numbers. They store letters and
other characters by assigning a number for each one. Though there are
hundreds of different encoding systems for assigning these numbers, no
single encoding scheme contains enough characters. The Encoding

Sikkim Manipal University B2072 Page No.: 73


Digital Electronics Unit 3

schemes such as ASCII and EBCDIC don’t have sufficient number of


characters to be able to encode alphanumeric data of all forms scripts and
languages. Moreover, these encoding schemes don’t allow multilingual
computer processing. Two encodings used the same number for two
different characters, or use different numbers for the same character there
by creating conflicts with one another. For example, the code 4E is same for
the letter N in ASCII and “+” sign in EBCIDIC code. This creates conflicts
between two codes while representing characters. So a complete character
encoding called Unicode is developed in conjunction with the Universal
Character Set standard and is published as The Unicode Standard. Unicode
is a computing industry standard for encoding, representation, and handling
of text expressed in most of the world's writing systems. Unicode provides a
unique number for every character, irrespective of the platform, program,
and language.
Unicode covers all the characters for all the writing systems of the world,
modern and ancient. It also includes technical symbols, punctuations, and
many other characters used in writing text.
The range of Unicode is expressed by using the U+ form, for example:
U+0100..U+03FF. The first version of Unicode was a 16-bit encoding (1991
to 1995), but with Unicode 2.0 (July, 1996), it has not been a 16-bit
encoding. The Unicode Standard encodes characters in the range
U+0000 ..U+10FFFF, which is a 21-bit code space. Each character will be
represented either as a sequence of one to four 8-bit bytes, one or two 16-
bit code units, or a single 32-bit code unit depending on the encoding form
we choose like UTF-8, UTF-16, or UTF-32. A Unicode transformation
format (UTF) is an algorithmic mapping from every Unicode code point
(except surrogate code points) to a unique byte sequence.
UTF-8 is the byte-oriented encoding form of Unicode. UTF-8 codes are
identical to standard ASCII (0-127) characters. UTF-16 uses 16-bit code
capable of encoding 1,112,064 possible characters in Unicode. The
encoding is variable-length, as code points are encoded with one or two 16-
bit code unit. UTF-32 uses exactly 32 bits per Unicode code point. So it is a
fixed-length encoding. Any Unicode character can be represented as a
single 32-bit unit in UTF-32.

Sikkim Manipal University B2072 Page No.: 74


Digital Electronics Unit 3

Versions of the Unicode Standard are fully compatible and synchronized


with the corresponding versions of International Standard ISO/IEC 10646,
which defines the Universal Character Set character encoding.
Version numbers for the Unicode Standard consist of three fields, the major
version, the minor version, and the update version. For example, “Unicode
3.1.1” indicates major version 3 of the Unicode Standard, minor version 1 of
Unicode 3, and update version 1 of minor version Unicode 3.1.
The latest version of Unicode is Unicode 7.0.0 (released in June 2014). It
contains a repertoire of more than 110,000 characters covering 100 scripts
and multiple symbol sets.
Self-Assessment Questions
10. The codes that can represent both letters and numbers are called
______________________ codes.
11. ASCII stands for ___________________________________.
12. ________________ is also alphanumeric code used by IBM
mainframes for its operating systems.
13. The code ______ is same for the letter N in ASCII and + sign in
EBCIDIC code.
14. ___________ provides a unique number for every character,
irrespective of the platform, program, and language.

3.5 Error Detection Codes


Error detection and correction (or error control) are techniques that
enable reliable delivery of digital data over unreliable communication
channels. Due to the electrical noise entering into the communication
channels, errors will be introduced during transmission from the source to a
receiver. The concept of noise is shown in figure 3.5.

Sikkim Manipal University B2072 Page No.: 75


Digital Electronics Unit 3

Figure 3.5: Noise causing an error during digital data transmission

In the figure 3.5, it can be observed that the original data sent from
transmitter gets distorted due to noise and error data signal is represented
as x. Error detection techniques detect such errors, and error correction
enables reconstruction of the original data.
The general definitions of the terms are as follows:
 Error detection is the detection of errors caused by noise or other
impairments during the data transmission from the transmitter to the
receiver.
 Error correction is the detection of errors and reconstruction of the
original data that is free of errors.
Usually binary information will be transmitted through communication
medium, e.g. using wires or wireless media. When noise gets added, the
bits get corrupted and may change from 0 to 1 or vice versa. So to detect
the errors at the receiver’s end, the sender sends an extra bit called parity
bit attached to the original binary message. A parity bit attached to the n-bit
binary message makes the total number of 1’s in the message (including the
parity bit) either odd or even. If the parity bit makes the total number of 1’s
an odd number, it is called odd parity. If the parity bit makes the total
number of 1’s even number, it is called even odd parity.
For example, suppose that we want to transmit the data 1000011. This is
the ASCII character “C.” The data has three 1s which is an odd number.
Therefore, we will add a parity bit of 1 to make the total number of 1s an
even number. This means it is an even parity. The new code group,
including the parity bit, thus becomes

Sikkim Manipal University B2072 Page No.: 76


Digital Electronics Unit 3

1 1 0 0 0 0 1 1

↓ ↓
Parity Bit Message Data
In case of odd-parity the parity bit is chosen such that the total number of 1s
(including the parity bit) is an odd number. For example, for the code group
1000001, we assign parity bit 1 to make it an odd parity. Now for the code
group 1000011, the total number of 1’s an odd number. So the parity bit 0
will be attached to this number. Regardless of whether even parity or odd
parity is used, the parity bit becomes an actual part of the code word.
The parity bit is used to detect any single-bit errors that occur during the
transmission of a data from one location to another. For example, suppose
that the character “A” is being transmitted and odd parity is being used.
The transmitted code would be
11000001
When the receiver circuit receives this code, it will check that the code
contains an odd number of 1s (including the parity bit). If so, the receiver will
assume that the code has been correctly received. Now, suppose that
because of some noise or malfunction the receiver actually receives the
following code:
11000000
The receiver will find that this code has an even number of 1s. This tells the
receiver that there must be an error in the code because presumably the
transmitter and receiver have agreed to use odd parity. There is no way,
however, that the receiver can tell which bit is in error because it does not
know what the code is.
Parity method would not work if two bits were in error. This is because two
errors would not change the “oddness” or “evenness” of the number of 1s in
the code. Usually the parity method is used only in situations where the
probability of a single error is very low and the probability of double errors is
essentially zero.
In general, a transmitted message with even number of errors cannot be
detected by the parity bit.

Sikkim Manipal University B2072 Page No.: 77


Digital Electronics Unit 3

In parity method, it is assumed that the transmitter and the receiver have
agreed, in advance, as to whether odd or even parity is being used.
The table 3.5 shows the required odd parity and even parity for a 3-bit
message.
Table 3.5: Odd and even parity

Three-Bit Message Odd Parity Bit Even Parity Bit


000 1 0
001 0 1
010 0 1
011 1 0
100 0 1
101 1 0
110 1 0
111 0 1

Now the message 010 with odd parity will be 0010. Similarly, message 010
with odd parity will be 1010.
Self-Assessment Questions
15. _________________is the detection of errors caused by noise or other
impairments during transmission from the transmitter to the receiver.
16. In case of odd-parity the parity bit is chosen such that the total number
of 1s (including the parity bit) is an odd number. (State true or false)
17. The message 010 with odd parity will be sent as ______________.

3.6 Summary
Let us recapitulate the important concepts discussed in this unit:
 In BCD, each decimal digit is represented by a four bit binary code.
 The drawbacks of the BCD encoding are the complexity of the digital
circuits which are used to implement the mathematical operations.
 Big-endian systems store the most significant byte of a word in the
smallest address and the least significant byte is stored in the largest
address.

Sikkim Manipal University B2072 Page No.: 78


Digital Electronics Unit 3

 Little-endian systems, store the least significant byte in the smallest


address and most significant byte of a word in the largest address.
 Gray code is called unit distance code.
 Alphanumeric codes represent both letters and numbers.
 ASCII is basically a 7-bit character code that represents 27=128 code
groups for different characters where every single bit represents a
unique character.
 Extended Binary Coded Decimal Interchange Code is also an
alphanumeric code used by IBM mainframes for its operating systems.
 Unicode is a computing industry standard for encoding, representation,
and handling of text expressed in most of the world's writing systems.
 An odd-parity is one in which the parity bit is chosen such that the total
number of 1s (including the parity bit) is an odd number.
Glossary:
BCD: A method of representing decimal digit by a four bit binary code.
Big-endian: A system which stores the most significant byte of a word in
the smallest address and the least significant byte is stored in the largest
address.
Little-endian: A system which stores the least significant byte in the
smallest address and most significant byte of a word in the largest address.
Packed BCD: Format of putting two digits per byte.
Gray code: A code which shows only one bit change between two
successive numbers in the sequence.
Alphanumeric codes: Binary codes used to represent alphanumeric data.
ASCII code: A 7-bit character code used by most of the computer
keyboards.
EBCDIC: An eight bit code used by IBM mainframes for its operating
systems.
Unicode: A computing industry standard for encoding, representation, and
handling of text expressed in most of the world's writing systems.
Odd-parity: A type of parity in which the total number of 1s (including the
parity bit) is an odd number.
Even- parity: A type of parity in which the total number of 1s (including the
parity bit) is an even number.

Sikkim Manipal University B2072 Page No.: 79


Digital Electronics Unit 3

3.7 Terminal Questions


1. What do you mean by BCD? Explain with an example.
2. Convert the following decimal numbers to BCD.
(a) 678 (b) 2728 (c) 5698
3. Compute the Gray code of the Binary number
(a) 110010
(b) 10011001
4. Write a note on ASCII code.
5. Write a note on Unicode.
6. Discuss on error detection and correction codes.

3.8 Answers
Self-Assessment Questions
1. Four
2. 1011
3. 0110100000111001(BCD)
4. 9615
5. Big-endian
6. 0000 0010 00000011 00000101
7. Gray
8. True
9. 101011
10. Alphanumeric
11. American Standard Code for Information Interchange
12. EBCDIC
13. 4E
14. Unicode
15. Error detection
16. True
17. 0010
Terminal Questions
1. A BCD is a code in which each decimal digit is represented by a four bit
binary code. Refer to section 3.1 for more details.
2. (a) 678= 0110 0111 1000 (b) 2728= 0010 0111 0010 1000
(c) 5698= 0101 0110 1001 1000.
Refer to section 3.2 for more details.

Sikkim Manipal University B2072 Page No.: 80


Digital Electronics Unit 3

3. (a) (110010)2 =(101011)Gray code


(b) (10011001)2 = 11010101 in gray code.
Refer to section 3.3for more details.
4. ASCII is a 7-bit character code that represents 27=128 code groups for
different characters where every single bit represents a unique
character. Refer to section 3.4 for more details.
5. Unicode is a computing industry standard for encoding, representation,
and handling of text expressed in most of the world's writing systems.
Refer to section 3.4 for more details
6. Error detection and correction (or error control) are techniques that
enable reliable delivery of digital data over unreliable communication
channels. Refer to section 3.5 for more details.

Sikkim Manipal University B2072 Page No.: 81

You might also like