4) MICROCONTROLLER FEATURES


    Thanks to Robin Getz of National Semiconductor who supplied some of
    the material in this section.


4.1) Fabrication techniques


    CMOS - Complementary Metal Oxide Semiconductor

       This is the name of a common technique used to fabricate most (if
       not all) of the newer microcontrollers.  CMOS requires much less
       power than older fabrication techniques, which permits battery
       operation.  CMOS chips also can be fully or near fully static,
       which means that the clock can be slowed up (or even stopped)
       putting the chip in sleep mode.  CMOS has a much higher immunity
       to noise (power fluctuations or spikes) than the older fabrication
       techniques.


    PMP - Post Metal Programming (National Semiconductor)

       PMP is a high-energy implantation process that allows
       microcontroller ROM to be programmed AFTER final metalization.
       Usually ROM is implemented in the second layer die, with nine or
       ten other layers then added on top.  That means the ROM pattern
       must be specified early in the production process, and completed
       prototypes devices won't be available typically for six to eight
       weeks.  With PMP, however, dies can be fully manufactured through
       metalization and electrical tests (only the passivation layers
       need to be added), and held in inventory.  This means that ROM can
       be programmed late in production cycle, making prototypes
       available in only two weeks.


4.2) Architectural features


    Von-Neuman Architecure

       Microcontrollers based on the Von-Neuman architecture have a
       single "data" bus that is used to fetch both instructions and
       data.  Program instructions and data are stored in a common main
       memory.  When such a controller addresses main memory, it first
       fetches an instruction, and then it fetches the data to support
       the instruction.  The two separate fetches slows up the
       controller's operation.


    Harvard Architecture

       Microcontrollers based on the Harvard Architecture have separate
       data bus and an instruction bus.  This allows execution to occur
       in parallel.  As an instruction is being "pre-fetched", the
       current instruction is executing on the data bus.  Once the
       current instruction is complete, the next instruction is ready to
       go.  This pre-fetch theoretically allows for much faster execution
       than a Von-Neuman architecture, but there is some added silicon
       complexity.


    CISC

       Almost all of today's microcontrollers are based on the CISC
       (Complex Instruction Set Computer) concept.  The typical CISC
       microcontroller has well over 80 instructions, many of them very
       powerful and very specialized for specific control tasks.  It is
       quite common for the instructions to all behave quite differently.
       Some might only operate on certain address spaces or registers,
       and others might only recognize certain addressing modes.

       The advantages of the CISC architecture is that many of the
       instructions are macro-like, allowing the programmer to use one
       instruction in place of many simpler instructions.


    RISC

       The industry trend for microprocessor design is for Reduced
       Instruction Set Computers (RISC) designs.  This is beginning to
       spill over into the microntroller market.  By implementing fewer
       instructions, the chip designed is able to dedicate some of the
       precious silicon real-estate for performance enhancing features.
       The benefits of RISC design simplicity are a smaller chip, smaller
       pin count, and very low power consumption.

       Among some of the typical features of a RISC processor:
          - Harvard architecture (separate buses for instructions and
            data) allows simultaneous access of program and data, and
            overlapping of some operations for increased processing
            performance
          - Instruction pipelining increases execution speed
          - Orthogonal (symmetrical) instruction set for programming
            simplicity; allows each instruction to operate on any
            register or use any addressing mode; instructions have no
            special combinations, exceptions, restrictions, or side
            effects


    SISC

       Actually, a microcontroller is by definition a Reduced Instruction
       Set Computer (at least in my opinion).  It could really be called
       a Specific Instruction Set Computer (SISC).  The [original] idea
       behind the microcontroller was to limit the capabilities of the
       CPU itself, allowing a complete computer (memory, I/O, interrupts,
       etc) to fit on the available real estate.  At the expense of the
       more general purpose instructions that make the standard
       microprocessors (8088, 68000, 32032) so easy to use, the
       instruction set was designed for the specific purpose of control
       (powerful bit manipulation, easy and efficient I/O, and so on).

       Microcontrollers now come with a mind boggling array of features
       that aid the control engineer - watchdog timers, sleep/wakeup
       modes, power management, powerful I/O channels, and so on.  By
       keeping the instruction set specific (and reduced), and thus
       saving valuable real estate, more and more of these features can
       be added, while maintaining the economy of the microcontroller.


