Chapter 1

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 46

Chapter 1

Binary Systems
Introduction
We are in “Information age” since digital systems have such a prominent
and growing role in modern society. They are involved in our business
transactions, communications, transportation, medical treatment and
entertainment. In industrial world they are heavily employed in design,
manufacturing, distribution and sales.
Digital system
A digital signal is discrete-time as well as discrete-valued signal
A system that works with digital signal is digital system
Digital doesn’t always mean binary

Why digital?
Perfect Reconstruction/Regeneration
Error control
Encryption/Decryption
Advantages of Digital System
 Easy to store and retrieve digital information
 Easy to process digital data
 Digital is less error prone
 Error can be controlled
 Noise does not accumulate from one logic stage to next as it does in
analog system (Regeneration)
 The ease of large scale fabrication
 Can be processed by a general purpose processor
Disadvantages of Digital System
 Use more energy than analog circuits to accomplish the same tasks,
thus producing more heat as well.
 Digital circuits are often fragile, in that if a single piece of digital
data is lost or misinterpreted, the meaning of large blocks of related
data can completely change.
 Quantization error during analog signal sampling.
Analog system
It is system that manipulate physical quantities that represent in analog
form.
Analogue systems process analogue signals which can take any value
within a range, for example the output from an LDR (light sensor) or a
microphone.
An audio amplifier is an example of an analogue system. The amplifier
produces an output voltage which can be any value within the range of
its power supply.
Logic signals
Most digital systems use the simplest possible type of signal which has
just two values. This type of signal is called a logic signal because the
two values (or states) can be called true and false. Normally the positive
supply voltage +Vs represents true and 0V represents false. Other labels
for the true and false states are shown in the table.
Logic states
True False
1 0
High Low
+Vs 0V
On Off
Analog vs. Digital design
Digital design need to handle with only few specified (mostly two) logic levels
– It is less important to precisely simulate resistive, capacitive and inductive
parameters
– Design simulation can be based on the logic only, tools can therefore follow the
truth tables
Analog design requires precise voltage and current characteristics of the devices
– Parasitic capacitance, resistance, inductance are very important
– Circuit elements are non-linear
– Design verifications require complex simulations
involving solutions of differential equations
Block diagram of digital computer
Working principle
Memory stores programs as well as input, output and intermediate data.
The Datapath performs arithmetic and other data-processing operations
as specified by the program. The control unit supervises the flow of
information between the various units. A Datapath, when combined with
the control unit, forms a component referred to as a central processing
unit, or CPU. The program and data prepared by the user are transferred
into memory by means of an input device such as a keyboard. An output
device, such as a CRT (cathode-ray tube) monitor, displays the results of
the computations and presents them to the user.
Number system
Number: Arithmetical value representing a particular quantity. The
various types of numbers are Natural Numbers, Whole Numbers,
Integers, Rational Numbers, Irrational Numbers, Real Numbers etc.
Integers
Integers are the numbers that includes whole numbers along with the
negative numbers.
Rational ,irrational, whole number ?
Number system
The technique to represent and work with numbers is called number
system. Decimal number system is the most common number system.
Other popular number systems include binary number system, octal
number system, hexadecimal number system, etc.
Decimal Number System
Decimal number system is a base 10 number system having 10 digits
from 0 to 9. This means that any numerical quantity can be represented
using these 10 digits. Decimal number system is also a positional value
system. This means that the value of digits will depend on its position.
Let us take an example to understand this.
Decimal number system
Example – 734, 971 and 207. The value of 7 in all three numbers is
different−
In 734, value of 7 is 7 hundreds or 700 or 7 × 100 or 7 × 10^2
In 971, value of 7 is 7 tens or 70 or 7 × 10 or 7 × 10^1
In 207, value 0f 7 is 7 units or 7 or 7 × 1 or 7 × 10^0
In digital systems, instructions are given through electric signals;
variation is done by varying the voltage of the signal. Having 10
different voltages to implement decimal number system in digital
equipment is difficult. So, many number systems that are easier to
implement digitally have been developed.
Binary Number System
The easiest way to vary instructions through electric signals is two-state
system – on and off. On is represented as 1 and off as 0, though 0 is not
actually no signal but signal at a lower voltage. The number system having
just these two digits – 0 and 1 – is called binary number system.
Each binary digit is also called a bit. Binary number system is also
positional value system, where each digit has a value expressed in powers
of 2,5 as displayed here. 3
2 2 4
2 2 2
21
20

