Microsoft PowerPoint - STU_EC_Ch02.ppt

Similar documents
<4D F736F F F696E74202D20B5DAD2BBD5C228B4F2D3A1B0E6292E BBCE6C8DDC4A3CABD5D>

SuperMap 系列产品介绍

<4D F736F F F696E74202D20BCC6A6ECA874B2CEBEC9BDD7C1BFB871B2C4A440B3B9>

Microsoft PowerPoint - STU_EC_Ch08.ppt

Microsoft PowerPoint - STU_EC_Ch04.ppt

Chapter 3

Microsoft PowerPoint - chap3.ppt

Microsoft PowerPoint - STU_EC_Ch01.ppt

Microsoft PowerPoint - C15_LECTURE_NOTE_05.ppt

Microsoft PowerPoint - lecture4--Signal Processing on DSPs.ppt

Microsoft PowerPoint - C15_LECTURE_NOTE_05.ppt

untitled

C/C++语言 - C/C++数据

WWW PHP Comments Literals Identifiers Keywords Variables Constants Data Types Operators & Expressions 2

C C

PowerPoint Presentation

2

!"# $% & $%%% ( ")*+,-./00-(11.-. $%! $ " # $ % & ( - ) +%23!"# $%%% %,.%,!" $%.! 1.% & /$ 3(,. ( /0% $%%% ( $%%% ( 3 5 /6%%%! ")*+,-./00-(11

!! "!! "! "!! "! "! "!!#$% & ()*+, -./!000$ 1-2$##0! 3

2/80 2

Date (Paper 2) : 7 May 2018 (Monday) Duration : 1 h 50 min Topics to be assessed : - Units School worksheets - P3 to P4 Work Format of Paper 2:

Microsoft Word - ch05note_1210.doc

Microsoft PowerPoint - ATF2015.ppt [相容模式]

spss.doc

C/C++语言 - 运算符、表达式和语句

PowerPoint 簡報

<4D F736F F D20AC4FBDBDA4FBB67DA96CAABA2DA743A67EAFC5AAA95FA7B9BD5A5F2E646F63>

ex

國家圖書館典藏電子全文

Microsoft Word - 2AF63內文.doc

14 建筑环境设计模拟分析软件DeST--辅助商业建筑设计应用实例.doc

Outline Speech Signals Processing Dual-Tone Multifrequency Signal Detection 云南大学滇池学院课程 : 数字信号处理 Applications of Digital Signal Processing 2

(Load Project) (Save Project) (OffLine Mode) (Help) Intel Hex Motor

Improved Preimage Attacks on AES-like Hash Functions: Applications to Whirlpool and Grøstl

6-1 Table Column Data Type Row Record 1. DBMS 2. DBMS MySQL Microsoft Access SQL Server Oracle 3. ODBC SQL 1. Structured Query Language 2. IBM

(baking powder) 1 ( ) ( ) 1 10g g (two level design, D-optimal) 32 1/2 fraction Two Level Fractional Factorial Design D-Optimal D


PowerPoint Presentation

國立中山大學學位論文典藏.PDF

Ps22Pdf

LectureSlides1001 Data Storage.ppt [相容模式]

(Microsoft Word - Motion Program \270\305\264\272\276\363 \307\245\301\366 \271\327 \270\361\302\367.doc)

QUESTION BANK UPDATED FOR STUDENT ONLY.xls

PowerPoint Presentation

Microsoft Word - 最新正文.doc

CC213

Microsoft Word - Final Exam Review Packet.docx

1 * 1 *

第1章 簡介

Research for RS encoding and decoding technology in the Digital Television Terrestrial Broadcasting System 2006 厦门大学博硕士论文摘要库

影響新產品開發成效之造型要素探討

Microsoft PowerPoint - sp2 [相容模式]

运动员治疗用药豁免申报审批办法

经 济 高 速 增 长 和 其 后 又 比 其 他 发 达 资 本 主 义 国 家 更 为 顺 利 地 克 服 了 石 油 危 机 的 冲 击, 使 日 本 的 市 场 经 济 体 制 在 7 0 ~ 8 0 年 代 赢 得 了 国 际 社 会 的 广 泛 赞 誉 ( 其 间 虽 有 欧 美 国 家

2015 TB-1-06.indd

168 健 等 木醋对几种小浆果扦插繁殖的影响 第1期 the view of the comprehensive rooting quality, spraying wood vinegar can change rooting situation, and the optimal concent

Microsoft Word - Probability.doc

Important Notice SUNPLUS TECHNOLOGY CO. reserves the right to change this documentation without prior notice. Information provided by SUNPLUS TECHNOLO

untitled

論 文 摘 要 本 文 乃 係 兩 岸 稅 務 爭 訟 制 度 之 研 究, 蓋 稅 務 爭 訟 在 行 訴 訟 中 一 直 占 有 相 當 高 的 比 例, 惟 其 勝 訴 率 一 直 偏 低, 民 87 年 10 月 28 日 行 訴 訟 法 經 幅 修 正 後, 審 級 部 分 由 一 級 一

Microsoft PowerPoint - C15_LECTURE_NOTE_04.ppt

1269 malondialdehyde (MDA) were significantly decreased, while oxygen partial pressure (PaO 2 ), ph value, superoxide dismutase (SOD) and glutathione

Microsoft PowerPoint - Ch5 The Bipolar Junction Transistor

合金投资年报正文.PDF

从 宾 馆 到 又 一 城 是 十 五 分 钟, 从 又 一 城 到 邵 逸 夫 是 十 分 钟, 去 时 一 路 上 坡 很 辛 苦, 回 时 一 路 下 坡 很 轻 松, 很 像 上 小 学 时 的 心 情, 这 是 最 初 几 天 最 深 的 感 受 有 段 时 间 很 少 走 校 内 的 路


92南師學術研討會

Untitled-3

a b c d e f g C2 C1 2

Microsoft Word - p11.doc

Ps22Pdf

國 立 政 治 大 學 教 育 學 系 2016 新 生 入 學 手 冊 目 錄 表 11 國 立 政 治 大 學 教 育 學 系 博 士 班 資 格 考 試 抵 免 申 請 表 論 文 題 目 申 報 暨 指 導 教 授 表 12 國 立 政 治 大 學 碩 博 士 班 論

國立中山大學論文典藏.PDF

Real-time Human Detection and Security System

National Taiwan Ocean University Error Correcting Codes Spring 2003 Lecture 6: CRC Codes and BCH Codes National Taiwan Ocean University Announcement C

Knowledge and its Place in Nature by Hilary Kornblith

<4D F736F F D205F FB942A5CEA668B443C5E9BB73A740B5D8A4E5B8C9A552B1D0A7F75FA6BFB1A4ACFC2E646F63>

C/C++ - 函数

3.1 num = 3 ch = 'C' 2

Microsoft PowerPoint - STU_EC_Ch07.ppt

C/C++ - 数组与指针


THE APPLICATION OF ISOTOPE RATIO ANALYSIS BY INDUCTIVELY COUPLED PLASMA MASS SPECTROMETER A Dissertation Presented By Chaoyong YANG Supervisor: Prof.D

Microsoft PowerPoint - C15_LECTURE_NOTE_04.ppt

Microsoft Word - WAFS BUFR航空?据的解?及可?化研究.doc

Stochastic Processes (XI) Hanjun Zhang School of Mathematics and Computational Science, Xiangtan University 508 YiFu Lou talk 06/

Microsoft Word - template.doc


穨control.PDF

Tel: Fax: TTP-344M/246M /

08陈会广

地質調査研究報告/Bulletin of the Geological Survey of Japan

Microsoft Word - 09.數學 docx

WLAN 2

coverage2.ppt

ENGG1410-F Tutorial 6

碩命題橫式

(Microsoft Word - 11-\261i\256m\253i.doc)

Microsoft PowerPoint - Ch04.ppt

Transcription:

樹德科技大學資訊工程系 Chapter 2: Number Systems Operations and Codes Shi-Huang Chen Sept. 2010 1 Chapter Outline 2.1 Decimal Numbers 2.2 Binary Numbers 2.3 Decimal-to-Binary Conversion 2.4 Binary Arithmetic 2.5 1's and 2's Complements of Binary Numbers 2.6 Signed Numbers 2.7 Arithmetic Operations with Signed Numbers 2.8 Hexadecimal Numbers 2.9 Octal Numbers 2.10 Binary Coded Decimal (BCD) 2.11 Digital Codes and Parity 2 1

Decimal Numbers -1 The decimal number system has ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9 The decimal numbering system has a base of 10 with each position weighted by a factor of 10.10 5 10 4 10 3 10 2 10 1 10 0. 10-1 10-2 10-3 10-4 10-5 14.2 = 1 x 10 1 + 4 x 10 0 + 2 x 10-1 Decimal Point 3 Decimal Numbers -2 3 X 10 1 + 7 X 10 0 is equal to 3.7 37 10 370 4 2

Decimal Numbers -3 The number 9240 can be expressed as or (9 x 10 3 ) + (2 x 10 2 ) + (4 x 10 1 ) + (0 x 10 0 ) 9 x 1,000 + 2 x 100 + 4 x 10 + 0 x 1 Express the number 480.52 as the sum of values of each digit. 480.52 = (4 x 10 2 ) + (8 x 10 1 ) + (0 x 10 0 ) + (5 x 10-1 ) +(2 x 10-2 ) 5 Binary Numbers -1 The binary numbering system has 2 digits: 0 and 1 The binary numbering system has a base of 2 with each position weighted by a factor of 2.2 5 2 4 2 3 2 2 2 1 2 0. 2-1 2-2 2-3 2-4 2-5 Decimal Point 10111 = 1 x 2 4 +0 x 2 3 +1 x 2 2 +1 x 2 1 + 1 x 2 0 =23 10 6 3

Binary Numbers -2 4 = log2 16 7 Binary Numbers -3 8 4

Binary Numbers -4 Illustration of a simple binary counting application. 9 Binary Numbers -5 The binary number 1110 is equal to the decimal number 3 1 7 14 10 5

Binary Numbers -6 The binary number 11001110 is equal to the decimal number 12 206 127 66 11 Binary Numbers -7 Convert the binary number 100101.01 to decimal. Start by writing the column weights; then add the weights that correspond to each 1 in the number. 2 5 2 4 2 3 2 2 2 1 2 0. 2-1 2-2 32 16 8 4 2 1. ½ ¼ 1 0 0 1 0 1. 0 1 32 +4 +1 +¼ = 37¼ 12 6

Decimal-to-Binary Conversion -1 Sum-of-weight method Binary weights 256 128 64 32 16 8 4 2 1 357 = 256 + 64 + 32 + 4 + 1 101100101 Binary weights 1024 512 256 128 64 32 16 8 4 2 1 1937 = 1024 + 512 + 256 + 128 + 16 + 1 11110010001 13 Decimal-to-Binary Conversion -2 Repeated division-by-2 method 14 7

Decimal-to-Binary Conversion -3 Converting Decimal fractions to Binary Using Sum-of-weights Binary weights 64 32 16 8 4 2 1.5.25.125.0625 95.6875 = 64 + 16 + 8 + 4 + 2 + 1 +.5 +.125 +.0625 1011111.1011 Repeated division by 2 yields the whole number while repeated multiplication by 2 of the fraction yields the binary fraction 15 Decimal-to-Binary Conversion -4 The decimal number 18 is equal to the binary number 11110 10001 10010 1111000 16 8

Decimal-to-Binary Conversion -5 The decimal number 188 is equal to the binary number 10111100 0111000 1100011 1111000 17 Decimal-to-Binary Conversion -6 Convert the decimal fraction 0.188 to binary by repeatedly multiplying the fractional results by 2. 0.188 x 2 = 0.376 carry = 0 MSB 0.376 x 2 = 0.752 carry = 0 0.752 x 2 = 1.504 carry = 1 0.504 x 2 = 1.008 carry = 1 0.008 x 2 = 0.016 carry = 0 Answer =.00110 (for five significant digits) 18 9

Binary Addition -1 0 + 0 = 0 Sum of 0 with a carry of 0 0 + 1 = 1 Sum of 1 with a carry of 0 1 + 0 = 1 Sum of 1 with a carry of 0 1 + 1 = 10 Sum of 0 with a carry of 1 11001 +1101 100110 25 +13 38 19 Binary Addition -2 The sum of 11101 + 10111 equals 110011 100001 110100 100100 20 10

Binary Subtraction -1 0-0 = 0 1-1 = 0 1-0 = 1 10-1 = 1 0-1 with a borrow of 1 1011-111 100 11-7 4 21 Binary Subtraction -2 The difference of 111 001 equals 100 111 001 110 22 11

Binary Multiplication 0 x 0 = 0 0 x 1 = 0 1 x 0 = 0 100110 1 x 1 = 1 x 101 100110 000000 38 x 5 190 100110 10111110 23 Binary Division Use the same procedure as decimal division 24 12

1's Complements of Binary Numbers -1 Example of inverters used to obtain the 1 s complement of a binary number 25 1's Complements of Binary Numbers -2 The 1's complement of 10011101 is 01100010 10011110 01100001 01100011 26 13

2's Complements of Binary Numbers -1 Example of obtaining the 2 s complement of a negative binary number. 27 2's Complements of Binary Numbers -2 The 2's complement of 11100111 is 11100110 00011001 00011000 00011010 28 14

Signed Numbers -1 Sign-Magnitude Form The left-most bit in a signed binary number is the sign bit A 0 is for positive, and a 1 is for negative Ex: (8-bit) +25 = 0 0011001 Sign bit Magnitude bits - 25 = 1 0011001 29 Signed Numbers -2 Sign-Magnitude Form Express the decimal number 37 as an 8-bit number in sign-magnitude. 10100101 00100101 11011000 11010001 30 15

Signed Numbers -3 1's Complement Form Ex: (8-bit) +25 = 00011001-25 = 11100110 (1's complement of 25) In the 1's Complement form, a negative number is the 1's complement of the corresponding positive number 31 Signed Numbers -4 1's Complement Form Determine the decimal values of the signed binary number 11110100 in 1's complement 116 12 11 128 32 16

Signed Numbers -5 2's Complement Form Ex: (8-bit) +25 = 00011001-25 = 11100111 (2's complement of 25) In the 2's Complement form, a negative number is the 2's complement of the corresponding positive number 33 Signed Numbers -6 Floating-Point Numbers (1/2) 32 bits S Exponent (E) Mantissa (Fraction, F) 1 bit 8 bits 23 bits Biased Exp (+127) 3.248 x 10 4 = 32480 = 111111011100000 2 1.11111011100000 x 2 14 14 + 127 = 141 = 10001101 2 0 10001101 1111101110000000000000 34 17

