Sei sulla pagina 1di 11

(Analog)

Input
Signal

Converter

A/D

binary

Digital
System
binary
Converter

D/A

While most information is given in continuous


(analog form), it can be converted into digital.

The 52 playing cards

The 26 letters of the alphabet

The 10 decimal digits

Examples:

(Analog)

Signal

Output

Any set with a finite number of elements contains discrete


information.

Main characteristic of digital systems: Manipulate discrete


elements of information.

Digital Systems: Digital telephones, Digital TV, Digital


Cameras, Computers.

Two types of electronic systems: Analog and Digital systems.

Digital Systems

Digital System

Output
Signals
(binary)
3

Accuracy: it is much less likely that a 0 and a 1 will


be interchanged than a continuous signal will be in
error. There are a lot of schemes for digital error
detection and correction. (Examples: digital
communications and DVD).
They are easy to designed, implemented, and tested.
Costs and size are rapidly dropping while speed and
functionality increase.
Therefore, digital systems have become the standard
for computing, communication, control, etc.

The advantages of digital systems:

Input
Signals
(binary)

Discrete elements of information are represented


in a digital systems by signals.
The signals use just two discrete values: 0 and 1
(binary ).
Each binary digit is called a bit.
Discrete elements of information are represented
with groups of bits called binary codes.

Input
Devices

104a4+103a3+102a2+101a1+100a0+10-1a-1+10-2a-2+10-3a-3

(5284)10 = 5000 + 200 + 80 + 4


= 5 x 103 + 2 x 102 + 8 x 101+ 4 x 100
A number with decimal point is represented by a
series of coefficients as follows:
a4a3a2a1a0.a-1a-2a-3
The aj coefficients are any of 10 digits
(0,1,2,.,9), and the subscript value j gives
place value.
This can be expressed as:

Output
Device

Input-Output Units

Storage

Memory
Unit

Central Processor
Unit (CPU)

Secondary

CPU:
Arithmetic operations
Logical operations

Example of digital system: computer

Example 3: (AC12)16= 10 x 163 + 12 x162 + 1 x 161


+ 2 x 160 = 40960 + 3072 + 16 + 2 = (44050)10

Example 2: (76)8 = 7 x 81 + 6 x 80 = 56 + 6 = (62)10

Example 1: (11010.11)2 = 1 x 24 + 1 x 23 + 0 x 22 +
1 x 21 + 0 x 20 + 1 x 2-1 + 1 x 2-2 =(26.75)10

anrn+an-1rn-1++a2r2+a1r1+a0+a-1r-1+a-2r-2++a-mr-m

A number expressed in a base-r system has


coefficients multiplied by powers of r:

Binary System: The digits are 0,1.


The binary system uses radix 2 (r = 2), (base-2
system). Example: (1101)2
Octal System: the digits are 0,1,2,3,4,5,6,7. r=8,
(base-8 system). Example: (7265)8
Decimal System: the digits are 0,1,2,3,4,5,6,7,8,9
r=10, (base-10 system)
Hexadecimal System: the digits are 0,1,2,3,4,5,
6,7,8,9,A,B,C,D,E,F. r=16, (base-16 system)
We have A=10, B=11,C=12,D=13,E=14,F=15
Example: (3D7F6)16

Number Systems

10

Convert (73)10 to binary


Integer Remainder
73
36
1
18
0
9
0
4
1
2
0
1
0
0
1
(1001001)2 = answer

Number Base Conversion (1)

101101
- 100111
------------000110

12

Integer Remainder
234
29
2
3
5
0
3
(352)8 = answer

Convert (234)10 to octal:

Number Base Conversion (2)

101
x 101
---------101
000
101
-------------11001

101101
+100111
---------------1010100

Subtraction: 101101-100111

Multiplication: 101 x 101

Arithmetic (2)

Addition: 101101+100111

Arithmetic (1)

13

11

13=D
4
1

Remainder

(14D)16 = answer

=
=
=
=

3
2
2
7

0.296
0.368
0.944
0.552

Fraction

Answer = (0.a-1a-2a-3a-4)8 = (0.3227)8

0.412 x 8
0.296 x 8
0.368 x 8
0.944 x 8

Integer

Convert (0.412)10 to octal

14

a-1=3
a-2=2
a-3=2
a-4=7

16

Coefficient

Number Base Conversion (5)

Integer
333
20
1
0

Convert (333)10 to Hexadecimal

Number Base Conversion (3)

=
=
=
=

1
0
1
1

0.3750
0.7500
0.5000
0.0000

Fraction

a-1=1
a-2=0
a-3=1
a-4=1

15

Coefficient

0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F

=
=
=
=
=
=
=
=
=
=
=
=
=
=
=
=

17

0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111

Hex.
Binary
-------------------------------