In any binary number, the rightmost digit is called least significant bit
(LSB) and leftmost digit is called most significant bit (MSB).
Binary Number System

1 0 0 0 1 1

MSB LSB
Computer memory is measured in terms of how many bits it can store.
Here is a chart for memory capacity conversion.
Unit of data storage
Bit=1 0r 0 (on or off)
1 byte (B) = 8 bits
1 Kilobytes (KB) = 1024 bytes
1 Megabyte (MB) = 1024 KB
1 Gigabyte (GB) = 1024 MB
1 Terabyte (TB) = 1024 GB
1 Exabyte (EB) = 1024 PB
1 Zettabyte = 1024 EB
1 Yottabyte (YB) = 1024 ZB
Octal Number System
Octal number system has eight digits – 0, 1, 2, 3, 4, 5, 6 and 7. Octal
number system is also a positional value system with where each digit
has its value expressed in powers of 8.
Decimal equivalent of any octal number is sum of product of each digit
with its positional value.

726 = 7×82 + 2×81 + 6×80


= 448 + 16 + 6
= 470
Hexadecimal Number System
Hexadecimal number system has 16 symbols – 0 to 9 and A to F where A
is equal to 10, B is equal to 11 and so on till F. Hexadecimal number
system is also a positional value system with where each digit has its
value expressed In power of 16.
Decimal equivalent of any hexadecimal number is sum of product of
each digit with its positional value.

What is the decimal equivalent of hex number CAFÉ ?


Number System Relationship
Number Base Conversions
Case I: Base-r system to Decimal: Base-r system can be binary (r=2), octal
(r=8), hexadecimal (r=16), base-60 system or any other. For decimal system
as destination of conversion, we just use power series explained above with
varying r and sum the result according to the arithmetic rules of base-10
system.
Case II: Decimal to Base-r system: Conversion follows following
algorithm.
1. Separate the number into integer and fraction parts if radix point is given.
2. Divide “Decimal Integer part” by base r repeatedly until quotient
becomes zero and storing remainders at each step.
3. Multiply “Decimal Fraction part” successively by r and accumulate the
integer digits so obtained.
4. Combine both accumulated results and parenthesize the whole result with
subscript r.
Number Base Conversions
Q. (41.6875)10=(?)2
Q. (41.675)8=(?)2
Q. (A5.6875)16=(?)2
Case III: Binary to octal & hexadecimal and vice-versa: Conversion from and to binary, octal and hexadecimal
representation plays an important part in digital computers. Since,
3
2 = 8, octal digit can be represented by at least 3 binary digits. So to convert given binary number into its equivalent
octal, we divide

it into groups of 3 bits, give each group an octal symbol and combine the result.

Integer part: Group bits from right to left of an octal point. 0’s can be added to make

it multiple of 3.

Fractional part: Group bits from left to right of an octal point. 0’s must be added to

if bits are not multiple of 3 (Note it).


4
2 = 16, each hex digit corresponds to 4 bits. So to convert given binary number into its

equivalent hex, we divide it into groups of 4 bits, give each group a hex digit and combine
Number Base Conversions