Signed Numbers -7 Floating-Point Numbers (2/2) Number = (-1) S (1+F)(2 E-127 ) S E F 1 10010001 10001110001000000000000 Number = (-1) 1 (1.10001110001)(2 145 127 ) = (-1)(1.10001110001)(2 18 ) = 1100011100010000000 2 = 407,688 10 35 Arithmetic Operations with Signed Numbers -1 Addition Both numbers positive Positive number > Negative number Positive number < Negative number Both numbers negative Overflow condition Negative number is presented in 2 s complement form. 36 18

Arithmetic Operations with Signed Numbers -2 Subtraction Take the 2 s complement of the subtrahend and add. Ex: 8 3 = 8 + ( 3) 12 ( 9) = 12 + 9 25 19 = 25 + ( 19) 120 ( 30) = 120 + 30 37 Arithmetic Operations with Signed Numbers -3 Multiplication Is equivalent to adding a number to itself a number of times equal to the multiplier Ex: 8x3 = 8+8+8 38 19

Arithmetic Operations with Signed Numbers -4 Division Dividend Divisor = Quotient Quotient is the number of times that the divisor will go into the dividend. Ex: 21 7 = 3 21 7 = 14 14 7 = 7 3 times 7 7 = 0 39 Hexadecimal Numbers -1 40 20

