微機原理ch01INTRODUCTIONTOCOMPUTER_第1頁
微機原理ch01INTRODUCTIONTOCOMPUTER_第2頁
微機原理ch01INTRODUCTIONTOCOMPUTER_第3頁
微機原理ch01INTRODUCTIONTOCOMPUTER_第4頁
微機原理ch01INTRODUCTIONTOCOMPUTER_第5頁
已閱讀5頁,還剩4頁未讀 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、.1 INTRODUCTION TO COMPUTER1.1 NUMBERING AND CODING SYSTEMS1.1.1 Decimal and binary number systemsWhereas human beings use 10 (decimal) arithmetic, computers use the base 2 (binary) system.The binary system is used in computers because 1 and 0 represent the two voltage levels of on and off.In base 1

2、0 there are 10 distinct symbols, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. In base 2 there are only two, 0 and 1, with which to generate numbers. These two binary digits, 0 and 1, are commonly referred to as bits.1.1.2 Converting from decimal to binaryOne method of converting from decimal to binary is divide th

3、e decimal number by 2 repeatedly, keeping track of the remainders.This process continues until the quotient becomes to zero. The remainders are then written in reverse order to obtain the binary number.Example:Convert 2510 to binarySolution:Quotient(商)Remainder(余數(shù))25/2=121LSB (least significant bit)

4、12/2=606/2=303/2=111/2=01MSB (most significant bit)Therefore, 2510 = 1100121.1.3 Converting from binary to decimalTo convert from binary to decimal, it is important to understand the concept of weight associated with each digit position.First, as analogy, recall the weight of numbers in base 10 syst

5、em.74068310=3x100=     38x101=    806x102=   6000x103=  00004x104= 400007x105=700000-740683By the some token, each digit position in a number in base 2 has a weight associated with it:1101012=DecimalBinary1x20=1x1= 1

6、0;    10x21=0x2= 0    001x22=1x4= 4   1000x23=0x8= 0  00001x24=1x16=16 100001x25=1x32=32100000-53110101Knowing the weight of each bit in a binary number makes it simple to add them together to get its decimal equiva

7、lent.20 = 128 = 25621 = 229 = 51222 = 4210 = 10241K23 = 8211 = 204824 = 16212 = 409625 = 32213 = 819226 = 64214 = 1638427 = 128215 = 32768216 = 65536220 = 10485761M230 = 10737418241G1.1.4 Hexadecimal systemBase 16, the hexadecimal system as it is called in computer literature, is used as convenient

8、representation of binary numbers.For example, it is much easier for human being to represent a string 0s and 1s as 1000 1001 0110 as its hexadecimal equivalent of 896H.The binary system has 2 digits, 0 and 1. The base 10 system has 10 digits, 0 through 9. The hexadecimal (16 base) system must have 1

9、6 digits. In base 16 system, the first 10 digits, 0 to 9, are the same as in decimal, and for the remaining six digits, the letters A, B, C, D, E and F are used.DecimalBinaryHexadecimal000000100011200102300113401004501015601106701117810008910019101010A111011B121100C131101D141110E151111F1.1.5 Convert

10、ing between binary and hexTo represent a binary number as its equivalent hexadecimal, start from the right and group 4 bits at a time, replacing each 4-bit binary number with its hex equivalent.Example:Represent binary 100111110101 in hex.Solution:First the number is grouped into sets of 4 bits: 100

11、1 1111 0101Then each group of 4 bits replaced with its hex equivalent:1001 1111 01019 F 5Therefore, 1001111101012 = 9F5 hexadecimal.To covert from hex to binary, each hex digit is replaced with its 4-bit binary equivalent.Example:Convert hex 29B to binary.Solution:2 9 B0010 1001 1011Dropping the lea

12、ding zero gives 1010011011.1.1.6 Converting from decimal to hexConverting from decimal to hex could be approached in two ways:l Convert to binary first then convert to hex.l Convert directly from decimal to hex by the method of repeated division, keeping track of the remainders.Example:Convert 4510

13、to hexSolution:QuotientRemainder45/16=213 (hex D)2/16=02Therefore, 4510 = 2D16.Example:Convert 62910 to hexSolution:QuotientRemainder629/16=39539/16=272/1602Therefore, 62910 = 27516.1.1.7 Converting from hex to decimalConverting from hex to decimal can also be approached in two ways:l Convert from h

14、ex to binary and then to decimal.l Convert directly from hex to decimal by summing the weight of all digits.Example:Convert 6B216 to decimalSolution:6B216=2x160=2x1=   211x161=11x16= 1766x162=6x256=1536Therefore, 6B216 = 171410.1.1.8 Counting in bases 10, 2, 16To show the relatio

15、nship between all three bases, in the following table we show the sequence of number from 0 to 31 in decimal, along with the equivalent binary and hexadecimal numbers.DecimalBinaryHexadecimal00000001000011200010230001134001004500101560011067001117801000890100191001010A1101011B1201100C1301101D1401110

