数字电子技术英文版.ppt

上传人:max****ui 文档编号:12175143 上传时间:2020-05-07 格式:PPT 页数:67 大小:1.59MB
返回 下载 相关 举报
数字电子技术英文版.ppt_第1页
第1页 / 共67页
数字电子技术英文版.ppt_第2页
第2页 / 共67页
数字电子技术英文版.ppt_第3页
第3页 / 共67页
点击查看更多>>
资源描述
CHAPTER2NUMBERSYSTEMS,OPERATIONS,ANDCODES数字系统、运算和编码,2-1DECIMALNUMBERS十进制数,IntroductoryParagraph,Youarefamiliarwiththedecimalnumbersystembecauseyouusedecimalnumberseveryday.Althoughdecimalnumbersarecommonplace,theirweightedstructureisoftennotunderstood.Inthissection,thestructureofdecimalnumbersisreviewed.Theirreviewwillhelpyoumoreeasilyunderstandthestructureofthebinarynumbersystem,whichisimportantincomputersanddigitalelectronics.,DecimalReview,Numbersconsistofabunchofdigits,eachwithaweight.,Theseweightsareallpowersofthebase,whichis10.Wecanrewritethis:,Tofindthedecimalvalueofanumber,multiplyeachdigitbyitsweightandsumtheproducts.,NothingSpecialabout10!,Decimalsystem(andtheideaof“0”)wasinventedinIndiaaround100-500AD.Whydidtheyuse10?Anythingspecialaboutit?Notreally.Probablythefactthatwehave10fingersinfluencedthis.Willabaseotherthan10work?Sure.,Whataboutbase2?,2-2BINARYNUMBERS二进制数,IntroductoryParagraph,Thebinarynumbersystemissimplyanotherwaytorepresentquantities.Thebinarysystemislesscomplicatedthanthedecimalsystembecauseithasonlytwodigits.Itmayseemmoredifficultatfirstbecauseitisunfamiliartoyou.Thedecimalsystemwithitstendigitsisabase-tensystem;thebinarysystemwithitstwodigitsisabase-twosystem.Thetwodigits(bits)are1and0.Thepositionofa1or0inabinarynumberindicatesitsweight,orvaluewithinthenumber,justasthepositionofadecimaldigitdeterminesthevalueofthatdigit.Theweightsinabinarynumberarebasedonpowersoftwo.,CountinginBinary,Abinarycountof0through15isshownbelow.Asyouwillsee,4bitsarerequiredtocountfrom0to15.,CountingTennisBallsGoingintoaboxfromaConveyorBelt,Thecountercountsthepulsesfromasensorthatdetectsthepassingofaballandproducesasequenceoflogiclevels(digitalwaveforms)oneachofitsfourparalleloutputs.Eachsetoflogiclevelsrepresenta4-bitbinarynumber.Thedecoderdecodeseachsetoffourbitsandconvertsittothecorrespondingdecimalnumberinthe7-segmentdisplay.,TheWeightingStructureofBinaryNumbers,Abinarynumberisaweightednumber(加权数).Theright-mostbitistheLSB(最低有效位)inabinarywholenumberandhasaweightof20=1.Theweightsincreasefromrighttoleftbyapoweroftwoforeachbit.Theleft-mostbitistheMSB(最高有效位).Fractionalnumbers(小数)canalsoberepresentedinbinarybyplacingbitstotherightofthebinarypoint.Theleft-mostbitistheMSBinabinaryfractionalnumberandhasaweightof2-1=0.5.Thefractionalweightsdecreasesfromlefttorightbyanegativepoweroftwoforeachbit.Theweightstructureofabinarynumberis,Binary-toDecimalConversion,Thedecimalvalueofanybinarynumbercanbefoundbyaddingtheweightsofallbitsthatare1anddiscardingtheweightsofallbitsthatare0.,2-3DECIMAL-TO-BINARYCONVERSION,RepeatedDivision-by-2Method,Asystematicmethodofconvertingwholenumbersfromdecimaltobinaryistherepeateddevision-by-2process.,RepeatedMultiplication-by-2Method,Asystematicmethodofconvertingfractionalnumbersfromdecimaltobinaryistherepeatedmultiplication-by-2process.,2-4BINARYARITHMETIC,BinaryAddition,Thefourbasicrulesforaddingbinarydigits(bits)areasfollows:,0+0=0Sumof0withacarryof00+1=1Sumof1withacarryof01+0=1Sumof1withacarryof01+1=0Sumof0withacarryof1,ExampleAdd1111and1100.,BinarySubtraction,Thefourbasicrulesforsubtractionbinarydigits(bits)areasfollows:,0-0=0Differenceof0withaborrowof00-1=1Differenceof1withaborrowof11-0=1Differenceof1withaborrowof01-1=0Differenceof0withaborrowof0,ExampleSubtract100from111.,BinaryMultiplication,Thefourbasicrulesformultiplicationbinarydigits(bits)areasfollows:,ExampleMultiply1101by1010.,BinaryDivision,Divisioninbinaryfollowsthesameprocedureasdivisionindecimal.,ExampleDivide1100by100.,2-51SAND2SCOMPLEMENTSOFBINARYNUMBERS二进制的反码和补码,Findingthe1sComplementofaBinaryNumber,The1scomplementofabinarynumberisfoundbychangingall1sto0sandall0sto1s.,ExampleFindthe1scomplementofbinarynumber10110010.,Findingthe2sComplementofaBinaryNumber,The2scomplementofabinarynumberisfoundbyadding1tothe1scomplement.,ExampleFindthe2scomplementofbinarynumber10110010.,2-6SIGNEDNUMBERS带符号数,TheSignBit,Theleft-mostbitinasignedbinarynumberisthesignbit,whichtellsyouwhetherthenumberispositiveornegative.A0isforpositive,anda1isfornegative.,Sign-MagnitudeSystem,Whenasignedbinarynumberisrepresentedinsign-magnitude,theleft-mostbitisthesignbitandtheremainingbitsarethemagnitudebits.Themagnitudebitsareintrue(uncomplemented)binaryforbothpositiveandnegativenumbers.,Thedecimalvaluesaredeterminedbysummingtheweightsinallthemagnitudebitpositionswherethereare1s.Thesignisdeterminedbyexaminationofthesignbit.,Sign-MagnitudeSystem,Example2-15Determinethedecimalvalueofthissignedbinarynumberexpressedinsign-magnitude:10010101.,1sComplementSystem,Positivenumbersinthe1scomplementsystemarerepresentedthesamewayasthepositivesign-magnitudenumbers.Negativenumbers,however,arethe1scomplementsofthecorrespondingpositivenumbers.,Thedecimalvaluesofpositivenumbersaredeterminedbysummingtheweightsinallbitpositionswherethereare1s.Thedecimalvaluesofnegativenumbersaredeterminedbysummingtheweightsinallbitpositionswherethereare1s,andadding1totheresult.Theweightofthesignbitisgivenanegativevalue.,1sComplementSystem,Why?,1sComplementSystem,Example2-16Determinethedecimalvalueofthesignedbinarynumbersexpressedin1scomplement:(a)00010111(b)11101000.,2sComplementSystem,Positivenumbersinthe2scomplementsystemarerepresentedthesamewayasinsign-magnitudeand1scomplementsystems.Negativenumbersarethe2scomplementsofthecorrespondingpositivenumbers.,Thedecimalvaluesaredeterminedbysummingtheweightsinallbitpositionswherethereare1s.Theweightofthesignbitisgivenanegativevalue.,2sComplementSystem,Example2-17Determinethedecimalvalueofthesignedbinarynumbersexpressedin2scomplement:(a)01010110(b)10101010.,2sComplementAdvantage,ToconverttodecimalThe2scomplementsystemsimplyrequiresasummationofweightsregardlessofwhetherthenumberispositiveornegative.Thesign-magnitudesystemrequirestwostepssumtheweightsofthemagnitudebitsandexaminethesignbittodetermineifthenumberispositiveornegative.The1scomplementsystemrequiresadding1tothesummationofweightsfornegativenumbersbutnotforpositivenumbers.Also,the1scomplementsystemisnotusedbecausetworepresentationsofzero(00000000or11111111)arepossible.,TheDevelopment,The2scomplementofann-bitnumberxisdefinedby,Forexample,ifn=8,then,TheDevelopment,and,RangeofSignedIntegerNumbers,Thenumberofdifferentcombinationsofnbitsis,For2scomplementsignednumbers,therangeofvalueforn-bitnumbersis,BytheWay,The8-bitgroupinghasbeengiventhespecialnamebyte.,Floating-PointNumbers(浮点数),Notrequired!,2-7ARITHMETICOPERATIONSWITHSIGNEDNUMBERS带符号数的算术运算,Addition(加法),Thetwonumbersinanadditionaretheaddend(加数)andtheaugend(被加数).Theresultsarethesum(和)andthecarry(进位).,Theadditionprocessisstatedasfollows:addthetwonumbersanddiscardanyfinalcarrybit.,Example(a)00000111+00000100=?(b)00001111+11111010=?(c)00010000+11101000=?(d)11111011+11110111=?,OverflowCondition(溢出条件),Whentwonumbersareaddedandthenumberofbitsrequiredtorepresentthesumexceedsthenumberofbitsinthetwonumbers,anoverflowresultsasindicatedbyanincorrectsignbit.Anoverflowcanoccuronlywhenbothnumbersarepositiveorbothnumbersarenegative.,Example(a)01111101+00111010=?(b)10001000+11101101=?,Subtraction(减法),Thetwonumbersinasubtractionarethesubtrahend(减数)andtheminuend(被减数).Theresultsarethedifference(差)andtheborrow(借位).,Thesubtractionprocessisstatedasfollows:takethe2scomplementofthesubtrahendandadd.Disiscardanyfinalcarrybit.,Example(a)0001000-00000011=?(b)11100111-00010011=?,Multiplication(乘法),Thetwonumbersinamultiplicationarethemultiplier(乘数)andthemultiplicand(被乘数).Theresultistheproduct(积).,Themultiplicationoperationinmostcomputersisaccomplishedusingpartialproductmethod(部分积方法).Thebasicstepsintheprocessareasfollows:Determineifthesignsofthetwonumbersarethesame.Thisdetermineswhatthesignoftheproductwillbe.Changeanynegativenumbertotrue(uncomplemented)form.StartingwiththeLSBofthemultiplier,generatethepartialproducts.Shifteachsuccessivepartialproductonebittotheleft.Addeachpartialproducttothesumofthepreviouspartialproductstogetthefinalproduct.Ifthesignoftheproductisnegative,takethe2scomplementoftheproduct.Attachthesignbittotheproduct.,Multiplication,Example2-22Multiplythesignedbinarynumber01010011and11000101.,Division(除法),Thetwonumbersinadivisionarethedivisor(除数)andthedividend(被除数).Theresultsarethequotient(商)andtheremainder(余数).,Thebasicstepsinadivisiontheprocessareasfollows:Determineifthesignsofthetwonumbersarethesame.Thisdetermineswhatthesignofthequotientwillbe.Initializethequotienttozeroandinitializethepartialremaindertothedividend.Subtractthedivisorfromthepartialremainderusing2scomplementadditiontogetthenextpartialremainder.Iftheresultispositive,add1tothequotientandrepeatforthenextpartialremainder;otherwise,thedivisioniscomplete.,Division,Example2-23Divide01100100by00011001.,2-8HEXADECIMALNUMBERS(十六进制数),WhyHexadecimal?,Asyouareprobablyaware,longbinarynumbersaredifficulttoreadandwritebecauseitiseasytodroportransposeabit.Sincecomputersandmicroprocessorsunderstandonly1sand0s,itisnecessarytousethesedigitswhenyouprograminmachinelanguage.Thehexadecimalnumbersystemhas16digitsandisusedprimarilyasacompactwayofdisplayingorwritingbinarynumbersbecauseitisveryeasytoconvertbetweenbinaryandhexadecimal.10numericdigits(0,1,2,3,4,5,6,7,8,9)and6alphabeticcharacters(A,B,C,D,E,F)makeupthehexadecimalnumbersystem.,Relationshipbetweenhexadecimalandbinary,Eachhexadecimaldigitrepresentsa4-bitbinarynumber.,Binary-to-HexadecimalConversion,Verystraightforward!Simplybreakthebinarynumberinto4-bitgroups,startingattheright-mostbitandreplaceeach4-bitgroupwiththeequivalenthexadecimalsymbol.Example2-24Convertthefollowingbinarynumberstohexadecimal:(a)1100101001010111(b)111111000101101001,Hexadecimal-to-BinaryConversion,Verystraightforward!Simplyreplaceeachhexadecimalsymbolwiththeequivalent4-bitgroup.Example2-25Determinethebinarynumbersforthefollowinghexadecimalnumbers:(a)10A4h(b)CF8Eh(c)9742h,Hexadecimal-to-DecimalConversion,Multiplythedecimalvalueofeachhexadecimaldigitbyitsweightandthentakethesumoftheseproducts.Example2-27Convertthefollowinghexadecimalnumberstodecimal:(a)E5h(b)B2F8h,Decimal-to-HexadecimalConversion,Repeateddivisionofadecimalnumberby16willproducetheequivalenthexadecimalnumber.Example2-28Convertthedecimalnumber650tohexadecimalbyrepeateddivisionby16.,2-10BINARYCODEDDECIMAL(BCD),IntroductoryParagraph,Binarycodeddecimal(BCD)isawaytoexpresseachofthedecimaldigitswithabinarycode.SincethereareonlytencodegroupsintheBCDsystem,itisveryeasytoconvertbetweendecimalandBCD.Becauseweliketoreadandwriteindecimal,theBCDcodeprovidesanexcellentinterfacetobinarysystems.Examplesofsuchinterfacesarekeypadinputsanddigitalreadouts.,The8421Code,The8421codeisatypeofBCDcode.BCDmeansthateachdecimaldigit,0through9,isrepresentedbyabinarycodeoffourbits.,Thedesignation8421indicatesthebinaryweightsofthefourbits.1010,1011,1100,1101,1110,and1111areinvalidcodes.The8421codeisthepredominantBCDcode,andwhenwerefertoBCD,wealwaysmeanthe8421codeunlessotherwisestated.,The8421Code,ToexpressanydecimalnumberinBCD,simplyreplaceeachdecimaldigitwiththeappropriate4-bitcode.Example2-33ConverteachofthefollowingdecimalnumberstoBCD.(a)35(b)98(c)170(d)2469,TodetermineadecimalnumberfromaBCDnumber,startattheright-mostbitandbreakthecodeintogroupsoffourbits,thenwritethedecimaldigitrepresentedbyeach4-bitgroup.Example2-34ConverteachofthefollowingBCDcodestodecimal:(a)10000110(b)001101010001(c)1001010001110000,BCDAddition,BCDisanumericalcodeandcanbeusedinarithmeticoperations.HereishowtoaddtwoBCDnumbers:AddthetwoBCDnumbers,usingtherulesforbinaryaddition.Ifa4-bitsumisequaltoorlessthan9,itisavalidBCDnumber.Ifa4-bitsumisgreaterthan9,orifacarryoutofthe4-bitgroupisgenerated,itisaninvalidresult.Add6(0110)tothe4-bitsuminordertoskipthesixinvalidcodesandreturnedthecodeto8421.Ifacarryresultswhen6isadded,simplyaddthecarrytothenext4-bitgroup.ExampleAddtheBCDnumbers:00010110+00010101.,2-11DIGITALCODESANDPARITY数字编码和奇偶校验,IntroductoryParagraph,Therearemanyspecializedcodesusedindigitalsystems.YouhavejustlearnedabouttheBCDcode;nowletslookatafewothers.Somecodesarestrictlynumeric,likeBCD,andothersarealphanumeric;thatis,theyareusedtorepresentnumbers,letters,symbols,andinstructions.ThecodeintroducedinthissectionaretheGraycodeandtheASCIIcode.Also,thedetectionoferrorsincodesusingaparitybitiscovered.,TheGrayCode(格雷码),TheGraycodeisunweightedandisnotanarithmeticcode;thatis,therearenospecificweightsassignedtothebitpositions.TheimportantfeatureoftheGraycodeisthatitexhibitsonlyasinglebitchangefromonecodenumbertothenext.相邻码,Binary-to-GraycodeConversion,TheMSBintheGraycodeisthesameasthecorrespondingMSBinthebinarynumber.Goingfromlefttoright,addeachadjacentpairofbinarycodebitstogetthenextGraycodebit.Discardcarries.,Gray-to-BinaryConversion,TheMSBinthebinarycodeisthesameasthecorrespondingMSBintheGraycode.Goingfromlefttoright,addeachbinarycodebitgeneratedtotheGraycodebitinthenextadjacentposition.Discardcarries.,ApplicationExample,Asimplifieddiagramofa3-bitshaftpositionencodermechanism(三位轴角位置编译器)isshownbelow.,ApplicationExample,Considerwhathappensifonebrush(forexample,theMSBbrush)isslightlyaheadoftheothersduringthetransitionfromonesectortothenext.,AlphanumericCodes(字母数字编码),Inthestrictestsense,alphanumericcodesarecodesthatrepresentnumbersandalphabeticcharacters(letters).Mostsuchcodes,however,alsorepresentothercharacterssuchassymbolsandvariousinstructionsnecessaryforconveyinginformation.TheASCIIisthemostcommonalphanumericcode.ASCIIhas128charactersrepresentedbya7-bitbinarycode.Thefirst32arenongraphiccharacters(controlcharacters).Thatareneverprintedordisplayedandusedonlyforcontrolpurposes.Theothersaregraphiccharactersthatcanbeprintedordisplayedandincludethelettersofthealphabet(lowercaseanduppercase),thetendecimaldigits,punctuationsigns,andothercommonlyusedsymbols.,ParityMethodforErrorDetection(用于错误检测的奇偶校验法),Manysystemsuseaparitybitasameansforbiterrordetection.Anygroupofbitscontaineitheranevenoranoddnumberof1s.Aparitybitisattachedtoagroupofbitstomakethetotalnumberof1sinagroupalwaysevenoralwaysodd.Aneven/oddparitybitmakesthetotalnumberof1seven/odd.,Homework,Problems:4,6,12,16,20,22,26,32,48,54,
展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 图纸专区 > 课件教案


copyright@ 2023-2025  zhuangpeitu.com 装配图网版权所有   联系电话:18123376007

备案号:ICP2024067431-1 川公网安备51140202000466号


本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。装配图网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知装配图网,我们立即给予删除!