4.3) Advanced Memory options


    EEPROM - Electrically Erasable Programmable Read Only Memory

       Many microcontrollers have limited amounts of EEPROM on the chip.
       EEPROM seems more suited (becuase of its economics) for small
       amounts of memory that hold a limited number of parameters that
       may have to be changed from time to time.  This type of memory is
       relatively slow, and the number of erase/write cycles allowed in
       its lifetime is limited.


    FLASH (EPROM)

       Flash provides a better solution than regular EEPROM when there is
       a requirement for large amounts of non-volatile program memory.
       It is both faster and permits more erase/write cycles than EEPROM.


    Battery backed-up static RAM

       Battery backed-up static RAM is useful when a large non-volatile
       program and DATA space is required.  A major advantage of static
       RAM is that it is much faster than other types of non-volatile
       memory so it is well suited for high performance application.
       There also are no limits as to the number of times that it may be
       written to so it is perfect for applications that keep and
       manipulate large amounts of data locally.


    Field programming/reprogramming

       Using nonvolatile memory as a place to store program memory allows
       the device to be reprogrammed in the field without removing the
       microcontroller from the system that it controls.  One such
       application is in automotive engine controllers.  Reprogrammable
       non-volatile program memory on the engine's microcontroller allows
       the engine controller program to be modified during routine
       service to incorporate the latest features or to compensate for
       such factors as engine aging and changing emissions control laws
       (or even to fix bugs!!).  Reprogramming of the microcontroller
       could become a standard part the routine engine tune-up.

       Almost every application could benefit from this type of program
       memory - If a modem's hardware supported it, you could remotely
       upgrade your modem from Vfast to V.34, or incorporate new features
       such as voice control or a digital answering machine.


    OTP - One Time Programmable

       An OTP is a PROM (Programmable Read-Only-Memory) device.  Once
       your program is written into the device with a standard EPROM
       programmer, it can not be erased or modified.  This is usually
       used for limited production runs before a ROM mask is done in
       order to test code.

       A OTP (One Time Programmable) part uses standard EPROM, but the
       package has no window for erasing.  Once your program is written
       into the device with a standard EPROM programmer, it cannot be
       erased or modified.  (Well, sort of - any bit that is a one can be
       changed to a zero - but a bit that is a zero cannot be changed
       into a one).

       As product design cycles get shorter, it is more important for
       micro manufacturers to offer OTPs as an option.  This was commonly
       used for limited production runs before a ROM mask in order to
       test code.  However, one problem with Mask ROM is that
       programming, setup, and engineering charges make it economical
       only when the systems manufacturer purchases large quantities of
       identically programmed micros.  Then when you discover THAT bug
       (and find it and fix your code), you have quantities of *old
       buggy* micros around that you have to throw away.  Not to mention
       that lead time (the time when you submit your code to the micro
       manufacture, to the time you receive your micro with your code on
       it) can be at least 8 weeks, and as bad as 44 weeks.


    Software protection

       Either by encryption or fuse protection, the programmed software
       is protected against unauthorized snooping (reverse engineering,
       modifications, piracy, etc.).

       This is only an option on OTPs and Windowed devices.  On Masked
       ROM devices, security is not needed - the only way to read your
       code would be to rip the microcontroller apart with a scanning
       electron microscope - and how many people really have one of
       those?

       Although - and this is a manufacturer's little know fact - when a
       silicon manufacturer makes your ROMed microcontroller - they have
       to test it in order to make sure that it is programmed properly.
       (You should see what a spec of dust does on a mask :-)  In order
       to test this, they must be able to read out the ROM and compare it
       to the code you submitted.  This mode is known as test mode.  IN
       TEST MODE YOU CAN READ OUT THE ROM OF ANY DEVICE.  Anybody who
       tells you different, does not know what they are talking about -
       or is lying.  This is usually not a big deal because test mode is
       ***VERY*** confidential, and (usually) only known by that
       manufacturer (i.e. you cannot put a device into test mode by
       accident).  Test mode is ONLY applicable with ROMed devices.