Hexadecimal Numbers -2 Counting in Hex. 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 1A, 1B, 1C, 1D, 1E, 1F, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 2A, 2B, 2C,.. Bin.-to-Hex. Conversion Hex.-to-Bin. Conversion Hex.-to-Dec. Conversion Dec.-to-Hex. Conversion 41 Hexadecimal Numbers -3 Hex. Addition 58 16 + 22 16 = 7A 16 8 16 + 2 16 = 8 10 + 2 10 = A 16 5 16 + 2 16 = 5 10 + 2 10 = 7 16 DF 16 + AC 16 = 18B 16 F 16 + C 16 = 15 10 + 12 10 = 27 10 27 10-16 10 = 11 10 = B 16 with a 1 carry D 16 + A 16 + 1 16 = 13 10 + 10 10 + 1 10 = 24 10 24 10-16 10 = 8 10 = 8 16 with a 1 carry 42 21

Hexadecimal Numbers -4 Hex. Subtraction (1/3) Getting the 2 s complement of a hexadecimal number, Method 1. 43 Hexadecimal Numbers -5 Hex. Subtraction (2/3) Getting the 2 s complement of a hexadecimal number, Method 2. 44 22

Hexadecimal Numbers -6 Hex. Subtraction (3/3) Getting the 2 s complement of a hexadecimal number, Method 3. 45 Octal Numbers -1 Counting in Oct. 0, 1, 2, 3, 4, 5, 6, 7 10, 11, 12, 13, 14, 15, 16, 17, 20, 21,.. Oct.-to-Dec. Conversion Dec.-to-Oct. Conversion 46 23

Octal Numbers -2 Oct.-to-Bin. Conversion Bin.-to-Oct. Conversion 47 Binary Coded Decimal (BCD) The 8421 code BCD Addition 48 24

Digital Codes and Parity -1 The Gray code 49 Digital Codes and Parity -2 Bin.-to-Gray Code 1 + 0 + 1 + 1 + 0 1 1 1 0 1 Bin. Gray Gray-to-Bin. Code 1 1 0 1 1 + + + + Gray 1 0 0 1 0 Bin. 50 25

Digital Codes and Parity -3 A simplified illustration of how the Gray code solves the error problem in shaft position encoders. 51 Digital Codes and Parity -4 ASCII code 52 26

Digital Codes and Parity -5 Parity Method for Error Detection 53 27