Q. (41.6875)10=(?)8
Q. (41.675)8=(?)16
Q. (A5.6875)16=(?)8
Q. (1010101.1101)2=(?)8
Q. (11101.1010)2=(?)16
Complements
Complements are used in digital computers for simplifying the subtraction operation and
for logical manipulation. There are two types of complements for each base-r system: r's
complement and the second as the (r - 1)'s complement. When the value of the base r is
substituted, the two types are referred to as the 2's complement and 1's complement for
binary numbers, the 10's complement and 9's complement for decimal numbers etc.
(r-1)'s Complement (diminished radix compl.)
(r-1)'s complement of a number N is defined as
(r^n-1) –N
Where N is the given number
r is the base of number system
n is the number of digits in the given number
To get the (r-1)'s complement fast, subtract each
digit of a number from (r-1).
Example:
- 9's complement of 835 is 164 (Rule: (10^n-1) –N)
- 1's complement of 1010 is 0101 (bit by bit complement operation)
r's Complement (radix complement)
r's Complement (radix complement)
r's complement of a number N is defined as r^n–N
Where N is the given number
r is the base of number system
n is the number of digits in the given number
To get the r's complement fast, add 1 to the low-order digit of its (r-1)'s
complement.
Example:
- 10's complement of 835 is 164 + 1 =
165
- 2's complement of 1010 is 0101 + 1 = 0110
Subtraction with complements
The direct method of subtraction taught in elementary schools uses the
borrow concept. When subtraction is implemented with digital hardware,
this method is found to be less efficient than the method that uses
complements.
1. Subtraction using 1’s complement
2. Subtraction using 2’s complement
3. Subtraction using 10’s complement
4. Subtraction using 9’s complement
Perform the following:
1. Subtract 101011 from 11101 using 1’s complement
2. Subtract 10111 from 111011 using 1’s complement
3. Subtract 101011 from 11101 using 2’s complement
4. Subtract 10111 from 111011 using 2’s complement
5. Subtract 5657 from 6745 using 9’s complement
6. Subtract 456434 from 124567 using 10’s complement
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. Binary codes play an important role in digital
computers. The codes must be in binary because computers can only
hold 1's and 0's.
Binary Coded Decimal (BCD)
The binary number system is the most natural system for a computer, but
people are accustomed to the decimal system. So, to resolve this
difference, computer uses decimals in coded form which the hardware
understands. A binary code that distinguishes among 10 elements of
decimal digits must contain at least four bits. Numerous different binary
codes can be obtained by arranging four bits into 10 distinct
combinations. The code most commonly used for the decimal digits is
the straightforward binary assignment listed in the table below. This is
called binary-coded decimal and is commonly referred to as BCD
Binary Coded Decimal (BCD)
Binary Coded Decimal (BCD)
A number with n decimal digits will require 4n bits in BCD. E.g. decimal
396 is represented in BCD with 12 bits as 0011 1001 0110.
Numbers greater than 9 has a representation different from its equivalent
binary number, even though both contain 1's and 0's.
Binary combinations 1010 through 1111 are not used and have no
meaning in the BCD code.
Example:
(185)10= (0001 1000 0101)BCD = (10111001)2
Error-Detection codes
Binary information can be transmitted from one location to another by
electric wires or other communication medium. Any external noise
introduced into the physical communication medium may change some
of the bits from 0 to 1 or vice versa.
The purpose of an error-detection code is to detect such bit-reversal
errors. One of the most common ways to achieve error detection is by
means of a parity bit. A parity bit is the extra bit included to make the
total number of 1's in the resulting code word either even or odd.
Error Checking Mechanism
During the transmission of information from one location to another, an
even parity bit is generated in the sending end for each message
transmission. The message, together with the parity bit, is transmitted to
its destination. The parity of the received data is checked in the receiving
end. If the parity of the received information is not even, it means that at
least one bit has changed value during the transmission.
This method detects one, three, or any odd combination of errors in each
message that is transmitted. An even combination of errors is undetected.
Additional error detection schemes may be needed to take care of an
even combination of errors.
Gray code (Reflected code)

It is a binary coding scheme used to represent digits generated from a


