力传感器及电子秤设计文献翻译输入输出访问Word格式.docx

上传人:b****1 文档编号:1009917 上传时间:2023-04-30 格式:DOCX 页数:17 大小:28.51KB
下载 相关 举报
力传感器及电子秤设计文献翻译输入输出访问Word格式.docx_第1页
第1页 / 共17页
力传感器及电子秤设计文献翻译输入输出访问Word格式.docx_第2页
第2页 / 共17页
力传感器及电子秤设计文献翻译输入输出访问Word格式.docx_第3页
第3页 / 共17页
力传感器及电子秤设计文献翻译输入输出访问Word格式.docx_第4页
第4页 / 共17页
力传感器及电子秤设计文献翻译输入输出访问Word格式.docx_第5页
第5页 / 共17页
力传感器及电子秤设计文献翻译输入输出访问Word格式.docx_第6页
第6页 / 共17页
力传感器及电子秤设计文献翻译输入输出访问Word格式.docx_第7页
第7页 / 共17页
力传感器及电子秤设计文献翻译输入输出访问Word格式.docx_第8页
第8页 / 共17页
力传感器及电子秤设计文献翻译输入输出访问Word格式.docx_第9页
第9页 / 共17页
力传感器及电子秤设计文献翻译输入输出访问Word格式.docx_第10页
第10页 / 共17页
力传感器及电子秤设计文献翻译输入输出访问Word格式.docx_第11页
第11页 / 共17页
力传感器及电子秤设计文献翻译输入输出访问Word格式.docx_第12页
第12页 / 共17页
力传感器及电子秤设计文献翻译输入输出访问Word格式.docx_第13页
第13页 / 共17页
力传感器及电子秤设计文献翻译输入输出访问Word格式.docx_第14页
第14页 / 共17页
力传感器及电子秤设计文献翻译输入输出访问Word格式.docx_第15页
第15页 / 共17页
力传感器及电子秤设计文献翻译输入输出访问Word格式.docx_第16页
第16页 / 共17页
力传感器及电子秤设计文献翻译输入输出访问Word格式.docx_第17页
第17页 / 共17页
亲,该文档总共17页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

力传感器及电子秤设计文献翻译输入输出访问Word格式.docx

《力传感器及电子秤设计文献翻译输入输出访问Word格式.docx》由会员分享,可在线阅读,更多相关《力传感器及电子秤设计文献翻译输入输出访问Word格式.docx(17页珍藏版)》请在冰点文库上搜索。

力传感器及电子秤设计文献翻译输入输出访问Word格式.docx

Inthisarticle,wewilllookatthethreebasicmethodsofI/Oaccessing-programmedI/O,interrupt-drivenI/O,anddirectmemoryaccess(DMA).ThekeyissuethatdistinguishesthesethreemethodsishowdeeplytheprocessorisinvolvedinI/Ooperations.Thediscussionemphasizesinterrupt-drivenI/O,becauseitisbasedontheconceptofinterrupthandling,whichisageneralproblemthatgoesbeyondInput/Outputoperations.Thestudyofinterrupthandlingalsoaidsinunderstandingthegeneralconceptofexceptionprocessing,whichisanimportantissuenotonlyforI/O,butalsoforinterfacingacomputerwithothersystemcontrolfunctions.

AddressingI/ORegisters

Input/OutputdevicescommunicatewithaprocessorthroughInput/Outputports.Throughtheinputports,sprocessorreceivesdatafromtheI/Odevices.Throughtheoutputports,aprocessorsendsdatatotheI/Odevices.EachI/Oportconsistsofasmallsetofregisters,suchasdatabufferregisters(theinputbufferand/ortheoutputbuffer),thestatusregister,andthecontrolregister.Theprocessormusthavesomemeanstoaddresstheseregisterswhilecommunicatingwiththem.TherearetwocommonmethodsofaddressingI/Oregister-memory-mappedI/OanddirectI/O.

1.Memory-MappedI/O

Memory-mappedI/OmapstheI/Oregistersandmainmemoryintoaunifiedaddressspaceinthecomputersystem.I/Oregisterssharethesameaddressspacewithmainmemory,butaremappedtoaspecificsectionthatisreservedjustforI/O.Thus,theI/Oregistercanbeaddressedinordinarymemoryreferenceinstructionsasiftheyarepartofthemainmemorylocations.TherearenospeciallydesignedI/Oinstructionsintheinstructionsetofthesystem.AnyinstructionthatreferencesalocationinthisareaisanI/Oinstruction.AnyinstructionthatcanspecifyamemoryaddressiscapableofperformingI/Ooperations.TheMotorolaMC68000isanexampleofacomputersystemthatusesthisaddressingmethod.

