微机原理ch01INTRODUCTIONTOCOMPUTER.docx
- 文档编号:25895105
- 上传时间:2023-06-16
- 格式:DOCX
- 页数:13
- 大小:34KB
微机原理ch01INTRODUCTIONTOCOMPUTER.docx
《微机原理ch01INTRODUCTIONTOCOMPUTER.docx》由会员分享,可在线阅读,更多相关《微机原理ch01INTRODUCTIONTOCOMPUTER.docx(13页珍藏版)》请在冰豆网上搜索。
微机原理ch01INTRODUCTIONTOCOMPUTER
1INTRODUCTIONTOCOMPUTER
1.1NUMBERINGANDCODINGSYSTEMS
1.1.1Decimalandbinarynumbersystems
Whereashumanbeingsuse10(decimal)arithmetic,computersusethebase2(binary)system.
Thebinarysystemisusedincomputersbecause1and0representthetwovoltagelevelsofonandoff.
Inbase10thereare10distinctsymbols,0,1,2,3,4,5,6,7,8,9.Inbase2thereareonlytwo,0and1,withwhichtogeneratenumbers.Thesetwobinarydigits,0and1,arecommonlyreferredtoasbits.
1.1.2Convertingfromdecimaltobinary
Onemethodofconvertingfromdecimaltobinaryisdividethedecimalnumberby2repeatedly,keepingtrackoftheremainders.
Thisprocesscontinuesuntilthequotientbecomestozero.
Theremaindersarethenwritteninreverseordertoobtainthebinarynumber.
Example:
Convert2510tobinary
Solution:
Quotient(商)Remainder(余数)
25/2=121LSB(leastsignificantbit)
12/2=60
6/2=30
3/2=11
1/2=01MSB(mostsignificantbit)
Therefore,2510=110012
1.1.3Convertingfrombinarytodecimal
Toconvertfrombinarytodecimal,itisimportanttounderstandtheconceptofweightassociatedwitheachdigitposition.
First,asanalogy,recalltheweightofnumbersinbase10system.
74068310=
3x100= 3
8x101= 80
6x102= 600
0x103= 0000
4x104= 40000
7x105=700000
------
740683
Bythesometoken,eachdigitpositioninanumberinbase2hasaweightassociatedwithit:
1101012=DecimalBinary
1x20=1x1= 1 1
0x21=0x2= 0 00
1x22=1x4= 4 100
0x23=0x8= 0 0000
1x24=1x16=16 10000
1x25=1x32=32100000
--------
53110101
Knowingtheweightofeachbitinabinarynumbermakesitsimpletoaddthemtogethertogetitsdecimalequivalent.
20=128=256
21=229=512
22=4210=10241K
23=8211=2048
24=16212=4096
25=32213=8192
26=64214=16384
27=128215=32768
216=65536
220=10485761M
230=10737418241G
1.1.4Hexadecimalsystem
Base16,thehexadecimalsystemasitiscalledincomputerliterature,isusedasconvenientrepresentationofbinarynumbers.
Forexample,itismucheasierforhumanbeingtorepresentastring0sand1sas100010010110asitshexadecimalequivalentof896H.
Thebinarysystemhas2digits,0and1.Thebase10systemhas10digits,0through9.Thehexadecimal(16base)systemmusthave16digits.Inbase16system,thefirst10digits,0to9,arethesameasindecimal,andfortheremainingsixdigits,thelettersA,B,C,D,EandFareused.
Decimal
Binary
Hexadecimal
0
0000
0
1
0001
1
2
0010
2
3
0011
3
4
0100
4
5
0101
5
6
0110
6
7
0111
7
8
1000
8
9
1001
9
10
1010
A
11
1011
B
12
1100
C
13
1101
D
14
1110
E
15
1111
F
1.1.5Convertingbetweenbinaryandhex
Torepresentabinarynumberasitsequivalenthexadecimal,startfromtherightandgroup4bitsatatime,replacingeach4-bitbinarynumberwithitshexequivalent.
Example:
Representbinary100111110101inhex.
Solution:
Firstthenumberisgroupedintosetsof4bits:
100111110101
Theneachgroupof4bitsreplacedwithitshexequivalent:
100111110101
9F5
Therefore,1001111101012=9F5hexadecimal.
Tocovertfromhextobinary,eachhexdigitisreplacedwithits4-bitbinaryequivalent.
Example:
Converthex29Btobinary.
Solution:
29B
001010011011
Droppingtheleadingzerogives1010011011.
1.1.6Convertingfromdecimaltohex
Convertingfromdecimaltohexcouldbeapproachedintwoways:
Converttobinaryfirstthenconverttohex.
Convertdirectlyfromdecimaltohexbythemethodofrepeateddivision,keepingtrackoftheremainders.
Example:
Convert4510tohex
Solution:
QuotientRemainder
45/16=213(hexD)
2/16=02
Therefore,4510=2D16.
Example:
Convert62910tohex
Solution:
QuotientRemainder
629/16=395
39/16=27
2/1602
Therefore,62910=27516.
1.1.7Convertingfromhextodecimal
Convertingfromhextodecimalcanalsobeapproachedintwoways:
Convertfromhextobinaryandthentodecimal.
Convertdirectlyfromhextodecimalbysummingtheweightofalldigits.
Example:
Convert6B216todecimal
Solution:
6B216=2x160=2x1= 2
11x161=11x16= 176
6x162=6x256=1536
Therefore,6B216=171410.
1.1.8Countinginbases10,2,16
Toshowtherelationshipbetweenallthreebases,inthefollowingtableweshowthesequenceofnumberfrom0to31indecimal,alongwiththeequivalentbinaryandhexadecimalnumbers.
Decimal
Binary
Hexadecimal
0
00000
0
1
00001
1
2
00010
2
3
00011
3
4
00100
4
5
00101
5
6
00110
6
7
00111
7
8
01000
8
9
01001
9
10
01010
A
11
01011
B
12
01100
C
13
01101
D
14
01110
E
15
01111
F
16
10000
10
17
10001
11
18
10010
12
19
10011
13
20
10100
14
21
10101
15
22
10110
16
23
10111
17
24
11000
18
25
11001
19
26
11010
1A
27
11011
1B
28
11100
1C
29
11101
1D
20
11110
1E
31
11111
1F
Noticeineachbasethatwhenoneisaddedtothehighestdigit(某进制中最大的数),thatdigitbecomeszeroanda1iscarriedtothenext-highestdigitposition.
Forexample,indecimal,9+1=0withacarrytothenext-highestposition.Inbinary,1+1=0withacarry,inhex,F+1=0withacarry.
1.1.9Additionofbinaryandhexnumbers
Thefollowingtableshowstheadditionoftwobinarybits.
A+B
Carry
Sum
0+0
0
0
0+1
0
1
1+0
0
1
1+1
1
0
Example:
Addthefollowingbinarynumbers:
1101,1001,10110
Checkagainsttheirdecimalequivalent.
Solution:
BinaryDecimal
110113
1001 9
+) 1011022
--------
10110044
Thediscussionofsubtractionofbinarynumbersisbypassedsinceallcomputersusetheadditionprocesstoimplementsubtraction.
Althoughcomputershaveaddercircuitry,thereisnoseparatecircuitryforsubtraction.Instead,addersareusedinconjunctionwith2’scomplementcircuitrytoperformsubtraction.
Intheotherword,toimplement“x-y”,thecomputertakesthe2’scomplementofyandaddsittox.
1.1.102’scomplement(补码)
Togetthe2’scomplementofabinarynumber,invertallthebitsandthenadd1totheresult.
Invertingthebitsissimplyamatterofchangingall0sto1sand1sto0s.Thisiscalledthe1’scomplement.
Example:
Takethe2’scomplementof10011101.
Solution:
10011101binarynumber
011000101’scomplement(11111111–10011101)
+) 1
--------
011000112’scomplement(100000000–10011101)
1.1.11Additionofhexnumbers
Startingwiththeleastsignificantdigits,thedigitsareaddedtogether.
Iftheresultislessthan16,writethatdigitasthesumforthatposition.
Ifitisgreaterthan16,subtract16fromittogetthedigitandcarry1tothenextdigit.
Example:
Proformhexaddition:
23D9+94BE.
Solution:
23D9
+)94BE
----
B897
LSD:
9+14=2323–16=7withacarrytonextdigit
1+13+11=2525-16=9withacarrytonextdigit
1+3+4=8
MSD:
2+9=B
1.1.12Subtractionofhexnumbers
Insubtractingtwohexnumbers,iftheseconddigitisgreaterthanthefirst,borrow16fromtheproceedingdigit.
Example:
Performhexsubtraction:
59F–2B8.
Solution:
59F
-)2B8
---
2E7
LSD:
8from15=7
11from25(9+16)=14,whichisE
MSD:
2from4(5-1)=2
59F–2B8=59F+(-2B8)
2’scomplementof(-2B8):
001010111000
1101010001111’scomplement
+) 1
--------------
1101010010002’scomplement
D48
59F
+) D48
- ---
1 2E7
^
|
Overflow
1.1.13ASCIIcode
Sinceallinformationinthecomputermustberepresentedby0sand1s,binarypatternmustbeassignedtolettersandothercharacters.
Inthe1960sastandardrepresentationcalledACSII(AmericanStandardCodeforInformationInterchange)wasestablished.TheASCII(pronounced“ask-E”)codeassignsbinarypatternsfor:
number0to9,
allthelettersofEnglishalphabet,bothuppercaseandlowercase,and
manycontrolcodeandpunctuationmarks(标点符号).
Thegreatadvantageofthissystemisthatitisusedbymostcomputers,sothatinformationcansharedamongcomputers.
TheASCIIsystemusesatotalof7bitstorepresenteachcode.Forexample,1000001isassignedtotheuppercaseletter“A”,and1100001isforlowercase“a”.Often,azeroisplacedinthemostsignificantbitpositiontomakeitan8-bitcode.
1.2INSIDETHECOMPUTER
1.2.1Someimportantterminology
Oneofthemostimportantfeaturesofacomputerishowmuchmemoryithas.
Abit(位,比特)isabinarydigitthatcanhavethevalue0or1.
Abyte(字节,8位元组)isdefinedas8bits.
Anibble(半字节,4位元组)ishalfabyte,or4bits.
Aword(字)istwobyte,or16bits.
Bit 0
Nibble 0000
Byte 00000000
Word00000000000000000000
Akilobyteis210bytes,whichis1024bytes.TheabbreviationKisoftenused.
Amegabyte,ormegassomecallit,is220bytes.
Agigabyteis230bytes.
Aterabyteis240bytes.
TwotypesofmemorycommonlyusedinmicrocomputersareRAM,whichstandsforrandomaccessmemory(sometimescalledread/writememory),andROM,whichstandsforread-onlymemory.
RAMisusedbythecomputerfortemporarystorageofprogramsthatitisrunning.Thatthedataislostwhenthecomputeristurnedoff.Forthisreason,RAMissometimescalledvolatilememory.
ROMcontainsprogramsandinformationessentialtooperationofthecomputer.TheinformationinROMispermanent,cannotbechangedbytheuser,andisnotlostwhenthepoweristurnedoff.Therefore,itiscallednonvolatile
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 微机 原理 ch01INTRODUCTIONTOCOMPUTER