microprocessors_第1页
microprocessors_第2页
microprocessors_第3页
microprocessors_第4页
microprocessors_第5页
已阅读5页,还剩33页未读 继续免费阅读

下载本文档

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

文档简介

MicroprocessorsandMicrocontrollers 1MicroprocessorsThemicroprocessoristheheartofamicrocomputersystem Infact itformsthecentralprocessingunitofanymicrocomputerandhasbeenrightlyreferredtoasthecomputeronachip Thischaptergivesanintroductiontomicroprocessorfundamentals followedbyapplication relevantinformation suchassalientfeatures pinconfiguration internalarchitecture instructionset etc ofpopularbrandsofeight bit 16 bit 32 bitand64 bitmicroprocessorsfrominternationalgiantslikeINTEL MOTOROLAandZILOG 1 1IntroductiontoMicroprocessorsMicroprocessorMemory I OAddressBusControlBusDataBusFigure1 Microprocessor basedsystem Amicroprocessorisaprogrammabledevicethatacceptsbinarydatafromaninputdevice processesthedataaccordingtotheinstructionsstoredinthememoryandprovidesresultsasoutput Inotherwords themicroprocessorexecutestheprogramstoredinthememoryandtransfersdatatoandfromtheoutsideworldthroughI Oports 微处理器是一种可编程器件 它接受从输入设备端的二进制数据 数据的处理依据寄存器中指令存储和提供的输出结果 换句话说 微处理器寄存器中执行程序存储和数据传输以及与外界通过I O端口交换 Anymicroprocessor basedsystemessentiallycomprisesthreeparts namelythemicroprocessor thememoryandperipheralI Odevices Themicroprocessorisgenerallyreferredtoastheheartofthesystemasitperformsalltheoperationsandalsocontrolstherestofthesystem Thethreepartsareinterconnectedbythedatabus theaddressbusandthecontrolbus Fig 1 任何微处理器系统主要由三部分组成 即微处理器 内存和外设I O设备 该微处理器通常被称为系统的核心 作为它执行的所有操作 并控制系统的其余部分 这三个部分通过数据总线 地址总线和控制总线相互关联 Thememorystoresthebinaryinstructionsanddataforthemicroprocessor Thememorycanbeclassifiedastheprimaryormainmemoryandsecondarymemory Read writememory R WM andreadonlymemory ROM areexamplesofprimarymemoryandareusedforexecutingandstoringprograms Magneticdisksandtapesareexamplesofsecondarymemory Theyareusedtostoreprogramsandresultsafterthecompletionofprogramexecution Microprocessorsdonotexecuteprogramsstoredinthesecondarymemorydirectly Instead theyarefirstcopiedontotheR Wprimarymemory Input outputdevicesaremeansthroughwhichthemicroprocessorinteractswiththeoutsideworld Thecommonlyusedinputdevicesincludekeyboards A Dconverters switches cameras scanners microphonesandsoon LEDs seven segmentdisplays LCDdisplays printersandmonitorsaresomeofthecommonlyusedoutputdevices Abusisbasicallyacommunicationlinkbetweentheprocessingunitandtheperipheraldevices Itisagroupofwiresthatcarryinformationintheformofbits TheaddressbusisunidirectionalandisusedbytheCPUtosendouttheaddressofthememorylocationtobeaccessed ItisalsousedbytheCPUtoselectaparticularinputoroutputport Itmayconsistof8 16 20oranevengreaternumberofparallellines Thenumberofbitsintheaddressbusdeterminesthemaximumnumberofdatalocationsinthememorythatcanbeaccessed A16 bitaddressbus forinstance canaccess216datalocations ItislabelledasA0 An 1 wherenisthewidth inbits oftheaddressbus Figure2 Businterfacebetweenthemicroprocessoranditsperipheraldevices Thedatabusisbidirectional thatis dataflowoccursbothtoandfromthemicroprocessorandperipherals Databussizehasaconsiderableinfluenceonthecomputerarchitecture asparameterssuchasthewordlengthandthequantumofdatathatcanbemanipulatedatatimearedeterminedbythesizeofthedatabus Thereisaninternaldatabus whichmaynotbeofthesamewidthastheexternaldatabusthatconnectsthemicroprocessortoI Oandmemory Thesizeoftheinternaldatabusdeterminesthelargestnumberthatcanbeprocessedbythemicroprocessorinasingleoperation Thelargestnumberthatcanbeprocessed forinstance byamicroprocessorhavinga16 bitinternaldatabusis65535 ThedatabusislabelledasD0 Dn 1 wherenisthedatabuswidth inbits Thecontrolbuscontainsanumberofindividuallinescarryingsynchronizingsignals Theterm bus wouldnormallyimplyagroupoflinesworkinginunison Thecontrolbus ifwecallitabus sendsoutcontrolsignalstomemory I Oportsandotherperipheraldevicestoensureproperoperation Itcarriescontrolsignalssuchasmemoryread memorywrite readinputport writeoutputport hold interrupt etc Forinstance ifitisdesiredtoreadthecontentsofaparticularmemorylocation theCPUfirstsendsouttheaddressofthatlocationontheaddressbusanda memoryread controlsignalonthecontrolbus Thememoryrespondsbyoutputtingdatastoredintheaddressedmemorylocationontothedatabus Interrupt tellstheCPUthatanexternaldeviceneedstobereadorserviced Hold allowsadevicesuchasthedirectmemoryaccesscontrollertotakeovertheaddressanddatabuses Fig 2showsthebusinterfacebetweenthemicroprocessoranditsperipheraldevices Themicroprocessorconsideredinthediagramisaneight bitmicroprocessorsuchasIntel s8085 Figure2 Businterfacebetweenthemicroprocessoranditsperipheraldevices Microprocessor basedsystemscanbecategorizedasgeneral purposereprogrammablesystemsandembeddedsystems Reprogrammablesystemsincludemicrocomputersandmainframeandminiframecomputerswheremicroprocessorsareusedforcomputinganddataprocessing Inembeddedsystems theyperformaspecifictaskandarenotavailableforreprogrammingtotheend user Examplesofthesesystemsincludemobilephones washingmachines microwaveovens dishwashersandsoon Inmostofthesesystems themicroprocessor memoryandI Oportsarecombinedontoonechip knownasthemicrocontroller 微处理系统可作为通用可编程系统和嵌入式系统 可编程系统包括微型计算机 中央处理机和小型电子计算机 微处理器被用作运算和数据处理 在嵌入式系统中 他们执行特定任务和不适用于重新编程的最终用户 这些系统包括移动电话 洗衣机 微波炉 洗碗机等 在这些大多数系统中把微处理器 存储器和I O端口结合到一个芯片上称为微控制器 1 2ProgrammingMicroprocessorsMicroprocessorsexecuteprogramsstoredinthememoryintheformofasequenceofbinarydigits Programmersdonotwritetheprograminbinaryformbutwriteiteitherintheformofatextfilecontaininganassembly languagesourcecodeorusingahigh levellanguage Programssuchaseditor assembler linkeranddebuggerenabletheusertowritetheprograminassemblylanguage convertitintobinarycodeanddebugthebinarycode Editorisaprogramthatallowstheusertoenter modifyandstoreagroupofinstructionsortextunderafilename Theassemblylanguagesourcecodeistranslatedintoanobjectcodebyaprogramcalledassembler Linkerconvertstheoutputoftheassemblerintoaformatthatcanbeexecutedbythemicroprocessor Thedebuggerisaprogramthatallowstheusertotestanddebugtheobjectfile 微处理器在程序存储器中是以二进制数字序列的形式运行 程序员不写二进制形式的程序而以一个文本文件的形式 包含汇编语言源代码或使用高级语言 编程如编辑器 汇编器 链接器和调试程序 使用户用汇编语言写的程序转换成二进制代码 并调试二进制代码 编辑器是一个程序允许用户输入 修改和根据文件名存储一些指令或文本 汇编语言源代码翻译成一个目标源代码 称为汇编程序 连接器转换成一个可以由微处理器执行的格式的汇编程序输出 调试器是一种程序 允许用户测试和调试的目标文件 Programminginassemblylanguageproducesacodethatisfastandtakesuplittlememory However itisdifficulttowritelargeprogramsusingassemblylanguage Anotherdisadvantageofassemblylanguageprogrammingisthatitisspecifictoaparticularmicroprocessor High levellanguageprogrammingovercomestheseproblems Someofthepopularhigh levellanguagesusedincludeC C Pascalandsoon 在汇编语言编程产生一个代码速度快并占用内存少 然而很难用汇编语言编写的大型程序 另一个汇编语言编程的缺点是要针对特定的微处理器 高级语言编程克服了这些问题 常用的高级语言包括有C语言 C Pascal等 Compilerprogramsareprimarilyusedtotranslatethesourcecodefromahigh levellanguagetoalower levellanguage e g assemblylanguageormachinelanguage Fig 3 a and b showthevariousstepsinvolvedinexecutingassemblylanguageprogramsandprogramswritteninhigh levellanguagesrespectively Figure3 Variousstepsinvolvedinexecuting a assemblylanguageprogramsand b programswritteninhigh levellanguages 1 3MicroprocessorsforEmbeddedApplicationsEmbeddedmicroprocessorsaremicroprocessorsdesignedforembeddedapplicationsandnotforuseinpersonalcomputers Theyaremostlyusedforembeddeddatacontrolapplicationssuchasdataprocessing dataformatting I Ocontrol datatransfer etc Inotherwords theyaredesignedforspecificapplicationsratherthanforgeneral purposeapplications Intelhasdevelopedanumberofembeddedmicroprocessors namelyIntel80960 Intel80376andembeddedversionsof80486 80386and80186microprocessors OtherembeddedmicroprocessorsincludeMotorola sColdfire Sun sSpare Hitachi sSuperH AdvancedRISCMachines ARM andMIPSComputerSystemsInc sMIPSprocessors TheIntel80960and80376microprocessorsare32 bitmicroprocessorsdesignedforsophisticatedindustrialcontrolapplications Embeddedversionsof80486include486GX 486SX 496DX2and486DX4microprocessors Theembeddedversionsof80386include386CXSA 386CXSB 386EXand386SXSAmicroprocessors Scalableprocessorarchitecture SPARC microprocessorsare32 bitand64 bitCISCprocessorsfromSunMicrosystems ARMmicroprocessorsare32 bitRISCmicroprocessorsandaremostlyusedinthemobileelectronicsmarket wherelowpoweristhemostcriticaldesignrequirement MIPS MicroprocessorwithoutInterlockedPipelineStages isaRISCmicroprocessorfromMIPSComputerSystemsInc Theyareavailablein32 bitand64 bitversions 2MicrocontrollerMicrocontrollersarehiddeninsidealmosteveryproductordevicewithwhichitsusercaninteract Infact anydevicethathasaremotecontrolorhasanLED LCDscreenandakeypadhasanembeddedmicrocontroller Somecommonproductswhereoneissuretofindtheuseofamicrocontrollerincludeautomobiles microwaveovens TVs VCRs high endstereosystems camcorders digitalcameras washingmachines laserprinters telephonesetswithcallerIDfacility mobilephones refrigeratorsandsoon Thischapterfocusesonmicrocontrollerfundamentalsandtheapplication relatedaspectsofit Beginningwithanintroductorydescriptionofthedevice withparticularreferencetoitscomparisonwithamicroprocessor thechaptercoversthegeneralarchitectureandthecriteriatobefollowedtochoosetherightdeviceforagivenapplication Thisisfollowedbyapplication relevantinformation suchassalientfeatures pinconfiguration internalarchitecture etc ofpopularbrandsofeight bit 16 bit 32 bitand64 bitmicrocontrollersfrommajorinternationalmanufacturers Intel s8051familyofmicrocontrollersisdescribedinmoredetail 2 1IntroductiontoMicrocontrollerThemicrocontrollermaybeconsideredasaspecializedcomputer on a chiporasingle chipcomputer Theword micro suggeststhatthedeviceissmall andtheword controller suggeststhatthedevicemaybeusedtocontroloneormorefunctionsofobjects processesorevents Itisalsocalledanembeddedcontrollerasmicrocontrollersareoftenembeddedinthedeviceorsystemthattheycontrol 微控制器可以被看作是一个专门的计算机上芯片或单芯片计算机 这个词 micro 表明该设备是小 controller 表明该设备可能被用来控制一个或多个对象 过程或事件的功能 它也被称为嵌入式控制器作为微控制器通常用来控制嵌入式设备或系统 Themicrocontrollercontainsasimplifiedprocessor somememory RAMandROM I Oportsandperipheraldevicessuchascounters timers analog to digitalconverters etc allintegratedonasinglechip Itisthisfeatureoftheprocessorandperipheralcomponentsavailableonasinglechipthatdistinguishesitfromamicroprocessor basedsystem Amicroprocessorisnothingbutaprocessingmicrocontrollersarededicatedtoonetaskandrunonespecificprogram ThisprogramisstoredinROMandgenerallydoesnotchange Whileamicroprocessor basedsystemneedsadditionalchipstomakeitafunctionalunit inamicrocontrollerthefunctionsofalltheseadditionalchipsareintegratedonthesamechip 微控制器含有一个简单的处理器 一些存储器 RAM和ROM I O端口和外围设备 如计数器 定时器 模数转换器等 都在集成一个芯片上 正是这种处理器特征和外围元件可用在单芯片上 这区别于微处理系统 微处理器只不过是处理微控制器专用于一项任务和运行一个特定的程序 该程序是存储在ROM中 一般不会改变 虽然微处理器系统需要额外的芯片 使其成为功能单位 而微控制器把所有这些额外功能的芯片的集成到同一个人芯片上 2 1 1ApplicationsMicrocontrollersareembeddedinsideasurprisinglylargenumberofproductcategoriesincludingautomobiles entertainmentandconsumerproducts testandmeasurementequipmentanddesktopcomputers tonamesomeprominentones Anydeviceorsystemthatmeasures stores controls calculatesordisplaysinformationissuretohaveanembeddedmicrocontrollerasapartofthedeviceorsystem Inautomobiles oneormoremicrocontrollersmaybeusedforenginecontrol carcruisecontrol antilockbrakesandsoon Testandmeasurementequipmentsuchassignalgenerators multimeters frequencycounters oscilloscopes etc makeuseofmicrocontrollerstoaddfeaturessuchastheabilitytostoremeasurements todisplaymessagesandwaveformsandtocreateandstoreuserroutines Indesktopcomputers microcontrollersareusedinperipheraldevicessuchaskeyboards printers modems etc ConsumerandentertainmentproductssuchasTVs videorecorders camcorders microwaveovens washingmachines telephoneswithcallerIDfacility cellularphones airconditioners refrigeratorsandmanymoreproductsmakeextensiveuseofmicrocontrollerstoaddnewcontrolandfunctionalfeatures 任何设备或系统的测量 存储 控制 计算和显示的信息肯定有一个嵌入式微控制器作为设备或系统的一部分 在汽车上 一个或多个微控制器可用于发动机控制 汽车巡航控制系统 刹车制动系统等 测试和测量设备如信号发生器 万用表 频率计数器 示波器等 利用微控制器的能够增加其特性如存储的测量 显示信息和信号波形 以及为用户创建和存储程序的功能 在台式计算机 微控制器可用于外围设备 如键盘 打印机 调制解调器等 消费电子和娱乐产品如电视机 录像机 摄像机 微波炉 洗衣机 有来电显示设备 移动电话 空调设备 冰箱 还有更多产品广泛使用的微控制器增加新的控制和功能特性 2 2InsidetheMicrocontrollerFig 4showstheblockschematicarrangementofvariouscomponentsofamicrocontroller Asoutlinedearlier amicrocontrollerisanintegratedchipwithanon chipCPU memory I Oportsandsomeperipheraldevicestomakeacompletefunctionalunit Figure5 Timersubsystem Figure4 Insidethemicrocontroller AtypicalmicrocontrollerasdepictedinFig 5hasthefollowingcomponents acentralprocessingunit CPU arandomaccessmemory RAM areadonlymemory ROM special functionregistersandperipheralcomponentsincludingserialand orparallelports timersandcounters analogue to digital A D convertersanddigital to analogue D A converters 图4显示了微控制器模块的各组成部分的 如前所述 微控制器是一种集成了一个CPU 存储器 I O端口和一些外围设备 使其成了一个完整的功能单位 如图5所示典型的微控制器 有以下部分组成 中央处理单元 CPU 随机存取存储器 RAM 只读存储器 ROM 特殊功能寄存器和外围设备包含有串行或并行端口 定时器和计数器 模拟到数字 A D 转换器和数字到模拟 D A 转换器 2 2 1CentralProcessingUnit CPU Thecentralprocessingunitprocessestheprogram Itexecutestheinstructionsstoredintheprogrammemorypointedtobytheprogramcounterinsynchronizationwiththeclocksignal Theprocessorcomplexitycouldvaryfromsimpleeight bitprocessorstosophisticated32 bitoreven64 bitprocessors Somecommonmicrocontrollersusingeight bitprocessorsinclude68HC11 FreescaleSemiconductor earlierpartofMotorola the80C51familyofmicrocontrollers IntelandDallasSemiconductor Zilog eZ8andZilog eZ80 Zilog andXC800 Infineon Examplesofmicrocontrollersusing16 bitprocessorsincludethe8096family Intel 68HC12and68HC16 FreescaleSemiconductor theF2MCfamily Fujitsu andtheXC166family Infineon Examplesofmicrocontrollersusing32 bitprocessorsinclude683XX MFC860 PowerQUICC MFC8240 8250 PowerQUICC II andMFC8540 8555 8560 PowerQUICC III allfromFreescaleSemiconductor theTRICOREfamily Infineon andtheFR FR Vfamily Fujitsu 2 2 2RandomAccessMemory RAM RAMisusedtoholdintermediateresultsandothertemporarydataduringtheexecutionoftheprogram Typically microcontrollershaveafewhundredsofbytesofRAM Asanexample microcontrollertypenumbers8XC51 80C31 8XC52 80C32and68HC12respectivelyhave128 256and1024bytesofRAM 2 2 3ReadOnlyMemory ROM ROMholdstheprograminstructionsandtheconstantdata Microcontrollersuseoneormoreofthefollowingmemorytypesforthispurpose ROM mask programmedROM PROM one timeprogrammableROM whichisnotfieldprogrammable EPROM fieldprogrammableandusuallyUVerasable EEPROM fieldprogrammable electricallyerasable byteerasable andflash similartoEEPROMtechnology Microcontrollertypenumbers8XC51 8XC51FAand8XC52have4K 8Kand16KofROM Asanotherexample the68HC1216 bitmicrocontrollerhas32KofflashEEPROM 768bytesofEEPROMand2Koferase protectedbootblock 2 2 4Special FunctionRegistersSpecial functionregisterscontrolvariousfunctionsofamicrocontroller Therearetwocategoriesoftheseregisters ThefirsttypeincludesthoseregistersthatarewiredintotheCPUanddonotnecessarilyformpartofaddressablememory Theseregistersareusedtocontrolprogramflowandarithmeticfunctions Examplesincludestatusregister programcounter stackpointer etc Theseregistersare however takencareofbycompilersofhigh levellanguages andthereforeprogrammersofhigh levellanguagessuchasC Pascal etc donotneedtoworryaboutthem Theothercategoryofregistersistheonethatisrequiredbyperipheralcomponents Thecontentsoftheseregisterscould forinstance setatimerorenableserialcommunicationandsoon Asanexample special functionregistersavailableonthe80C51familyofmicrocontrollers 80C51 87C51 80C31 includeaprogramcounter stackpointer RAMaddressregister programaddressregisterandPCincrementer 2 2 5PeripheralComponentsPeripheralcomponentssuchasanalogue to digitalconverters I Oports timersandcounters etc areavailableonthemajorityofmicrocontrollers Thesecomponentsperformfunctionsassuggestedbytheirrespectivenames Inadditiontothese microcontrollersintendedforsomespecificorrelativelymorecomplexfunctionscomewithmanymoreon chipperipherals Someofthecommononesincludethepulsewidthmodulator serialcommunicationinterface SCI serialperipheralinterface SPI interintegratedcircuit I2C two wirecommunicationinterface RS232 UART port infraredport IrDA USBport controllerareanetwork CAN andlocalinterconnectnetwork LIN 外围组件如模拟到数字转换器 I O端口 定时器和计数器 等等 大多数都利用微控制器 这些组件执行的功能从各自的名字中得到暗示 除了这些 微型控制器为某一具体或相对更加复杂的功能用在许多芯片外围设备来 一些常见的包括脉宽调制器 串行通信接口 SCI 串行外设接口 SPI I2C双线通信接口 RS232 UART 端口 红外端口 红外线 USB接口 控制器局域网 CAN 和本地互连网 LIN Theseperipheraldevicesarebrieflydescribedinthefollowingparagraphs 2 3InterfacingPeripheralDeviceswithaMicrocontroller2 3 1InterfacingKeyboards键盘接口Figure6 Connectionofa16 keymatrixkeypadwithamicrocontroller Keyboardsareusedtoenterdata values etc intothemicrocontrollersystem Theyaregenerallyavailableinthreeconfigurations namelythelead per keykeyboard thematrixkeyboardandthecodedkeyboard Lead per keyorlinearkeyboardsareusedwhenveryfewkeyshavetobesensed Codedkeypadsaregenerallyusedintelephonicapplications Theyarehigh qualitydurable持久的 耐用的keyboardsandpermitamultiplekeypresstobedetectedeasily Theyareusedwhenthenumberofkeysis16orless astheyareveryexpensive Themostcommonlyusedkeyboardisthematrixkeyboardwherethekeysarearrangedinamatrix withkeysinthesamerowandcolumnsharingthesameaccesslines Whenthenumberofkeysexceeds10 moreoftenthannotmatrixkeyboards矩阵键盘areused Interfacingamatrixkeyboardwiththemicrocontrollerisdiscussedinthefollowingparagraphs Fig 6showstheconnectionofa16 keymatrixkeypadwithamicrocontroller Here eachcolumnandrowaccesslineisconnectedtothemicrocontrollerpin ThecolumnsaregenerallyataHIGHlevel Figure6 Connectionofa16 keymatrixkeypadwithamicrocontroller Therowlinesareconfiguredasoutputlinesandthecolumnlinesareusedasscanlines ThekeyactuationissensedbysendingaLOWtoeachrowoneatatimethroughasoftwareroutineviatherow1 row2 row3androw4lines ThecolumnlinesarecheckedforeachrowtoseewhetheranyofthenormallyHIGHcolumnlinesarepulledLOW IfacolumnisdrivenLOW then bydeterminingwhichrowandcolumnlineisLOW thekeyisidentifiedandtheroutinecorrespondingtothatkeypressisexecuted 2 3 2InterfacingLCDDisplaysFigure7 LCDdisplayinterfacewithamicrocontroller LiquidcrystaldisplaysallowabetteruserinterfacecomparedwithLEDdisplaysasitismucheasiertodisplaytextmessagesinLCDdisplays TheyalsoconsumemuchlesspowerthanLEDdisplays However LEDdisplayshavebetterintensitythanLCDdisplays 液晶显示器相比LED显示屏有更好的用户界面 因为它更容易在LCD显示屏上显示文本信息 LCD显示屏的消耗功率远低于LED显示屏 不过LED显示屏比LCD显示器有更好

温馨提示

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

评论

0/150

提交评论