Microcontrollers
569
14.2.2 Random Access Memory (RAM)
RAM is used to hold intermediate results and other temporary data during the execution of the program.
Typically, microcontrollers have a few hundreds of bytes of RAM. As an example, microcontroller
type numbers 8XC51/80C31, 8XC52/80C32 and 68HC12 respectively have 128, 256 and 1024 bytes
of RAM.
14.2.3 Read Only Memory (ROM)
ROM holds the program instructions and the constant data. Microcontrollers use one or more of
the following memory types for this purpose: ROM (mask-programmed ROM), PROM (one-time
programmable ROM, which is not field programmable), EPROM (field programmable and usually
UV erasable), EEPROM (field programmable, electrically erasable, byte erasable) and flash (similar to
EEPROM technology). Microcontroller type numbers 8XC51, 8XC51FA and 8XC52 have 4K, 8K and
16K of ROM. As another example, the 68HC12 16-bit microcontroller has 32K of flash EEPROM,
768 bytes of EEPROM and 2K of erase-protected boot block.
14.2.4 Special-Function Registers
Special-function registers control various functions of a microcontroller. There are two categories of
these registers. The first type includes those registers that are wired into the CPU and do not necessarily
form part of addressable memory. These registers are used to control program flow and arithmetic
functions. Examples include status register, program counter, stack pointer, etc. These registers are,
however, taken care of by compilers of high-level languages, and therefore programmers of high-level
languages such as C, Pascal, etc., do not need to worry about them. The other category of registers is the
one that is required by peripheral components. The contents of these registers could, for instance, set
a timer or enable serial communication and so on. As an example, special-function registers available
on the 80C51 family of microcontrollers (80C51, 87C51, 80C31) include a program counter, stack
pointer, RAM address register, program address register and PC incrementer.
14.2.5 Peripheral Components
Peripheral components such as analogue-to-digital converters, I/O ports, timers and counters, etc., are
available on the majority of microcontrollers. These components perform functions as suggested by
their respective names. In addition to these, microcontrollers intended for some specific or relatively
more complex functions come with many more on-chip peripherals. Some of the common ones
include the pulse width modulator, serial communication interface (SCI), serial peripheral interface
(SPI), interintegrated circuit (I
2 C) two-wire communication interface, RS 232 (UART) port, infrared
port (IrDA), USB port, controller area network (CAN) and local interconnect network (LIN). These
peripheral devices are briefly described in the following paragraphs.
14.2.5.1 Analogue-to-Digital Converters
Analogue-to-digital and digital-to-analogue converters provide an interface with analogue devices. For
example, the analogue-to-digital converter provides an interface between the microcontroller and the
sensors that produce analogue electrical equivalents of the actual physical parameters to be controlled.
569
14.2.2 Random Access Memory (RAM)
RAM is used to hold intermediate results and other temporary data during the execution of the program.
Typically, microcontrollers have a few hundreds of bytes of RAM. As an example, microcontroller
type numbers 8XC51/80C31, 8XC52/80C32 and 68HC12 respectively have 128, 256 and 1024 bytes
of RAM.
14.2.3 Read Only Memory (ROM)
ROM holds the program instructions and the constant data. Microcontrollers use one or more of
the following memory types for this purpose: ROM (mask-programmed ROM), PROM (one-time
programmable ROM, which is not field programmable), EPROM (field programmable and usually
UV erasable), EEPROM (field programmable, electrically erasable, byte erasable) and flash (similar to
EEPROM technology). Microcontroller type numbers 8XC51, 8XC51FA and 8XC52 have 4K, 8K and
16K of ROM. As another example, the 68HC12 16-bit microcontroller has 32K of flash EEPROM,
768 bytes of EEPROM and 2K of erase-protected boot block.
14.2.4 Special-Function Registers
Special-function registers control various functions of a microcontroller. There are two categories of
these registers. The first type includes those registers that are wired into the CPU and do not necessarily
form part of addressable memory. These registers are used to control program flow and arithmetic
functions. Examples include status register, program counter, stack pointer, etc. These registers are,
however, taken care of by compilers of high-level languages, and therefore programmers of high-level
languages such as C, Pascal, etc., do not need to worry about them. The other category of registers is the
one that is required by peripheral components. The contents of these registers could, for instance, set
a timer or enable serial communication and so on. As an example, special-function registers available
on the 80C51 family of microcontrollers (80C51, 87C51, 80C31) include a program counter, stack
pointer, RAM address register, program address register and PC incrementer.
14.2.5 Peripheral Components
Peripheral components such as analogue-to-digital converters, I/O ports, timers and counters, etc., are
available on the majority of microcontrollers. These components perform functions as suggested by
their respective names. In addition to these, microcontrollers intended for some specific or relatively
more complex functions come with many more on-chip peripherals. Some of the common ones
include the pulse width modulator, serial communication interface (SCI), serial peripheral interface
(SPI), interintegrated circuit (I
2 C) two-wire communication interface, RS 232 (UART) port, infrared
port (IrDA), USB port, controller area network (CAN) and local interconnect network (LIN). These
peripheral devices are briefly described in the following paragraphs.
14.2.5.1 Analogue-to-Digital Converters
Analogue-to-digital and digital-to-analogue converters provide an interface with analogue devices. For
example, the analogue-to-digital converter provides an interface between the microcontroller and the
sensors that produce analogue electrical equivalents of the actual physical parameters to be controlled.
