Você está na página 1de 33

Introduction to Digital Electronics

Suplementary Reading
Digital Design by - John F. Wakerly
www.ddpp.com - you will find some solutions at this site. www.xilinx.com - Xlinix Web site

Logic and Computer Design Fundamentals by - M. Morris Mano & Charles R. Kime Digital Design by - M. Morris Mano Digital Logic Circuit Analysis and Design
by - Victor P. Nelson, H. Troy Nagle, J. David Irwin & Bill D. Carrol

Digital Electronics
Digital Electronics represents information (0, 1) with only two discrete values. Ideally no voltage (e.g., 0v) represents a 0 and full source voltage (e.g., 5v) represents a 1 Realistically low voltage (e.g., <1v) represents a 0 and high voltage (e.g., >4v) represents a 1 We achieve these discrete values by using switches. We use transistor switches, which operates at high speed, electronically, a small in size.

Analog versus Digital


Analog systems process time-varying signals that can take on any value across a continuous range of voltages (in electrical/electronics systems). Digital systems process time-varying signals that can take on only one of two discrete values of voltages (in electrical/electronics systems).
Discrete values are called 1 and 0 (ON and OFF, HIGH and LOW, TRUE and FALSE, etc.)

Representing Information Electronically


Analog electronics deals with non-discrete values Digital electronics deals with discrete values

Benefits of Digital over Analog


Reproducibility Not effected by noise means quality Ease of design Data protection Programmable Speed Economy

Digital Revolution
Digital systems started back in 1940s. Digital systems cover all areas of life:
still pictures digital video digital audio telephone traffic lights Animation

Digital Devices

Gates Flip-Flops PLDs FPGAs

Gates
The most basic digital devices are called gates. Gates got their name from their function of allowing or blocking (gating) the flow of digital information. A gate has one or more inputs and produces an output depending on the input(s). A gate is called a combinational circuit. Three most important gates are: AND, OR, NOT

What, More Number Systems?


Why do we need more number systems?
Humans understand decimal
Check out my ten digits !

Digital electronics (computers) understand binary

Since computers have 32, 64, and even 128 bit busses, displaying numbers in binary is cumbersome. Data on a 32 bit data bus would look like the following:
0110 1001 0111 0001 0011 0100 1100 1010

Hexadecimal (base 16) and octal (base 8) number systems are used to represent binary data in a more compact form. This presentation will present an overview of the process for converting numbers between the decimal number system and the hexadecimal & octal number systems.
10

Converting To and From Decimal


Decimal10
Successive Division Weighted Multiplication Successive Division
0123456789

Weighted Multiplication Successive Division

Weighted Multiplication

Octal8
01234567

Hexadecimal16
0123456789ABCDEF

Binary2
01

11

Counting . . . 2, 8, 10, 16
Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 Binary 00000 00001 00010 00011 00100 00101 00110 00111 01000 01001 01010 01011 01100 01101 01110 01111 10000 10001 10010 10011 Octal 0 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17 20 21 22 23 Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F 10 11 12 13

12

Review: Decimal
Successive Division

Binary

a) Divide the decimal number by 2; the remainder is the LSB of the binary number. b) If the quotation is zero, the conversion is complete. Otherwise repeat step (a) using the quotation as the decimal number. The new remainder is the next most significant bit of the binary number.

Weighted Multiplication
a) Multiply each bit of the binary number by its corresponding bit-weighting factor (i.e., Bit-0 20=1; Bit-1 21=2; Bit-2 22=4; etc). b) Sum up all of the products in step (a) to get the decimal number.
13

Conversion Process Decimal


(Any base including Binary2, Octal8, Hexidecimal16) Successive Division

BaseN

a) Divide the decimal number by N; the remainder is the LSB of the ANY BASE Number . b) If the quotient is zero, the conversion is complete. Otherwise repeat step (a) using the quotient as the decimal number. The new remainder is the next most significant bit of the ANY BASE number.

Weighted Multiplication
a) Multiply each bit of the ANY BASE number by its corresponding bit-weighting factor (i.e., Bit-0 N0; Bit-1 N1; Bit-2 N2; etc). b) Sum up all of the products in step (a) to get the decimal number.
14

Decimal

Octal Conversion

The Process: Successive Division Divide the decimal number by 8; the remainder is the LSB of the octal number . If the quotation is zero, the conversion is complete. Otherwise repeat step (a) using the quotation as the decimal number. The new remainder is the next most significant bit of the octal number. Example: Convert the decimal number 9410 into its octal equivalent.
r! r! r!
n MSB n LSB

@ 9410 = 1368

15

Example: Dec
Example:

Octal

Convert the decimal number 18910 into its octal equivalent.

16

Example: Dec
Example:

Octal

Convert the decimal number 18910 into its octal equivalent. Solution:

r! r! r!

n LSB