4.4) Power Management and Low Voltage


    Low voltage parts

       Since automotive applications have been the driving force behind
       most microcontrollers, and 5 Volts is very easy to do in a car,
       most microcontrollers have only supported 4.5 - 5.5 V operation.
       In the recent past, as consumer goods are beginning to drive major
       segments of the microcontroller market, and as consumer goods
       become portable and lightweight, the requirement for 3 volt (and
       lower) microcontrollers has become urgent (3 volts = 2 battery
       solution / lower voltage = longer battery life).  Most low voltage
       parts in the market today are simply 5 volt parts that were
       modified to operate at 3 volts (usually at a performance loss).
       Some micros being released now are designed from the ground up to
       operate properly at 3.0 (and lower) voltages, which offer
       comparable performance of the 5 volt devices.


       Now, why are voltages REALLY going down on ICs?  Paul K. Johnson
       (of Hewlett-Packard) explains:

       There are a few interesting rules of thumb regarding transistors:
       1)  The amount of power they dissipate is proportional to their
           size.  If you make a transistor half as big, it dissipates
           half as much power.
       2)  Their propagation delay is proportional to their size.  If you
           make a transistor half as big, it's twice as fast.
       3)  Their cost is proportional to the square of their size.  If
           you make them half as big, they cost one quarter as much.

       If you make a transistor smaller, you improve the power, speed,
       and cost.  The only drawback is that they are harder to make.
       (Hey, how hard can it be for HP, IBM, Motorola, National, etc?
       ed.)  Everybody in the world wants to make transistors smaller and
       smaller, the advantages are enormous.

       For years people have been using 5 Volts to power IC's.  Because
       the transistors were large, there was little danger damaging the
       transistor putting this voltage across it.  However, now that the
       transistors are getting so small, 5 Volts will actually fry them.
       The only way around this is to start lowering the voltage.  This
       is why people are now using 3 (actually 3.3) Volt logic, and lower
       in the next few years.  It isn't just because of batteries.


    Brownout Protection

       Brownout protection is usually an on-board protection circuit that
       resets the device when the operating voltage (Vcc) is lower than
       the brownout voltage.  The device is held in reset and will remain
       in reset when Vcc stays below the Brownout voltage.  The device
       will resume execution (from reset) after Vcc has risen above the
       brownout Voltage.


    Idle/Halt/Wakeup

       The device can be placed into IDLE/HALT mode by software control.
       In both Halt and Idle conditions the state of the microcontroller
       remains.  RAM is not cleared and any outputs are not changed.  The
       terms idle and halt often have different definitions, depending on
       the manufacturer.  What some call idle, others may call halt, and
       vice versa.  It can be confusing, so check the data sheet for the
       device in question to be sure.

       In IDLE mode, all activities are stopped except:
         - associated on-board oscillator circuitry
         - watchdog logic (if any)
         - the clock monitor
         - the idle timer (a free running timer)
       Power supply requirements on the microcontroller in this mode are
       typically around 30% of normal power requirements of the
       microprocessor.  Idle mode is exited by a reset, or some other
       stimulus (such as timer interrupt, serial port, etc.).  A special
       timer/counter (the idle timer) causes the chip to wake up at a
       regular interval to check if things are OK.  The chip then goes
       back to sleep.

       IDLE mode is extremely useful for remote, unattended data logging
       - the microprocessor wakes up at regular intervals, takes its
       measurements, logs the data, and then goes back to sleep.

       In Halt mode, all activities are stopped (including timers and
       counters).  The only way to wake up is by a reset or device
       interrupt (such as an I/O port).  The power requirements of the
       device are minimal and the applied voltage (Vcc) can sometimes be
       decreased below operating voltage without altering the state
       (RAM/Outputs) of the device.  Current consumption is typically
       less than 1 uA.

       A common application of HALT mode is in laptop keyboards.  In
       order to have maximum power saving, the controller is in halt
       until it detects a keystroke (via a device interrupt).  It then
       wakes up, decodes and sends the keystroke to the host, and then
       goes back into halt mode, waiting either for another keystroke, or
       information from the host.


    Multi-Input Wakeup (National Semiconductor)

       The Multi-Input WakeUp (MIWU) feature is used to return (wakeup)
       the microcontroller from either HALT or IDLE modes.  Alternately
       MIWU may also be used to generate up to 8 edge selectible external
       interrupts.  The user can select whether the trigger condition on
       the pins is going to be either a positive edge (low to high) or a
       negative edge (high to low).