mechanical sensor that may be prone to error. Used in telegraphy in the
late 1800s, and also known as "reflected binary code”. Gray code was
patented by Bell Labs researcher Frank Gray in 1947. In Gray code,
there is only one bit location different between two successive values,
which makes mechanical transitions from one digit to the next less error
prone. The following chart shows normal binary representations from 0
to 15 and the corresponding Gray code.
Gray code (Reflected code)
Gray code (Reflected code)
The Gray code is used in applications where the normal sequence of
binary numbers may produce an error or ambiguity during the transition
from one number to the next. If binary numbers are used, a change from
0111 to 1000 may produce an intermediate erroneous number 1001 if the
rightmost bit takes more time to change than the other three bits. The
Gray code eliminates this problem since only one bit changes in value
during any transition between two numbers.
Excess-3 code
The excess-3 code (or XS3) is a non-weighted code used to express
decimal numbers. It is a self-complementary binary coded decimal
(BCD) code and numerical system which has biased representation. It is
particularly significant for arithmetic operations as it overcomes
shortcoming encountered while using 8421 BCD code to add two
decimal digits whose sum exceeds 9. Excess-3 arithmetic uses different
algorithm than normal non-biased BCD or binary positional number
system.
Representation of Excess-3 Code
Excess-3 codes are unweighted and can be obtained by adding 3 to each decimal
digit then it can be represented by using 4 bit binary number for each digit. An
Excess-3 equivalent of a given binary number is obtained using the following steps:
Find the decimal equivalent of the given binary number.
Add +3 to each digit of decimal number. Convert the newly obtained decimal
number back to binary number to get required excess-3 equivalent.
You can add 0011 to each four-bit group in binary coded decimal number (BCD) to
get desired excess-3 equivalent.
Example-1 Convert decimal number 23 to Excess-3 code.
So, according to excess-3 code we need to add 3 to both digit in the decimal number
then convert into 4-bit binary number for result of each digit. Therefore,
= 23+33=56 =0101 0110 which is required excess-3 code for given decimal number
23.
Representation of Excess-3 Code
Alphanumeric codes
Alphanumeric character set is a set of elements that includes the 10
decimal digits, 26 letters of the alphabet and special characters such as $,
%, + etc. It is necessary to formulate a binary code for this set to handle
different data types. If only capital letters are included, we need a binary
code of at least six bits, and if both uppercase letters and lowercase
letters are included, we need a binary code of at least seven bits.
The most common alphanumeric codes is ASCII code
ASCII code
ASCII is the abbreviation for American Standard Code for Information
Interchange. ASCII is a universally accepted alphanumeric code used in
most computers and other electronic equipment. Most computer keyboards
are standardized with the ASCII. When we enter a letter, a number, or
control command, the corresponding ASCII code goes into the computer.
 ASCII has 128 characters and symbols represented by a 7-bit binary
code. Actually, ASCII can be considered an 8-bit code with the MSB
always 0. This 8-bit code is 00 through 7F in hexadecimal.
 The first thirty-two ASCII characters are non-graphic commands that are
never printed or displayed and are used only for control purposes.
Examples of the control characters are "null," "line feed," "start of text,"
and "escape."
 The other characters are graphic symbols that can be printed or displayed
and include the letters of the alphabet (lowercase and uppercase), the ten
decimal digits, punctuation signs and other commonly used symbols.
ASCII code
ASCII nonprintable code
Extended ASCII characters
In addition to the 128 standard ASCII characters, there are an additional
128 characters that were adopted by IBM for use in their PCs (personal
computers). Because of the popularity of the PC, these particular
extended ASCII characters are also used in applications other than PCs
and have become essentially an unofficial standard. The extended ASCII
characters are represented by an 8-bit code series from hexadecimal 80
to hexadecimal FF.
Extended ASCII characters
EBCDIC character code
EBCDIC, in full extended binary-coded decimal interchange code, data-
encoding system, developed by IBM and used mostly on its computers,
that uses a unique eight-bit binary code for each number and alphabetic
character as well as punctuation marks and accented letters and
nonalphabetic characters. EBCDIC differs in several respects from
Unicode and ASCII, the most widely used systems of encoding text,
dividing the eight bits for each character into two four-bit zones, with
one zone indicating the type of character, digit, punctuation mark,
lowercase letter, capital letter, and so on, and the other zone indicating
the value that is, the specific character within this type.
EBCDIC character code

You might also like