Each hexadecimal digit corresponds to


four binary digits.

Each octal digit corresponds to three


binary digits.

Octal
Binary
------------------------------0
=
000
1
=
001
2
=
010
3
=
011
4
=
100
5
=
101
6
=
110
7
=
111

Octal and Hexadecimal Numbers

Answer = (0.a-1a-2a-3a-4)2 = (0.1011)2

0.6875 x 2
0.3750 x 2
0.7500 x 2
0.5000 x 2

Integer

Convert (0.6875)10 to binary

Number Base Conversion (4)

18

There are two types of complements for each base-r system:

The radix complement: rs complement

The diminished radix complement: (r-1)s complement


Examples:
In binary system: 2s complement and 1s complement
In decimal system: 10s complement and 9s complement
20

Complements are used in digital circuits for simplifying the


subtraction operation. The common method of subtraction
uses the borrow concept. In this method, we borrow a 1 from a
higher significant position when we subtract a larger digit
from smaller digit. This method of subtraction is inefficient
when it is implemented with digital hardware.

Complements

Binary to octal
(10110001101011.111100000110)2
(10 110 001 101 011 . 111 100 000 110)2
=(2 6 1 5 3 . 7 4 0
6)8
-------------------------------------------------------------Binary to hexadecimal
(10110001101011.111100000110)2
(10 1100 0110 1011 . 1111 0000 0110)2
= (2 C
6
B . F
0
6

Examples (1)

19

Examples:
The 9s complement of 546700 is 999999 546700 =
453299.
The 9s complement of 012398 is 999999 012398 =
987601.
21

Given a number N in base r having n digits: the (r-1)s


complement of N is defined as (rn-1)-N.
For decimal numbers, the 9s complement is obtained by
subtracting each digit from 9.

Diminished Radix Complement (1)

Octal to binary
(354.7)8 = ( 011 101 100 . 111 )2
Hexadecimal to binary
(A3E)16= ( 1010 0011 1110 )2

Examples (2)

24

The 2s complement of a number can be obtained by leaving the all


least significant 0s and the first 1 unchanged, and replace 1s with
0s and 0s with 1s in all other higher significant digits.
Examples:
The 2s complement of 1101100 is 0010100
The 2s complement of 0110111 is 1001001.

The 10s complement of a number can be obtained by leaving all least


significant 0s unchanged, subtracting the first nonzero least
significant digit from 10, and subtracting all higher significant
digits from 9.
Examples:
The 10s complement of 012398 is 987602
The 10s complement of 246700 is 753300

Radix Complement (2)

22

The (r-1)s complement of octal or hexadecimal numbers


is obtained by subtracting each digit from 7 or F
respectively.

For binary numbers, the 1s complement is obtained by


subtracting each digit from 1. However, we have 10=1 and 1-1=0, which cause the bit to change from 0
to 1 or from 1 to 0. Therefore, the 1s complement of
binary number is formed by changing 1s to 0s and
0s to 1s.
Examples:
The 1s complement of 1011000 is 0100111.
The 1s complement of 0101101 is 1010010.

Diminished Radix Complement (2)


0

for N

23

25

If a number contains a radix point, the point


should be removed temporarily in order to form
rs or (r-1)s complement. The radix point is
then restored to the complemented number in
the same relative position.
The rs complement of the rs complement of N
is N.
The (r-1)s complement of the (r-1)s
complement of N is N.

Examples:
The 10s complement of 2389 is 7610+1=7611.
The 2s complement of (101100)2 is
010011+1=(010100)2

The rs complement is obtained by adding 1 to the (r-1)s


complement since rn-N=[(rn-1)-N]+1.

The rs complement of an n-digit number N in base r is


r n  N for N z 0
defined as:

Radix Complement (1)

Sum =
There is no end carry.
The answer is (10s complement
of 80733)

10s complement of 26547 =

Using 10s complement, calculate


7280 - 26547

Example 2

28

= -19267

07280
+73453
------------80733

26

To do subtraction of two n-digit unsigned number M-N


in base r:
1. M + the rs complement of N. The result is M+(rnN).
2. If M >= N, the sum will produce an end carry, rn,
which can be discarded and the result will be M-N.
3. If M<N, the sum does not produce an end carry and
is equal to rn-(N-M), which is the rs complement of
(N-M). To obtain M-N, take the rs complement of
the sum and place a negative sign in front.

Subtracting with Complement

27

26547
+92720
------------119267
-100000
------------19267

29

111100
2s complement of 100111 =
+011001
------------1010101
Sum =
6
Discard end carry 2
-1000000
--------------Answer =
010101

Using 2s complement, calculate


(111100)2 (100111)2

Example 3

Answer =

Sum =
Discard end carry 105

10s complement of 07280 =

Using 10s complement, calculate


26547 - 7280

Example 1

+6
-13
------7

00000110
11110011
-----------11111001

-6
-13
------19

32

A carry out of the


sign-bit is discarded

11111010
11110011
------------11101101

Unlike ordinary arithmetic, the rule for adding numbers


in signed-complement system does not require a
comparison or subtraction, but only addition. We need
just to change any negative number to 2s complement
form.

30

= -010101

100111
+000100
------------101011

Arithmetic Addition

Sum =
There is no end carry.
The answer is (2s complement
of 101011)

2s complement of 111100 =

Using 2s complement, calculate


(100111)2 (111100)2

Example 4

Advantage: The computer needs only one common


hardware circuit to handle both addition and
subtraction operations.

Any subtraction operation can be converted to an


addition operation.
(A) (+B) = (A) + (-B)
We can use the 2s complement operation for (-B).
(A) (-B) = (A) + (+B)

Arithmetic Subtraction

33

31

In decimal number, a negative number indicated by a


minus sign and a positive number by a plus sign.
However, everything should be represented with 0
and 1 digits in binary system.
There are three ways to represent a negative number in
binary, consider the number -9:
1. Signed-magnitude representation:
10001001
2. Signed-1s-complement representation: 11110110
3. Signed-2s-complement representation: 11110111
However, there is only one way to represent a positive
number. (9)10 = (00001001)2.

Signed Binary Numbers

4
+5
----9

0100
+0101
-------1001
8
1000
+3 +0011
----- --------11
1011
+0110
--------10001

BCD Addition: We need to add (0110)2 for any


result larger than (1001)2.

Examples:
(10)10= (0001 0000)BCD = (1010)2
(185)10 = (0001 1000 0101)BCD = (10111001)2

BCD Code

36

34

Digital systems manipulate not only binary


numbers, but also many other discrete elements
of information. Discrete elements can be
represented by binary codes.
For n-bit binary code, we have 2n distinct
combinations of 1s and 0s, with each
combination representing one element of the
set that is being coded. Each element can be
assigned a unique binary bit combination.

Binary Codes

0000
0001
0010
0011
0100
0101
0110
0111
1000
1001

0
1
2
3
4
5
6
7
8
9

184
+576
------760

-----0111

0001
+0101
------0111

1000 0100
0111 0110
-------- -------10000 1010
+0110 +0110
-------- ------0110 0000

Example: using BCD addition, calculate 184+576

BCD
Digit

Decimal Symbol

37

35

It allows to perform the arithmetic operations directly with decimal


numbers when they are stored in the computer in coded form.

BCD (Binary Coded Decimal ) Code

40

A binary cell is a device that possesses two


stable states and is capable of storing one bit of
information.
A register is a group of binary cells.
A register with 16 cells has 216 possible states.
A digital system is characterized by its
registers and the components that perform data
processing. A register transfer operation is a
basic operation in digital systems.

Binary Storage and Registers

38

ASCII Character Code(American Standard Code for


Information Interchange): It used seven bits to code
128 characters.

Example: 4=0110, 5=0111, and 6=0101. Used in

Other Codes:
Gray Code: only one bit in the code group changes
when going from one number to the next.

Other Decimal Codes:


2421 Code: weighted code
Excess-3 Code: 9s complement of a decimal number
is obtained directly by changing 1s to 0s and 0s to
1s.

Sum

Processor Unit

R3

0100100010
0 0 1 1 10 0 0 0 0 R2

Digital logic circuits


For binary addition

0 0 0 1 0 0 0 0 1 0 R1

0001000010

0011100001

0000000000

11000001
01010100

Overflow: a problem because of limited bits storage.

Operand 2

Operand 1

Memory Unit

01000001
11010100

Binary Addition

ASCII A = 1000001
ASCII T = 1010100

41

39

With even parity With odd parity

Used to detect errors in data communication


and processing.

Error-Detecting Code

Input-Output Signals for Gates

44

There are three basic logical operations:


AND: x.y=z or xy=z,
z=1 iff x=1 and y=1, otherwise z=0.
OR: x+y=z
z=1 if x=1 or y=1, otherwise z=0 ( z=0 if x=0 and y=0)
NOT: x=z
z=0 if x=1
z=1 if x=0
42

Each variable has two possible values: 0 or 1

Binary logic consists of binary variables and logical


operations.
Binary variables: A, B, C, x, y, z,

Binary Logic

x
y
y
0
1
0
1

x
0
0
1
1

x.y

AND Gate
z= x.y
x
y

0
1

x+y

OR Gate
x

z= x+y

x
1
0

x
0
1

NOT Gate

43

Logic gates are electronic circuits that operate on


one or more input signals to produce an output
signal.

Logic Gates

z=x

Potrebbero piacerti anche