`
`Programming
`Emb€dd€d
`
`Systems in C and C++
`
`1
`
`LG 1021
`
`
`
`WEMWIJEMEH
`by Michael Barr
`
`Copyright 0 1999 G‘li‘deill}r 3r. Associates. Inc. M] rights reserved.
`Prhued in the United States of America.
`
`Published In O'Reilly iii Associates. Inc“ 191 Morris Sheet. Sebastopol, Cal 954”.
`
`HEW: find? Dram
`
`m Elites Melanie Wang
`
`mm
`
`januar}r 1999:
`
`First Edition.
`
`Nutshell Handbook. the Nutshell Handbook logo, and the D'Reflly logo are registered
`trademarks offl‘fleillyii Associates, Inc. 111e modatimtbetween the image offirJts and the
`topleofembeddedsystemsisauademarkoffi’fleifly&hssodafls Inch-Itartyofthe
`desigmtimts usedbynmnufaehreisuldseflersmdistmguishdleirpmductsmdalmedas
`trademarks. Where those designations appearlnthisboolt. andD‘Reflly&Assoe-iatee, [nowas
`awareofahadelrmk lullaim1 Ihedesignalionshavebeen pfintedineapsorirfllialeaps.
`
`While ell-«era.r precaution has been taken in the preparation oftlfis hook. the publisher assume:
`noreepocrlsihilinrforerrm Hermie-shone. orimdamgesrestfltingfiwnmeuseefthe
`infirm-ration oorrtained herein
`
`ISBN: 1565923545
`[Ml
`
`tum]
`
`
`
`2
`
`
`
`GermKnowwercessor
`
`5!
`
`evolutionary path. The most obvious example is lntel’s 80x86 family. which spans
`from the original 8086 to the Pentium ll—and beyond. in fact, the 80x86 family
`has been so successful that it has spawned an entire industry of imitators.
`
`As itisusedinthisbook. the tennpmcessorreferstoanyofthreetypesofdevices
`known as microprocessors, microcontrollers, and digital signal processors. The
`name microprocessor is usually reserved for a chip that contains a powerful CPU
`that has not been designed with any particular computation in mind. These chips
`are usually the foundation of personal computers and high-end workstations. The
`most common microprocessors are members of Motorola's 68k—found in older
`Macintosh computers—and the ubiquitous 80x86 families.
`
`A microcontroller is very much like a microprocessor. except that it has been
`designed specifically for use in embedded systems. Microcontrollers typically
`include a CPU, memory (a small amount of RAM, ROM. or both), and other
`peripherals in the same integrated circuit. if you purchase all of these items on a
`single chip, it is possible to reduce the cost of an embedded system substantially.
`Among the most popular microcontrollers are the 8051 and its many imitators and
`Motorola's 68HCxx series. It is also common to find microcontroller versions of
`
`popular microprocessors. For example, Intel's 386EX is a microcontroller version
`of the very successful 80386 microprocessor.
`
`The final type of processor is a digital signal processor, or 08?. The CPU within a
`DSP is specially designed to perform discrete-time signal processing alculations—
`like those required for audio and video communications—extremely fast. Because
`DSPs can perform these types of calculations much faster than other processors,
`they offer a powerful,
`low-cost microprocessor alternative for designers of
`modems and other telecommunications and multimedia equipment. Two of the
`most common DSP families are the TMSSZOCxx and 5600x series from Ti and
`
`Motorola, respectively.
`
`Intel'5 80188EB Processor
`
`The processor on the Arcom board is an Intel 8018888—a microcontroller version
`of the 80186. In addition to the CPU, the 8018888 contains an interrupt control
`
`unit. two programmable [/0 ports. three timer/counters. two serial ports. a DRAM
`controller, and a chip-select unit. These extra hardware devices are located within
`the same chip and are referred to as on-chip peripherals. The CPU is able to com-
`municate with and control the on-chip peripherals directly, via internal buses.
`
`Although the on-chip peripherals are distinct hardware devices. they act like little
`extensions of the 80186 CPU. The software can control them by reading and writ-
`
`ing a 256—byte block of registers known as the peripheral control block (PCB).
`You may real] that we encountered this block when we first discussed the mem-
`ory and [/0 maps for the board. By default the PCB is located in the [/0 space,
`
`
`
`3
`
`