Download presentation
Presentation is loading. Please wait.
Published byMyles Stephens Modified over 9 years ago
1
ECE 362 Microprocessor Systems and Interfacing ©5-1 Lecture 1 Hexadecimal Computation Outline n Decimal n Binary n Octal n Hexadecimal
2
How is the base-10 or decimal number represented? ECE 362 Microprocessor Systems and Interfacing ©1-2 Base-10: each digit can be 0 to 9 weights
3
How is the base-2 or binary number represented? ECE 362 Microprocessor Systems and Interfacing ©1-3 Base-2: each digit can be either 0 or 1 weights
4
How to convert Decimal to Binary? n Above decimal point u Keep dividing by 2 u Remainders are binary sequence of the given decimal n Below decimal point u Keep multiplying by 2 u Binary sequence of values above decimal point ECE 362 Microprocessor Systems and Interfacing ©1-4
5
How is the base-16 or hexadecimal number represented? ECE 362 Microprocessor Systems and Interfacing ©1-5 Base-16: each digit can be 0 to F
6
How to convert Hexadecimal to Decimal? ECE 362 Microprocessor Systems and Interfacing ©1-6 weights
7
ECE 362 Microprocessor Systems and Interfacing © How to represent common decimal numbers in hexadecimal? 1-7 Decimal Hex 256 511 512 1023 1024 (1K) 2047 2048 (2K) 4095 4096 (4K) 8191 8192 (8K) 16383 16384 (16K) 32767 32768 (32K) 65535 65536 (64K)
8
ECE 362 Microprocessor Systems and Interfacing © How to represent common decimal numbers in hexadecimal? 1-8 Decimal Hex 256 511 512 1023 1024 (1K) 2047 2048 (2K) 4095 4096 (4K) 8191 8192 (8K) 16383 16384 (16K) 32767 32768 (32K) 65535 65536 (64K)
9
How to perform Decimal Addition? 111 3758 + 4657 8415 What is going on? 1 1 1 (carry) 3 7 5 8 + 4 6 5 7 14 11 15 - 10 10 10 (subtract the base) 8 4 1 5
10
How to perform Binary Addition? Rules: u 0 + 0 = 0 u 0 + 1 = 1 u 1 + 0 = 1 u 1 + 1 = 2 = 10 2 = 0 with 1 to carry u 1 + 1 + 1 = 3 = 11 2 = 1 with 1 to carry
11
How to perform Binary Addition? 1 1 1 1 1 1 0 1 1 1 + 0 1 1 1 0 0 2 3 2 2 - 2 2 2 2 1 0 1 0 0 1 1 Verification 55 10 + 28 10 83 10 64 32 16 8 4 2 1 1 0 1 0 0 1 1 = 64 + 16 + 2 +1 = 83 10
12
ex) Verification 1 0 0 1 1 1 + 0 1 0 1 1 0 + ___ ___________ 128 64 32 16 8 4 2 1 = How to perform Binary Addition?
13
How to perform Octal Addition? 1 1 6 4 3 7 8 + 2 5 1 0 8 9 9 - 8 8 (subtract Base (8)) 1 1 1 4 7 8
14
How to perform Octal Addition? Ex) 3 5 3 6 8 + 2 4 5 7 8 - (subtract Base (8))
15
How to perform Hexadecimal Addition? 1 1 7 C 3 9 16 + 3 7 F 2 16 20 18 11 - 16 16 (subtract Base (16)) B 4 2 B 16
16
8 A D 4 16 + 5 D 6 16 - (subtract Base (16)) 16 How to perform Hexadecimal Addition?
17
How to perform Decimal Subtraction? 7 13 10 8 4 1 15 - 4 6 5 7 3 7 5 8 How is it done? (add the base 10 when borrowing) 10 10 7 3 0 10 8 4 1 5 13 10 15 - 4 6 5 7 3 7 5 8
18
How to perform Binary Subtraction? 1 2 1 0 2 0 2 2 1 0 1 0 0 1 1 - 0 1 1 1 0 0 1 1 0 1 1 1 Verification 83 10 - 28 10 55 10 64 32 16 8 4 2 1 1 1 0 1 1 1 = 32 + 16 + + 4 + 2 +1 = 55 10
19
How to perform Binary Subtraction? ex Verification 1 0 0 1 1 1 - 0 1 0 1 1 0 - ___ ___________ 128 64 32 16 8 4 2 1 =
20
How to perform Octal Subtraction? 8 0 0 8 1 1 1 4 7 8 8 9 - 6 4 3 7 8 2 51 0 8
21
ex 3 5 3 6 8 - 2 4 5 7 8 How to perform Octal Subtraction?
22
How to perform Hexadecimal Subtraction? B 16 7 C 3 9 16 19 - 3 7 F 2 16 4 4 4 7 16
23
8 A D 4 16 - 5 D 6 16 16 How to perform Hexadecimal Subtraction?
24
Notations to distinguish n In order to avoid misunderstanding, different prefixes and suffixes are directly added to the numbers. The prefix $ or 0x as well as the suffix h marks the numbers in hexadecimal system. n For example, hexadecimal number 10AF may look as follows $10AF, 0x10AF or 10AFh. n Similarly, binary numbers usually get the suffix % or 0b, ECE 362 Microprocessor Systems and Interfacing ©1-24
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.