微机原理ch01INTRODUCTIONTOCOMPUTER.doc_第1页
微机原理ch01INTRODUCTIONTOCOMPUTER.doc_第2页
微机原理ch01INTRODUCTIONTOCOMPUTER.doc_第3页
微机原理ch01INTRODUCTIONTOCOMPUTER.doc_第4页
微机原理ch01INTRODUCTIONTOCOMPUTER.doc_第5页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

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 10 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 the 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(余数)25/2=121LSB (least significant bit)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 system.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=110x21=0x2=0001x22=1x4=41000x23=0x8=000001x24=1x16=16100001x25=1x32=32100000-53110101Knowing the weight of each bit in a binary number makes it simple to add them together to get its decimal equivalent.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 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 16 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 Converting 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: 1001 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 leading 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 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 hex 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 relationship 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.DecimalBinaryHexadecimal00000001000011200010230001134001004500101560011067001117801000890100191001010A1101011B1201100C1301101D1401110E1501111F16100001017100011118100101219100111320101001421101011522101101623101111724110001825110011926110101A27110111B28111001C29111011D20111101E31111111FNotice in each base that when one is added to the highest digit (某进制中最大的数), that digit becomes zero and a 1 is carried to the next-highest digit position.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:Add the following binary numbers:1101, 1001, 10110Check against their decimal equivalent.Solution:BinaryDecimal11011310019+)1011022-10110044The discussion of subtraction of binary numbers is bypassed since all computers use the addition process to implement subtraction. 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 complement (补码)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 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.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 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 (-2B8):0010 1011 10001101 0100 01111s complement+)1-1101 0100 10002s complementD 4 859F+)D48-12E7|Overflow1.1.13 ASCII codeSince all information in the computer must be represented by 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 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 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 bit (位,比特) is a binary digit that can have the value 0 or 1.A byte (字节,8位元组) is defined as 8 bits.A nibble (半字节,4位元组) is half a byte, or 4 bits.A word (字) is two byte, or 16 bits.Bit0Nibble0000Byte0000 0000Word0000 0000 0000 0000 0000A kilobyte is 210 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 ROM, 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 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, andl I/O (Input/Output) devices.The function of CPU is to execute (process) i

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论