
PIC Microcontroller Systems 7
www.newnespress.com
RAM File Registers
The main RAM block ( Table 1.1 ) is a set of 368 8-bit file registers, including the special
function registers (SFRs), which have a dedicated function, and the general purpose
registers (GPRs). When variables are created in C, they are stored in the GPRs, starting at
address 0020 h. The file registers are divided into four blocks, register banks 0 to 3. The
SFRs are located at the low addresses in each RAM bank.
Some registers are addressable across the bank boundaries; for example, the status
register can be accessed in all blocks at the corresponding address in each bank. Others
are addressable in only a specific page, for example, Port A data register. Some register
addresses are not physically implemented. Since some registers are accessible in multiple
banks, bank switching can be minimized by the compiler when assembling the machine
code, thus saving program code space and execution time. For full details of the file
register set, see the MCU data sheet.
The program counter uses two 8-bit registers to store a 13-bit program memory address.
Only the low byte at address 002 h is directly addressable. The status register 003 h
records results from ALU (arithmetic and logic unit) operations, such as zero and carry/
borrow. The indirect and file select registers are used for indexed addressing of the GPRs.
Timer0 is the timer/counter register available in all PIC MCUs, while Timer1 and Timer2
registers are in the peripheral block. The port registers are located in Bank 0 at addresses
05 h (Port A) to 09 h (Port E) with the data direction register for each at the corresponding
location in bank 1. We can see that a total of 80 ⫹ 1 6 ⫹ 8 0 ⫹ 9 6 ⫹ 9 6 ⫽ 368 GPRs are
available for use as data RAM. Note that the number of registers used for each C variable
depends on the variable type and can range from 1 to 32 bits (1–4 GPRs).
Other PIC Chips
In any embedded design, the features of the MCU need to be matched to the application
requirements. The manufacturer needs to make sure that, as applications become more
demanding, a more powerful device of a familiar type is available. We can see this
process at work where Microchip started out producing basic chips such as the 16C84,
then developed the product range to meet the growing market. PIC microcontrollers are
currently available in distinct groups, designated the 10, 12, 16, 18, and 24 series. Their
general characteristics are outlined in Table 1.2 .
The original 16 series CMOS devices were designated as 16CXX. When flash memory
was introduced, they became 16FXXX. Currently, a limited number of devices are
Ch01-H8960.indd 7Ch01-H8960.indd 7 6/10/2008 4:56:54 PM6/10/2008 4:56:54 PM