【正文】
ns mitte r (o r re ce ive r) b uffer. S e r ia liza t io n o f t he dat a in the appropriate format is then handled by the hardware circuit. Timing/counter facilities. Many app lica t io n o f s ingle chip mic roco mp uters req uire acc ura te e va lua t io n of elapsed real time .This can be determined by careful assessment of the execution time of each branch in a program but this rapidly bees ineffic ie nt for all but simplest programs .The preferred approach is to use timer circuit that can independent l y count precise time increme nts and generate an interrupt after a preset time has elapsed .This type of timer is usually arranged to be reloadable with the required count .The timer then decrements this value producing an interrupt or setting a flag when the counter reaches zero. Better timers then have the abilit y to automatica ll y reload the initia l count value. This relieves the programmer of the respo ns ib il it y o f r e load ing t he co unte r a nd asses s ing e lapsed t ime b e fore t he t ime r rest arted , w hic h ot he rw ise wo und be necessa r y if co nt inuo us prec ise ly timed interrup ts were required ( as in a clock ,for example).S o met i me s assoc ia ted w it h t imer is a n e ve nt co unt er. Wit h t his fac il it y t here is us ua lly a special input pin , that can drive the counter directly. Timing ponents. T he c lock c irc uitr y o f mos t mic roco mp uters req uires o nly s i mp le t iming co mpo ne nts. I f ma ximum pe r for ma nce is req uir ed, a cr ysta l mus t be used to ens ure t he ma ximu m c lo ck fr eq ue nc y is approac hed b ut no t e xce eded. Ma ny c lock c irc uit s a lso wo rk w it h a res isto r and capa c ito r as lo w cost t iming co mpo ne nts or c a n be d r i ve n fro m a n e xte r na l so urce. T his lat ter arra nge me nt is use ful is e xter na l s ync hro niza t io n o f the microputer is required. B:PLC[1] P LC s (pro gra mmab le lo gica l co ntro lle r) face e ve r mo re co mp le x cha lle nge s t hese da ys . W her e once t he y q uie t ly rep laced r e la ys a nd ga ve a n occas io na l r eport to a corpora te ma infra me, t he y are no w gro uped into ce lls, give n new job a nd ne w la ngua ge s, a nd are forced to co mpe te a ga inst a gro w ing arra y o f co ntro l prod uc ts. F or t his year39。T hese de vices a re na t ura lly mo re e xpe ns ive t ha n eq uiva le nt RO M de vice, b ut do provide co mp lete c irc uit eq uiva le nts. EP RO M based de vices ar e a lso extre me ly at trac t ive fo r low vo lume app lica t io ns w here t he y pro vide t he adva nta ges o f a s ingle c hip de vice, in ter ms o f on c hip I/O , etc. ,w it h t he convenie nce of flexib le user programmab il ity. Random access memory (RAM). RAM is fo r t he stora ge o f work ing va r iab les a nd da ta used d ur ing pro gra m exec ut io n. T he s ize o f t his me mor y var ie s w it h de vice t ype b ut it has t he sa me c har acte r is t ic w id t h (4,8,16 b its e tc.) as t he proce ssor ,S pec ia l func t io n r e gis ters, s uc h as s tack po inter or t ime r re giste r are o fte n lo gica lly incorpora ted into t he R AM a rea. I t is a lso co mmo n in Ha rd t ype microco mp ute rs to tre at t he R AM a rea as a co llect io n o f r e gis ter 。 p iggy back39。 Output unit External Timing ponents System clock Timer/ Counter Serial I/O Prarallel I/O ROM Interrupts Power Fig35A3. Principal features of a microputer Read only memory (ROM) RO M is us ua lly for t he per ma ne nt, no n vo la t ile stora ge o f a n app lica t io ns progra m .Ma ny microco mp ute rs a nd mic roco ntro lle rs are inte nded for high vo lume app lica t io ns a nd he nce t he eco no mica l ma nufac t ure o f t he devices req uires t ha t t he co nte nts o f t he pro gra m me mor y be co mmit ted per ma ne nt ly d ur ing t he ma nufact ur e o f chips . C lear ly, t his imp lies a r igoro us approac h to RO M code d e ve lop me nt s ince c ha nges ca nno t be made after ma nufac t ure . T his de ve lop me nt p rocess ma y invo lve e mulat io n us ing a sophist icat ed deve lop me nt s yst e m w it h a ha rdwa re e mulat io n capab ilit y as well as the use of powerful software tools. S ome ma nufa ct ure rs pro vide add it io na l RO M op t io ns b y inc lud ing in the ir r a nge de vice s w it h (or inte nded fo r use w it h) user pro gra mmab le me mor y. T he s imp lest o f t hese is us ua lly de vice w hic h ca n oper ate in a microp rocesso r mode b y us ing so me o f t he inp ut/o utp ut lines a s an add