Digital Fundamentals - Helsinki

Preview:

Citation preview

Digital Fundamentals

Number systems,

Operations, and codes

Objectives

•Review the decimal number system

•Count in the binary number system

•Convert from decimal to binary and from binary to decimal

•Apply arithmetic operations to binary numbers

•Determine the 1's and 2's complements of a binary number

•Express signed binary numbers in sign-magnitude, 1's complement, 2's complement, and floating-point format

•Carry out arithmetic operations with signed binary numbers

•Convert between the binary and hexadecimal number systems

Number systems, operations, and codes

2

•Convert between the binary and hexadecimal number systems

•Add numbers in hexadecimal form

•Convert between the binary and octal number systems

•Express decimal numbers in binary coded decimal (BCD) form

•Add BCD numbers

•Convert between the binary system and the Gray code

•Interpret the American Standard Code for Information Interchange (ASCII)

•Use binary numbers and codes in a system application

Binary numbers

Number systems, operations, and codes

3

Application example

How can you detect a passing tennis ball?

Number systems, operations, and codes

4

Binary weights

Number systems, operations, and codes

5

Repeated division-by-2 method

Number systems, operations, and codes

6

Number systems, operations, and codes

7

Decimal fractions to binary

Number systems, operations, and codes

8

Binary arithmetic – addition (ADD) & subtraction (SUB)

Number systems, operations, and codes

9

Binary arithmetic – multiplication (MUL) & division (DIV)

Number systems, operations, and codes

10

2’S complements of binary numbers

Number systems, operations, and codes

11

Signed numbers

Number systems, operations, and codes

12

Conversion from signed binary to decimal

Number systems, operations, and codes

13

2’s complement to decimal

Number systems, operations, and codes

14

Range of signed interger numbers that can be represented

N2

)12()2( 11 −+− −− NN tofrom

total combinations

2’s complement reduces the maximum absolute value to approximately half

Number systems, operations, and codes

15

with 8 bits the range is –128 to +128with 16 bits the range is –32768 to +32767

Floating point numbers in binary format

single-precision

Number systems, operations, and codes

16

The exponent is expressed with a bias of 127, exponent has thus the

range of –126 to +128

Number systems, operations, and codes

17

Number systems, operations, and codes

18

Arithmeticoperationswith signednumbers

Number systems, operations, and codes

19

Number systems, operations, and codes

20

Subtraction

Number systems, operations, and codes

21

Multiplication

Number systems, operations, and codes

22

Number systems, operations, and codes

23

Division

Number systems, operations, and codes

24

Number systems, operations, and codes

25

Hexadecimal numbers

Number systems, operations, and codes

26

binary to hexadecimal

Number systems, operations, and codes

27

hexadecimal to binary

Number systems, operations, and codes

28

hexadecimal to decimal

Number systems, operations, and codes

29

hexadecimal to decimal

Number systems, operations, and codes

30

decimal to hexadecimal

Number systems, operations, and codes

31

hexadecimal addition

Number systems, operations, and codes

32

hexadecimal subtraction

Method 1. Convert the hexadecimalnumber to binary. Take the 2’s comp-lement of the binary number. Convertthe result to hexadecimal.

Number systems, operations, and codes

33

Method 2. Subtract the hexadecimalnumber from the maximum hexadeci-mal number and add 1.

Method 3. Write the sequence of single hexadecimal digits. Write the sequence inreverse below the forward sequence. The 1’s complement of each hex digit is thedigit directly below it. Add 1 to the resulting number to get the 2’s complement.

Number systems, operations, and codes

34

Hexadecimal subtraction

Number systems, operations, and codes

35

octal-to-decimal conversion

Number systems, operations, and codes

36

decimal-to-octal conversion

Number systems, operations, and codes

37

Number systems, operations, and codes

38

binary-to-octal

Number systems, operations, and codes

39

decimal-to-BCD

Number systems, operations, and codes

40

BCD-to-decimal

Number systems, operations, and codes

41

BCD addition

Number systems, operations, and codes

42

Number systems, operations, and codes

43

binary-to-gray

Number systems, operations, and codes

44

gray-code application example

Number systems, operations, and codes

45

ASCII

Number systems, operations, and codes

46

ASCII control characters

Number systems, operations, and codes

47

Extended ASCII characters

Number systems, operations, and codes

48

Parity method for error detection

Number systems, operations, and codes

49

Digital system application

Number systems, operations, and codes

50

Number systems, operations, and codes

51

Number systems, operations, and codes

52