Digital Computer Fundamentals (Unit-I)
Digital Computer Fundamentals (Unit-I)
Number Systems
Digital electronics, digital circuits, and digital technology are electronics that are operated on digital
signals. Digital techniques are much easier for getting the electronic device. These devices are used to
switch into one of the known states apart from reproducing a continuous range of values. Digital circuits
are made from a large collection of logic gates and a simple electronic representation of the Boolean
logic function.
In digital electronics, the number system is used for representing the information. The number system has
different bases and the most common of them are the decimal, binary, octal, and hexadecimal.
There are three conversions possible for binary number, i.e., binary to decimal, binary to octal, and
binary to hexadecimal. The conversion process of a binary number to decimal differs from the remaining
others. Let's take a detailed discussion on Binary Number System conversion.
The process of converting binary to decimal is quite simple. The process starts from multiplying the bits
of binary number with its corresponding positional weights. And lastly, we add all those products.
Let's take an example to understand how the conversion is done from binary to decimal.
Example 1: (10110.001)2
We multiplied each bit of (10110.001)2 with its respective positional weight, and last we add the products
of all the bits with its weight.
(10110.001)2=(1×24)+(0×23)+(1×22)+(1×21)+(0×20)+
(0×2-1)+(0×2-2)+(1×2-3)
(10110.001)2=(1×16)+(0×8)+(1×4)+(1×2)+(0×1)+
(0×1⁄2)+(0×1⁄4)+(1×1⁄8)
(10110.001)2=16+0+4+2+0+0+0+0.125
(10110.001)2=(22.125 )10
Binary to Octal Conversion
The base numbers of binary and octal are 2 and 8, respectively. In a binary number, the pair of three bits
is equal to one octal digit. There are only two steps to convert a binary number into an octal number
which are as follows:
1. In the first step, we have to make the pairs of three bits on both sides of the binary point. If there
will be one or two bits left in a pair of three bits pair, we add the required number of zeros on
extreme sides.
2. In the second step, we write the octal digits corresponding to each pair.
Example 1: (111110101011.0011)2
1. Firstly, we make pairs of three bits on both sides of the binary point.
On the right side of the binary point, the last pair has only one bit. To make it a complete pair of three
bits, we added two zeros on the extreme side.
(111110101011.0011)2=(7653.14)8
The base numbers of binary and hexadecimal are 2 and 16, respectively. In a binary number, the pair of
four bits is equal to one hexadecimal digit. There are also only two steps to convert a binary number into
a hexadecimal number which are as follows:
1. In the first step, we have to make the pairs of four bits on both sides of the binary point. If there
will be one, two, or three bits left in a pair of four bits pair, we add the required number of zeros
on extreme sides.
2. In the second step, we write the hexadecimal digits corresponding to each pair.
Example 1: (10110101011.0011)2
1. Firstly, we make pairs of four bits on both sides of the binary point.
On the left side of the binary point, the first pair has three bits. To make it a complete pair of four bits,
add one zero on the extreme side.
(011110101011.0011)2=(7AB.3)16
To get 2’s complement of a binary number, simply invert the given number and add 1 to the least
significant bit (LSB) of given result.
Simply invert each bit of given binary number, so 1’s complement of given number will be 01010001.
Simply invert each bit of given binary number, so 1’s complement of given number will be 01110.110.
Firstly, we find the 1's complement of the number that is 0100110 and add 1 to the LSB. So, by adding 1
to the LSB, the number will be (0100110)+1=0100111.
The 9's complement is used to find the subtraction of the decimal numbers. The 9's complement of a
number is calculated by subtracting each digit of the number by 9. For example, suppose we have a
number 1423, and we want to find the 9's complement of the number. For this, we subtract each digit of
the number 1423 by 9. So, the 9's complement of the number 1423 is 9999-1423= 8576.
10's Complement
The 10's complement is also used to find the subtraction of the decimal numbers. The 10's complement of
a number is calculated by subtracting each digit by 9 and then adding 1 to the result. Simply, by adding 1
to its 9's complement we can get its 10's complement value. For example, suppose we have a number
1423, and we want to find the 10's complement of the number. For this, we find the 9's complement of
the number 1423 that is 9999-1423= 8576, and now we will add 1 to the result. So the 10's complement
of the number 1423 is 8576+1=8577.
Binary Codes
In the coding, when numbers, letters or words are represented by a specific group of symbols.
The group of symbols is called as a code. The digital data is represented, stored and transmitted
as group of binary bits. This group is also called as binary code.
Binary codes make the analysis and designing of digital circuits if we use the binary
codes.
Alphanumeric Codes
Weighted Codes
Weighted binary codes are those binary codes which obey the positional weight principle. Each
position of the number represents a specific weight. In these codes each decimal digit is
represented by a group of four bits.
Non-Weighted Codes
In this type of binary codes, the positional weights are not assigned. The examples of non-
weighted codes are Excess-3 codeand Gray code.
Excess-3 code
The Excess-3 code is also called as XS-3 code. It is non-weighted code used to express decimal
numbers. The Excess-3 code words are derived from the 8421 BCD code words adding (0011) 2
or (3)10 to each code word in 842. The excess-3 codesare obtained as follows −
Example
Gray Code
It is the non-weighted code and it is not arithmetic codes. That means there are no specific
weights assigned to the bit position. It has a very special feature that, only one bit will change
each time the decimal number is incremented as shown in fig. As only one bit changes at a time,
the gray code is called as a unit distance code. The gray code is a cyclic code. Gray code cannot
be used for arithmetic operation.
Application of Gray code
A shaft position encoder produces a code word which represents the angular position of the
shaft.
In this code each decimal digit is represented by a 4-bit binary number. BCD is a way to
express each of the decimal digits with a binary code. In the BCD, with four bits we can
represent sixteen numbers (0000 to 1111). But in BCD code only first ten of these are used (0000 to
1001). The remaining six code combinations i.e. 1010 to 1111 are invalid in BCD.
Advantages of BCD Codes
BCD needs more number of bits than binary to represent the decimal number. So BCD is less
efficient than binary.
Alphanumeric codes
A binary digit or bit can represent only two symbols as it has only two states '0' or '1'. But this is not
enough for communication between two computers because there we need many more symbols for
communication. These symbols are required to represent 26 alphabets with capital and small letters,
numbers from 0 to 9, punctuation marks and other symbols.
The alphanumeric codes are the codes that represent numbers and alphabetic characters. Mostly
such codes also represent other characters such as symbol and various instructions necessary for
conveying information. An alphanumeric code should at least represent 10 digits and 26 letters of
alphabet i.e. total 36 items. The following three alphanumeric codes are very commonly used for the
data representation.
ASCII code is a 7-bit code whereas EBCDIC is an 8-bit code. ASCII code is more commonly used
worldwide while EBCDIC is used primarily in large IBM computers.
Error Detection & Correction
What is Error?
Error is a condition when the output information does not match with the input information.
During transmission, digital signals suffer from noise that can introduce errors in the binary
bits travelling from one system to other. That means a 0 bit may change to 1 or a 1 bit may
change to 0.
Types Of Errors
There are mainly three types of a bit error that occur in data transmission from the
sender to the receiver.
Burst errors
The change made in one bit in the entire data sequence is known as "Single bit error".
In data sequence, if there is a change in two or more bits of a data sequence of a transmitter to
receiver, it is known as "Multiple bit errors."
Burst Errors
The change of the set of bits in data sequence is known as "Burst error".
Error-Detecting codes
Whenever a message is transmitted, it may get scrambled by noise or data may get corrupted.
To avoid this, we use error-detecting codes which are additional data added to a given digital
message to help us detect if an error occurred during transmission of the message. A simple
example of error-detecting code is parity check.
Error-Correcting codes
Along with error-detecting code, we can also pass some data to figure out the original
message from the corrupt message that we received. This type of code is called an error-
correcting code.
Error-correcting codes also deploy the same strategy as error-detecting codes but
additionally, such codes also detect the exact location of the corrupt bit.
In error-correcting codes, parity check has a simple way to detect errors along with a
sophisticated mechanism to determine the corrupt bit location.
Once the corrupt bit is located, its value is reverted (from 0 to 1 or 1 to 0) to get the original
message.
The additional bits are called parity bits. They allow detection or correction of the
errors.
The data bits along with the parity bits form a code word.
Parity Checking of Error Detection
It is the simplest technique for detecting and correcting errors. The MSB of an 8-bits word is
used as the parity bit and the remaining 7 bits are used as data or message bits. The parity of
8-bits transmitted word can be either even parity or odd parity.
Even parity -- Even parity means the number of 1's in the given word including the parity bit
should be even (2,4,6, ).
Odd parity -- Odd parity means the number of 1's in the given word including the parity bit
should be odd (1,3,5, ).
The parity bit can be set to 0 and 1 depending on the type of the parity required.
For even parity, this bit is set to 1 or 0 such that the no. of "1 bits" in the entire word is
even. Shown in fig. (a).
For odd parity, this bit is set to 1 or 0 such that the no. of "1 bits" in the entire word is
odd. Shown in fig. (b).
How Does Error Detection Take Place?
Parity checking at the receiver can detect the presence of an error if the parity of the receiver
signal is different from the expected parity.
That means, if it is known that the parity of the transmitted signal is always going to be "even"
and if the received signal has an odd parity, then the receiver can conclude that the received
signal is not correct.
If an error is detected, then the receiver will ignore the received byte and request for
retransmission of the same byte to the transmitter.
For error detection by checksums, data is divided into fixed sized frames or segments.
Sender’s End − The sender adds the segments using 1’s complement arithmetic to get
the sum. It then complements the sum to get the checksum and sends it along with the
data frames.
Receiver’s End − The receiver adds the incoming segments along with the checksum
using 1’s complement arithmetic to get the sum and then complements it.
If the result is zero, the received frames are accepted; otherwise they are discarded.
Example
Suppose that the sender wants to send 4 frames each of 8 bits, where the frames are 11001100,
10101010, 11110000 and
11000011.
The sender adds the bits using 1s complement arithmetic. While adding two numbers using 1s
complement arithmetic, if there is a carry over, it is added to the sum.
After adding all the 4 frames, the sender complements the sum to get the checksum,
11010011, and sends it along with the data frames.
The receiver performs 1s complement arithmetic sum of all the frames including the
checksum. The result is complemented and found to be 0. Hence, the receiver assumes that no
error has occurred.
Error correction code
Error correction codes are generated by using the specific algorithm used for
removing and detecting errors from the message transmitted over the noisy
channels.
The error-correcting codes find the correct number of corrupted bits and their
positions in the message.
Hamming Code
Hamming code is an example of a block code. The two simultaneous bit errors
are detected, and single-bit errors are corrected by this code.
In the hamming coding mechanism, the sender encodes the message by adding
the unessential bits in the data.
These bits are added to the specific position in the message because they are the
extra bits for correction.
which is 1011011.
First, let us talk about the redundant bits.
The redundant bits are some extra binary bits that are not part of the original
data, but they are generated & added to the original data bit. All this is done to
ensure that the data bits don't get damaged and if they do, we can recover them.
As we go through the example, the first step is to identify the bit position of the
data & all the bit positions which are powers of 2 are marked as parity bits (e.g. 1,
2, 4, 8, etc.).
The following image will help in visualizing the received hamming code of 7
bits.
First, we need to detect whether there are any errors in this received hamming
code.
Step 1: For checking parity bit P1, use check one and skip one method, which
means, starting from P1 and then skip P2, take D3 then skip P4 then take D5, and
then skip D6 and take D7, this way we will have the following bits,
As we can observe the total number of bits are odd so we will write the value of
parity bit as P1 = 1. This means error is there.
Step 2: Check for P2 but while checking for P2, we will use check two and skip
two method, which will give us the following data bits. But remember since we
are checking for P2, so we have to start our count from P2 (P1 should not be
considered).
As we can observe that the number of 1's are even, then we will write the value
of P2 = 0. This means there is no error.
Step 3: Check for P4 but while checking for P4, we will use check four and skip
four method, which will give us the following data bits. But remember since we
are checking for P4, so we have started our count from P4(P1 & P2 should not be
considered).
As we can observe that the number of 1's are odd, then we will write the value of
P4 = 1. This means the error is there.
So, from the above parity analysis, P1 & P4 are not equal to 0, so we can clearly
say that the received hamming code has errors.
Since we found that received code has an error, so now we must correct them. To
correct the errors, use the following steps:
We get E = 5, which states that the error is in the fifth data bit. To correct it, just
invert the fifth data bit.
_______________________________________