2.DirectI/O

ThemethodofaddressingI/OregistersdirectlywithoutsharingtheaddressspacewiththemainmemoryiscalleddirectI/OorI/O-mappedI/O.Inotherwords,I/Oregistersarenotmappedtothesameaddressspacewiththemainmemory.EachI/Oregisterhasanindependentaddressspace.Asaresult,instructionsthatreferencethemainmemoryspacecannotbeusedforInput/Output.Intheinstructionsetofthecomputersystem,specialI/OinstructionsmustbedesignedforI/Ooperations.IntheseI/Oinstructions,distinctI.D.numbersmustbeusedtoaddressdifferentI/Ocommunicationchannels(i.e.,I/Oports).Theyarecalledportnumbers.TheI/OregistersofanI/OportareconnectedtothesystemI/Obus,throughwhichtheprocessorcanreferencetheI/Oregistersdirectlytosend/receivedatato/fromanI/Odevice.AnI/Oportnumberisnotfromthesameaddressspaceasmainmemory.ThePentiumisanexampleofacomputersystemthatusesthedirectI/Oaddressingmethod.Ithasa64GBmemoryaddressspace(32addressbits)and,atthesametime,a64KBI/Oaddressspace(16bitsI/Oaddress/portnumber).

Wecancomparememory-mappedI/OandthedirectI/OandthedirectI/Oasfollows:

●Memory-mappedI/OusesordinarymemoryreferenceinstructionstoaccessI/O,soitprovidesflexibilityforI/OprogrammingandsimplifiesI/Osoftware.DirectI/OdoesnotprovideanyflexibilityinI/Oprogramming,sinceonlyasmallsetofspecialI/OinstructionsareallowedtoreferenceI/Oregisters.

●formemory-mappedI/O,theprocessorusesthesameaddresslinestoaccessalltheaddressableI/Oregistersandthesamedatalinestosend/receivedatato/formtheseregisters.ThissimplifiestheconnectionbetweenI/Oportandtheprocessor,andthusleadstoalow-costhardwaredesignandimplementation.FordirectI/O,theconnectionbetweenI/Oportsandtheprocessormaybemoreexpensive.Thisisbecauseeither

(1)specialhardwareisneededtoimplementseparateI/Oaddresslinesor

(2)whenmemoryaddresslinesareusedforI/O;

aspecialflagisneeded,indicatingthattherequestedaddressisforanI/Ooperation.

●InspiteoftheadvantageofusingordinarymemoryreferenceinstructionstoaccessI/Oregisters,memory-mappedI/OmaycomplicatethecontrolunitdesigninregardstotheimplementationofI/O-relatedinstructions.ThisisbecauseusuallytheI/Obuscyclesneedtobelongerthantheequivalentmemorybuscycles,andthismeansthatthedesignofdifferenttimingcontrollogicisrequired.Thiscanbeusedtoexplainwhymemory-mappedI/Obenefitsprogrammers,butnotelectronicsengineers.

●DirectI/Oaddressinghasanotheradvantageovermemory-mappedI/Ointhatlow-leveldebuggingonadifferentiatedaddressingsystemmaybeeasier,becausebreak-pointsorerrortrapscanbeimposedmoregenerally.

●withmemory-mappedI/O,I/Oregisterssharethesameaddressspacewithmainmemory;

hence,thememoryspaceavailableforprogramsanddataisreduced.FordirectI/Oaddressing,I/Odoesnotsharememoryspacewithmainmemory,andasinglecontiguousmemoryspacecanbemaintainedandusedbyprogrammers.

ProgrammedI/O

ProgrammedI/Orequiresthatalldatatransferoperationsbeputunderthecompletecontroloftheprocessorwhenexecutingprograms.Itissometimescalledpolling,becausetheprogramrepeatedlypolls(checks)thestatusflagofanI/Odevice,sothatitsinput/outputoperationcanbesynchronizedwiththeprocessor.AgeneralflowchartofsuchaprogramisshowninFigure1.TheprogramcontinuouslypollsthestatusofanI/Odevicetofindoutwhether

(1)dataisavailableintheinputbufferor