16、E1501111F16100001017100011118100101219100111320101001421101011522101101623101111724110001825110011926110101A27110111B28111001C29111011D20111101E31111111FNotice in each base that when one is added to the highest digit (某進制中最大的數(shù)), that digit becomes zero and a 1 is carried to the next-highest digit po

17、sition.For example, in decimal, 9 + 1 = 0 with a carry to the next-highest position. In binary, 1 + 1 = 0 with a carry, in hex, F + 1 = 0 with a carry.1.1.9 Addition of binary and hex numbersThe following table shows the addition of two binary bits. A + BCarrySum0 + 0000 + 1011 + 0011 + 110Example:A

18、dd the following binary numbers:1101, 1001, 10110Check against their decimal equivalent.Solution:BinaryDecimal  110113  1001 9+) 1011022-10110044The discussion of subtraction of binary numbers is bypassed since all computers use the addition process to implement subtrac

19、tion. Although computers have adder circuitry, there is no separate circuitry for subtraction. Instead, adders are used in conjunction with 2s complement circuitry to perform subtraction.In the other word, to implement “x - y”, the computer takes the 2s complement of y and adds it to x.1.1.10 2s com

20、plement (補碼)To get the 2s complement of a binary number, invert all the bits and then add 1 to the result.Inverting the bits is simply a matter of changing all 0s to 1s and 1s to 0s. This is called the 1s complement.Example:Take the 2s complement of 10011101.Solution:10011101binary number011000101s

21、complement (11111111 10011101)+)       1-011000112s complement (100000000 10011101)1.1.11 Addition of hex numbersStarting with the least significant digits, the digits are added together. If the result is less than 16, write that digit as the sum for that position.

22、If it is greater than 16, subtract 16 from it to get the digit and carry 1 to the next digit.Example:Proform hex addition: 23D9 + 94BE.Solution:23D9+)94BE-B897LSD: 9+14 = 2323 16 = 7 with a carry to next digit1+13+11 = 2525 -16 = 9 with a carry to next digit1+3+4 = 8MSD:2+9 = B1.1.12 Subtraction of

23、hex numbersIn subtracting two hex numbers, if the second digit is greater than the first, borrow 16 from the proceeding digit.Example:Perform hex subtraction: 59F 2B8.Solution:59F-)2B8-2E7LSD: 8 from 15 = 711 from 25 (9+16) = 14, which is EMSD:2 from 4 (5-1) = 259F 2B8 = 59F + (-2B8)2s complement of

24、 (-2B8):0010 1011 10001101 0100 01111s complement+)             1-1101 0100 10002s complementD 4 8  59F+)  D48- -1 2E7|Overflow1.1.13 ASCII codeSince all information in the computer must be represented by

25、0s and 1s, binary pattern must be assigned to letters and other characters. In the 1960s a standard representation called ACSII (American Standard Code for Information Interchange) was established. The ASCII (pronounced “ask-E”) code assigns binary patterns for:l number 0 to 9, l all the letters of

26、English alphabet, both uppercase and lowercase, and l many control code and punctuation marks(標點符號).The great advantage of this system is that it is used by most computers, so that information can shared among computers.The ASCII system uses a total of 7 bits to represent each code. For example, 100

27、 0001 is assigned to the uppercase letter “A”, and 110 0001 is for lowercase “a”. Often, a zero is placed in the most significant bit position to make it an 8-bit code.1.2 INSIDE THE COMPUTER1.2.1 Some important terminologyOne of the most important features of a computer is how much memory it has.A

28、bit (位,比特) is a binary digit that can have the value 0 or 1.A byte (字節(jié),8位元組) is defined as 8 bits.A nibble (半字節(jié),4位元組) is half a byte, or 4 bits.A word (字) is two byte, or 16 bits.Bit                   

29、0;   0Nibble                    0000Byte               0000 0000Word0000 0000 0000 0000 0000A kilobyte is 210

30、bytes, which is 1024 bytes. The abbreviation K is often used.A megabyte, or meg as some call it, is 220 bytes.A gigabyte is 230 bytes.A terabyte is 240 bytes.Two types of memory commonly used in microcomputers are RAM, which stands for random access memory (sometimes called read/write memory), and R

31、OM, which stands for read-only memory.RAM is used by the computer for temporary storage of programs that it is running. That the data is lost when the computer is turned off. For this reason, RAM is sometimes called volatile memory.ROM contains programs and information essential to operation of the

32、computer. The information in ROM is permanent, cannot be changed by the user, and is not lost when the power is turned off. Therefore, it is called nonvolatile memory.1.2.2 Internal organization of computersThe internal working of every computer can be broken down into three parts:l CPU (central processing unit)l Memory, a

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論