@ 18910 = 2758

n MSB

17

Octal

Decimal Process

The Process: Weighted Multiplication Multiply each bit of the Octal Number by its corresponding bitweighting factor (i.e., Bit-0 80=1; Bit-1 81=8; Bit-2 82=64; etc.). Sum up all of the products in step (a) to get the decimal number. Example: Convert the octal number 1368 into its decimal equivalent.

1
82
64 64 +

3
81
8 24 +

6
80
1 6

Bit-Weighting Factors

@ 136 8 = 9410

9410
18

Example: Octal
Example:

Dec

Convert the octal number 1348 into its decimal equivalent.

19

Example: Octal
Example:

Dec

Convert the octal number 1348 into its decimal equivalent. Solution:

1
82
64

3
81
8

4
80
1

@ 1348 = 9210
=

64

24

9210

20

Decimal

Hexadecimal Conversion

The Process: Successive Division Divide the decimal number by 16; the remainder is the LSB of the hexadecimal number. If the quotation is zero, the conversion is complete. Otherwise repeat step (a) using the quotation as the decimal number. The new remainder is the next most significant bit of the hexadecimal number. Example: Convert the decimal number 9410 into its hexadecimal equivalent.

5 16 94 0 16 5

r ! E n SB r ! 5 n MSB

@ 9410 = 5E16
21

Example: Dec
Example:

Hex

Convert the decimal number 42910 into its hexadecimal equivalent.

22

Example: Dec
Example:

Hex

Convert the decimal number 42910 into its hexadecimal equivalent. Solution:
26 16 429 1 16 26 0 16 1 r ! D (13) n SB r ! A (10) r !1
n MSB

@ 42910 = 1AD16 = 1ADH

23

Hexadecimal

Decimal Process

The Process: Weighted Multiplication Multiply each bit of the hexadecimal number by its corresponding bitweighting factor (i.e., Bit-0 160=1; Bit-1 161=16; Bit-2 162=256; etc.). Sum up all of the products in step (a) to get the decimal number. Example: Convert the octal number 5E16 into its decimal equivalent.

5
161
16 80 +

E
160
1 14

Bit-Weighting Factors

@ 5E 16 = 9410

9410
24

Example: Hex
Example:

Dec

Convert the hexadecimal number B2EH into its decimal equivalent.

25

Example: Hex
Example:

Dec

Convert the hexadecimal number B2EH into its decimal equivalent. Solution:

B
162
256

2
161
16

E
160
1

@ B2EH = 286210
=

2816

32

14

286210

26

Example: Hex
Example:

Octal

Convert the hexadecimal number 5AH into its octal equivalent.

27

Example: Hex
Example: Solution:

Octal

Convert the hexadecimal number 5AH into its octal equivalent. First convert the hexadecimal number into its decimal equivalent, then convert the decimal number into its octal equivalent.
5
161
16

A
160
1

11 8 90 1 8 11

r ! 2 n SB r!3 r ! 1 n MSB

80

10

9010

0 8 1

@ 5AH = 1328
28

Example: Octal

Binary

Example: Convert the octal number 1328 into its binary equivalent.

29

Example: Octal

Binary

Example: Convert the octal number 1328 into its binary equivalent. Solution: First convert the octal number into its decimal equivalent, then convert the decimal number into its binary equivalent.
1
82
64

3
81
8

2
80

r! r!

n LSB

r!
64 + 24 + 2

@ 1328 = 10110102

= 9010

r! r! r! r!
n MSB
30

Binary

Octal

Hex Shortcut

Because binary, octal, and hex number systems are all powers of two (which is the reason we use them) there is a relationship that we can exploit to make conversion easier.

1 0 1 1 0 1 0 2 = 132 8 = 5A H
To convert directly between binary and octal, group the binary bits into sets of 3 (because 23 = 8). You may need to pad with leading zeros.

0 0 1 0 1 1 0 1 0 2= 1

28

1 3 2 001 011 010 To convert directly between binary and hexadecimal number systems, group the binary bits into sets of 4 (because 24 = 16). You may need to pad with leading zeros.

0 1 0 1 1 0 1 0 2= 5
5 A 0101 1 010

A 16
31

Example: Binary

Octal

Hex

Example: Using the shortcut technique, convert the hexadecimal number A616 into its binary and octal equivalent. Use your calculator to check your answers.

32

Example: Binary

Octal

Hex

Example: Using the shortcut technique, convert the hexadecimal number A616 into its binary & octal equivalent. Use your calculator to check your answers. Solution: First convert the hexadecimal number into binary by expanding the hexadecimal digits into binary groups of (4).

6 16
@ A616 = 101001102

1010 0110

Convert the binary number into octal by grouping the binary bits into groups of (3).

010100110
2 4 6

@ 101001102 = 2468
33

Você também pode gostar