(2)theoutputdeviceisreadyforreceivingdatafromtheprocessor.Ifthestatusshows“available”theprogramwillexecuteadatatransferinstructiontocompletetheI/Ooperation;

otherwise,thebusystatusoftheI/Odevicewillforcetheprogramtocirculateinabusy-waitingloopuntilthestatusbecomesavailable.Suchabusy-waitingloop,whichcontinuouslychecksthestatusofdataavailability(forinput)ordeviceavailability(forout-put),formsthetypicalprogramstructureofprogrammedI/O.Itisthistime-consumingbusy-waitingloopthatwastesprocessortimeandmakesprogrammedI/Overyinefficient.TheprocessormustbeinvolvedcontinuouslyintheentireI/Oprocess.Duringthistimeinterval,theprocessorcannotperformanyusefulcomputation,butonlyserveasingleI/Odevice.ForcertainslowI/Odevices,thisbusy-waitingloopintervalmaybelongenoughthattheprocessorcouldexecutemillionsofinstructionsbeforetheI/Oeventoccurs,e.g.,akeystrokeonakeyboard.

TheoperationalmodelfprogrammedI/Ostatedaboveischaracterizedbythebusywaitingloopoftheprogram,duringwhichtheprocessorspendstimepollinganI/Odevice.Becauseofthededicationoftheprocessortoasingletask,thismodeofprogrammedI/Oiscalleddedicatedpollingorspinpolling.Althoughdedicatedpollingishighlyinefficient,sometimesitisnecessaryandevenunavoidable.Inaparticularcase,ifanurgenteventneedsanimmediateresponsewithoutdelay,thendedicatedpollingbyadedicatedprocessormaybethebestwaytohandleit.Oncetheexpectedeventhappens,theprocessorcantracttoitimmediately.Forexample,certainrealtimesystems(e.g.,radarechoprocessingsystems)requireareactiontoincomingdatathatissoquickthatevenaninterruptresponseistooslow.Undersuchacircumstance,onlyafastdedicatedpollingloopmaysuffice.

AnothermodeofoperationofprogrammedI/Oiscalledintermittentpollingortimedpolling.Inthismode,theprocessormaypollthedeviceataregulartimedinterval,whichcanbeexpectedorprescheduled.Suchadevicecanbefoundinmanyembeddedsystemswhereaspecial-purposecomputerisusedforprocesscontrol,dataacquisition,environmentalmonitoring,trafficcounting,etc.thesedevices,whichmeasure,collect,orrecorddata,areusuallypolledperiodicallyinaregularscheduledeterminedbytheneedsoftheapplication.Suchamethodofintermittentpollingcanhelpsavetimelostinspinpollingandavoidthecomplexityofinterruptprocessing.However,itshouldbenotedthatintermittentpollingmaynotbeapplicableinsomespecialcases,inwhichthereisonlyonedevicetobepolledandthecorrectpollingratemustbeachievedwiththeassistanceofaninterrupt-drivenclock.Usingtimedpollinginthiscasewouldresultinsimplyswappingoneinterrupt-drivenclock.Usingtimepollinginthiscasewouldresultinsimplyswappingoneinterruptrequirementforanother.

Interrupt-DrivenI/O

Interrupt-drivenI/Oisameanstoavoidtheinefficientbusy-waitingloops,whichcharacterizeprogrammedI/O.InsteadofwaitingwhiletheI/Odeviceisbusydoingitsjobofinput/output,theprocessorcanrunotherprograms.WhentheI/Odevicecompletesitsjobanditsstatusbecomes“available”,itwillissueaninterruptrequesttotheprocessor,askingforCPUservice.Inresponse,theprocessorsuspendswhateveritiscurrentlydoing,inordertoattendtotheneedsofthatI/Odevice.

Inrespondtoaninterruptrequest,theprocessorwillfirstsavethecontentsofboththeprogramcounterandthestatusregisterfortherunningprogram,andthentransferthecontroltothecorrespondinginterruptserviceroutinetoperformtherequireddatainput/outputoperation.Whentheinterruptserviceroutinehascompleteditsexecutionandifnomoreinterruptrequestsarepending,theprocessorwillresumetheexecutionofthepreviouslyinterruptedprogramandrestorethecontentsofthestatusesandprogramcounter.Theprocessorhardwareshouldchecktheinterruptrequestsignaluponcompletionofexecutionofeveryinstruction.Ifm

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 求职职场 > 简历

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2