4.5) I/O


    UART

       A UART (Universal Asynchronous Receiver Transmitter) is a serial
       port adapter for asynchronous serial communications.


    USART

       A USART (Universal Synchronous/Asynchronous Receiver Transmitter)
       is a serial port adapter for either asynchronous or synchronous
       serial communications.  Communications using a USART are typically
       much faster (as much as 16 times) than with a UART.


    Synchronous serial port

       A synchronous serial port doesn't require start/stop bits and can
       operate at much higher clock rates than an asynchronous serial
       port.  Used to communicate with high speed devices such as memory
       servers, display drivers, additional A/D ports, etc.  Can also be
       used to implement a simple microcontroller network.


    SPI (Motorola)

       An SPI (serial peripheral interface) is a synchronous serial port.


    SCI

       An SCI (serial communications interface) is an enhanced UART
       (asynchronous serial port).


    I2C bus - Inter-Integrated Circuit bus (Philips)

       The I2C bus is a simple 2 wire serial interface developed by
       Philips.  It was developed for 8 bit applications and is widely
       used in consumer electronics, automotive and industrial
       applications.  In addition to microcontrollers, several
       peripherals also exist that support the I2C bus.

       The I2C bus is a two line, multi-master, multi-slave network
       interface with collision detection.  Up to 128 devices can exist
       on the network and they can be spread out over 10 meters.  Each
       node (microcontroller or peripheral) may initiate a message, and
       then transmit or receive data.  The two lines of the network
       consist of the serial data line and the serial clock line.  Each
       node on the network has a unique address which accompanies any
       message passed between nodes.  Since only 2 wires are needed, it
       is easy to interconnect a number of devices.


    MICROWIRE/PLUS (National Semiconductor)

       MICROWIRE/PLUS is a serial synchronous bi-directional
       communications interface.  This is used on National Semiconductor
       Corporation's devices (microcontrollers, A/D converters, display
       drivers, EEPROMS, etc.).


    CAN & J1850

       CAN (Controller Area Network) is a mutiplexed wiring scheme that
       was developed jointly by Bosh and Intel for wiring in automobiles.
       J1850 is the SAE (Society of Automotive Engineers) multiplexed
       automotive wiring standard that is currently in use in North
       America.

       Both of these groups have the "NOT INVENTED HERE" syndrome and
       refuse to work with each other's standard. The standards are quite
       different and are not compatible at all.

       The CAN specification seems to be the one that is being used in
       industrial control both in North American and Europe.  With lower
       cost microcontrollers that support CAN, CAN has a good potential
       to take off.


    Analog to Digital Conversion (A/D)

       Converts an external analog signal (typically relative to voltage)
       and converts it to a digital representation.  Microcontrollers
       that have this feature can be used for instrumention,
       environmental data logging, or any application that lives in an
       analog world.

       The various types of A/D converters that can be found:

       Succesive Approximation A/D converters -- This the most common
       type of A/D and is used in the majority of microcontrollers.  In
       this technique, the converter figures out each bit at a time (most
       significant first) and finds if the next step is higher or lower.
       This way has some benefits - it takes exactly the same amount of
       time for any conversion - it is very common - (and therefore very
       cheap).  However it also has some disadvantages - it is slow - for
       every bit it takes at least one clock cycle - the best an 8-bit
       A/D can do is at least 8 clock cycles (and a couple for
       housekeeping).  Because it takes so long - it is a power hog as
       compared to the other types of A/Ds.

       Single Slope A/D converters -- This is the type of converter that
       you can build yourself (if the microcontroller has a couple of
       analog blocks on it).  Your single slope A/D converter would
       include Analog Mux / comparator / timer (8-bit timer = 8 bit A/D -
       16-bit timer = 16 bit A/D) with input capture and a constant
       current source.  The only microcontroller (that I know of) that
       has all of this on it is National's COP888EK.

       First Step is to clear the timer to 0000 and then start it.  It is
       a simple matter to hang an external capacitor, and charge it with
       the constant current source (linearly because of the current
       source) when the voltage on the cap exceeds the sampling voltage,
       the comparitor toggles, stops the timer - and voila - you have the
       voltage in uSecs - with 16-bit accuracy.  The only drawback is you
       can't really expect 16 bits (14 yes) - the conversion time varies
       quite a bit, and it is SLOW.

       Delta-Sigma A/Ds converters -- This type of A/D converter is found
       on higher-end DSPs.  These are the hardest to understand of the
       A/Ds because it just makes a best guess (a little National
       Semiconductor humor here :-).  Delta sigma A/Ds can be broken down
       into two main parts.

       The modulator which does the A/D conversion and the filter, which
       turns the output of the modulator into a format suitible for the
       microcontroller (or DSP).

       The modulator is very simple - it just compares the input voltage
       to the average of the last 100 (or so) modulator outputs and
       decides if the input is higher or lower than the average. This
       happens millions of times a second, resulting in a high speed
       single-bit datastream of 1s and 0s who's *average* is equal to the
       input voltage. Becuse the ouput is only a one or a zero, there are
       very few sources of errors. This is the main reason that
       delta-sigma A/Ds are **very** accurate.

       The filter comes after the modulator ... and this filter is
       essentially a big DSP block.  It must take the very high speed
       stream of ones and zeros and turn it into a slower speed stream of
       16-bit (or greater) words to be used by the microcontroller.  This
       process is called decimation and the filter is often called a
       "comb filter".  Another digital filter follows this stage and
       rejects unwanted frequencies.  This filter performs a similar
       function to the anti-aliasing filter required in many traditional
       A/D appliactions, but it does it at an unprecedented level of
       performance and at low cost.  This is the other major benefit of
       delta-sigma A/Ds.

       Flash A/D -- This is the basic architecure for the fastest
       category of A/Ds.  The flash converter involves looking at each
       level that is possible and instantaneously saying what level the
       voltage is at.  This is done by setting up comparators as
       threshold detectors with each detector being set up for a voltage
       exaclty 1 LSB higher than the detector below it.  The benefit of
       this architecture is that with a single clock cycle, you can tell
       exactly what the input voltage is - that is why it is so fast.
       The disadvantage is that to achieve 8-bit accuracy you need 256
       comparators and to achieve 10-bit accuracy you need 1024
       comparators. To make these comparators operate at higher speeds,
       they have to draw LOTS of current, and beyond 10 bits, the number
       of comparators required becomes totally unmanageable.


    D/A (Digital to Analog) Converters

       This feature takes a Digital number and converts it to a analog
       output. The number 50 would be changed to the analog output of
       (50/256 * 5Volts) = .9765625V on a 8-bit / 5 Volt system.


    Pulse width modulator

       Often used as a digital-to-analog conversion technique.  A pulse
       train is generated and regulated with a low-pass filter to
       generate a voltage proportional to the duty cycle.


    Pulse accumulator

       A pulse accumulator is an event counter.  Each pulse increments
       the pulse accumulator register, recording the number of times this
       event has occurred.


    Input Capture

       Input Capture can measure external frequencies or time intervals
       by copying the value from a free running timer into a register
       when an external event occurs.


    Comparator

       One or more standard comparators can sometimes be placed on a
       microcontroller die.  These comparators operate much like standard
       comparators however the input and output signals are available on
       the microcontroller bus.


    Mixed (Analog-Digital) Signal

       We live in an analog world where the information we see, hear,
       process, and exchange with each other, and with our mechanical and
       electronic systems, is always an analog quantity - pressure,
       temperature, voltage, current, air and water flow are always
       analog entities.  They can be digitized for more efficient
       sorting, storage and transmittal, but the interface - the input
       and output - is almost always analog.  Thus the essence of analog
       electronics lies in sensing continuously varying information,
       shaping and converting it for the efficiency of digital processing
       and transmission, and reshaping the digital data to an analog
       signal at the other end.

       Mixed analog-digital devices are being used increasingly to
       integrate the complex functions of high-speed telecommunications,
       or the real-time data processing demanded by industrial control
       systems and automotive systems.  Start looking for
       microcontrollers that have analog comparators, analog
       multiplexers, current sources, voltage doublers, PLL (Phase Lock
       Loops) and all sorts of peripherals that you thought were analog
       only.


4.6) Interrupts



    Polling

       Polling is not really a "feature" - it's what you have to do if
       your microcontroller of choice does not have interrupts.
       Polling is a software technique whereby the controller continually
       asks a peripheral if it needs servicing.  The peripheral sets a
       flag when it has data ready for transferring to the controller,
       which the controller notices on its next poll.  Several such
       peripherals can be polled in succession, with the controller
       jumping to different software routines, depending on which flags
       have been set.


    Interrupts

       Rather than have the microcontroller continually polling - that
       is, asking peripherals (timers / UARTS / A/Ds / external
       components) whether they have any data available (and finding most
       of the time they do not), a more efficient method is to have the
       peripherals tell the controller when they have data ready.  The
       controller can be carrying out its normal function, only
       responding to peripherals when there is data to respond to.  On
       receipt of an interrupt, the controller suspends its current
       operation, identifies the interrupting peripheral, then jumps
       (vectors) to the appropriate interrupt service routine.

       The advantage of interrupts, compared with polling, is the speed
       of response to external events and reduced software overhead (of
       continually asking peripherals if they have any data ready).

       Most microcontrollers have at least one external interrupt, which
       can be edge selectible (rising or falling) or level triggered.
       Both systems (edge/level) have advantages.  Edge - is not time
       sensitive, but it is susceptible to gitches.  Level - must be held
       high (or low) for a specific duration (which can be a pain - but
       is not susceptible to glitches).

       Interrupts are critical when you are controlling anything (this is
       what microcontrollers do).  If you misunderstand any of the terms,
       and design your systems with the way you *think* it works - not
       the way it *really* works - it will effect system performance.  It
       may also work for a very long time with no problems, and then all
       of a sudden fail.  Check your datasheets - these descriptions are
       the correct ones (or are at least supposed to be), but that does
       not mean that they are agreed to by the silicon manufacturers, (or
       by the marketing guys that they employ, and who write parts of the
       data sheets.)

       4 bit microcontrollers usually have either a polling or
       non-vectored type of interrupt scheme.  8 and 16 bit
       microcontrollers usually have some type of vectored arbitration
       type of interrupt scheme.  32 bit microcontrollers usually will
       have some type of vectored priority type of interrupt scheme.
       Again, check your data sheet to make sure - or ask a
       manufacturer's rep if you aren't sure.


    Maskable Interrupts

       A maskable interrupt is one that you can disable or enable
       (masking it out means disabling the interrupt), whereas
       non-maskable interrupts you can't disable.  The benefit of
       maskable interrupts is that you can turn off a particular
       interrupts (for example a UART) during some time critical task.
       Then, those particular interrupts will be ignored thus allowing
       the microcontroller to deal with the task at hand.  Most
       microcontrollers (as well as most microprocessors) have some type
       of Global Interrupt Enable (GIE) which allows you to turn off (or
       on) all of the maskable interrupts with one bit.  NOTE:  GIE
       usually does not effect any NMI (Non-Maskable Interrupts)


    Vectored Interrupts

       Simple (non-vectored) interrupts is one of the simplest interrupt
       schemes there is (Simple = less silicon = more software = slower).
       Whenever there is an interrupt, the program counter (PC) branches
       to one specific address.  At this address, the system designer
       needs to check the interrupts (one at a time) to see which
       peripheral has caused the interrupt to occur.  Code for this may
       look like (on a COP8):

         IFBIT  UART,PSW      ; If the UART bit has been set
         JP     UART_Recieve  ;  Jump to the UART receive service routine

         IFBIT  T1,PSW        ; If the timer has underflowed
         JP     Underflow     ;  Jump to the underflow service routine

         ...   and so on

       This can be *very* slow - and the time between the interrupt
       happening and the time the service routine is entered, depends on
       how the system designer sets up their ranking.  The peripheral
       that is checked last takes the longest to process.  Most
       microcontrollers that have fewer than 3 - 5 interrupts use this
       method.  The benefit of this is that the system designer can set
       the priority - The most important peripheral gets checked first -
       and you get to decide which peripheral that is.

       Vectored interrupts are a little easier to set up, but the system
       designer has less control of the system (i.e. is dependent on the
       silicon manufacture to make the proper decisions during design of
       the chip).  When an interrupt occurs, the hardware interrupt
       handler automatically branches to a specific address depending on
       what interrupt occurred.  This is much faster than the
       non-vectored approach described above, however the system designer
       does not get to decide what peripheral gets checked first.
       Example (on a National Semiconductor COP888CG):

          Rank         Source          Description        Vector Address
       ------------------------------------------------------------------
            1 (highest) Software       INTR Instruction    01FE - 01FF
            2           External       Pin G0 Edge         01FA - 01FB
            3           Timer T0       Underflow           01F8 - 01F9
            4           Timer T1       T1A / Underflow     01F6 - 01F7
            5           Timer T1       T1B                 01F4 - 01F5
            6           MICROWIRE/PLUS BUSY Goes Low       01F2 - 01F3
            7           UART           Receive             01EE - 01EF
            8           UART           Transmit            01EC - 01ED
            9           Timer T2       T2A / Underflow     01EA - 01EB
           10           Timer T2       T2B                 01E8 - 01E9
           11           Timer T3       T3A / Underflow     01E6 - 01E7
           12           Timer T3       T3B                 01E4 - 01E5
           13           Port L / MIWU  Port L Edge         01E2 - 01E3
           14 (lowest)  Default        VIS Interaction     01E0 - 01E1

       In ROM location 01F8 - 01F9 (2bytes x 8 bits = 16bit address) the
       system designer enters the ROM location of where they want the
       service routine (of the Timer T0 underflow) to be. And so on for
       the rest of the addresses.


    Interrupt arbitration and priority

       Interrupt arbitration and priority - These are two of the most
       misused words when it comes to microcontrollers (microprocessors
       too for that matter) and it's generally because no one knows the
       difference between them.  Priority is not Arbitration.
       Arbitration is not Priority.  Lets see if we can sort out the
       differences.

       Arbitration - If you look at the above chart of the COP888CG, you
       may think the interrupts are prioritized because they have some
       ranking.  They do have rank, but they are not prioritized.  What
       happens is that (in an arbitration scheme) when an interrupt
       occurs, the GIE (Global Interrupt Enable) is cleared.  This
       effectively means that all future interrupts will be delayed until
       the GIE is set.  The GIE becomes set only if the system designer
       sets it in a service routines, or on a RETI (Return from
       Interrupt).

       Quick Example 1 - Timer 1 underflows - the hardware clears the
       GIE, looks at ROM locations 01F6 and 01F7 and jumps to the ROM
       location pointed to by those addresses.  The program does a couple
       things, and then sets the GIE (because the user wants to recognize
       an external interrupt during this service routine).  However while
       in the service routine, Timer 3 underflows.  Although a timer 3
       underflow is lower in rank than a timer 1 underflow, the interrupt
       handler does not care - it simply looks at the GIE, and because it
       is set - handles the interrupt (now we have nested interrupts).
       The Timer 1 underflow service routine will not be completed until
       the Timer 3 underflow is complete.

       Quick Example 2 - Timer 3 underflows at the same time as an
       External interrupt occur.  The one to be handled first is the
       External Interrupt.  If the user sets the GIE, the interrupt
       handler will jump down to the Timer 3 underflow handler.  If the
       user does not set the GIE, the microcontroller handles the
       External interrupt, does a RETI, and the Timer 3 underflow can now
       be handled.


       Priority - In a priority scheme, things are prioritized (well,
       what'd you expect?).  If Timer T0 underflows, the only thing that
       can interrupt that is an external or software interrupt.  If a
       external or software interrupt occurs, the interrupt handler will
       branch to these service routines.  When they are complete, it will
       return to the Timer T0 underflow.

       Quick Example - In the below timing diagram, the following
       happens:
         1) Timer T0 underflows
         2) Timer T2 underflows
         3) An External Interrupt occurs.


       In a priority scheme, the following would happen:

        External Interrupt             |---------|
                                       |         |
        Timer T0 Underflow     |-------|         |------|
                               |                        |
        Timer T2 Underflow     |                        |------|
                               |                               |
        Normal Execution    ---|                               |-------

                               ^   ^   ^         ^      ^       ^
                               |   |   |         |      |       |
        Time ->                |   |   |         |      |       \-T2 Done
                               |   |   |         |      \-------- T0 Done
                               |   |   |         \-------------- Ext Done
                               |   |   \------------------------ Ext Edge
                               |   \----------------------- T2 Underflows
                               \--------------------------- T0 Underflows

       This is what RTOS (Real Timer Operating Systems) do - prioritize
       and handle interrupts.


4.7) Special microcontroller features



    Watchdog timer

       A watchdog timer provides a means of graceful recovery from a
       system problem.  This could be a program that goes into an endless
       loop, or a hardware problem that prevents the program from
       operating correctly.  If the program fails to reset the watchdog
       at some predetermined interval, a hardware reset will be
       initiated.  The bug may still exist, but at least the system has a
       way to recover.  This is especially useful for unattended systems.


    Digital Signal Processors (DSP)

       Microcontrollers react to and control events - DSPs execute
       repetitive math-intensive algorithms.  Today many embedded
       applications require both types of processors, and semiconductor
       manufacturers have responded by introducing microcontrollers with
       on-chip DSP capability and DSPs with on-chip microcontrollers.

       The most basic thing a DSP will do is a MACC (Multiply and
       ACCumulate).  The number of data bits a DSP can Multiply and
       ACCumulate will determine the dynamic range (and therefore the
       application).

        Bits Fixed/Floating  Dynamic Range   Typical Application

          8     Fixed           48 dB         Telephone-quality voice
         16     Fixed           96 dB         Compact disk (marginal)
         24     Fixed          144 dB         Compact disk
                                                  (room for error)


    Clock Monitor

       A clock monitor can shut the microcontroller down (by holding the
       microcontroller in reset) if the input clock is too slow.  This
       can usually be turned on or off under software control.


    Resident program loader

       Loads a program by Initializing program/data memory from either a
       serial or parallel port.  Convenient for prototyping or trying out
       new features, eliminates the erase/burn/program cycle typical with
       EPROMs, and allows convenient updating of a system even from an
       offsite location.


    Monitor

       A monitor is a program installed in the microcontroller which
       provides basic development and debug capabilities.  Typical
       capabilities of a microcontroller monitor include:  loading object
       files into system RAM, executing programs, examining and modifying
       memory and registers, code disassembly, setting breakpoints, and
       single-stepping through code.  Some simple monitors only allow
       basic functions such as memory inspection, and the more
       sophisticated monitors are capable of a full range of debug
       functions.

       Monitors can either communicate with a dumb terminal or with a
       host computer such as a PC.  Much of the work of the monitor (such
       as user interface) can be offloaded to the host PC running a
       program designed to work with the monitor.  This makes it possible
       to reduce the size and complexity of the code that must be
       installed in the target system.


    MIL transducer

       An MIL transducer is a sophisticated and expensive device that
       detects the presence of your mother-in-law.  Sensitivity settings
       are possible for a full range of stimuli such as:  snarling,
       stomping, nasty faces, and others.  Techno-Wimp (address withheld
       upon request), the sole manufacturer of the MIL transducer, has
       recently announced a major new version which is sensitive enough
       to detect less-tangible stimuli.  This breakthrough product is
       dubbed the MIL-WOMF ("Whoa, outta my face!") transducer.  Both the
       original MIL and the new MIL-WOMF transducers are programmable and
       easy to interface to most microcontrollers.